Nmap

Nmap Cheatsheet for Reconnaissance.

Command Options

<Nmap>
-sV: Probe open ports to determine service/version info
-oA <basename>: Output in the three major formats at once
-oN/-oX/-oS/-oG <file>: Output scan in normal, XML, s|<rIpt kIddi3, and Grepable format, respectively, to the given filename 
-p <port ranges>: Set destination port(s).
-sn: Ping Scan - disable port scan
-sS: TCP SYN
-sA: ACK Scan
-sT: Connect() Scan (TCP)
-sU: UDP Scan
-sN/sF/sX: TCP Null, FIN, and Xmas scans
-O: Enable OS detection
-A: Enable OS detection, version detection, script scanning, and traceroute
-Pn: Treat all hosts as online -- skip host discovery
-n: Do not resolve hostnames via DNS
-v: Increment verbosity level by one.
-p1-65535/-p-: Scan for full ports 1-65535
--top-ports <number>: Scan <number> most common ports
--exclude <host1[,host2][,host3],...>: Exclude hosts/networks
--reason: Display the reason a port is in a particular state
--open: Only show open (or possibly open) ports
-F: Fast mode - Scan fewer ports than the default scan
-iL <inputfilename>: Input from list of hosts/networks

<NSE Script>
-sC: equivalent to --script=default
--script=<Lua scripts>: <Lua scripts> is a comma separated list of
           directories, script-files or script-categories
--script-args=<n1=v1,[n2=v2,...]>: provide arguments to scripts

<DB_nmap>
# db_nmap MSF wrapper
msf > db_nmap -sS -Pn -A 10.11.1.217

# search the Metasploit database for machines with specific open ports
msf > services -p 443

Port Status

  • Open: This indicates that an application is listening for connections on this port.

  • Closed: This indicates that the probes were received but there is no application listening on this port.

  • Filtered: This indicates that the probes were not received and the state could not be established. It also indicates that the probes are being dropped by some kind of filtering.

  • Unfiltered: This indicates that the probes were received but a state could not be established.

  • Open/Filtered: This indicates that the port was filtered or open but Nmap couldn’t establish the state.

  • Closed/Filtered: This indicates that the port was filtered or closed but Nmap couldn’t establish the state.

Timing Template

The main timing option is set through the -T parameter if you may want more control over the timing in order get the scan over and done with quicker. However, Nmap adjusts its timings automatically depending on network speed and response times of the victim. Nmap offers a simpler approach, with six timing templates. You can specify them with the -T option and their number (0–5) or their name as shown below:

  • T0: paranoid

  • T1: sneaky

  • T2: polite

  • T3: normal

  • T4: aggressive

  • T5: insane

General Scan

List NSE (Nmap Scripting Engine ) Scripts

Scan with NSE Scripts

Last updated

Was this helpful?