diff --git a/README.md b/README.md index 0a7e942..47eb0d8 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,7 @@ The features below will be shipped in the next releases of the project. - Complete VLAN support - ~~Exports (JSON & YAML)~~ - released in 0.7.0 - Full ARP packet customization (Ethernet protocol, ARP operation, ...) +- Time estimations & bandwidth - ~~MAC vendor lookup in the results~~ - released in 0.9.0 - ~~Fine-grained scan timings (interval)~~ - released in 0.8.0 - Wide network range support diff --git a/src/args.rs b/src/args.rs index dca9a73..f6d31d2 100644 --- a/src/args.rs +++ b/src/args.rs @@ -292,6 +292,7 @@ impl ScanOptions { }), None => match profile { ProfileType::Stealth => REQUEST_MS_INTERVAL * 2, + ProfileType::Fast => 0, _ => REQUEST_MS_INTERVAL } }; diff --git a/src/main.rs b/src/main.rs index 5197265..5b84678 100644 --- a/src/main.rs +++ b/src/main.rs @@ -116,7 +116,7 @@ fn main() { if scan_options.is_plain_output() { let estimations = network::compute_scan_estimation(network_size, &scan_options); - println!("Estimated scan time {}ms (sending {} bytes, {} bytes/s)", estimations.duration_ms, estimations.request_size, estimations.bandwidth); + println!("Estimated scan time {}ms ({} bytes, {} bytes/s)", estimations.duration_ms, estimations.request_size, estimations.bandwidth); println!("Sending {} ARP requests (waiting at least {}ms, {}ms request interval)", network_size, scan_options.timeout_ms, scan_options.interval_ms); } diff --git a/src/network.rs b/src/network.rs index bd0d26c..f508f98 100644 --- a/src/network.rs +++ b/src/network.rs @@ -64,24 +64,26 @@ pub struct TargetDetails { * estimation of the scan impact (timing, bandwidth, ...). Keep in mind that * this is only an estimation, real results may vary based on the network. */ -pub fn compute_scan_estimation(network_size: u128, options: &Arc) -> ScanEstimation { +pub fn compute_scan_estimation(host_count: u128, options: &Arc) -> ScanEstimation { let interval: u128 = options.interval_ms.into(); let timeout: u128 = options.timeout_ms.into(); let packet_size: u128 = match options.has_vlan() { - true => ETHERNET_VLAN_PACKET_SIZE.try_into().unwrap(), - false => ETHERNET_STD_PACKET_SIZE.try_into().unwrap() + true => ETHERNET_VLAN_PACKET_SIZE.try_into().expect("Internal number conversion failed for VLAN packet size"), + false => ETHERNET_STD_PACKET_SIZE.try_into().expect("Internal number conversion failed for Ethernet packet size") }; let retry_count: u128 = options.retry_count.try_into().unwrap(); + // The values below are averages based on an amount of performed network + // scans. This may of course vary based on network configurations. let avg_arp_request_ms = 3; let avg_resolve_ms = 500; - let request_duration_ms: u128 = (network_size * (interval+avg_arp_request_ms)) * retry_count; - let duration_ms = request_duration_ms + timeout + avg_resolve_ms; - let request_size: u128 = network_size * packet_size; + let request_phase_ms = (host_count * (avg_arp_request_ms+ interval)) * retry_count; + let duration_ms = request_phase_ms + timeout + avg_resolve_ms; + let request_size = host_count * packet_size; - let bandwidth = (request_size / request_duration_ms) * 1000; + let bandwidth = (request_size * 1000) / request_phase_ms; ScanEstimation { duration_ms,