Nmap cheat sheet for vulnerability assessment and penetration testing
This cheat sheet covers the essential Nmap commands for comprehensive penetration testing and vulnerability assessment workflows.
Nmap Installation & Setup
Installing the Nmap tool on various operating systems and performing initial configuration, including updating the script database.
bash
# Install on Kali Linux (pre-installed) or update
sudo apt update && sudo apt install nmap
# Install on Ubuntu/Debian
sudo apt install nmap
# Install on CentOS/RHEL
sudo yum install nmap
# or for newer versions:
sudo dnf install nmap
# Install on macOS
brew install nmap
# Install on Windows
# Download from: https://nmap.org/download.html
# Check installation and version
nmap --version
# Update Nmap (on Kali/Ubuntu/Debian)
sudo apt update && sudo apt upgrade nmap
# Update NSE scripts
nmap --script-updatedbHost Discovery
Finding live hosts and active devices on a network.
bash
Port Scanning Techniques
Identifying open ports and the associated protocols (TCP/UDP) on a target.
bash
Service & Version Detection
Determining the specific application name and version number running on an open port.
bash
Vulnerability Scanning with NSE
Using the Nmap Scripting Engine to probe for known vulnerabilities and misconfigurations.
bash
Authentication & Credential Testing
Attempting to brute-force or test login credentials for various services.
bash
Firewall Evasion & Stealth
Using techniques to avoid detection by firewalls and Intrusion Detection Systems (IDS).
bash
Timing & Performance
Controlling the speed and aggressiveness of the scan to balance speed and stealth.
bash
Output Formats
Saving scan results in different file formats for reporting and integration with other tools.
bash
Common PT Workflow Commands
Pre-built command sequences for typical penetration testing stages.
bash
Integration with Other Tools
Using Nmap's output to feed into other security tools like Metasploit.
bash
Useful Script Arguments
Advanced options for controlling and debugging NSE scripts.
bash
Quick Reference
-sS: TCP SYN Stealth Scan
-sT: TCP Connect Scan
-sU: UDP Scan
-sV: Service Version Detection
-O: OS Fingerprinting
-A: Aggressive Scan (OS, version, script, traceroute)
-T[0-5]: Timing Template (0=slowest, 5=fastest)
-p: Port specification
-oA: Output all formats
--script: NSE script execution
Last updated