Nmap (Network Mapper) is the industry-standard tool for network discovery and security auditing. This room covers everything from basic scans to advanced NSE scripting. Master Nmap and you'll have X-ray vision into any network!
Nmap was created by Gordon Lyon (Fyodor) in 1997 and has been featured in countless movies, from The Matrix Reloaded to Mr. Robot. It's so iconic that learning it is a rite of passage for every security professional.
Basic Scanning
Port Specification
-p- scans all ports but takes time. For CTFs, start with default scan, then run -p- in background if you're missing something.
Scan Types
TCP SYN scan (-sS) is the default when running as root. It sends SYN, receives SYN/ACK (port open) or RST (closed), then sends RST instead of completing the connection. Stealthier and faster!
Less Common Scan Types
Service & OS Detection
OS detection (-O) requires at least one open and one closed port to work accurately. Results are probabilistic - Nmap shows confidence percentages.
Nmap Scripting Engine (NSE)
NSE transforms Nmap from a scanner into a full vulnerability assessment tool. Scripts are organized into categories:
Essential Scripts
- vuln - Runs all vulnerability checks
- http-enum - Web directory/file enumeration
- smb-enum-shares - List SMB shares
- ftp-anon - Check anonymous FTP
- ssh-brute - SSH brute forcing
Firewall Evasion
Output Formats
Practical Examples
Knowledge Check
Key Takeaways
- SYN scan (-sS) is faster and stealthier than connect scan
- -sC -sV is your go-to combination for service enumeration
- NSE scripts extend Nmap's capabilities significantly
- Always save output with -oA for later reference
- Timing templates balance speed vs. stealth vs. accuracy
- Firewall evasion techniques help in hardened environments