简体   繁体   English

使用 arp 表运行 nmap 扫描

[英]Using arp table to run an nmap scan

I'm trying to do a network scan however scanning the entire network for any possible host consumes to many resources, then I found that you could use arp to find all ip address on your network.我正在尝试进行网络扫描,但是扫描整个网络以查找任何可能的主机会消耗许多资源,然后我发现您可以使用 arp 查找网络上的所有 IP 地址。

arp -n > exampleOutput.txt

Now my issues is that the output has some unwanted information and other such things to improve readablity.现在我的问题是输出有一些不需要的信息和其他类似的东西来提高可读性。 My hope is to do an nmap scan using my output file so i don't have to scan entire network.我希望使用我的输出文件进行 nmap 扫描,这样我就不必扫描整个网络。 Rather I know what IPs exist on the network so just scan those.相反,我知道网络上存在哪些 IP,因此只需扫描这些 IP。

Umm ... no, arp -n will not find all ip addresses on your network;嗯...不,arp -n不会找到您网络上的所有 IP 地址; it will find any machine that has talked at your machine within a short time frame, typically 60 seconds.它将找到在短时间内(通常为 60 秒)与您的机器通话的任何机器。

That said (if you're happy with the limitation of the arp cache):也就是说(如果您对 arp 缓存的限制感到满意):

nmap $(arp -n | awk '$1 ~ /[0-9]+/{printf "%s ", $1}')

will do what you asked (not what you want!).会做你问的(不是你想要的!)。 What we do here is to just extract IP addresses from arp via awk, and using awks printf to put them on nmaps command line separated by space.我们这里所做的只是通过awk从arp中提取IP地址,并使用awks printf将它们放在以空格分隔的nmaps命令行中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM