diff --git a/src/cli.rs b/src/cli.rs index 47e6d42..857374b 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -15,14 +15,13 @@ pub struct Args { )] pub threads: u64, -// #[clap( -// help = "A file containing ignored IPv4 addresses (seperated by linebreaks).", -// short = 'i', -// long = "ignore-ip-list", -// default_value = "ignore-ips-list.txt" -// )] -// pub ignorelist: PathBuf, - + // #[clap( + // help = "A file containing ignored IPv4 addresses (seperated by linebreaks).", + // short = 'i', + // long = "ignore-ip-list", + // default_value = "ignore-ips-list.txt" + // )] + // pub ignorelist: PathBuf, #[clap( help = "Enable verbose (debug) output", short = 'v', diff --git a/src/ipv4.rs b/src/ipv4.rs index c5aca1d..91ae6bb 100644 --- a/src/ipv4.rs +++ b/src/ipv4.rs @@ -43,7 +43,8 @@ impl IPv4 { Self { id, ip } } - pub fn to_ipaddr(self: &mut Self) -> Result { // TODO: remove unneeded Result returns + pub fn to_ipaddr(self: &mut Self) -> Result { + // TODO: remove unneeded Result returns if let [a, b, c, d] = self.ip[0..4] { Ok(IpAddr::V4(Ipv4Addr::new(a, b, c, d))) } else { @@ -80,7 +81,7 @@ impl IPv4Range { } pub fn from_cidr(cidr_string: String, id_ignore: Option>) -> Self { - let cidr = Ipv4Cidr::from_str(cidr_string).unwrap(); + let cidr = Ipv4Cidr::from_str(cidr_string).unwrap(); let (from, to) = (cidr.first(), cidr.last()); // TODO: fix forgotten "constants" Self::new(from, to, id_ignore) diff --git a/src/scanner.rs b/src/scanner.rs index 2ce3c6f..55a4ab8 100644 --- a/src/scanner.rs +++ b/src/scanner.rs @@ -1,6 +1,6 @@ use crate::ipv4::{IPv4, IPv4Range}; use core::time::Duration; -use log::{warn, debug, info}; +use log::{debug, info, warn}; use std::net::TcpStream; use std::thread::JoinHandle; use std::{panic, thread}; @@ -44,7 +44,6 @@ fn create_scan_worker( ips_per_thread: u64, target_port: u16, ) -> JoinHandle> { - let ignorelist = range.id_ignore; let (f, t) = ( @@ -86,12 +85,7 @@ fn get_scan_workers( // Clean up the rest warn!("Number of IPv4 addresses is not divisible by the amount of threads! Creating extra thread..."); - let worker = create_scan_worker( - range, - threads.len() as u64 + 1, - ips_left, - target_port - ); + let worker = create_scan_worker(range, threads.len() as u64 + 1, ips_left, target_port); threads.push(worker); }; @@ -136,7 +130,6 @@ pub fn start_scan(range: IPv4Range, target_port: u16, num_threads: u64) -> Vec