awk - Get IP From Mac Address With Nmap Command on Linux? -
given following nmap output, how can extract ip address matches particular mac address?
nmap scan report 10.0.0.2 host (0.0011s latency). mac address: 00:02:cf:e2:52:4e (zygate communications) nmap scan report 10.0.0.9 host (0.015s latency). mac address: 1c:18:4a:08:88:48 (unknown) nmap scan report 10.0.0.35 host (0.019s latency). mac address: b8:b4:2e:f9:2b:b1 (unknown) nmap scan report 10.0.0.40 host (0.00036s latency). mac address: 00:25:11:2c:f6:9c (elitegroup computer system )
i pipeline this, doesn't work:
nmap -sp 10.0.0.0-255 | grep 00:25:11 | awk '{print ip address}'
this may help;
nmap -sp....|awk -v mac="00:25:11" '/report for/{ip=$5}$0~mac{print ip}'
you change mac="00:25:11"
part different mac filtering.
if test line on example, output:
10.0.0.40
Comments
Post a Comment