-
Notifications
You must be signed in to change notification settings - Fork 65
Open
Description
逻辑问题,导致UDP端口无法扫描
type-nmap.go
func (n *Nmap) Scan(ip string, port int) (status Status, response *Response) {
var probeNames ProbeList
if n.bypassAllProbePort.exist(port) == true {
probeNames = append(n.portProbeMap[port], n.allProbeMap...)
} else {
probeNames = append(n.allProbeMap, n.portProbeMap[port]...)
}
probeNames = append(probeNames, n.sslProbeMap...)
//探针去重
probeNames = probeNames.removeDuplicate()
firstProbe := probeNames[0]
status, response = n.getRealResponse(ip, port, n.timeout, firstProbe) //如果目标为UDP端口这里就直接退出函数了
if status == Closed || status == Matched {
return status, response
}
otherProbes := probeNames[1:]
return n.getRealResponse(ip, port, 2*time.Second, otherProbes...)
}如果目标端口为UDP端口,该函数首次使用TCP协议连接会返回closed,导致无法准确识别端口
在func (n *Nmap) getResponseByProbes(host string, port int, timeout time.Duration, probes ...string) (status Status, response *Response) 函数中也有相似问题,目标端口如果是TCP端口,但是做循环的时候如果遇到requestName为UDP_*这类的规则,也会由于TCP端口无法使用UDP协议连接导致判断为close退出函数。
可不可以TCP和UDP分开扫
Metadata
Metadata
Assignees
Labels
No labels