Menu Close

Nmap Commands

SwitchExampleDescription
nmap 192.168.1.1Scan a single IP
nmap 192.168.1.1 192.168.2.1Scan specific IPs
nmap 192.168.1.1-254Scan a range
nmap scanme.nmap.orgScan a domain
nmap 192.168.1.0/24Scan using CIDR notation
-iLnmap -iL targets.txtScan targets from a file
-iRnmap -iR 100Scan 100 random hosts
–excludenmap –exclude 192.168.1.1Exclude listed hosts
SwitchExampleDescription
-sLnmap 192.168.1.1-3 -sLNo Scan. List targets only
-snnmap 192.168.1.1/24 -snDisable port scanning. Host discovery only.
-Pnnmap 192.168.1.1-5 -PnDisable host discovery. Port scan only.
-PSnmap 192.168.1.1-5 -PS22-25,80TCP SYN discovery on port x.Port 80 by default
-PAnmap 192.168.1.1-5 -PA22-25,80TCP ACK discovery on port x.Port 80 by default
-PUnmap 192.168.1.1-5 -PU53UDP discovery on port x.Port 40125 by default
-PRnmap 192.168.1.1-1/24 -PRARP discovery on local network
-nnmap 192.168.1.1 -nNever do DNS resolution
SwitchExampleDescription
-pnmap 192.168.1.1 -p 21Port scan for port x
-pnmap 192.168.1.1 -p 21-100Port range
-pnmap 192.168.1.1 -p U:53,T:21-25,80Port scan multiple TCP and UDP ports
-p-nmap 192.168.1.1 -p-Port scan all ports
-pnmap 192.168.1.1 -p http,httpsPort scan from service name
-Fnmap 192.168.1.1 -FFast port scan (100 ports)
–top-portsnmap 192.168.1.1 –top-ports 2000Port scan the top x ports
-p-65535nmap 192.168.1.1 -p-65535Leaving off initial port in range
makes the scan start at port 1
-p0-nmap 192.168.1.1 -p0-Leaving off end port in rangemakes the scan go through to port 65535
SwitchExampleDescription
-sVnmap 192.168.1.1 -sVAttempts to determine the version of the service running on port
-sV –version-intensitynmap 192.168.1.1 -sV –version-intensity 8Intensity level 0 to 9. Higher number increases possibility of correctness
-sV –version-lightnmap 192.168.1.1 -sV –version-lightEnable light mode. Lower possibility of correctness. Faster
-sV –version-allnmap 192.168.1.1 -sV –version-allEnable intensity level 9. Higher possibility of correctness. Slower
-Anmap 192.168.1.1 -AEnables OS detection, version detection, script scanning, and traceroute
SwitchExampleDescription
-Onmap 192.168.1.1 -ORemote OS detection using TCP/IP
stack fingerprinting
-O –osscan-limitnmap 192.168.1.1 -O –osscan-limitIf at least one open and one closed
TCP port are not found it will not try
OS detection against host
-O –osscan-guessnmap 192.168.1.1 -O –osscan-guessMakes Nmap guess more aggressively
-O –max-os-triesnmap 192.168.1.1 -O –max-os-tries 1Set the maximum number x of OS
detection tries against a target
-Anmap 192.168.1.1 -AEnables OS detection, version detection, script scanning, and traceroute
SwitchExampleDescription
-fnmap 192.168.1.1 -fRequested scan (including ping scans) use tiny fragmented IP packets. Harder for packet filters
–mtunmap 192.168.1.1 –mtu 32Set your own offset size
-Dnmap -D 192.168.1.101,192.168.1.102,
192.168.1.103,192.168.1.23 192.168.1.1
Send scans from spoofed IPs
-Dnmap -D decoy-ip1,decoy-ip2,your-own-ip,decoy-ip3,decoy-ip4 remote-host-ipAbove example explained
-Snmap -S www.microsoft.com www.facebook.comScan Facebook from Microsoft (-e eth0 -Pn may be required)
-gnmap -g 53 192.168.1.1Use given source port number
–proxiesnmap –proxies http://192.168.1.1:8080, http://192.168.1.2:8080 192.168.1.1Relay connections through HTTP/SOCKS4 proxies
–data-lengthnmap –data-length 200 192.168.1.1Appends random data to sent packets
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
-oG –nmap 192.168.1.1 -oG –Grepable output to screen. -oN -, -oX – also usable
–append-outputnmap 192.168.1.1 -oN file.file –append-outputAppend a scan to a previous scan file
-vnmap 192.168.1.1 -vIncrease the verbosity level (use -vv or more for greater effect)
-dnmap 192.168.1.1 -dIncrease debugging level (use -dd or more for greater effect)
–reasonnmap 192.168.1.1 –reasonDisplay the reason a port is in a particular state, same output as -vv
–opennmap 192.168.1.1 –openOnly show open (or possibly open) ports
–packet-tracenmap 192.168.1.1 -T4 –packet-traceShow all packets sent and received
–iflistnmap –iflistShows the host interfaces and routes
–resumenmap –resume results.fileResume a scan