mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-22 11:20:41 +08:00
fix: exclude timeout from scan failure rate calculation (#578)
Timeout is a normal scan result when firewalls drop packets, not a scan failure. Only resource exhaustion errors count toward failure rate.
This commit is contained in:
+2
-6
@@ -400,17 +400,13 @@ func scanSinglePort(ctx context.Context, host string, port int, addr string, tim
|
||||
}
|
||||
|
||||
// handleConnectionFailure 处理连接失败
|
||||
// 只收集资源耗尽类错误,timeout 是正常的扫描结果(防火墙 drop)不计入失败
|
||||
func handleConnectionFailure(err error, host string, port int, addr string, failedCollector *failedPortCollector) {
|
||||
if isResourceExhaustedError(err) || isTimeoutError(err) {
|
||||
if isResourceExhaustedError(err) {
|
||||
failedCollector.Add(host, port, addr)
|
||||
}
|
||||
}
|
||||
|
||||
// isTimeoutError 判断是否为超时错误
|
||||
func isTimeoutError(err error) bool {
|
||||
return err != nil && strings.Contains(err.Error(), "i/o timeout")
|
||||
}
|
||||
|
||||
// verifyProxyConnectionDeep 深度验证代理连接是否真正可用
|
||||
// 防止透明代理/全回显代理的假连接问题
|
||||
// 返回: (是否有效, 验证方式)
|
||||
|
||||
Reference in New Issue
Block a user