Introduction to Nmap
Nmap (Network Mapper) is a free and open-source network discovery and security auditing tool. It is widely used by network administrators, security professionals, and penetration testers for network inventory, managing service upgrade schedules, and monitoring host or service uptime.
Basic Nmap Commands
Here are some essential Nmap commands to get you started:
1. Basic Scan
nmap [target]
This performs a basic scan on the target, checking the most common 1,000 TCP ports.
2. Scan Specific Ports
nmap -p 80,443,22 [target]
This scans only the specified ports (80, 443, and 22 in this example).
3. Scan All Ports
nmap -p- [target]
This scans all 65,535 ports on the target.
4. Service Version Detection
nmap -sV [target]
This detects the version of services running on open ports.
5. OS Detection
nmap -O [target]
This attempts to detect the operating system of the target.
Advanced Scanning Techniques
For more comprehensive scanning, you can combine options:
Aggressive Scan
nmap -A [target]
This enables OS detection, version detection, script scanning, and traceroute.
Stealth Scan
nmap -sS [target]
This performs a SYN scan, which is less likely to be logged.
Output Formats
Nmap can output results in various formats:
- Normal output (-oN): Standard Nmap output
- XML output (-oX): XML format for easy parsing
- Grepable output (-oG): Easy to search with grep
- All formats (-oA): Outputs in all three formats
Conclusion
Nmap is an incredibly powerful tool for network discovery and security auditing. Mastering these basic commands is the first step toward becoming proficient in network security. Always ensure you have proper authorization before scanning any networks that you do not own.
← Back to Blog