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

无法出外网的情况下,这样做可能获取网卡更好 #53

Open
Lcys opened this issue Jul 28, 2021 · 0 comments
Open

无法出外网的情况下,这样做可能获取网卡更好 #53

Lcys opened this issue Jul 28, 2021 · 0 comments

Comments

@Lcys
Copy link

Lcys commented Jul 28, 2021

https://github.com/knownsec/ksubdomain/blob/master/core/device.go
68行改为:

if dns.QR {
	continue
}
for _, v := range dns.Questions {
	if string(v.Name) == domain {
		ethLayer := packet.Layer(layers.LayerTypeEthernet)
		if ethLayer != nil {
			eth := ethLayer.(*layers.Ethernet)
			signal <- EthTable{SrcIp: data[drviceName].SrcIp, SrcIpV6: data[drviceName].SrcIpV6, Device: drviceName, SrcMac: eth.SrcMAC, DstMac: eth.DstMAC}
			// 网关mac 和 本地mac
			return
		}
	}
}
				

这样可以保证 net.LookupHost所走的系统dns,发出dns请求后没有收到dns回包也可以获取网卡

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

1 participant