Host Discovery

We utilize host discovery, to discover hosts on a network before conducting a pentest

chevron-rightScan a Network Rangehashtag
sudo nmap 10.129.2.0/24 -sn -oA tnet | grep for | cut -d" " -f5
chevron-rightScan an IP List hashtag
sudo nmap -sn -oA tnet -iL hosts.lst | grep for | cut -d" " -f5
chevron-rightScan Multiple IP Addresseshashtag
sudo nmap -sn -oA tnet 10.129.2.18 10.129.2.19 10.129.2.20| grep for | cut -d" " -f5
chevron-rightScan a Single IP address to determine if its active or nothashtag
  • Before we scan a single host for open ports and its services, we first have to determine if it is alive or not. For this, we can use the same method as before.

sudo nmap 10.129.2.18 -sn -oA host 
chevron-rightConfirm Host is Activehashtag

If we disable port scan (-sn), Nmap automatically ping scan with ICMP Echo Requests (-PE). Once such a request is sent, we usually expect an ICMP reply if the pinging host is alive. The more interesting fact is that our previous scans did not do that because before Nmap could send an ICMP echo request, it would send an ARP ping resulting in an ARP reply. We can confirm this with the "--packet-trace" option. To ensure that ICMP echo requests are sent, we also define the option (-PE) for this.

z3tssu@htb[/htb]$ sudo nmap 10.129.2.18 -sn -oA host -PE --packet-trace 

Starting Nmap 7.80 ( https://nmap.org ) at 2020-06-15 00:08 CEST
SENT (0.0074s) ARP who-has 10.129.2.18 tell 10.10.14.2
RCVD (0.0309s) ARP reply 10.129.2.18 is-at DE:AD:00:00:BE:EF
Nmap scan report for 10.129.2.18
Host is up (0.023s latency).
MAC Address: DE:AD:00:00:BE:EF
Nmap done: 1 IP address (1 host up) scanned in 0.05 seconds

chevron-rightDetermine why Nmap marked host as activehashtag

Another way to determine why Nmap has our target marked as "alive" is with the "--reason" option.

z3tssu@htb[/htb]$ sudo nmap 10.129.2.18 -sn -oA host -PE --reason 

Starting Nmap 7.80 ( https://nmap.org ) at 2020-06-15 00:10 CEST
SENT (0.0074s) ARP who-has 10.129.2.18 tell 10.10.14.2
RCVD (0.0309s) ARP reply 10.129.2.18 is-at DE:AD:00:00:BE:EF
Nmap scan report for 10.129.2.18
Host is up, received arp-response (0.028s latency).
MAC Address: DE:AD:00:00:BE:EF
Nmap done: 1 IP address (1 host up) scanned in 0.03 seconds

chevron-rightDisable ARP Scanhashtag

Last updated