Original post
Nmap Complete Guide: From Beginner to Pro
Nmap (Network Mapper) is the industry-standard open-source tool for network discovery and security auditing. Whether you are mapping your own network or testing firewall rules, this cheat sheet covers everything you need to get started.
Disclaimer: Always ensure you have explicit permission before scanning any network or target.
---
1. Basic Target Selection
Before running advanced scans, you need to tell Nmap what to scan.
---
2. Essential Scan Techniques
Different situations require different types of packets.
---
3. Port Specification
By default, Nmap scans the top 1,000 most common ports. You can customize this easily.
---
4. Service, Version & OS Detection
Finding open ports is just step one. Next, find out what is actually running on them.
---
5. Speed & Timing Templates
Control how fast or quiet your scan is using
---
6. Nmap Scripting Engine (NSE)
Automate vulnerability detection and advanced enumeration using built-in Lua scripts.
---
7. Firewall Evasion & Saving Results
---
8. The "All-in-One" Practical Command
If you want a fast, detailed scan for CTFs or authorized labs, combine the flags like this:
What this does: Scans all ports (
Nmap (Network Mapper) is the industry-standard open-source tool for network discovery and security auditing. Whether you are mapping your own network or testing firewall rules, this cheat sheet covers everything you need to get started.
Disclaimer: Always ensure you have explicit permission before scanning any network or target.
---
1. Basic Target Selection
Before running advanced scans, you need to tell Nmap what to scan.
- Scan a single IP:
nmap 192.168.1.1 - Scan a domain:
nmap example.com - Scan multiple IPs:
nmap 192.168.1.1 192.168.1.2 - Scan an entire subnet:
nmap 192.168.1.0/24 - Scan from a text file list:
nmap -iL targets.txt
---
2. Essential Scan Techniques
Different situations require different types of packets.
- Ping Scan (Host Discovery only, no port scan):
nmap -sn 192.168.1.0/24 - TCP SYN Scan (Fast, stealthy, default with root/sudo):
sudo nmap -sS 192.168.1.1 - TCP Connect Scan (Default without root privileges):
nmap -sT 192.168.1.1 - UDP Scan (Slower, checks services like DNS, SNMP, DHCP):
sudo nmap -sU 192.168.1.1
---
3. Port Specification
By default, Nmap scans the top 1,000 most common ports. You can customize this easily.
- Scan a specific port:
nmap -p 80 192.168.1.1 - Scan multiple specific ports:
nmap -p 22,80,443 192.168.1.1 - Scan a range of ports:
nmap -p 1-1000 192.168.1.1 - Scan ALL 65,535 ports:
nmap -p- 192.168.1.1 - Fast Scan (Top 100 ports only):
nmap -F 192.168.1.1
---
4. Service, Version & OS Detection
Finding open ports is just step one. Next, find out what is actually running on them.
- Detect Service Versions:
nmap -sV 192.168.1.1 - Detect Operating System:
sudo nmap -O 192.168.1.1 - Aggressive Scan (OS + Versions + Default Scripts + Traceroute):
sudo nmap -A 192.168.1.1
---
5. Speed & Timing Templates
Control how fast or quiet your scan is using
-T0 (slowest/stealthiest) to -T5 (fastest/noisiest).- Normal Speed (Default):
nmap -T3 192.168.1.1 - Aggressive/Fast Speed (Good for local networks):
nmap -T4 192.168.1.1
---
6. Nmap Scripting Engine (NSE)
Automate vulnerability detection and advanced enumeration using built-in Lua scripts.
- Run default safe scripts:
nmap -sC 192.168.1.1 - Check for known vulnerabilities:
nmap --script vuln 192.168.1.1 - Run a specific script (e.g., HTTP title):
nmap --script http-title 192.168.1.1
---
7. Firewall Evasion & Saving Results
- Skip Ping (Treat host as online even if ICMP is blocked):
nmap -Pn 192.168.1.1 - Save output to a normal text file:
nmap -oN scan.txt 192.168.1.1 - Save in all formats (Normal, XML, Grepable):
nmap -oA full_scan 192.168.1.1
---
8. The "All-in-One" Practical Command
If you want a fast, detailed scan for CTFs or authorized labs, combine the flags like this:
Code
sudo nmap -sC -sV -p- -T4 -Pn -oN results.txt 192.168.1.1What this does: Scans all ports (
-p-), skips host discovery (-Pn), runs default scripts (-sC), detects service versions (-sV), moves fast (-T4), and saves everything to results.txt.