This commands scans all IP addresses in a range and shows the MAC address of each IP address.
It does this in a greppable format, or in other words; displays IP and MAC address on a single line. Thats handy if you want to export to Excel or run a grep on it.

nmap -n -sP | awk '/Nmap scan report/{printf $5;printf " ";getline;getline;print $3;}'

It seems to also work for IP’s/MAC’s which are not already in the hosts ARP table. That’s a good thing.

The command results in: B8:27:EB:8E:C5:51 00:26:B6:E1:4B:EB 00:01:29:02:55:25

Leave a Reply

Your email address will not be published. Required fields are marked *