Nmap Cheat Sheet: Randomized & Stealth Scanning

Nmap Cheat Sheet: Randomized & Stealth Scanning

 

TechniqueCommandPurpose
Random Port Scannmap -p- --randomize-hosts scanme.nmap.orgScans all ports in random order to avoid detection.
Random Host Scannmap -iL targets.txt --randomize-hostsScans multiple hosts from a file in random order.
Decoy Scannmap -D 192.168.1.100,10.0.0.5,ME scanme.nmap.orgMasks your IP using spoofed decoys.
Fragmented Packetsnmap -f scanme.nmap.orgBreaks packets into fragments to evade deep packet inspection.
Slow Timing Scannmap -T2 scanme.nmap.orgSlows scan to reduce detection risk.
Spoof MAC Addressnmap --spoof-mac 00:11:22:33:44:55 scanme.nmap.orgBypasses MAC-based filters.
ACK Scannmap -sA scanme.nmap.orgMaps firewall rules without full connection.
Idle Zombie Scannmap -sI zombie_host scanme.nmap.orgUses a third-party host to mask your identity.
IP Protocol Scannmap -sO scanme.nmap.orgScans using different IP protocols.
Random Source Portnmap --source-port 53 scanme.nmap.orgUses port 53 (DNS) to bypass firewalls.
Random port using shellnmap -p $(shuf -i 1-65535 -n 5 | paste -sd, -) scanme.nmap.org
 
See notes
Service Version Detection
nmap -sV scanme.nmap.org
This command probes open ports to determine what service is running. It's incredibly useful for vulnerability assessments, patch management, and understanding the software stack of a target.

Random port using shell

  • shuf -i 1-65535 -n 5 randomly selects 5 ports between 1 and 65535.
  • paste -sd, - formats them as a comma-separated list.
  • Nmap scans those random ports on scanme.nmap.org.

Combined Nmap Command: Stealth + Service Detection

nmap -sS -sV -T2 -f --spoof-mac 00:11:22:33:44:55 scanme.nmap.org

 

What Each Flag Does:

  • -sS: SYN scan (stealthy, doesn’t complete TCP handshake)
  • -sV: Enables service version detection
  • -T2: Slows down the scan to reduce detection risk
  • -f: Fragments packets to evade deep packet inspection
  • --spoof-mac: Masks your MAC address to bypass MAC-based filters

Why This Combo Works:

This command allows you to:

  • Identify open ports and the services running on them
  • Detect service versions (e.g., Apache 2.4.41, SSH 8.2)
  • Avoid triggering basic IDS/IPS systems
  • Mask your identity and scan more discreetly