Nmap

Network Mapper

Performance Tuning
  • Timing tables go from 0 to 5, being 3 the default.

nmap -T4 192.168.1.1
  • --min-parallelism allows to manually control the concurrency of the scan:

nmap -sS -T4 --min-parallelism 20 --max-retries 1 -p 80,443,22,3389 192.168.1.1
  • Rate Limiting (--min-rate/--max-rate) gives you a better control over packets/second:

nmap -sS --min-rate 500 192.168.1.1
  • --max-rtt-timeout adjusts how long Nmap waits for responses before retrying:

Optimized for LANs
nmap -sS --max-rtt-timeout 200ms 192.168.1.1
TCP Scans
Connect Scan
nmap -sT -sV -p- 192.168.1.1
ACK Scan
nmap -sA 192.168.1.1
Window Scan
nmap -sW 192.168.1.1
Maimon Scan
nmap -sM 192.168.1.1
Host Discovery
Ping Sweep
nmap -sn 192.168.1.0/24
Disable Host Discovery
nmap -Pn 192.168.1.0/24
List targets Only
nmap 192.168.1.1-3 -sL
From Target File
nmap -iL targets.txt
Range Scan
nmap 192.168.1.1-254
TCP SYN Ping
nmap 192.168.1.1-5 -PS22-25,80
TCP ACK Ping
nmap 192.168.1.1-5 -PA22-25,80
ARP Ping
nmap 192.168.1.1-1/24 -PR
Ping Host (ICMP, ACK, ARP)
nmap -PE -PA80 -PR 192.168.1.0/24
Host Scan with traceroute
nmap -iR 10 -sn -traceroute
Script for Discovery
nmap --script discovery 192.168.1.1
DNS Scans
Standard Scan
nmap --dns-servers 8.8.8.8 192.168.1.1
Disable DNS Resolution
nmap 192.168.1.1 -n
Resolve Hostnames in a Range
nmap 192.168.1.1-50 -sL -dns-server 192.168.1.1
Service and OS Detection
Service Version Detection
nmap -sV 192.168.1.1
OS Detection
nmap -O 192.168.1.1
Limits OS Detection
nmap 192.168.1.1 -O -osscan-limit
Aggressive Scan
nmap -A 192.168.1.1
Target Specific Ports
sudo nmap -sCV -oA nmap -p 'PORTS' [IP]
UDP Scans
Basic Scan
nmap -sU 192.168.1.1
Specific Ports
nmap -p 53,123,161 -sU -sC 192.168.1.1
All Ports
nmap -p- -sU 192.168.1.1
Service Detection
nmap -sU -sV 192.168.1.1
Script Scanning
nmap -sU --script=udp* 192.168.1.1

Host discovery for UDP

UDP Ping first
nmap -PU53,161,123 192.168.1.1-254 -oN udp_live_hosts.txt  
Then scan live hosts
nmap -sS -sV -p- -iL udp_live_hosts.txt -oA full_scan --max-retries 1  
Stealthy Scans
Scripting Engine - NSE
Outputs

Filtering

Generate a IPs live hosts list

Other Techniques

Last updated