mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-23 19:51:52 +08:00
fix(credential): 修复凭据测试结果不一致的问题
问题原因: 1. 未知错误类型不重试,导致服务端限流时跳过正确密码 2. SSH 错误分类不够准确,某些临时错误未被识别 修复内容: 1. 未知错误改为可重试(可能是临时问题) 2. 增加 SSH 特有的网络错误识别(handshake failed, disconnect 等)
This commit is contained in:
@@ -255,10 +255,10 @@ func testCredentialWithRetry(
|
||||
// 根据错误类型决定是否重试
|
||||
switch result.ErrorType {
|
||||
case ErrorTypeAuth:
|
||||
// 认证错误,不重试
|
||||
// 认证错误(密码错误),不重试
|
||||
return nil
|
||||
case ErrorTypeNetwork:
|
||||
// 网络错误,可以重试
|
||||
case ErrorTypeNetwork, ErrorTypeUnknown:
|
||||
// 网络错误或未知错误,可以重试(可能是服务端限流等临时问题)
|
||||
if attempt < testConfig.MaxRetries-1 {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
@@ -267,9 +267,6 @@ func testCredentialWithRetry(
|
||||
// 继续重试
|
||||
}
|
||||
}
|
||||
default:
|
||||
// 未知错误,不重试
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user