mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-22 03:10:42 +08:00
- UDP 插件在 -p 指定端口时被跳过 - Redis exploit 无超时保护 / readReply 吞没非超时错误 - service_probe 连接丢失后静默成功 - SNMP 探测成功但终端无输出 - SSH 爆破不稳定 (并发过高 + 自适应超时过短 + 限流误判) - 进度条 isActive 竞态 新增 Config.ModuleTimeout() 协议级超时下限 (≥3s) 新增 ErrorTypeThrottle 限流错误分类
54 lines
1.1 KiB
Go
54 lines
1.1 KiB
Go
//go:build plugin_dns || !plugin_selective
|
|
|
|
package services
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/shadow1ng/fscan/common"
|
|
"github.com/shadow1ng/fscan/plugins"
|
|
)
|
|
|
|
type DNSPlugin struct {
|
|
plugins.BasePlugin
|
|
}
|
|
|
|
func NewDNSPlugin() *DNSPlugin {
|
|
return &DNSPlugin{BasePlugin: plugins.NewBasePlugin("dns")}
|
|
}
|
|
|
|
func (p *DNSPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *ScanResult {
|
|
timeout := session.Config.ModuleTimeout()
|
|
if timeout <= 0 {
|
|
timeout = 3 * time.Second
|
|
}
|
|
|
|
target := info.Target()
|
|
queryID := randomUint16()
|
|
query := buildDNSRootNSQuery(queryID)
|
|
|
|
data, n := udpProbe(ctx, session, target, timeout, query, 1500)
|
|
if data == nil || n < 12 {
|
|
return &ScanResult{Success: false, Service: "dns"}
|
|
}
|
|
|
|
banner, ok := parseDNSResponse(data[:n], queryID)
|
|
if !ok {
|
|
return &ScanResult{Success: false, Service: "dns"}
|
|
}
|
|
|
|
return &ScanResult{
|
|
Success: true,
|
|
Type: plugins.ResultTypeService,
|
|
Service: "dns",
|
|
Banner: banner,
|
|
}
|
|
}
|
|
|
|
func init() {
|
|
RegisterUDPPluginWithPorts("dns", func() Plugin {
|
|
return NewDNSPlugin()
|
|
}, []int{53})
|
|
}
|