From aldeid
Jump to: navigation, search
This article is also available in one or more other languages
To view this article in French, click here
You might also see: Zenmap, Nmap's graphical frontend


Nmap is certainly THE scanner to know. Thanks to its numerous parameters, it is a swiss army knife to all situations where network identification is needed. It enables among other things to list network hosts and scan their ports.


From the package

This method shows how to install Nmap-5.00 from packages. Simply run:

$ sudo apt-get install nmap

From sources

First install development sources of libpcap:

$ sudo apt-get install libpcap-dev

Installing Nmap from sources enables, among other things, to obtain the last development revision (5.35-DC1).

$ cd /data/src/
$ wget http://nmap.org/dist/nmap-5.35DC1.tar.bz2
$ bzip2 -cd nmap-5.35DC1.tar.bz2 | tar xf -
$ cd nmap-5.35DC1/
$ .configure
$ make
$ sudo make install

Without change in the configuration options, Nmap installs in /usr/local/bin/nmap.


Basic syntax

$ ./nmap [Scan Type(s)] [Options] {target specification}


Target Specification

-iL <inputfilename>
Input from list of hosts/networks
-iR <num hosts>
Choose random targets
--exclude <host1[,host2][,host3],...>
Exclude hosts/networks
--excludefile <exclude_file>
Exclude list from file

Host Discovery

List Scan - simply list targets to scan
Ping Scan - disable port scan
Treat all hosts as online -- skip host discovery
TCP SYN/ACK, UDP or SCTP discovery to given ports
ICMP echo, timestamp, and netmask request discovery probes
-PO[protocol list]
IP Protocol Ping
Never do DNS resolution/Always resolve [default: sometimes]
--dns-servers <serv1[,serv2],...>
Specify custom DNS servers
Use OS's DNS resolver
Trace hop path to each host

Scan techniques

TCP SYN/Connect()/ACK/Window/Maimon scans
UDP Scan
TCP Null, FIN, and Xmas scans
--scanflags <flags>
Customize TCP scan flags
-sI <zombie host[:probeport]>
Idle scan
IP protocol scan
-b <FTP relay host>
FTP bounce scan

Port Specification and Scan Order

-p <port ranges>
Only scan specified ports
Ex: -p22 | -p1-65535 | -p U:53,111,137,T:21-25,80,139,8080,S:9
Fast mode - Scan fewer ports than the default scan
Scan ports consecutively - don't randomize
--top-ports <number>
Scan <number> most common ports
--port-ratio <ratio>
Scan ports more common than <ratio>

Service/Version Detection

Probe open ports to determine service/version info
--version-intensity <level>
Set from 0 (light) to 9 (try all probes)
Limit to most likely probes (intensity 2)
Try every single probe (intensity 9)
Show detailed version scan activity (for debugging)

Script Scan

equivalent to --script=default
--script=<Lua scripts>
<Lua scripts> is a comma separated list of directories, script-files or script-categories
provide arguments to scripts
Show all data sent and received
Update the script database.

OS Detection

Enable OS detection
Limit OS detection to promising targets
Guess OS more aggressively

Timing and Performance

Options which take