fix: 大规模扫描全局超时过短导致提前终止 (#588)

4 万 IP 全端口扫描默认 -gt 180s 完全不够用,3 分钟后报
"解析目标失败: context deadline exceeded" 误导用户。

1. 自适应全局超时:用户未显式指定 -gt 时,根据端口数和是否有
   hosts 文件自动调大超时(最高 24h),并输出调整日志
2. 修正超时错误信息:context deadline exceeded 不再包装为
   "解析目标失败",改为提示用户调大 -gt 或设为 0 禁用
This commit is contained in:
ZacharyZcR
2026-06-27 16:42:32 +08:00
parent a3ccc2827b
commit 1980504007
8 changed files with 64 additions and 2 deletions
+4
View File
@@ -26,6 +26,10 @@ flag_module_thread_num:
other: "Module thread count"
flag_global_timeout:
other: "Global timeout"
global_timeout_adjusted:
other: "Large scan detected, global timeout adjusted from {{.V0}}s to {{.V1}}s (use -gt to override)"
global_timeout_exceeded:
other: "Global timeout reached (-gt {{.V0}}s), scan aborted. Use -gt to increase or set to 0 to disable"
flag_disable_ping:
other: "Disable ping detection"
flag_disable_tcp_probe:
+4
View File
@@ -26,6 +26,10 @@ flag_module_thread_num:
other: "模块线程数"
flag_global_timeout:
other: "全局超时时间"
global_timeout_adjusted:
other: "扫描规模较大,全局超时从 {{.V0}}s 自动调整为 {{.V1}}s(可用 -gt 手动指定)"
global_timeout_exceeded:
other: "全局超时已到(-gt {{.V0}}s),扫描被终止。大规模扫描请用 -gt 调大超时或设为 0 禁用"
flag_disable_ping:
other: "禁用ping探测"
flag_disable_tcp_probe: