Today, I wrote a little bash scripts that scans the network for computers that are not registered in DNS. Reverse DNS to be more precise. It uses nmap to do a reverse DNS lookup for each computer it pings:
$ nmap -sPR -oG - 192.168.0.*
The result is filtered for failed DNS lookups:
$ nmap -sPR -oG - 192.168.0.* | grep "()"
Since all computers are contacted their mac address is known in the ARP (Address Resolution Protocol) table:
$ /sbin/arp | grep -w 192.168.0.35 | awk '{ print $3 }'
After looking up the MAC address, a table is presented with ip addresses and their mac addresses. This is the complete script.