Double Ctrl-C kills entire scan; single Ctrl-C skips country
This commit is contained in:
+7
-2
@@ -148,6 +148,7 @@ def cmd_run(args):
|
||||
total_matches = 0
|
||||
workers = args.workers
|
||||
n_countries = len(countries)
|
||||
_interrupted = False
|
||||
|
||||
def progress(msg: str, end="\n"):
|
||||
print(f" {W}{msg}{RST}", end=end, flush=True)
|
||||
@@ -170,13 +171,17 @@ def cmd_run(args):
|
||||
cidrs = cidrs[:max_hosts // 256 + 1]
|
||||
|
||||
print(f"\n{C}[{idx}/{n_countries}]{RST} {BOLD}{cc}{RST} — {len(cidrs)} CIDR blocks")
|
||||
info(f"{cc}: running masscan at {rate} pps (Ctrl-C to skip country)...")
|
||||
info(f"{cc}: running masscan at {rate} pps (Ctrl-C once = skip country, twice = abort all)...")
|
||||
|
||||
try:
|
||||
open_ports = masscan_sweep(cidrs, all_ports, rate, tmp)
|
||||
_interrupted = False
|
||||
except KeyboardInterrupt:
|
||||
print()
|
||||
warn(f"{cc}: scan interrupted — skipping to next country")
|
||||
if _interrupted:
|
||||
raise
|
||||
_interrupted = True
|
||||
warn(f"{cc}: skipping — press Ctrl-C again to abort entire scan")
|
||||
continue
|
||||
|
||||
hosts_found = len(set(e["ip"] for e in open_ports))
|
||||
|
||||
Reference in New Issue
Block a user