mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-25 20:51:52 +08:00
fix: 修复实机测试发现的可靠性问题 (v2.2.0-rc.1)
- UDP 插件在 -p 指定端口时被跳过 - Redis exploit 无超时保护 / readReply 吞没非超时错误 - service_probe 连接丢失后静默成功 - SNMP 探测成功但终端无输出 - SSH 爆破不稳定 (并发过高 + 自适应超时过短 + 限流误判) - 进度条 isActive 竞态 新增 Config.ModuleTimeout() 协议级超时下限 (≥3s) 新增 ErrorTypeThrottle 限流错误分类
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user