Move Tor prompt before cost estimate and factor Tor latency into estimate table

- Tor choice now appears before the estimate table so the displayed time/cost is accurate
- build_estimate_table accepts use_tor; applies 0.2x rate multiplier for nmap/probe modes
- masscan-only excluded from multiplier (masscan bypasses proxychains via raw sockets)
- Added per-mode warnings explaining which traffic actually routes through Tor
This commit is contained in:
n0mad1k
2026-04-30 16:59:24 -04:00
parent d8d832a434
commit ae693a8fd5
2 changed files with 25 additions and 11 deletions
+8
View File
@@ -73,13 +73,21 @@ def fmt_ip_count(n: int) -> str:
return str(n)
# Tor adds ~5x latency overhead for TCP probes; masscan bypasses proxychains (raw sockets)
# so only nmap/probe phases are affected — modes that include masscan see partial impact
TOR_RATE_MULTIPLIER = 0.2
def build_estimate_table(
total_ips: int,
n_ports: int,
providers: list[str],
scan_mode: str,
use_tor: bool = False,
) -> list[dict]:
mode_rate = SCAN_MODES.get(scan_mode, {'rate': 3000})['rate']
if use_tor and scan_mode != 'masscan-only':
mode_rate = int(mode_rate * TOR_RATE_MULTIPLIER)
rows = []
for preset_key, preset in PRESETS.items():
n_chunks = max(1, math.ceil(total_ips / preset['chunk_size']))