Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UDP端口无法扫描 #7

Open
u1timate06 opened this issue Oct 10, 2022 · 1 comment
Open

UDP端口无法扫描 #7

u1timate06 opened this issue Oct 10, 2022 · 1 comment

Comments

@u1timate06
Copy link

逻辑问题,导致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分开扫

@lcvvvv
Copy link
Owner

lcvvvv commented Oct 11, 2022

确实有这个问题。。。。。。

架构设计的时候设计的不合理

暂时还没想好怎么改

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants