Wiki / Security
Nmap cheat sheet
The scan commands I reach for most, from host discovery to service and script scans.
Updated
- recon
- networking
Only scan networks and hosts you own or are explicitly allowed to test.
Host discovery
Find live hosts without port scanning:
nmap -sn 192.168.1.0/24
Skip discovery and treat every host as up (useful when ICMP is blocked):
nmap -Pn 192.168.1.10
Port scanning
nmap 192.168.1.10 # top 1000 TCP ports
nmap -p- 192.168.1.10 # all 65535 TCP ports
nmap -p 22,80,443 192.168.1.10 # specific ports
nmap --top-ports 100 192.168.1.10
nmap -sU --top-ports 50 192.168.1.10 # UDP, slow, needs root
Service and OS detection
nmap -sV 192.168.1.10 # service versions
nmap -O 192.168.1.10 # OS fingerprint, needs root
nmap -A 192.168.1.10 # -sV -O -sC --traceroute in one go
Scripts (NSE)
nmap -sC 192.168.1.10 # default safe scripts
nmap --script vuln 192.168.1.10 # known-vulnerability checks
nmap --script http-title -p 80,443 192.168.1.0/24
Timing and output
nmap -T4 192.168.1.10 # faster timing template (T0-T5)
nmap -oA scan 192.168.1.10 # save normal, XML and grepable output
nmap -v --reason 192.168.1.10 # verbose, explain each port state
A typical first pass
nmap -Pn -p- -T4 -oA full 192.168.1.10
nmap -Pn -sV -sC -p <open-ports> -oA detail 192.168.1.10
Find the open ports fast, then run the slower version and script scan only against those ports.