diff --git a/src/ipv4.rs b/src/ipv4.rs index c83ce74..b8ee418 100644 --- a/src/ipv4.rs +++ b/src/ipv4.rs @@ -1,8 +1,8 @@ -use std::net::{IpAddr, Ipv4Addr, SocketAddr}; -use std::convert::TryInto; use crate::util; use anyhow::{anyhow, Result}; use convert_base::Convert; +use std::convert::TryInto; +use std::net::{IpAddr, Ipv4Addr, SocketAddr}; /* Algorithm: O(n) @@ -38,7 +38,9 @@ impl IPv4 { ip = ip.into_iter().rev().collect(); // convert to array - let ip: [u8; 4] = ip.try_into().unwrap_or_else(|_: Vec| panic!("Unable to convert Vec to [u8; 4] for IPv4!")); + let ip: [u8; 4] = ip + .try_into() + .unwrap_or_else(|_: Vec| panic!("Unable to convert Vec to [u8; 4] for IPv4!")); Self { id, diff --git a/src/main.rs b/src/main.rs index e7b8009..c536bf0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,6 +4,4 @@ mod util; //use ipv4::IPv4; -fn main() { -} - +fn main() {} diff --git a/src/scanner.rs b/src/scanner.rs index 24e6022..ef40798 100644 --- a/src/scanner.rs +++ b/src/scanner.rs @@ -1,9 +1,9 @@ use crate::ipv4; use anyhow::Result; use log::info; +use std::net::{SocketAddr, TcpStream}; use std::thread; use std::thread::JoinHandle; -use std::net::{SocketAddr, TcpStream}; fn tcp_scan(mut target: ipv4::IPv4, target_port: u16) -> bool { let dest = target.to_socketaddr(target_port).unwrap(); @@ -19,7 +19,7 @@ fn create_scan_thread( ip_list: Vec, thread_id: u32, ips_per_thread: u32, - target_port: u16 + target_port: u16, ) -> JoinHandle> { thread::spawn(move || { info!("Starting thread worker #{}", thread_id); @@ -53,13 +53,18 @@ pub fn start_scan(target_port: u16, num_threads: u32, ignorelist: Option 0 { - threads.push(create_scan_thread(ip_list, num_threads, ips_left, target_port)); + threads.push(create_scan_thread( + ip_list, + num_threads, + ips_left, + target_port, + )); } Ok(())