Nmap Target Specification – POFTUT

Nmap Target Specification

[rps-include post=6632]

Requirement for scanning is target specification. Nmap provides different methodologies to set targets.

Single Host Address

This is the simplest and mostly used target specification. We only provide single ip address.

$ nmap
  • is the target ip address

Dns Name

Nmap can use DNS names as targets. It will resolve DNS addresses into ip addresses. Be sure that DNS is working in the system

$ nmap localhost.com
  • localhost.com is the DNS name of our IP address

Multiple Dns Names

We can also provide multiple dns names into nmap to scan like below.

$ nmap google.com microsoft.com

Multiple Host Address

As we see that scanning hosts one by one is tedious work. We may specify multiple hosts in very different ways.

$ nmap 192.168.1.*
  • 192.168.1.* is network address. means possible all values which mean from 0 to 255
$ nmap 192.168.*.*
  • As we expect we will scan /16 subnet in other words 

As Network Address

We can provide targets with CIDR masks.

$ nmap
  • Scan C class network
$ nmap
  • Scans between
$ nmap
  • Scans between
  • – is used to specify range

Reading From File Line By Line

In enterprise environment there is a lot ip hosts. So specifying them by network can not be a good way. There is an option which is reading target hosts/networks from file.

We create a file named db  and add hosts/networks line by line like below

Now we can use -iL  to scan these hosts

$ nmap -iL db
  • We provide text file with -iL and the file name is db. As we see we can provide network addresses too. is a network address.
LEARN MORE  Linux Mtr Command Tutorial with Examples To Network Diagnostics

[rps-include post=6632]

Leave a Comment