Basic Scans
# Basic TCP connect scan (no root required)
nmap -sT <target>
nmap -sT <target>
# Quick scan (top 100 ports)
nmap -F <target>
nmap -F <target>
# Standard scan (top 1000 ports)
nmap <target>
nmap <target>
# Ping scan (host discovery only)
nmap -sn <target>
nmap -sn <target>
Advanced Scans (Root Required)
# SYN scan (stealth scan, default for root)
nmap -sS <target>
nmap -sS <target>
# UDP scan (often missed in assessments)
nmap -sU <target>
nmap -sU <target>
# Comprehensive scan (all ports, OS/service detection)
nmap -p- -A <target>
nmap -p- -A <target>
# Aggressive scan (OS/service detection, scripts, traceroute)
nmap -A <target>
nmap -A <target>
Port Specification
# Scan specific ports
nmap -p 22,80,443 <target>
nmap -p 22,80,443 <target>
# Scan port range
nmap -p 1-1024 <target>
nmap -p 1-1024 <target>
# Scan top ports
nmap --top-ports 50 <target>
nmap --top-ports 50 <target>
# Scan all ports (slow)
nmap -p- <target>
nmap -p- <target>
Output Options
# Save to normal format
nmap -oN output.txt <target>
nmap -oN output.txt <target>
# Save to XML format
nmap -oX output.xml <target>
nmap -oX output.xml <target>
# Save to all formats
nmap -oA output <target>
nmap -oA output <target>
# Verbose output
nmap -v <target>
nmap -v <target>
NSE Scripting Engine
# Run default scripts
nmap -sC <target>
nmap -sC <target>
# Run specific script
nmap --script=http-vuln-cve2017-5638 <target>
nmap --script=http-vuln-cve2017-5638 <target>
# Run script category
nmap --script=vuln <target>
nmap --script=vuln <target>
# Run multiple scripts
nmap --script=smb-enum*,http-title <target>
nmap --script=smb-enum*,http-title <target>
Common Script Categories:
auth - Authentication related
default - Default scripts
discovery - Service discovery
dos - Denial of service checks
default - Default scripts
discovery - Service discovery
dos - Denial of service checks
exploit - Exploit checks
intrusive - Potentially intrusive
safe - Safe scripts
vuln - Vulnerability checks
intrusive - Potentially intrusive
safe - Safe scripts
vuln - Vulnerability checks