Skip to content
Pwnversity
TOOL-NMAPbasic · 4 min · upd. 2026-10

nmap

nmap (Network Mapper) is the standard network and port scanner. It discovers hosts, open ports, services, versions and, with its scripts (NSE), detects vulnerabilities and enumerates services. It’s almost always the first step of any pentest or CTF (see Active recon, CTF methodology).

nmap is an open-source network discovery tool. It sends specially crafted packets and analyzes the responses to work out which hosts are alive, which ports are listening, which services and versions run and, through the NSE scripting engine, many specific vulnerabilities and configurations.

  • Discover live hosts on a network (host discovery).
  • Enumerate open TCP/UDP ports and the services listening on them.
  • Detect service versions and operating system.
  • Run NSE scripts for deep enumeration and vulnerability detection.
Ventana de terminal
sudo apt install nmap # Debian/Kali/Parrot
# macOS
brew install nmap
nmap --version
Ventana de terminal
nmap -sS -p- 10.10.10.10 # SYN scan of ALL ports (requires root)
nmap -sV -sC -p 22,80,443 host # service versions + default scripts
nmap -sn 10.10.10.0/24 # host discovery (ping sweep), no port scan
nmap -Pn host # skip ping (host not answering ICMP)
nmap -sU --top-ports 100 host # UDP scan of the 100 most common ports

Key scan types: -sS (SYN, stealthy, root), -sT (TCP connect, no root), -sU (UDP), -sn (discovery only), -sV (versions), -O (OS).

Typical two-phase flow: first all ports fast, then targeted enumeration.

Ventana de terminal
# 1. discover ALL open ports, fast
nmap -sS -p- --min-rate 5000 -T4 -Pn 10.10.10.10 -oG ports.txt
# 2. deep-enumerate only the open ports
nmap -sV -sC -p22,80,443 -Pn 10.10.10.10 -oN enum.txt

NSE (Nmap Scripting Engine) — scripts in /usr/share/nmap/scripts/:

Ventana de terminal
nmap --script vuln host # vuln category (known-flaw detection)
nmap --script "http-*" -p80,443 host # all http scripts
nmap --script smb-enum-shares,smb-os-discovery -p445 host
nmap --script-help ftp-anon # see what a script does

Output formats (-oA base writes all three at once):

Ventana de terminal
nmap -sV -oA scan host # scan.nmap (normal), scan.xml, scan.gnmap
nmap -iL hosts.txt -oN multi.txt # read targets from a file
flowchart TD
  A[Target in scope] --> B["Phase 1: -p- --min-rate -Pn"]
  B --> C{Open ports}
  C --> D["Phase 2: -sV -sC on specific ports"]
  D --> E{Interesting services}
  E -->|HTTP| F[web fuzzing / ffuf]
  E -->|SMB/445| G[SMB enum / netexec]
  E -->|vuln NSE| H[--script vuln]
  • --min-rate speeds things up, but raises noise and the risk of false negatives; tune it to the environment.
  • -T4 is a good balance; -T5 may miss ports on lossy networks.
  • Always save with -oA: you can reprocess the output (e.g. grep over .gnmap).
  • A SYN scan leaves many half-open connections (SYN with no final ACK): visible to IDS (Snort/Suricata) and to firewalls with logging.
  • Full-port and UDP scans are especially noisy: traffic spikes toward many ports in a short time.
  • -sV sends probes to each service that show up in the applications’ logs (anomalous connect/disconnect lines).
  • Target within authorized scope.
  • Phase 1 full-port scan completed and saved.
  • -sV -sC enumeration over the open ports.
  • Relevant NSE run (http, smb, vuln depending on services).
  • Output saved with -oA for later analysis.