E. Almqvist 2 years ago
parent d351be6961
commit 20aec49d15
  1. 4
      src/ipv4.rs
  2. 4
      src/scanner.rs

@ -61,7 +61,7 @@ pub struct IPv4Range {
} }
impl IPv4Range { impl IPv4Range {
pub fn new(from: u32, to: u32, id_ignore: &mut Vec<u32>) -> Self { pub fn new(from: u32, to: u32, id_ignore: Vec<u32>) -> Self {
let to = to.clamp(0, u32::max_value()); let to = to.clamp(0, u32::max_value());
if from >= to { if from >= to {
@ -71,7 +71,7 @@ impl IPv4Range {
Self { Self {
id_start: from, id_start: from,
id_end: to, id_end: to,
id_ignore: id_ignore.to_vec(), id_ignore,
} }
} }
} }

@ -41,7 +41,7 @@ fn create_scan_worker(
thread_id: u32, thread_id: u32,
ips_per_thread: u32, ips_per_thread: u32,
target_port: u16, target_port: u16,
ignorelist: &mut Vec<u32>, ignorelist: Vec<u32>,
) -> JoinHandle<Vec<bool>> { ) -> JoinHandle<Vec<bool>> {
let (f, t) = ( let (f, t) = (
(thread_id * ips_per_thread), (thread_id * ips_per_thread),
@ -67,7 +67,7 @@ fn start_scan(
let mut threads: Vec<JoinHandle<Vec<bool>>> = Vec::new(); let mut threads: Vec<JoinHandle<Vec<bool>>> = Vec::new();
for thread_id in 0..num_threads { for thread_id in 0..num_threads {
let id_ignorelist = ignorelist.unwrap().cloned().unwrap_or_else(Vec::new()); let id_ignorelist = ignorelist.clone().unwrap_or_default();
// Create a worker // Create a worker
let worker = create_scan_worker(thread_id, ips_per_thread, target_port, id_ignorelist); let worker = create_scan_worker(thread_id, ips_per_thread, target_port, id_ignorelist);

Loading…
Cancel
Save