Nmap

Common Nmap Commands & Examples

Nmap (Network Mapper) is a powerful tool used for network discovery and security auditing. Below are the most common Nmap commands, along with practical examples.


Basic Host Discovery

Scan that I start with

nmap 10.10.10.10 -sC -sV -p- -T 3

Scan a Range of IPs

nmap 10.10.102.1-50

Scan an Entire Subnet

nmap 10.10.102.0/24

Port Scanning

Scan Specific Ports

nmap -p 22,80,443 10.10.102.93

Scans only ports 22 (SSH), 80 (HTTP), and 443 (HTTPS).

Scan All 65,535 Ports

nmap -p- 10.10.102.93

Detect Open, Closed, and Filtered Ports

nmap --reason 10.10.102.93

Service & Version Detection

Detect Running Services & Versions

nmap -sV 10.10.102.93

Aggressive Scan (OS Detection, Services, and More)

nmap -A 10.10.102.93

Detect the Target OS

nmap -O 10.10.102.93

Stealth & Evasion Scans

SYN Scan (Stealthy Scan)

nmap -sS 10.10.102.93

Scan Without DNS Resolution

nmap -n 10.10.102.93

Evade Firewalls Using Fragmentation

nmap -f 10.10.102.93

Use a Decoy to Mask Your Scan

nmap -D RND:10 10.10.102.93

Script-Based Scanning (NSE)

Scan for Vulnerabilities

nmap --script=vuln 10.10.102.93

Scan for SMB Shares

nmap --script=smb-enum-shares -p 445 10.10.102.93

Brute-Force FTP Login

nmap --script=ftp-brute -p 21 10.10.102.93

Saving Scan Results

Save Output in Normal Format

nmap -oN scan_results.txt 10.10.102.93

Save Output in Grepable Format

nmap -oG scan_results.txt 10.10.102.93

Save Output in XML Format

nmap -oX scan_results.xml 10.10.102.93

Comprehensive Scan Example

nmap -A -p- --script=vuln -oN full_scan.txt 10.10.102.93