NMAP

NMAP Cheatsheet #

Nmap, short for Network Mapper, is a versatile and widely used open-source tool for network exploration and security auditing. Developed by Gordon Lyon, also known as Fyodor, Nmap is designed to scan large networks efficiently while providing detailed information about network topology, host discovery, service detection, operating system identification, and vulnerability analysis. It supports a wide range of scanning techniques and is extensible through the Nmap Scripting Engine (NSE). Nmap is a critical tool for network administrators, security professionals, and penetration testers, aiding in identifying and mitigating security risks.

Scan Targets #

SWITCHEXAMPLEDESCRIPTION
nmap 10.0.1.1Scan a single IP
nmap 10.0.1.1 10.0.2.1Scan specific IPs
nmap 10.0.1.1-254Scan a range
nmap scanme.nmap.orgScan a domain
nmap 10.0.1.0/24Scan using CIDR notation
-iL nmap -iL targets.txtScan targets from a file
-iR nmap -iR 100Scan 100 random hosts
-exclude nmap -exclude 10.0.1.1Exclude listed hosts

Scan Techniques #

SWITCHEXAMPLEDESCRIPTION
-sS nmap 10.0.1.1 -sSTCP SYN port scan (Default)
-sT nmap 10.0.1.1 -sTTCP connect port scan (Default without root privilege)
-sU nmap 10.0.1.1 -sUUDP port scan
-sA nmap 10.0.1.1 -sATCP ACK port scan
-sW nmap 10.0.1.1 -sWTCP Window port scan
-sM nmap 10.0.1.1 -sMTCP Maimon port scan

Discovery Options #

SWITCHEXAMPLEDESCRIPTION
-sL nmap 10.0.1.1-3 -sLNo Scan. List targets only
-sn nmap 10.0.1.1/24 -snDisable port scanning. Host discovery only.
-Pn nmap 10.0.1.1-5 -PnDisable host discovery. Port scan only.
-PS nmap 10.0.1.1-5 -PS22-25,80TCP SYN discovery on port x. Port 80 by default
-PA nmap 10.0.1.1-5 -PA22-25,80TCP ACK discovery on port x. Port 80 by default
-PU nmap 10.0.1.1-5 -PU53UDP discovery on port x. Port 40125 by default
-PR nmap 10.0.1.1-1/24 -PRARP discovery on local network
-n nmap 10.0.1.1 -nNever do DNS resolution

Port Scan Options #

SWITCHEXAMPLEDESCRIPTION
-p nmap 10.0.1.1 -p 21Port scan for port x
-p nmap 10.0.1.1 -p 21-100Port range
-p nmap 10.0.1.1 -p U:53,T:21-25,80Port scan multiple TCP and UDP ports
-p nmap 10.0.1.1 -p-Port scan all ports
-p nmap 10.0.1.1 -p http,httpsPort scan from service name
-F nmap 10.0.1.1 -FFast port scan (100 ports)
-top-ports nmap 10.0.1.1 -top-ports 2000Port scan the top x ports
-p-65535 nmap 10.0.1.1 -p-65535Leaving off initial port in range makes the scan start at port 1
-p0- nmap 10.0.1.1 -p0-Leaving off end port in range makes the scan go through to port 65535

Service Version Detection #

SWITCHEXAMPLEDESCRIPTION
-sV nmap 10.0.1.1 -sVAttempts to determine the version of the service running on port
-sV -version-intensity nmap 10.0.1.1 -sV -version-intensity 8Intensity level 0 to 9. Higher number increases possibility of correctness
-sV -version-light nmap 10.0.1.1 -sV -version-lightEnable light mode. Lower possibility of correctness. Faster
-sV -version-all nmap 10.0.1.1 -sV -version-allEnable intensity level 9. Higher possibility of correctness. Slower
-A nmap 10.0.1.1 -AEnables OS detection, version detection, script scanning, and traceroute

OS Detection #

SWITCHEXAMPLEDESCRIPTION
-O nmap 10.0.1.1 -ORemote OS detection using TCP/IP stack fingerprinting
-O -osscan-limit nmap 10.0.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-guess nmap 10.0.1.1 -O -osscan-guessMakes Nmap guess more aggressively
-O -max-os-tries nmap 10.0.1.1 -O -max-os-tries 1Set the maximum number x of OS detection tries against a target
-A nmap 10.0.1.1 -AEnables OS detection, version detection, script scanning, and traceroute

Timing Options #

SWITCHEXAMPLEDESCRIPTION
-T0 nmap 10.0.1.1 -T0Paranoid (0) Intrusion Detection System evasion
-T1 nmap 10.0.1.1 -T1Sneaky (1) Intrusion Detection System evasion
-T2 nmap 10.0.1.1 -T2Polite (2) slows down the scan to use less bandwidth and use less target machine resources
-T3 nmap 10.0.1.1 -T3Normal (3) which is default speed
-T4 nmap 10.0.1.1 -T4Aggressive (4) speeds scans; assumes you are on a reasonably fast and reliable network
-T5 nmap 10.0.1.1 -T5Insane (5) speeds scan; assumes you are on an extraordinarily fast network

Performance Options #

SWITCHEXAMPLEDESCRIPTION
-host-timeout 1s; 4m; 2hGive up on target after this long
-min-rtt-timeout/max-rtt-timeout/initial-rtt-timeout 1s; 4m; 2hSpecifies probe round trip time
-min-hostgroup/max-hostgroup 50; 1024Parallel host scan group sizes
-min-parallelism/max-parallelism 10; 1Probe parallelization
-max-retries 3Specify the maximum number of port scan probe retransmissions
-min-rate 100Send packets no slower than per second
-max-rate 100Send packets no faster than per second

Script Scan Options #

SWITCHEXAMPLEDESCRIPTION
-sC nmap 10.0.1.1 -sCScan with default NSE scripts. Considered useful for discovery and safe
-script default nmap 10.0.1.1 -script defaultScan with default NSE scripts. Considered useful for discovery and safe
-script nmap 10.0.1.1 -script=bannerScan with a single script. Example banner
-script nmap 10.0.1.1 -script=http*Scan with a wildcard. Example http
-script nmap 10.0.1.1 -script=http,bannerScan with two scripts. Example http and banner
-script nmap 10.0.1.1 -script “not intrusive”Scan default, but remove intrusive scripts
-script-args nmap -script snmp-sysdescr -script-args snmpcommunity=admin 10.0.1.1NSE script with arguments

Firewall and IDS Evasion #

SWITCHEXAMPLEDESCRIPTION
-f nmap 10.0.1.1 -fRequested scan (including ping scans) use tiny fragmented IP packets. Harder for packet filters
-mtu nmap 10.0.1.1 -mtu 32Scan using specified MTU
-D nmap -D RND:10 10.0.1.1Cloak a scan with decoys
-S nmap 10.0.1.1 -S www.example.comCloak a scan with a spoofed source address
-e nmap 10.0.1.1 -e eth0Use specified interface
-g nmap 10.0.1.1 -g 53Use specified source port number
–source-port nmap 10.0.1.1 –source-port 53Use specified source port number
-sI nmap 10.0.1.1 -sI zombieZombie scan
-sY nmap 10.0.1.1 -sYSCTP INIT scan
-sZ nmap 10.0.1.1 -sZSCTP COOKIE-ECHO scan
-b nmap 10.0.1.1 -bFTP bounce scan
-Tn nmap 10.0.1.1 -TnTiming template (where n=0-5)

Output Options #

SWITCHEXAMPLEDESCRIPTION
-oN nmap 10.0.1.1 -oN output.txtNormal output to file
-oX nmap 10.0.1.1 -oX output.xmlXML output to file
-oS nmap 10.0.1.1 -oS output.scrScript kiddie output to file
-oG nmap 10.0.1.1 -oG output.gnmapGrepable output to file
-v nmap 10.0.1.1 -vIncrease verbosity level
-v -v nmap 10.0.1.1 -v -vIncrease verbosity level further
-d nmap 10.0.1.1 -dIncrease debugging level
-d -d nmap 10.0.1.1 -d -dIncrease debugging level further
–packet-trace nmap 10.0.1.1 –packet-traceShow all packets sent and received
–open nmap 10.0.1.1 –openShow only open (or possibly open) ports
–reason nmap 10.0.1.1 –reasonShow host, port, and state, as well as the reason
–stats-every nmap 10.0.1.1 –stats-every 10sPeriodically display statistics
–log-errors nmap 10.0.1.1 –log-errorsLog errors/warnings to nmap. err

Miscellaneous #

SWITCHEXAMPLEDESCRIPTION
–append-output nmap 10.0.1.1 –append-outputAppend to rather than clobber specified output files
–resume nmap –resume interrupted.scanResume an aborted scan
–stylesheet nmap –stylesheet nmap.xslXSL stylesheet to transform XML output
–webxml nmap –webxmlReference stylesheet from Nmap.Org for more attractive XML
–no-stylesheet nmap –no-stylesheetPrevent associating of XSL stylesheet w/XML output
–data-length nmap –data-length 10.0.1.1 –data-length 25Append random data to sent packets
–ip-options nmap 10.0.1.1 –ip-optionsSend packets with specified ip options
–ttl nmap 10.0.1.1 –ttl 1Set IP time-to-live field
–spoof-mac nmap 10.0.1.1 –spoof-mac 00:11:22:33:44:55Spoof your MAC address
–badsum nmap 10.0.1.1 –badsumSend packets with a bogus TCP/UDP/SCTP checksum

Miscellaneous Options #

SWITCHEXAMPLEDESCRIPTION
-6 nmap -6 scanme.nmap.orgEnable IPv6 scanning
-A nmap 10.0.1.1 -AEnable OS detection, version detection, script scanning, and traceroute
-V nmap -VPrint Nmap version and exit
-h nmap -hPrint Nmap help screen and exit

NMAP

Explore our comprehensive cheatsheets to enhance your knowledge and efficiency. Each cheatsheet provides detailed command options, examples, and descriptions to help you master various tools and technologies.