Find machine/host names on the network

Firstly we try to resolve the PTR records in DNS for the specified IP addresses.
It sends nothing to the hosts so there is no guarantee if it is really connected or turned on but we can get the actual DNS map including those devices which are within their DHCP lease timeout.

nmap -sn -sL

Then we scan for hosts really connected sending ARP requests. The disadvantage is that it only works on your subnet.

nmap -sP

or if we want to remove useless lines:

nmap -sP | grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}"

output example:

cesare@cesare-desktop:~$ nmap -sP | grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}"
 Nmap scan report for router (
 Nmap scan report for vpnudp (
 Nmap scan report for vpntcp (
 Nmap scan report for desktop (
 Nmap scan report for unas (
 Nmap scan report for pi2 (
 Nmap scan report for cloud (

or for a better output:

nmap -sP | grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}" | cut -d ' ' -f5-
router (
vpnudp (
vpntcp (
desktop (
unas (
cloud (

No Comments

No comments yet.

RSS feed for comments on this post.

Leave a comment

WordPress Themes