Nmap Cheat Sheet
Study guide: CORE = practical scan, discovery, fingerprinting, and NSE concepts supported by PT0-003 objectives and the course materials; EXTENDED = additional valid Nmap options for recognition. These labels are study organization, not official exam weights.
Typed CLI practice — how answers are checked
- Type the full command beginning with
nmap; optional leading sudo is accepted.
- Equivalent option order is accepted. For example, the target may appear before or after the options.
-p 22,443 and -p22,443 are treated the same; numeric comma-list order is ignored.
--script vuln and --script=vuln are treated the same.
- Unrequested extra flags are marked as extra rather than silently accepted; the exercise trains the smallest command that meets the stated conditions.
Scope: the core typed bank practices common discovery, scan, fingerprinting, output, and NSE commands. Some forms extend the examples in the PT0-003 course materials.
PT0-003 Nmap study core
| Option | What to remember |
-sS | TCP SYN / half-open scan; CertMaster calls it a stealth scan. |
-sU | UDP port scan. |
-p | Specify ports or ranges. |
-sn | Host discovery only; do not perform a port scan. |
-PR | ARP discovery on a local Ethernet network. |
-sV | Service and version detection. |
-O | OS fingerprinting/detection. |
-T4 | Aggressive timing template; faster scan assumptions. |
-p- | Ports 1 through 65,535 instead of the default common-port set. |
Combined practice command: nmap -sS -T4 -O -sV -p- 192.168.50.9 combines SYN scanning, faster timing, OS detection, service/version detection, and the full port range against one target. Assess scope and traffic impact before using such a broad scan.
Do not confuse: -A is an aggressive feature bundle (OS detection + version detection + default scripts + traceroute). -T4 is an aggressive timing template.
Port states — read the scan
| State | Meaning |
| open | An application is accepting connections/packets. |
| closed | Host is reachable and replies (often RST), but nothing is listening on the port. |
| filtered | Nmap cannot determine the port state because filtering blocks useful probes/responses. |
| unfiltered | Reachable, but Nmap cannot tell open vs. closed; characteristic ACK-scan result. |
| open|filtered | Scan cannot distinguish open from filtered; common with UDP and some no-response scan types. |
| closed|filtered | Idle scan cannot distinguish closed from filtered. |
Exam cue: port state is evidence, not a vulnerability rating. A service on an open port may still be secure or vulnerable depending on configuration/version.
Scan techniques
| Option | Technique / distinction |
-sS | SYN / half-open; does not complete the normal TCP handshake. |
-sT | TCP connect; uses the OS connect call and completes a connection to open ports. |
-sU | UDP scan. |
-sA | ACK scan; maps firewall rules/filtering, not which service is accepting connections. |
-sN | NULL scan; no TCP flags. |
-sF | FIN scan. |
-sX | Xmas scan; FIN + PSH + URG. |
-sW | Window scan; ACK-like technique that examines TCP window behavior on some stacks. |
-sM | Maimon scan; FIN/ACK probe. |
-sI | Idle scan using a suitable “zombie” host. |
Host discovery, ports & targets
| Syntax | Use |
-sn | Discover hosts, skip port scanning. |
-Pn | Skip normal host discovery and treat specified targets as up; requested scans still run. |
-PS22,80 | TCP SYN discovery probes to specified ports. |
-PA80 | TCP ACK discovery probe. |
-PU53 | UDP discovery probe. |
-PR | ARP host discovery on local Ethernet. |
-sL | List targets without scanning them. |
-n | Do not perform reverse DNS resolution. |
-p 80,443 | Scan only ports 80 and 443. |
-p- | Scan the full 1–65,535 port range. |
-F | Fast/limited scan: normally 100 most common ports. |
-r | Scan ports sequentially instead of the normal randomized order. |
-iL hosts.txt | Read targets from a file. |
--exclude | Exclude specified target(s). |
-6 | Enable IPv6 scanning. |
10.20.5.0/24 | CIDR target range syntax. |
Legacy syntax: some older material shows -P0. Current Nmap uses -Pn; Nmap documents -P0/-PN as older forms.
Service, OS, NSE & output
| Option/tool | Meaning |
-sV | Probe detected ports to identify service/application/version information. |
-O | OS fingerprinting. |
-A | OS detection + version detection + default script scan + traceroute. |
-sC | Run the default NSE script set; equivalent to --script=default. |
--script vuln | Select scripts in the NSE vuln category. |
--script-help <name> | Show help for matching NSE scripts. |
--script-updatedb | Refresh the script database after scripts are added/removed. |
-oN file | Normal-format file output. |
-oX file | XML output; preferred for machine parsing/import workflows. |
-oG file | Grepable output; still recognized but deprecated by Nmap. |
-oA base | Write normal, XML, and grepable files using one basename. |
| Zenmap | Official graphical Nmap front-end; profiles, result comparison, topology visualization. |
NSE scope: NSE can help with discovery, versioning, misconfiguration and vulnerability checks. It can also contain intrusive/exploit/DoS scripts, so script category matters.
Timing, evasion & spoofing (extended)
| Option | Meaning |
-T0 | Paranoid. |
-T1 | Sneaky. |
-T2 | Polite. |
-T3 | Normal/default. |
-T4 | Aggressive. |
-T5 | Insane; prioritizes speed and may sacrifice reliability. |
-f | Fragment IPv4 probes into small pieces (where supported). |
-D <decoys> | Use decoy source addresses along with the real scanner. |
--spoof-mac <value> | Spoof source MAC for applicable local-link scans. |
-g / --source-port | Use a specified source port. |
--ttl <n> | Set IPv4 time-to-live on sent packets. |
--mtu <n> | Use a specified MTU for fragmentation. |
--data-length <n> | Append random data bytes to many sent packets. |
--randomize-hosts | Randomize target-host scan order. |
--badsum | Send packets with invalid checksums for firewall/IDS behavior testing. |
Study focus: practice choosing a scan and interpreting its results first. Keep the less-common evasion flags here for recognition; the PT0-003 objectives do not specify their individual weighting.
Tool-selection pattern
| Need | Best fit |
| Detailed host/port scan + service/OS fingerprint + NSE | Nmap |
| Same Nmap engine but graphical profiles/topology | Zenmap |
| Huge range as fast as possible; depth later | Masscan |
| Simple fast GUI sweep / lightweight discovery | Angry IP Scanner |
| Full vulnerability-management scanner with CVE/plugin depth | Nessus / OpenVAS-class tool, not Nmap alone |
Pattern-recognition hook: depth / fingerprint / NSE → Nmap. Internet-scale speed → Masscan. simple GUI sweep → Angry IP Scanner.
Metasploit & Nmap integration
db_nmap = execute Nmap from Metasploit and automatically record results in the database.
db_import = import an already-created scan result file, including supported Nmap XML.
Correction from the old trainer: “imports Nmap results” is too vague for db_nmap. If the scan already exists as a file, think db_import; if Metasploit should run Nmap and record it, think db_nmap.
Privilege behavior & practical cautions
- Many raw-packet scan modes are more capable with root/administrator privileges.
- Without raw-packet privileges, Nmap can use a TCP connect scan for TCP port scanning rather than SYN scanning.
- Full-port + version + OS + script scans can be noisy, slow, and operationally invasive.
- Nmap results are inferences from network responses; filtering, unusual stacks, and deceptive responses can reduce certainty.
- Only scan systems and networks you are authorized to test.
Keyboard shortcuts
Enter Score / Re-score N New set/question S Shuffle pool (drag modes)
Exam scope: CompTIA PenTest+ PT0-003 Exam Objectives v3.0, especially 2.4 and 4.2, with related 3.1, 3.2, and 4.1 tasks. Teaching references: PenTest+ CertMaster Perform Module 3, Lesson 3B (host and service discovery); Dion's PT0-003 Study Guide, Section 9 (Nmap and NSE); and the Sybex CompTIA PenTest+ Study Guide, Third Edition. Additional Nmap syntax is retained as reference practice, not presented as an official exam priority.