Skip to main content

Nmap: How to Exclude Targets Using a List (part-8)

 Exclude Targets Using a List

The --excludefile option is similar to the --exclude option and can be used to
provide a list of targets to exclude from a network scan.
$ cat list.txt
192.168.10.1
192.168.10.12
192.168.10.44
Text file with hosts to exclude from a scan
The example below demonstrates using the --excludefile argument to exclude the
hosts in the list.txt file displayed above.
Usage syntax: nmap [targets] --excludefile [list.txt]
$ nmap 192.168.10.0/24 --excludefile list.txt
Starting Nmap 5.00 ( http://nmap.org ) at 2009-08-08 20:49 CDT
Interesting ports on 192.168.10.100:
Not shown: 995 closed ports
PORT STATE SERVICE
22/tcp open ssh
111/tcp open rpcbind
139/tcp open netbios-ssn
445/tcp open microsoft-ds
2049/tcp open
nfs
Nmap done: 253 IP addresses (1 host up) scanned in 33.10 second
Excluding a list of hosts from a network scan
In the above example, the targets in the list.txt file are excluded from the scan.

Exclude Targets Using a List
The --excludefile option is similar to the --exclude option and can be used to
provide a list of targets to exclude from a network scan.
$ cat list.txt
192.168.10.1
192.168.10.12
192.168.10.44
Text file with hosts to exclude from a scan
The example below demonstrates using the --excludefile argument to exclude the
hosts in the list.txt file displayed above.
Usage syntax: nmap [targets] --excludefile [list.txt]
$ nmap 192.168.10.0/24 --excludefile list.txt
Starting Nmap 5.00 ( http://nmap.org ) at 2009-08-08 20:49 CDT
Interesting ports on 192.168.10.100:
Not shown: 995 closed ports
PORT STATE SERVICE
22/tcp open ssh
111/tcp open rpcbind
139/tcp open netbios-ssn
445/tcp open microsoft-ds
2049/tcp open
nfs
Nmap done: 253 IP addresses (1 host up) scanned in 33.10 second
Excluding a list of hosts from a network scan
In the above example, the targets in the list.txt file are excluded from the scan.


The --excludefile option is similar to the --exclude option and can be used to
 provide a list of targets to exclude from a network scan.
$ cat list.txt
192.168.10.1
192.168.10.12
192.168.10.44

Text file with hosts to exclude from a scan

The example below demonstrates using the --excludefile argument to exclude the
hosts in the list.txt file displayed above.

Usage syntax: nmap [targets] --excludefile [list.txt]

 nmap 192.168.10.0/24 --excludefile list.txt
Starting Nmap 5.00 ( http://nmap.org ) at 2009-08-08 20:49 CDT
Interesting ports on 192.168.10.100:
Not shown: 995 closed ports
PORT STATE SERVICE
22/tcp open ssh
111/tcp open rpcbind
139/tcp open netbios-ssn
445/tcp open microsoft-ds
2049/tcp open
nfs
Nmap done: 253 IP addresses (1 host up) scanned in 33.10 second
Excluding a list of hosts from a network scan

In the above example, the targets in the list.txt file are excluded from the scan.