Nmap
A powerful network scanning tool used to discover hosts, open ports, running services, and operating systems on a target network.
Host Discovery
nmap -sP 10.0.0.0/24
Description
Ping sweep to find live hosts on a subnet
nmap -iL targets.txt
Description
Scan a list of targets from a text file
Port Scanning
nmap [target] -sT
Description
Scan TCP ports only
nmap [target] -sU -T5
Description
Scan UDP ports (slower, use -T5 to speed up)
nmap [target] -sS
Description
Stealth SYN scan (default technique, less likely to be logged)
nmap [target] -p 22-150
Description
Scan a specific port range
nmap [target] -p- -T5
Description
Scan all 65535 ports
nmap [target] --top-ports 100
Description
Scan only the most common ports for a quick overview
Service & OS Detection
nmap [target] -sV
Description
Probe open ports for service/version info
nmap [target] -O
Description
Enable OS detection
nmap [target] -sT -O -sV -T4
Description
Combined OS + version detection
nmap [target] -A -T4
Description
Aggressive scan: OS, version, scripts, traceroute
Scripting
nmap [target] -sC -T5
Description
Run default NSE scripts on open ports
nmap [target] --script http-enum.nse
Description
Run a specific NSE script against the target
Output
nmap [target] --script http-enum.nse -oN test.txt
Description
Save scan output in normal format to a file
nmap [target] -sV -T5 -oA scan-results
Description
Save output in all major formats at once
Vulnerability Investigation
nmap [target] -p 3632 -sV
Description
Investigate an unknown/suspicious port's version
nmap -p 3632 [target] --script distcc-cve2004-2687 --script-args="distcc-cve2004-2687.cmd='id'"
Description
Run a vulnerability-specific NSE script with command execution
Timing
nmap [target] -T0
Description
Paranoid timing — extremely slow requests, lowest chance of detection, used to evade strict IDS
nmap [target] -T1
Description
Sneaky timing — still very slow, slightly faster than paranoid
nmap [target] -T2
Description
Polite timing — slows down to use less bandwidth and target resources
nmap [target] -T3
Description
Normal timing — the default speed when no timing option is specified
nmap [target] -T4
Description
Aggressive timing — faster scans; not recommended against real targets due to increased detection risk
nmap [target] -T5
Description
Insane timing — fastest and most aggressive, sacrifices accuracy for speed; not recommended against real targets due to very high detection risk