192.168.1.1
IPv6AABB:CCDD::FF%eth0
Hostnamewww.target.tgt
IP range192.168.0-255.0-255
CIDR block192.168.0.0/16
file-iL <filename>
Target Specification#nmap [Scan Type] [Options] {targets}
SwitchExampleDescription
nmap 192.168.1.1Scan a single IP
nmap 192.168.1.1 192.168.2.1Scan specific IP's
nmap 192.168.1-254Scan a range of IP's
nmap scanme.nmap.orgScan a domain
nmap 192.168.1.0/24Scan using CIDR notation
-iLnmap -iL targets.txtScan target from a file
-iRnmap -iR 100Scan 100 random host
--excludenmap --exclude 192.168.1.1Exclude listed host
Scan Techniques#nmap [Scan Type] [Options] {targets}
SwitchExampleDescription
-sSnmap -sS 192.168.1.1TCP SYN port scan (Default)
-sTnmap -sT 192.168.1.1TCP connect port scan (Default without root privilege)(use sudo)
-sUnmap -sU 192.168.1.1UDP port scan
-sAnmap -sA 192.168.1.1TCP ACK port scan
-sWnamp -sW 192.168.1.1TCP Window port scan
-sMnmap -sM 192.168.1.1TCP Maimon port scan
Host Discovery#nmap [Scan Type] [Options] {targets}
SwitchExampleDescription
-sLnmap -sL 192.168.1-3No Scan. List targets only (only reverse-DNS lookup on the hosts)
-snnmap -sn 192.168.1.1/24No Scan. Host discovery only.
-Pnnmap -Pn 192.168.1.1-30No host discovery. Only scan
-PSnmap -PS22-25,443 192.168.0.0/16TCP SYN discovery on port x (default port 80)
-PAnmap -PA21-30 192.168.1.0/24TCP ACK discovery on port x (default port 80)
-PUnmap -PU5-80 192.168.2.4-20TCP UDP discovery on port x (default port 80)
-PRnmap -PR1-443 192.168.1.0/22ARP discovery on local network only
-nnmap -n 192.168.1.1no DNS resolution
Port Specification#nmap [Scan Type] [Options] {targets}
SwitchExampleDescription
-pnmap -p 21 192.168.1.1Port scan for port x
-pnmap -p 21-100 192.168.1.1Port range
-pnmap -p U:53,T:21-25,443 192.168.1.1Port scan multiple TCP and UDP ports
-p-nmap -p- 192.168.1.0/24Port scan all ports
-pnmap -p http,https 192.1.1.45Port scan from service name
-Fnmap -F 192.168.1.1Fast scan (100 ports)
--top-portsnmap --top-ports 2000 192.168.1.1Port scan the top 2000 ports
-p-65535nmap -p-65535 192.168.1.1Leaving off initial port in range makes the scan start at port 1
-p0-nmap -p0- 192.168.1.1Leaving off end port in range makes the scan go through to port 65535
Service & Version Detection#nmap [Scan Type] [Options] {targets}
SwitchExampleDescription
-sVnmap -sV -p 43 192.168.7.6Attemps to determine the version of the service running on port
-sV --version-intensitynmap -sV --version-intensity 7 192.168.2.3Intensity level 0-9. Higher number increases possibility of correctness
-sV --version-lightnmap -sV --version-light 10.2.3.5Enable light mode. Lower possibility of correctness. (Faster)
-sV --version-allnmap -sV --version-all 10.10.10.3Enable intensity level 9. Higher possibility of correctness. (Slower)
-Anmap -A 4.5.34.67
Eables OS detection, version detection, script scanning and traceroute (NSE script)
OS Detection#nmap [Scan Type] [Options] {targets}
SwitchExampleDescription
-Onmap -O 192.168.4.23Remote OS detection using tcp/ip stack fingerprinting
-O --osscan-limitnmap -O --osscan-limit 10.10.9.8
If atleast one open and one closed TCP port are not found it will not try OS detection against host
-O --osscan-guessnmap -O --osscan-guess 10.10.9.8Makes Nmap guess more agressivlely
-O --max-os-triesnmap -O --max-os-tries 2 10.10.9.8Set the maximum number of OS detection tries against a target
-Anmap -A 4.5.34.67
Eables OS detection, version detection, script scanning and traceroute (NSE script)
FW/IDS evasion & Spoofing#nmap [Scan Type] [Options] {targets}
SwitchExampleDescription
-fnmap -f 10.10.10.9send packets fragmented
--mtunmap -mtu 24 10.10.7.8set your own offset size
-Dnmap -D 192.168.1.12,192.168.4.5,10.0.0.1Sends scan from spoofed IP's
-Dnmap -D decoy1,decoy2 remote host
-Snmap -S www.microsoft.com www.facebook.comScan Facebook from Microsoft (-e eth0 -Pn may be required)
-gnmap -g 53 192.168.5.8Use given source port number
--proxiesnmap --proxies http://10.10.10.8:8080Relay connections through http/socket4 proxies\
--data-lengthnmap --data-length 200 192.168.4.6appends random data to sent packets
IDS evasion example
nmap -f -t 0 -n -Pn --data-length 200 -D 192.168.2.3,192.168.1.3 10.10.10.1
NSE Scripts#nmap [Scan Type] [Options] {targets}
SwitchExampleDescription
-sCnmap -sC 192.168.1.1Scan with default NSE scripts. Considered useful for discovery and safe
--script defaultnmap --script default 192.168.1.1Scan with default NSE scripts
--scriptnmap --script=banner 192.168.1.1Scan with single script (ex. banner)
--scriptnmap --script=http* 192.168.1.1Scan with a wildcard (*)
--scriptnmap --script=http,banner 192.168.1.1Scan with two scripts
--scriptnmap --script"not intrusive" 192.168.1.2Scan default, but remove intrusive scripts
--script-args
nmap --script snmp-sysdescr --script-args snmpcommunity=admin 192.168.1.1
Output#nmap [Scan Type] [Options] {targets}
SwitchExampleDescription
-oNnmap 192.168.1.1 -oN normal.fileNormal output to the file normal.file
-oXnmap 192.168.1.1 -oX xml.fileXML output to the file xml.file
-oGnmap 192.168.1.1 -oG grep.filegrepable output to the file grep.file
-oAnmap 192.168.1.1 -oA resultsoutput in the three major formats at once
-0G -nmap 192.168.1.1 -oG -grepable output to screen -oN-,-oX -also usable

Comments