Reference guide for scanning networks with Nmap.
Table of Contents
- What is Nmap?
- How to Use Nmap
- Basic Scanning Techniques
- Port Scanning Options
- Discovery Options
- Perform a Ping Only Scan
- Do Not Ping
- TCP SYN Ping
- TCP ACK Ping
- UDP Ping
- SCTP INIT Ping
- ICMP Echo Ping
- ICMP Timestamp Ping
- ICMP Address Mask Ping
- IP Protocol Ping
- ARP Ping
- Traceroute
- Force Reverse DNS Resolution
- Disable Reverse DNS Resolution
- Alternative DNS Lookup
- Manually Specify DNS Server
- Create a Host List
- Firewall Evasion Techniques
- Advanced Scanning Functions
- Timing Options
- Timing Templates
- Set the Packet TTL
- Minimum Number of Parallel Operations
- Maximum Number of Parallel Operations
- Minimum Host Group Size
- Maximum Host Group Size
- Maximum RTT Timeout
- Initial RTT TImeout
- Maximum Number of Retries
- Host Timeout
- Minimum Scan Delay
- Maximum Scan Delay
- Minimum Packet Rate
- Maximum Packet Rate
- Defeat Reset Rate Limits
- Output Options
- Compare Scans
- Troubleshooting and Debugging
- Nmap Scripting Engine
Nmap ("Network Mapper") is a free and open source utility for network discovery and security auditing. Many systems and network administrators also find it useful for tasks such as network inventory, managing service upgrade schedules, and monitoring host or service uptime. Nmap uses raw IP packets in novel ways to determine what hosts are available on the network, what services (application name and version) those hosts are offering, what operating systems (and OS versions) they are running. It was designed to rapidly scan large networks, but works fine against single hosts.
Nmap can be used in a variety of ways depending on the user's level of technical expertise.
Technical Expertise | Usage |
---|---|
Beginner | Zenmap the graphical user interface for Nmap |
Intermediate | Command line |
Advanced | Python scripting with the Python-Nmap package |
nmap [ <Scan Type> ...] [ <Options> ] { <target specification> }
The -s
switch determines the type of scan to perform.
Nmap Switch | Description |
---|---|
-sA | ACK scan |
-sF | FIN scan |
-sI | IDLE scan |
-sL | DNS scan (a.k.a. list scan) |
-sN | NULL scan |
-sO | Protocol scan |
-sP | Ping scan |
-sR | RPC scan |
-sS | SYN scan |
-sT | TCP connect scan |
-sW | Windows scan |
-sX | XMAS scan |
nmap [target]
nmap [target1, target2, etc]
nmap -iL [list.txt]
nmap [range of IP addresses]
nmap [ip address/cdir]
nmap -iR [number]
nmap [targets] --exclude [targets]
nmap [targets] --excludefile [list.txt]
nmap -A [target]
nmap -6 [target]
nmap -F [target]
nmap -p [port(s)] [target]
nmap -p [port name(s)] [target]
nmap -sU -sT -p U:[ports],T:[ports] [target]
nmap -p 1-65535 [target]
nmap --top-ports [number] [target]
nmap -r [target]
nmap -O --osscan-guess [target]
nmap -sV [target]
nmap -sV --version-trace [target]
nmap -sR [target]
Host Discovery
The -p
switch determines the type of ping to perform.
Nmap Switch | Description |
---|---|
-PI | ICMP ping |
-Po | No ping |
-PS | SYN ping |
-PT | TCP ping |
nmap -sn [target]
nmap -Pn [target]
nmap -PS [target]
nmap -PA [target]
nmap -PU [target]
nmap -PY [target]
nmap -PE [target]
nmap -PP [target]
nmap -PM [target]
nmap -PO [target]
nmap -PR [target]
nmap --traceroute [target]
nmap -R [target]
nmap -n [target]
nmap --system-dns [target]
Can specify a single server or multiple.
nmap --dns-servers [servers] [target]
nmap -sL [targets]
Nmap Switch | Description |
---|
Nmap Switch | Description |
---|---|
-sV | Enumerates software versions |
Nmap Switch | Description |
---|---|
-sC | Run all default scripts |
Nmap Switch | Description |
---|
The -t
switch determines the speed and stealth performed.
Nmap Switch | Description |
---|---|
-T0 | Serial, slowest scan |
-T1 | Serial, slow scan |
-T2 | Serial, normal speed scan |
-T3 | Parallel, normal speed scan |
-T4 | Parallel, fast scan |
Not specifying a T
value will default to -T3
, or normal speed.
Nmap Switch | Description |
---|
nmap -f [target]
nmap --mtu [MTU] [target]
nmap -D RND:[number] [target]
nmap -sI [zombie] [target]
nmap --source-port [port] [target]
nmap --data-length [size] [target]
nmap --randomize-hosts [target]
nmap --spoof-mac [MAC|0|vendor] [target]
nmap --badsum [target]
nmap -sS [target]
nmap -sT [target]
nmap -sU [target]
nmap -sN [target]
nmap -sF [target]
nmap -sA [target]
nmap -sA [target]
nmap --scanflags [flags] [target]
nmap -sO [target]
nmap --send-eth [target]
nmap --send-ip [target]
nmap -T[0-5] [target]
nmap --ttl [time] [target]
nmap --min-parallelism [number] [target]
nmap --max-parallelism [number] [target]
nmap --min-hostgroup [number] [targets]
nmap --max-hostgroup [number] [targets]
nmap --initial-rtt-timeout [time] [target]
nmap --max-rtt-timeout [TTL] [target]
nmap --max-retries [number] [target]
nmap --host-timeout [time] [target]
nmap --scan-delay [time] [target]
nmap --max-scan-delay [time] [target]
nmap --min-rate [number] [target]
nmap --max-rate [number] [target]
nmap --defeat-rst-ratelimit [target]
Nmap Switch | Description |
---|---|
-oN |
Normal output |
-oX |
XML output |
-oA |
Normal, XML, and Grepable format all at once |
nmap -oN [scan.txt] [target]
nmap -oX [scan.xml] [target]
nmap -oG [scan.txt] [target]
nmap -oA [path/filename] [target]
nmap --stats-every [time] [target]
nmap -oS [scan.txt] [target]
ndiff [scan1.xml] [scan2.xml]
ndiff -v [scan1.xml] [scan2.xml]
ndiff --xml [scan1.xml] [scan2.xml]
nmap -h
nmap -V
nmap -v [target]
nmap -d [target]
nmap --reason [target]
nmap --open [target]
nmap --packet-trace [target]
nmap --iflist
nmap -e [interface] [target]
nmap --script [script.nse] [target]
nmap --script [expression] [target]
nmap --script [category] [target]
nmap --script [category1,category2,etc]
nmap --script [script] --script-trace [target]
nmap --script-updatedb
Reference Sites
- Nmap - The Basics
- Reference link 1
- Beginner's Guide to Nmap
- Top 32 Nmap Command
- Nmap Linux man page
- 29 Practical Examples of Nmap Commands
- Nmap Scanning Types, Scanning Commands , NSE Scripts
- Nmap CheatSheet
- Nmap Cheat Sheet
- Nmap Cheat Sheet: From Discovery to Exploits
- Nmap: my own cheatsheet
- NMAP Commands Cheatsheet
- Nmap Cheat Sheet
- Nmap Cheat Sheet