Nmap

Field Detail
Summary Port scan, detect services/versions/OS, run NSE scripts
Category Network scanning
Phase recon, scanning, enumeration
Interface CLI
Platform Linux, Windows, macOS
Licence Free (NPSL)
Docs https://nmap.org/book/man.html
Related Nessus, Metasploit, Wireshark and tcpdump

Network mapper: host discovery, port scanning, service/version detection, OS fingerprinting and scripted checks (NSE). Usually the first thing you run against a scope.

⚠️ Warning — Scope Only scan targets you have written permission to test. Even a ping sweep against an out-of-scope range can breach rules of engagement (and the Computer Misuse Act 1990).

Target specification

Syntax Meaning
10.10.10.5 Single host
10.10.10.0/24 CIDR range
10.10.10.1-50 Octet range
scanme.nmap.org Hostname
-iL targets.txt Read targets from file
--exclude 10.10.10.1 Exclude hosts
--excludefile out-of-scope.txt Exclude from file

Host discovery

nmap -sn 10.10.10.0/24                # ping sweep only, no port scan (host discovery)
nmap -sn -PR 10.10.10.0/24            # ARP ping — local subnet, fastest & most reliable
nmap -sn -PE 10.10.10.0/24            # ICMP echo ("classic ping") sweep
nmap -sn -PS22,80,443 10.10.10.0/24   # TCP SYN ping to those ports
nmap -sn -PA80,443 10.10.10.0/24      # TCP ACK ping (slips past some stateless filters)
nmap -sn -PU53,161 10.10.10.0/24      # UDP ping
nmap -Pn 10.10.10.5                   # skip discovery, treat host as up (firewalled/ICMP-blocked)
nmap -sL 10.10.10.0/24                # list targets + reverse DNS, sends nothing to targets

Discovery probe types (-P*)

Probe Technique When to use
-PR ARP ping Local subnet — a host firewall can't block it; auto-used as root on-LAN
-PE ICMP echo request Classic ping; frequently dropped by Windows / outbound filters
-PP ICMP timestamp Fallback when echo is filtered
-PM ICMP address-mask Rare fallback when echo + timestamp are filtered
-PS<ports> TCP SYN ping Default -PS80 as non-root; good through stateful filters
-PA<ports> TCP ACK ping Can pass stateless firewalls that allow "established" traffic
-PU<ports> UDP ping Reaches hosts filtering TCP; triggers ICMP port-unreachable
-PY<ports> SCTP INIT ping Niche — telecom / SS7-style networks
-PO<protos> IP-protocol ping Raw IP protocols, e.g. -PO1,6,17 (ICMP/TCP/UDP)

Combine probes and tune resolution:

nmap -sn -PE -PS443 -PA80 -PU161 10.10.10.0/24   # several probe types in one sweep
nmap -sn --disable-arp-ping 10.10.10.0/24        # force IP-level probes on-LAN (skip ARP)
nmap -sn -n 10.10.10.0/24                        # no reverse-DNS — faster and quieter
nmap -sn -R 10.10.10.0/24                        # force reverse-DNS on every host, even down ones
nmap -sn --traceroute 10.10.10.0/24              # add path discovery to the sweep
  • On the local subnet, run as root and Nmap uses ARP (-PR) automatically whatever probes you ask for — --disable-arp-ping overrides this.
  • -sn is host discovery only (no port scan). With no -P* given, the root default probes are ICMP echo + ICMP timestamp + TCP SYN→443 + TCP ACK→80 (plus ARP on-LAN); non-root falls back to a TCP connect to 80/443.
  • -Pn skips discovery entirely (assume up) — use when hosts drop every probe (Windows/ICMP-blocked). It's slower, since every port is then probed on hosts that may be down.
  • Pair -PS/-PA with ports you expect open (e.g. -PS22,80,443,3389) for better hit rates through filters.

Scan types

Flag Type Notes
-sS TCP SYN ("half-open") Default as root. Fast, fairly quiet
-sT TCP connect Default without root. Full handshake, gets logged
-sU UDP Slow; combine with --top-ports
-sA ACK Maps firewall rules (filtered vs unfiltered), not open ports
-sN / -sF / -sX Null / FIN / Xmas Firewall evasion tricks; unreliable against Windows

Port selection

nmap -p 22,80,443 10.10.10.5      # specific ports
nmap -p 1-1000 10.10.10.5         # range
nmap -p- 10.10.10.5               # all 65535 TCP ports
nmap --top-ports 100 10.10.10.5   # most common 100
nmap -F 10.10.10.5                # fast: top 100
nmap -sU -p U:53,161,T:22 10.10.10.5   # mix UDP and TCP

💡 Tip — Default is only the top 1000 TCP ports Services on high ports (e.g. 8089, 10000, 47001) get missed unless you use -p-.

Service, version & OS detection

nmap -sV 10.10.10.5                      # service/version detection
nmap -sV --version-intensity 9 ...       # try harder (0-9)
nmap -O 10.10.10.5                       # OS fingerprint (needs root, one open + one closed port)
nmap -A 10.10.10.5                       # aggressive: -sV -O -sC --traceroute
nmap -sC 10.10.10.5                      # default NSE scripts (= --script=default)

Timing & performance

Flag Use
-T0 / -T1 Paranoid / sneaky — IDS evasion, extremely slow
-T3 Default
-T4 Fast — fine for labs and most stable networks
-T5 Insane — drops accuracy
--min-rate 1000 Send at least N packets/sec
--max-retries 2 Fewer retransmissions
--host-timeout 10m Give up on slow hosts

⚠️ Warning — Fragile networks Aggressive timing and -sV/-A can crash old embedded devices — printers, PLCs, OT kit. Use -T2 or slower and agree it with the client first.

NSE (Nmap Scripting Engine)

nmap --script=vuln 10.10.10.5                     # vuln category
nmap --script=smb-enum-shares,smb-os-discovery -p445 10.10.10.5
nmap --script "http-*" -p80,443 10.10.10.5        # wildcard
nmap --script=ssl-enum-ciphers -p443 10.10.10.5   # TLS ciphers/protocols
nmap --script-help=http-title                     # what does this script do?
nmap --script-updatedb                            # after adding custom scripts
ls /usr/share/nmap/scripts/ | grep ftp            # find scripts

Categories: auth, broadcast, brute, default, discovery, dos, exploit, external, fuzzer, intrusive, malware, safe, version, vuln.

ℹ️ Note — About this script list — compiled 2026-11-14, for the Nmap 7.9x NSE set Nmap ships 600+ NSE scripts and the exact set changes between releases, so the tables below are a curated selection of the most-used scripts, not the full catalogue. The authoritative, version-correct reference is always your own install — lead with --script-help:

nmap --script-help "<name>"     # one script: description, categories, args, usage
nmap --script-help "smb-*"      # a whole family
nmap --script-help "*" | less   # EVERY script shipped with YOUR Nmap, with descriptions
nmap --version                  # confirm your version (set it below)

Nmap version this was checked against: 7.9x series — the build environment couldn't auto-detect a version, so replace this with your nmap --version output. Full docs: nmap.org/nsedoc. Re-stamp the date/version whenever you refresh the list.

⚠️ Warning — dos, exploit, intrusive and brute scripts can break services or lock out accounts. Prefer --script safe, and read --script-help on anything before you run it.

Discovery, broadcast & general

Script What it does
banner Grab generic service banners
unusual-port Flag a service running on a non-standard port
fingerprint-strings Dump strings from unidentified services
broadcast-dhcp-discover Find DHCP servers via broadcast
broadcast-ping Discover live hosts via broadcast ping
dns-brute Brute-force subdomains/hostnames
targets-asn Expand an ASN into target ranges
whois-ip / whois-domain Registration/ownership data
ip-geolocation-geoplugin Geolocate an IP
traceroute-geolocation Map the path to a target

SMB / NetBIOS / MSRPC (#tcp/139, #tcp/445)

Script What it does
smb-os-discovery OS, domain, hostname, uptime
smb-protocols / smb2-capabilities Dialects the server supports
smb2-security-mode / smb-security-mode Is signing required? (relay check)
smb-enum-shares List shares and access level
smb-enum-users Enumerate local/domain users
smb-enum-domains / smb-enum-groups Domains, policies, groups
smb-enum-sessions / smb-enum-services Active sessions / services
smb-mbenum Master-browser host enumeration
nbstat NetBIOS names + MAC
smb-vuln-ms17-010 EternalBlue (MS17-010)
smb-vuln-ms08-067 Classic SMB RCE
smb-vuln-cve-2017-7494 SambaCry

HTTP / web (#tcp/80, #tcp/443, …)

Script What it does
http-title / http-headers Page title / response headers
http-methods Allowed verbs (flags risky PUT/DELETE)
http-enum Fingerprint apps & common dirs (nikto-lite)
http-robots.txt Disallowed paths from robots.txt
http-auth / http-auth-finder Auth schemes / login pages
http-security-headers CSP/HSTS/X-Frame-Options posture
http-cookie-flags Secure / HttpOnly flags
http-webdav-scan WebDAV methods enabled
http-git Exposed .git directory
http-config-backup Backup/config files left on server
http-wordpress-enum / http-wordpress-users WP plugins/themes / usernames
http-default-accounts Default creds on known apps/devices
http-ntlm-info Host info from an NTLM endpoint
http-shellshock CVE-2014-6271 Shellshock
http-sql-injection Spider for basic SQLi
http-stored-xss / http-dombased-xss Reflected/stored/DOM XSS checks
http-vuln-cve2017-5638 Apache Struts2 RCE
http-vuln-cve2015-1635 IIS HTTP.sys (MS15-034)
http-slowloris-check Slowloris DoS susceptibility (check only)

SSL/TLS (#tcp/443 and any TLS port)

Script What it does
ssl-enum-ciphers Protocols + ciphers with letter grades
ssl-cert Certificate subject/issuer/dates/SANs
ssl-date TLS server clock (skew)
ssl-dh-params Weak DH / Logjam
ssl-heartbleed CVE-2014-0160 Heartbleed
ssl-poodle SSLv3 POODLE
ssl-ccs-injection CVE-2014-0224
sslv2-drown DROWN / SSLv2 enabled

DNS (#tcp/53, #udp/53)

Script What it does
dns-zone-transfer Attempt AXFR
dns-brute Subdomain brute-force
dns-recursion Open resolver?
dns-cache-snoop Domains cached by the resolver
dns-nsid Server id / version
dns-srv-enum Enumerate SRV service records

SNMP (#udp/161)

Script What it does
snmp-info / snmp-sysdescr System description/info
snmp-interfaces Network interfaces
snmp-netstat Active connections
snmp-processes Running processes
snmp-win32-users Windows user accounts
snmp-win32-software Installed software
snmp-brute Brute-force community strings

FTP / SSH

Script What it does
ftp-anon Anonymous login allowed?
ftp-syst SYST/STAT server details
ftp-vsftpd-backdoor vsftpd 2.3.4 backdoor
ftp-proftpd-backdoor ProFTPD 1.3.3c backdoor
ftp-bounce FTP bounce-scan capability
ssh2-enum-algos KEX/cipher/MAC algorithms offered
ssh-auth-methods Permitted auth methods
ssh-hostkey Host-key fingerprint
ssh-publickey-acceptance Test whether a public key is accepted
sshv1 Legacy SSHv1 supported?

RDP / VNC

Script What it does
rdp-enum-encryption Security layer / NLA requirement
rdp-ntlm-info Hostname/domain via RDP
rdp-vuln-ms12-020 MS12-020 DoS/RCE check
vnc-info VNC security types
realvnc-auth-bypass CVE-2006-2369 auth bypass

LDAP / Kerberos / databases

Script What it does
ldap-rootdse Naming contexts / base DN (anon)
ldap-search Query the directory (with creds)
krb5-enum-users Valid Kerberos usernames
ms-sql-info / ms-sql-ntlm-info MSSQL instance + host info
ms-sql-empty-password Blank sa password
ms-sql-xp-cmdshell Command execution (with creds)
mysql-info Handshake/version
mysql-empty-password root with no password
mysql-users / mysql-databases Enumerate (with creds)
oracle-sid-brute Discover Oracle SIDs
mongodb-info / mongodb-databases Unauthenticated MongoDB
redis-info Unauthenticated Redis
pgsql-brute PostgreSQL credential brute

Mail (SMTP/POP/IMAP)

Script What it does
smtp-commands Supported SMTP verbs
smtp-open-relay Open-relay test
smtp-enum-users VRFY/EXPN/RCPT user enumeration
smtp-ntlm-info Host info via SMTP NTLM
pop3-capabilities / imap-capabilities Capabilities/extensions

Vulnerability mapping

Script What it does
vulners Map -sV versions to known CVEs (very useful)
--script vuln Run the whole vuln category
rsync-list-modules Exposed rsync modules
rmi-vuln-classloader Java RMI registry RCE
clamav-exec CVE-2007-4560

OT / ICS / SCADA (authorised + gentle — see the OT sheets)

Script What it does
modbus-discover Modbus unit IDs / device identity (#tcp/502)
s7-info Siemens S7 module/firmware (#tcp/102)
enip-info EtherNet/IP identity (#tcp/44818)
bacnet-info BACnet device info (#udp/47808)
dnp3-info DNP3 outstation info (#tcp/20000)
omron-info Omron FINS PLC info
fox-info Niagara Fox / Tridium (#tcp/1911)
pcworx-info Phoenix Contact PLCs

*⚠️ Warning — The `-brutefamily** ssh-brute,ftp-brute,http-brute,smb-brute,rdp-brute,mysql-brute,snmp-brute,vnc-brute,telnet-brute,pop3-brute— online credential brute-forcing per service. Noisy and **will trip account lockouts**; pull the password policy first (see NetExec (CrackMapExec)--pass-pol`).

Output

nmap -oN scan.txt ...      # normal
nmap -oG scan.gnmap ...    # greppable
nmap -oX scan.xml ...      # XML (import into Metasploit, reporting tools)
nmap -oA scans/target ...  # all three at once — always do this
nmap -v / -vv              # verbosity (shows open ports as found)
nmap --reason              # why a port is in its state
nmap --open                # show only open ports

Pull open ports from greppable output:

grep -oP '\d+/open' scan.gnmap | cut -d/ -f1 | sort -un | paste -sd,

Firewall/IDS evasion (know them for exams, rarely needed)

nmap -f ...                       # fragment packets
nmap -D RND:5 ...                 # decoys
nmap -S <spoofed-ip> -e eth0 ...  # spoof source (you won't see replies)
nmap --source-port 53 ...         # use a trusted source port
nmap --data-length 25 ...         # pad packets

Go-to workflow

# 1. Find live hosts
nmap -sn 10.10.10.0/24 -oA scans/sweep

# 2. Fast full TCP port scan
sudo nmap -p- --min-rate 1000 -T4 10.10.10.5 -oA scans/allports

# 3. Deep scan only the open ports
sudo nmap -p 22,80,445 -sC -sV -O 10.10.10.5 -oA scans/detailed

# 4. Top UDP ports (don't forget UDP)
sudo nmap -sU --top-ports 50 10.10.10.5 -oA scans/udp

Port states

State Meaning
open Service accepting connections
closed Reachable, nothing listening
filtered No response / ICMP unreachable — firewall
unfiltered Reachable but can't tell (ACK scan)
open|filtered Common with UDP — no reply either way

Kill-chain usage

Nmap spans the first three stages — one example at each (full detail is in the sections above):

Recon

nmap -sn -PR 10.10.10.0/24                        # ARP ping sweep — which hosts are alive

Scanning

sudo nmap -p- --min-rate 1000 -sV -O 10.10.10.5   # all TCP ports + service & OS detection

Enumeration

nmap -p445 --script smb-enum-shares,smb-os-discovery 10.10.10.5   # NSE service enumeration

Miscellaneous & scripting flags

Flag Purpose
-6 Scan IPv6 targets (fe80::1%eth0 for link-local)
--resume scans/all.gnmap Resume an aborted scan from its output file
--append-output Add to an output file instead of overwriting
--stats-every 10s Periodic progress during long scans (or press Enter mid-scan)
--packet-trace Show every packet sent/received (great for learning / NSE debug)
--iflist List the interfaces and routes Nmap sees
-e <iface> Force a specific interface
--resolve-all Scan every IP a hostname resolves to
-d / -dd Debug output (more d's = more detail)
--version-all Max version-detection intensity (= --version-intensity 9)
nmap -A -T4 10.10.10.5                     # aggressive one-shot: -sV -O -sC --traceroute
nmap --script-help "smb-*"                 # what a script family does before you run it
nmap -sV --version-all --script-trace 10.10.10.5   # deep version probe + script tracing