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

大佬我又来提意见了 #9

Open
hq-zhonger opened this issue Oct 26, 2022 · 4 comments
Open

大佬我又来提意见了 #9

hq-zhonger opened this issue Oct 26, 2022 · 4 comments

Comments

@hq-zhonger
Copy link

用了一段时间 gonmap在并发上 是有问题的 原因不详
还有端口+服务+指纹的一体化优秀扫描
kscan中fingerprint.txt有大量的优秀指纹库
如果可以
open/filter/closed 443 https apache2 2.4.7 wordpress
会更加的优秀和强大
希望大佬在重构的时候 可以考虑一下

@lcvvvv
Copy link
Owner

lcvvvv commented Oct 28, 2022

没太明白,你看一下kscan里面的置顶issus加一下我微信,具体聊一下

@lcvvvv
Copy link
Owner

lcvvvv commented Oct 28, 2022

并发的问题,具体是什么问题?

@scyxdd
Copy link

scyxdd commented Nov 15, 2022

并发问题我好像也发现了,但是可以解决。
复现并发问题代码:

func main() {
	wg := new(sync.WaitGroup)
	nmap := gonmap.New()
	for i := 0; i < 5; i++ {
		wg.Add(1)
		go func() {
			defer wg.Done()
			status, resp := nmap.Scan("107.xx.xx.xx", 22)
			if resp != nil {
				fmt.Printf("status:%s service:%s product_name:%s version:%s info:%s \n", status, resp.FingerPrint.Service, resp.FingerPrint.ProductName, resp.FingerPrint.Version, resp.FingerPrint.Info)
			} else {
				fmt.Println(status, resp)
			}
		}()
	}
	wg.Wait()
}

上面代码输出可能会丢失数据

image

没有问题的代码:

func main() {
	wg := new(sync.WaitGroup)
	for i := 0; i < 5; i++ {
		wg.Add(1)
		go func() {
			defer wg.Done()
			nmap := gonmap.New()
			status, resp := nmap.Scan("107.xx.xx.xx", 22)
			if resp != nil {
				fmt.Printf("status:%s service:%s product_name:%s version:%s info:%s \n", status, resp.FingerPrint.Service, resp.FingerPrint.ProductName, resp.FingerPrint.Version, resp.FingerPrint.Info)
			} else {
				fmt.Println(status, resp)
			}
		}()
	}
	wg.Wait()
}

把创建nmap实例放到协程中,好像能解决这个并发问题

@lcvvvv
Copy link
Owner

lcvvvv commented Nov 15, 2022

是的,单个nmap实例,是没办法并发,需要每个并发协程来创建独立的实例

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

3 participants