fix: 修复实机测试发现的可靠性问题 (v2.2.0-rc.1)
测试构建 / 代码检查 (push) Has been cancelled
测试构建 / 单元测试和构建 (push) Has been cancelled
测试构建 / 构建验证 (push) Has been cancelled

- UDP 插件在 -p 指定端口时被跳过
- Redis exploit 无超时保护 / readReply 吞没非超时错误
- service_probe 连接丢失后静默成功
- SNMP 探测成功但终端无输出
- SSH 爆破不稳定 (并发过高 + 自适应超时过短 + 限流误判)
- 进度条 isActive 竞态

新增 Config.ModuleTimeout() 协议级超时下限 (≥3s)
新增 ErrorTypeThrottle 限流错误分类
This commit is contained in:
ZacharyZcR
2026-06-14 22:23:52 +08:00
parent 3babff6863
commit 6d61b661f4
51 changed files with 285 additions and 257 deletions
+1 -65
View File
@@ -20,7 +20,7 @@ func NewIPMIPlugin() *IPMIPlugin {
}
func (p *IPMIPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
timeout := session.Config.Timeout
timeout := session.Config.ModuleTimeout()
if timeout <= 0 {
timeout = 3 * time.Second
}
@@ -60,8 +60,6 @@ func (p *IPMIPlugin) rmcpPing(ctx context.Context, target string, timeout time.D
}
}
// getChannelAuth 需要独立连接,暂不执行(核心检测已完成)
return &ScanResult{
Success: true,
Type: plugins.ResultTypeVuln,
@@ -71,68 +69,6 @@ func (p *IPMIPlugin) rmcpPing(ctx context.Context, target string, timeout time.D
}
}
func (p *IPMIPlugin) getChannelAuth(conn interface {
Read([]byte) (int, error)
Write([]byte) (int, error)
SetDeadline(time.Time) error
}) string {
_ = conn.SetDeadline(time.Now().Add(2 * time.Second))
// IPMI Get Channel Authentication Capabilities
// RMCP header + IPMI session wrapper + message
pkt := []byte{
0x06, 0x00, 0xff, 0x07, // RMCP: version, reserved, seq=0xff, class=IPMI
0x00, 0x00, 0x00, 0x00, // auth type = none
0x00, 0x00, 0x00, 0x00, // session seq
0x00, 0x00, 0x00, 0x00, // session id
0x09, // message length
0x20, // target = BMC
0x18, // netFn=App(6) << 2 | lun=0
0xc8, // checksum
0x81, // source
0x00, // seq
0x38, // cmd = Get Channel Auth Capabilities
0x8e, // channel=14 (current), IPMI v2.0
0x04, // privilege = Administrator
0xb5, // checksum
}
if _, err := conn.Write(pkt); err != nil {
return ""
}
buf := make([]byte, 512)
n, err := conn.Read(buf)
if err != nil || n < 30 {
return ""
}
// Parse auth capabilities from response
if n >= 27 {
authTypes := buf[22]
var methods []string
if authTypes&0x01 != 0 {
methods = append(methods, "none")
}
if authTypes&0x02 != 0 {
methods = append(methods, "md2")
}
if authTypes&0x04 != 0 {
methods = append(methods, "md5")
}
if authTypes&0x10 != 0 {
methods = append(methods, "password")
}
if authTypes&0x20 != 0 {
methods = append(methods, "oem")
}
if len(methods) > 0 {
return fmt.Sprintf("[auth: %v]", methods)
}
}
return ""
}
func init() {
RegisterUDPPluginWithPorts("ipmi", func() Plugin {
return NewIPMIPlugin()