@@ -14,6 +14,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
1414use pnet:: datalink;
1515
1616use crate :: args:: { ScanOptions , OutputFormat } ;
17+ use crate :: network:: NetworkIterator ;
1718use crate :: vendor:: Vendor ;
1819
1920fn main ( ) {
@@ -117,11 +118,7 @@ fn main() {
117118 break ;
118119 }
119120
120- // The random approach has one major drawback, compared with the native
121- // network iterator exposed by 'ipnetwork': memory usage. Instead of
122- // using a small memory footprint iterator, we have to store all IP
123- // addresses in memory at once. This can cause problems on large ranges.
124- let ip_addresses: Vec < IpAddr > = network:: compute_ip_range ( & ip_networks, & scan_options) ;
121+ let ip_addresses = NetworkIterator :: new ( & ip_networks, scan_options. randomize_targets ) ;
125122 let source_ip = network:: find_source_ip ( selected_interface, scan_options. source_ipv4 ) ;
126123
127124 for ip_address in ip_addresses {
@@ -143,8 +140,8 @@ fn main() {
143140 let mut sleep_ms_mount: u64 = 0 ;
144141 while !finish_sleep. load ( Ordering :: Relaxed ) && sleep_ms_mount < scan_options. timeout_ms {
145142
146- thread:: sleep ( Duration :: from_millis ( 500 ) ) ;
147- sleep_ms_mount += 500 ;
143+ thread:: sleep ( Duration :: from_millis ( 100 ) ) ;
144+ sleep_ms_mount += 100 ;
148145 }
149146 timed_out. store ( true , Ordering :: Relaxed ) ;
150147
0 commit comments