ᛉ Yggdrasil

Tool references

Nmap Wiki

17 Sep 2026 · 4,651 words · 21 min

Contents

Author: Gordon Lyon (@fyodor) Repo: https://github.com/nmap/nmap Description: Network discovery, port scanning, service/OS fingerprinting, and scripting engine Current Version: 7.99 (March 2026) License: Nmap Public Source License (NPSL) Docs: https://nmap.org/book/man.html


Overview

Nmap ("Network Mapper") is the de-facto standard tool for network discovery and security auditing. It sends crafted probe packets to targets and interprets the responses to determine host liveness, open/closed/filtered port states, the service and version bound to each port, and — with enough signal — the underlying operating system. First released by Gordon Lyon (Fyodor) in Phrack in September 1997, it has grown into a full suite: the core scanner, the Nmap Scripting Engine (NSE) for extensibility, Ncat for arbitrary TCP/UDP redirection and relaying, Nping for packet crafting, Ndiff for diffing scan results, and Zenmap as a GUI front end.

For an operator — CTF or red team — Nmap is almost always the first tool run against a target: it defines the attack surface before anything else happens.

Key capabilities:

  • Host discovery across a huge range of target specification formats (CIDR, ranges, hostnames, list files)
  • Six core TCP scan techniques plus UDP scanning, each with different stealth/speed/privilege tradeoffs
  • Service and version detection (-sV) against open ports, including SSL/TLS-wrapped services
  • OS fingerprinting (-O) using TCP/IP stack quirks
  • The Nmap Scripting Engine (NSE) — 612 scripts as of the 7.99 release, covering discovery, vuln checks, brute force, exploitation, and more, written in Lua
  • Firewall/IDS evasion primitives: fragmentation, decoys, spoofed source, MTU manipulation, bogus checksums
  • Six built-in timing templates (-T0–-T5) plus fully granular manual timing control
  • Multiple output formats (normal, XML, grepable, all-formats) suitable for parsing/automation and diffing (ndiff)
  • Companion tools: Ncat (netcat replacement with SSL/proxy/broker support), Nping (packet generation and RTT measurement), Zenmap (GUI), Ndiff (scan comparison)

Note: As of 7.99, Nmap upgraded bundled libraries to OpenSSL 3.0.19, libpcap 1.10.6, libpcre2 10.47, and on Windows bundles a newer Npcap driver. Version fingerprint databases are refreshed on every release, so keeping current genuinely improves -sV/-O accuracy — an older Nmap binary will misidentify or fail to identify newer service/OS combinations.


Installation

# Debian/Ubuntu/Kali
sudo apt install nmap

# Arch Linux
sudo pacman -S nmap

# macOS (Homebrew)
brew install nmap

# From source (get every NSE script + latest fingerprints)
git clone https://github.com/nmap/nmap.git
cd nmap
./configure
make
sudo make install
# Verify version and confirm script count
nmap --version
Platform note Detail
Linux Raw-socket scan types (-sS, -sU, OS detection) require root or CAP_NET_RAW
Windows Requires the bundled Npcap driver for raw packet capture; standard installer includes it
Privilege drop Nmap drops privileges after opening raw sockets where the OS supports it, but still needs elevated rights to start
Unprivileged mode Nmap auto-falls-back to -sT (connect scan) if run without root and a raw scan type was requested

Architecture & Scan Phases

Nmap's execution model runs through a consistent pipeline regardless of scan type. Understanding this order explains why certain flags disable/skip certain phases (e.g. -Pn skips phase 1, -sn stops after phase 1).

┌─────────────────────┐
│ 1. Target           │  Expand target spec (CIDR/range/list/DNS)
│    Enumeration      │
└──────────┬──────────┘
           ▼
┌─────────────────────┐
│ 2. Host Discovery   │  ARP (LAN) / ICMP+TCP+UDP probes (routed)
│    (skip with -Pn)  │  -sn stops here (ping sweep only)
└──────────┬──────────┘
           ▼
┌─────────────────────┐
│ 3. Reverse-DNS      │  PTR lookups (skip with -n)
│    Resolution       │
└──────────┬──────────┘
           ▼
┌─────────────────────┐
│ 4. Port Scanning    │  SYN/Connect/UDP/etc against live hosts
└──────────┬──────────┘
           ▼
┌─────────────────────┐
│ 5. Version Detection│  -sV: probe open ports for banners/behavior
└──────────┬──────────┘
           ▼
┌─────────────────────┐
│ 6. OS Detection     │  -O: TCP/IP stack fingerprinting
└──────────┬──────────┘
           ▼
┌───────────────────────┐
│ 7. NSE Scripting      │  --script: scriptrules run against results
│    (script/version/   │
│     traceroute phases)│
└──────────┬────────────┘
           ▼
┌─────────────────────┐
│ 8. Output           │  Normal / XML / Grepable / All
└─────────────────────┘

Target Specification

nmap 10.10.10.5                      # single host
nmap 10.10.10.0/24                   # CIDR
nmap 10.10.10.1-50                   # range (last octet)
nmap 10.10.10.1 10.10.10.5 10.10.11.0/24   # multiple, mixed
nmap -iL targets.txt                 # from file, one target per line
nmap -iR 100                         # 100 random targets (internet scanning — use carefully)
nmap --exclude 10.10.10.5            # exclude a host
nmap --excludefile excluded.txt      # exclude a list
Flag Purpose
-iL <file> Read targets from file
-iR <num> Pick random targets
--exclude <hosts> Exclude hosts/networks from an otherwise larger spec
--excludefile <file> Exclude list from file

Tip: In HTB/CTF boxes, 10.10.10.0/24-style ranges are common lab defaults — but always scan only the specific target IP given unless the engagement explicitly authorizes a wider range.


Host Discovery

Host discovery ("ping scanning") determines which hosts are up before spending time port-scanning ones that are down. On a local Ethernet segment Nmap defaults to ARP requests (fast, reliable, can't be firewalled away). Off-segment, it defaults to a mix of ICMP echo, TCP SYN to 443, TCP ACK to 80, and ICMP timestamp request.

nmap -sn 10.10.10.0/24        # ping sweep only, no port scan
nmap -Pn 10.10.10.5           # skip discovery entirely, treat host as up
nmap -PS22,80,443 10.10.10.5  # TCP SYN ping to specific ports
nmap -PA80,443 10.10.10.5     # TCP ACK ping
nmap -PU53 10.10.10.5         # UDP ping
nmap -PE 10.10.10.5           # ICMP echo ping
nmap -PR 10.10.10.0/24        # ARP ping (default and automatic on LAN)
nmap -n 10.10.10.5            # never do reverse DNS resolution
nmap -R 10.10.10.5            # always do reverse DNS resolution
Flag Effect
-sn Host discovery only, no port scan (formerly -sP)
-Pn Treat all hosts as online, skip discovery — essential when ICMP is filtered
-PS<ports> TCP SYN ping
-PA<ports> TCP ACK ping
-PU<ports> UDP ping
-PE / -PP / -PM ICMP echo / timestamp / netmask ping
-PO<protocols> IP protocol ping
-PR ARP ping (LAN default, very reliable)
-n / -R Never / always resolve DNS

Tip: A huge fraction of "no open ports found" false negatives in CTF and internal pentests come from Nmap's discovery phase dropping a host because ICMP is filtered. If a box is confirmed alive out-of-band (e.g. it responds on a known port, or you got the IP from a VPN config) and Nmap reports it down, add -Pn immediately.


Port Specification & Scan Order

nmap -p 80 10.10.10.5              # single port
nmap -p 22,80,443 10.10.10.5       # list
nmap -p 1-1000 10.10.10.5          # range
nmap -p- 10.10.10.5                # all 65535 ports
nmap -p U:53,111,T:21-25,80 host   # mixed UDP/TCP
nmap -F 10.10.10.5                 # fast mode, top 100 ports
nmap --top-ports 20 10.10.10.5     # N most common ports
nmap -r 10.10.10.5                 # scan ports in order given, don't randomize
Flag Effect
-p <ports> Explicit port list/range
-p- All 65535 ports (equivalent to -p 1-65535)
-F Fast — top 100 ports only
--top-ports <n> Scan the n most common ports per nmap-services frequency data
-r Don't randomize port order
--port-ratio <ratio> Scan ports with a frequency above the given ratio

Tip: The classic CTF workflow is a fast full-port TCP scan first (-p- -T4 --min-rate 5000) to find every open port quickly, then a slower, thorough -sC -sV -p<found-ports> pass against just those ports for accurate banners. Running -sC -sV -p- in one shot is much slower because version detection and script execution happen against all 65535 ports rather than the handful that are actually open.


Scan Types

TCP Scans

nmap -sS 10.10.10.5     # SYN scan ("half-open") — default with root, requires raw sockets
nmap -sT 10.10.10.5     # Connect scan — full 3-way handshake, no root needed
nmap -sA 10.10.10.5     # ACK scan — maps firewall rulesets (stateful vs stateless), not port state
nmap -sW 10.10.10.5     # Window scan — variant of ACK using TCP window size quirks
nmap -sM 10.10.10.5     # Maimon scan — FIN/ACK probe, exploits certain BSD-derived stack bugs
nmap -sN 10.10.10.5     # NULL scan — no flags set
nmap -sF 10.10.10.5     # FIN scan — FIN flag only
nmap -sX 10.10.10.5     # Xmas scan — FIN, PSH, URG flags set
Scan Flag(s) sent Root required Notes
SYN SYN Yes Fastest, most common, "stealthy" since it never completes the handshake
Connect Full handshake No Uses OS connect() syscall, shows up in target app logs
ACK ACK Yes Doesn't determine open/closed — only filtered/unfiltered, used for firewall mapping
Window ACK (window analysis) Yes Can sometimes distinguish open from closed on certain stacks where plain ACK cannot
Maimon FIN/ACK Yes Niche — targets specific old BSD TCP implementations
NULL/FIN/Xmas none / FIN / FIN+PSH+URG Yes Rely on RFC 793 behavior: closed ports send RST, open/filtered send nothing. Useless against Windows, which doesn't follow this RFC behavior — everything reports open|filtered

Tip: NULL/FIN/Xmas scans are frequently taught as "stealth" evasion techniques, but modern stateful firewalls and most IDS/IPS trivially detect and normalize them. Treat them as situational tools for specific old-stack edge cases, not a general evasion strategy.

UDP Scan

nmap -sU 10.10.10.5                    # UDP scan
nmap -sU -p 53,161,162,500 10.10.10.5  # common UDP services only — full UDP is slow
nmap -sU --top-ports 20 -T4 10.10.10.5 # fast-ish UDP triage

UDP scanning is fundamentally slower and less reliable than TCP: there's no handshake, so Nmap infers state from ICMP port-unreachable (closed) vs no response (open|filtered) vs an actual protocol reply (open). Rate-limited ICMP responses on the target (common on Linux) throttle scan speed hard.

Tip: Never run a blind -sU -p- against a full /24 unless you have a lot of patience — it can take hours. Target likely UDP services directly (53 DNS, 69 TFTP, 123 NTP, 161 SNMP, 500 IKE, 1900 SSDP) based on context from the TCP scan and box theme.

Uncommon / Exotic Scans

nmap -sO 10.10.10.5              # IP protocol scan — which IP protocols (TCP/UDP/ICMP/GRE/etc) respond
nmap -sI zombie_ip 10.10.10.5    # Idle/zombie scan — spoofs source via a third host's IP ID sequence
nmap -sY 10.10.10.5              # SCTP INIT scan
nmap -sZ 10.10.10.5              # SCTP COOKIE ECHO scan
nmap --scanflags SYNFIN 10.10.10.5  # custom TCP flag combination

The idle/zombie scan (-sI) is worth understanding conceptually even if rarely used in practice: it bounces the scan through a third "zombie" host with predictable IP ID incrementing, letting you scan a target without ever sending a packet from your own IP. It requires finding a genuinely idle host with a predictable IPID sequence, which is uncommon on modern networks (most stacks now randomize IPID).


Service & Version Detection

nmap -sV 10.10.10.5                  # version detection against open ports
nmap -sV --version-intensity 9 host  # max intensity — try every probe (slow, thorough)
nmap -sV --version-light host        # light probes only — fast, less accurate
nmap -sV --version-all host          # try every single probe regardless of rarity
nmap -A 10.10.10.5                   # aggressive: -sV -O -sC --traceroute combined
Flag Purpose
-sV Enable version detection
--version-intensity <0-9> Controls how many probes are tried (default 7)
--version-light Shortcut for intensity 2
--version-all Shortcut for intensity 9
--version-trace Show detailed version-detection activity — useful for debugging misfires
-A Aggressive: enables -O -sV -sC --traceroute all at once

Version detection works by sending a sequence of probes from nmap-service-probes and matching responses against a large regex database — this is why it's slower than a plain port scan and why higher intensity means more (and rarer) probes get tried.


OS Detection

nmap -O 10.10.10.5                # OS detection
nmap -O --osscan-guess host       # more aggressive guessing when match is imperfect
nmap -O --osscan-limit host       # only attempt against hosts with 1 open + 1 closed port (higher confidence data)
nmap -O --max-os-tries 1 host     # limit retries — speeds up large scans, less accurate

OS detection sends a series of TCP/UDP/ICMP probes and examines subtle stack behaviors — initial TTL, TCP window size, TCP options ordering, ISN sampling, ICMP response quirks — to fingerprint the OS against the nmap-os-db database. Requires at least one open and one closed TCP port on the target for a confident match; with only open or only closed ports available, results are far less reliable.


Timing & Performance

nmap -T0 host    # paranoid — 5min between probes, IDS evasion
nmap -T1 host    # sneaky
nmap -T2 host    # polite — reduces load, slower
nmap -T3 host    # normal — default
nmap -T4 host    # aggressive — assumes reasonably fast/reliable network, common for CTF
nmap -T5 host    # insane — assumes very fast network, sacrifices accuracy for speed
Flag Effect
--min-rate <n> Send at least n packets/sec — the real lever for fast full-port scans
--max-rate <n> Cap packets/sec
--min-parallelism <n> / --max-parallelism <n> Bound probe parallelism
--min-hostgroup <n> / --max-hostgroup <n> Bound how many hosts are scanned in parallel groups
--host-timeout <time> Give up on a host after this long
--scan-delay <time> / --max-scan-delay <time> Force delay between probes
--max-retries <n> Cap probe retransmissions

Tip: -T4 alone doesn't make a full port scan fast — --min-rate does the heavy lifting. The standard CTF full-port sweep is nmap -p- --min-rate 5000 -T4 10.10.10.5, which forces a high packet rate rather than relying on the timing template's conservative defaults.


Firewall / IDS Evasion & Spoofing

nmap -f 10.10.10.5                  # fragment packets (8 bytes per fragment)
nmap -ff 10.10.10.5                 # smaller fragments (16-byte, more fragmentation)
nmap --mtu 24 10.10.10.5            # custom fragment size (multiple of 8)
nmap -D RND:5 10.10.10.5            # 5 random decoy source IPs mixed with real scan
nmap -D decoy1,decoy2,ME 10.10.10.5 # explicit decoys, ME marks your real position
nmap -S 10.10.10.200 10.10.10.5     # spoof source IP (rarely returns usable results unless on-path)
nmap -e eth0 10.10.10.5             # specify interface
nmap -g 53 10.10.10.5               # spoof source port (e.g. to slip past naive ACLs allowing port 53)
nmap --data-length 25 10.10.10.5    # append random data to pad packet size
nmap --randomize-hosts host1 host2  # randomize scan order across targets
nmap --spoof-mac 0 10.10.10.5       # random MAC address
nmap --spoof-mac Cisco 10.10.10.5   # vendor-prefixed random MAC
nmap --badsum 10.10.10.5            # send invalid checksums, see what responds anyway (finds naive stacks)
Flag Purpose
-f / -ff / --mtu Fragment packets to slip past packet-inspecting firewalls
-D <decoys> Mix in decoy source IPs to obscure which scan is real
-S <ip> Spoof source IP — mostly useful on-path or when you control response routing
-g / --source-port Spoof source port
--data-length <n> Pad packets, changes the packet signature
--spoof-mac Spoof MAC address (local segment only)

Tip: These techniques are taught heavily in OSCP/CTP-style material but have limited real-world effect against modern stateful firewalls and commercial IDS/IPS, which normalize fragments and correlate decoy traffic. Treat this section as "know it exists, understand the mechanism," not as a reliable modern evasion toolkit. It remains relevant in CTF boxes that specifically simulate older/naive detection logic.


Nmap Scripting Engine (NSE)

NSE is what elevates Nmap from a scanner into a lightweight vulnerability/enumeration framework. Scripts are written in Lua and stored in /usr/share/nmap/scripts/ (Linux) — as of 7.99 the distribution ships 612 scripts total.

Script Categories

Category Purpose
auth Authentication bypass / credential-related checks
broadcast Discovery via broadcast/multicast queries (not run by default)
brute Brute-force credential guessing
default Safe, useful scripts run automatically with -sC
discovery Enumerate more info about the target/network
dos Denial-of-service testing (use only with explicit authorization)
exploit Active exploitation of found vulnerabilities
external Scripts that send data to third-party services (e.g. WHOIS)
fuzzer Protocol fuzzing (unpredictable, noisy)
intrusive Risk of crashing services or being detected — not in default
malware Checks for signs of malware/backdoors
safe Won't crash services, not intrusive
version Extends version detection
vuln Checks for specific known vulnerabilities

Running Scripts

nmap -sC 10.10.10.5                       # run default category scripts
nmap --script default,vuln 10.10.10.5     # multiple categories
nmap --script=smb-vuln* 10.10.10.5        # wildcard match
nmap --script smb-enum-shares.nse host    # explicit single script
nmap --script vuln --script-args=unsafe=1 host   # pass script arguments
nmap --script-help smb-enum-shares         # see what a script does and its args
nmap --script-updatedb                     # refresh script database after adding scripts manually
Flag Purpose
-sC Shortcut for --script=default
--script <name/category/wildcard> Select scripts explicitly
--script-args <k=v,...> Pass arguments into scripts
--script-args-file <file> Load arguments from file
--script-trace Show all data sent/received by scripts — debugging
--script-updatedb Rebuild script.db after adding custom scripts

Useful Scripts by Purpose

# SMB enumeration — extremely common on AD boxes
nmap --script smb-os-discovery,smb-enum-shares,smb-enum-users,smb-protocols -p445 host

# SMB vuln checks (EternalBlue etc)
nmap --script smb-vuln* -p445 host

# HTTP enumeration
nmap --script http-enum,http-title,http-headers,http-methods -p80,443 host

# FTP anonymous login check
nmap --script ftp-anon -p21 host

# Kerberos user enumeration
nmap --script krb5-enum-users --script-args krb5-enum-users.realm='DOMAIN.LOCAL' -p88 host

# LDAP enumeration
nmap --script ldap-search -p389 host

# SSL/TLS cert + cipher info
nmap --script ssl-cert,ssl-enum-ciphers -p443 host

# DNS zone transfer attempt
nmap --script dns-zone-transfer --script-args dns-zone-transfer.domain=target.local -p53 host

# SNMP enumeration
nmap --script snmp-info,snmp-sysdescr -p161 --script-args snmpcommunity=public host

# General vuln sweep
nmap --script vuln host

Writing a Basic NSE Script

Worth knowing the skeleton even if you rarely write scripts from scratch — it helps when reading/modifying an existing one during a CTF.

-- basic-check.nse
description = [[
Checks for a specific HTTP header on the target and reports it.
]]

author = "operator"
license = "Same as Nmap"
categories = {"discovery", "safe"}

local http = require "http"
local shortport = require "shortport"

portrule = shortport.http

action = function(host, port)
  local response = http.get(host, port, "/")
  if response and response.header then
    return response.header["server"] or "no Server header"
  end
end
# Run a custom/local script directly by path
nmap --script /path/to/basic-check.nse -p80 host

Output Formats

nmap -oN scan.txt 10.10.10.5          # normal output to file (same as stdout)
nmap -oX scan.xml 10.10.10.5          # XML — parseable, feeds other tools
nmap -oG scan.gnmap 10.10.10.5        # grepable — legacy but still handy for quick grep/awk
nmap -oA scan_base 10.10.10.5         # all three formats at once, using scan_base as prefix
nmap -v 10.10.10.5                    # verbose
nmap -vv 10.10.10.5                   # very verbose
nmap -d 10.10.10.5                    # debug output
nmap --reason 10.10.10.5              # show why a port was marked open/closed/filtered
nmap --open 10.10.10.5                # only show open (or open|filtered) ports
nmap --stats-every 10s 10.10.10.5     # periodic progress updates, useful on long full-port scans
Flag Output
-oN Normal (human-readable)
-oX XML
-oG Grepable
-oA All three, one prefix
--append-output Append rather than overwrite
-6 Enable IPv6 scanning

Tip: -oX output feeds directly into tools that parse Nmap XML (Metasploit's db_import, various CTF automation scripts, xsltproc for HTML reports). Get in the habit of always running -oA on real engagement scans so you have all three formats without re-scanning.


Ncat, Nping, Ndiff, Zenmap

The Nmap suite bundles several companion tools worth knowing.

# Ncat — netcat replacement with SSL, proxy, and broker support
ncat -l 4444                          # listen
ncat 10.10.10.5 4444                  # connect
ncat --ssl -l 4444                    # SSL-wrapped listener
ncat -e /bin/bash -l 4444             # bind shell (lab/CTF use)
ncat --broker -l 4444                 # chat/relay broker mode — connects multiple clients together

# Nping — packet crafting and RTT/latency measurement
nping --tcp -p 80 -c 3 10.10.10.5     # send 3 TCP packets to port 80
nping --icmp -c 5 10.10.10.5          # ICMP echo, 5 packets
nping --udp --data-string "test" -p 53 10.10.10.5

# Ndiff — compare two scan results (great for change detection across re-scans)
ndiff scan1.xml scan2.xml

# Zenmap — GUI front end, wraps the above with saved profiles and topology view
zenmap

OPSEC Notes (Detection & Logging)

Understanding what a scan looks like from the defender's side matters as much as knowing the flags.

  • SYN scans (-sS) never complete the handshake, so they won't appear in application-level connection logs, but they are trivially visible to any IDS/IPS or flow-based monitoring (half-open connections, RST floods are a classic signature).
  • Connect scans (-sT) complete full TCP handshakes through the OS socket API — these will show up in target application/service logs, not just network-layer monitoring.
  • -sV and -sC generate substantially more, and more varied, traffic than a bare port scan, since they send protocol-specific probes and NSE script traffic — much noisier and easier to fingerprint as "Nmap-shaped" traffic even without matching a specific signature.
  • -A is convenient but by far the noisiest common flag combination — it stacks OS detection, version detection, default scripts, and traceroute together.
  • Fragmentation and decoys (-f, -D) are frequently taught as evasion but are normalized/correlated by modern stateful inspection; don't rely on them against a competent blue team.
  • Timing matters for detection more than most people assume — a full -p- -T4 --min-rate 5000 sweep against a single host in seconds is an obvious signature on any host-based or network IDS; -T1/-T2 with --scan-delay trades detectability for a very large time cost.
  • -Pn skipping host discovery means every port on every listed target gets probed regardless of whether the host is actually up — this can dramatically increase scan time and noise against a subnet where many addresses are unused.

Note: In CTF and lab environments detection rarely matters, so aggressive flags (-T4, -A, --min-rate 5000) are the norm for speed. On an actual red team engagement, always match scan aggressiveness to the agreed rules of engagement — many engagements explicitly restrict scan rate or scan types to avoid tripping alerts prematurely.


Common Attack Workflows

Workflow: Standard CTF Box Initial Enumeration

# 1. Fast full-port TCP sweep to find everything open
nmap -p- --min-rate 5000 -T4 -oG allports.gnmap 10.10.10.5

# 2. Extract open ports from the grepable output
ports=$(grep -oP '\d{1,5}/open' allports.gnmap | cut -d/ -f1 | tr '\n' ',' | sed 's/,$//')

# 3. Thorough scan against only the open ports found
nmap -sC -sV -p$ports -oA detailed 10.10.10.5

# 4. If SMB/AD services present, add targeted NSE
nmap --script smb-os-discovery,smb-enum-shares,smb-enum-users -p445 10.10.10.5

# 5. Don't forget UDP — at least a top-ports sweep
nmap -sU --top-ports 20 -T4 10.10.10.5

Workflow: Active Directory Box Triage

# 1. Full TCP sweep — AD boxes have a very recognizable port fingerprint
nmap -p- --min-rate 5000 -T4 10.10.10.5

# Recognizable AD ports: 53 (DNS), 88 (Kerberos), 135 (RPC), 139/445 (SMB),
# 389/636 (LDAP/LDAPS), 3268/3269 (Global Catalog), 5985 (WinRM)

# 2. Targeted enumeration once AD is confirmed
nmap -p88,389,445 --script krb5-enum-users,ldap-search,smb-os-discovery,smb-enum-shares \
     --script-args krb5-enum-users.realm='DOMAIN.LOCAL' 10.10.10.5

# 3. Hand off to specialized AD tooling (NetExec, BloodHound, Impacket)
# once service versions and domain name are confirmed from Nmap output

Workflow: Web Application Box

# 1. Standard port sweep
nmap -p- --min-rate 5000 -T4 10.10.10.5

# 2. HTTP-focused enumeration
nmap -sC -sV -p80,443 --script http-enum,http-title,http-headers,ssl-cert,ssl-enum-ciphers 10.10.10.5

# 3. Confirm vhosts / naming conventions from headers and cert SANs
#    before moving to gobuster/ffuf/whatweb for deeper web enum

Workflow: Firewalled / Filtered Host Triage

# 1. Confirm the host is actually up via an out-of-band method,
#    then force Nmap to skip discovery
nmap -Pn -p- --min-rate 3000 -T4 10.10.10.5

# 2. ACK scan to distinguish stateful filtering from a genuinely closed port
nmap -sA -p- 10.10.10.5

# 3. If results are inconsistent, slow down and retry —
#    aggressive rate limiting on the target side can cause false negatives
nmap -Pn -p<suspect-ports> -T2 --max-retries 3 10.10.10.5

Cheatsheet

Quick-reference for the most common operator tasks. Replace hosts/ports/ranges as needed.

Discovery

nmap -sn 10.10.10.0/24              # ping sweep
nmap -Pn host                       # skip discovery
nmap -PR 10.10.10.0/24              # ARP ping (LAN)

Full Port Sweep (find everything fast)

nmap -p- --min-rate 5000 -T4 host

Standard Detailed Scan

nmap -sC -sV -p<ports> -oA output host

Aggressive All-in-One

nmap -A -T4 host

UDP Triage

nmap -sU --top-ports 20 -T4 host

Scan Types

nmap -sS host      # SYN (default, root)
nmap -sT host      # Connect (no root)
nmap -sU host      # UDP
nmap -sA host      # ACK (firewall mapping)
nmap -sN/-sF/-sX host  # NULL/FIN/Xmas

Service / OS Detection

nmap -sV host
nmap -O host
nmap -A host        # combines both + scripts + traceroute

NSE

nmap -sC host                        # default scripts
nmap --script vuln host              # vuln checks
nmap --script smb-vuln* -p445 host   # wildcard category
nmap --script-help <script>          # script docs
nmap --script-args key=value host    # pass args

Evasion (situational, not reliable against modern defenses)

nmap -f host                # fragment
nmap -D RND:5 host          # decoys
nmap --spoof-mac 0 host     # random MAC
nmap --data-length 25 host  # pad packets

Output

nmap -oA basename host      # all formats
nmap -oX scan.xml host      # XML for tooling
nmap --open host            # only show open ports

Companion Tools

ncat -l 4444                 # listener
ncat --ssl -l 4444           # SSL listener
nping --tcp -p80 -c3 host    # packet crafting
ndiff scan1.xml scan2.xml    # diff two scans

Timing Reference

-T0 paranoid   -T1 sneaky   -T2 polite
-T3 normal     -T4 aggressive (common CTF default)   -T5 insane
--min-rate 5000   # forces high packet rate regardless of template

References

  • Official site: https://nmap.org
  • Book / man page: https://nmap.org/book/man.html
  • GitHub mirror: https://github.com/nmap/nmap
  • NSE script documentation: https://nmap.org/nsedoc/
  • Changelog: https://nmap.org/changelog.html
  • Npcap (Windows driver): https://npcap.com

← Tool references top ↑