strix/skills/tooling/nmap.md
Official docs:
Canonical syntax:
nmap [Scan Type(s)] [Options] {target specification}
High-signal flags:
-n skip DNS resolution-Pn skip host discovery when ICMP/ping is filtered-sS SYN scan (root/privileged)-sT TCP connect scan (no raw-socket privilege)-sV detect service versions-sC run default NSE scripts-p <ports> explicit ports (-p- for all TCP ports)--top-ports <n> quick common-port sweep--open show only hosts with open ports-T<0-5> timing template (-T4 common)--max-retries <n> cap retransmissions--host-timeout <time> give up on very slow hosts--script-timeout <time> bound NSE script runtime-oA <prefix> output in normal/XML/grepable formatsAgent-safe baseline for automation:
nmap -n -Pn --open --top-ports 100 -T4 --max-retries 1 --host-timeout 90s -oA nmap_quick <host>
Common patterns:
nmap -n -Pn --top-ports 100 --open -T4 --max-retries 1 --host-timeout 90s <host>nmap -n -Pn -p 22,80,443,8080,8443 --open -T4 --max-retries 1 --host-timeout 90s <host>nmap -n -Pn -sV -sC -p <comma_ports> --script-timeout 30s --host-timeout 3m -oA nmap_services <host>nmap -n -Pn -sT --top-ports 100 --open --host-timeout 90s <host>Critical correctness rules:
--host-timeout; add --script-timeout whenever NSE scripts are involved.--top-ports profile unless broader coverage is explicitly required.-p-, very high --top-ports, or wide host ranges) unless explicitly required.naabu for broad port discovery; use nmap for scoped verification/enrichment.Usage rules:
-n by default in automation to avoid DNS delays.-oA for reusable artifacts.-p 22,80,443,8080,8443 or --top-ports 100 before considering larger sweeps.-h/--help for routine usage unless absolutely necessary.Failure recovery:
-Pn.-p or smaller --top-ports) and lower retries.--script-timeout.If uncertain, query web_search with:
site:nmap.org/book nmap <flag>