1NMAP(1) Nmap Reference Guide NMAP(1)
2
3
4
6 nmap - Network exploration tool and security / port scanner
7
9 nmap [Scan Type...] [Options] {target specification}
10
12 Nmap (“Network Mapper”) is an open source tool for network exploration
13 and security auditing. It was designed to rapidly scan large networks,
14 although it works fine against single hosts. Nmap uses raw IP packets
15 in novel ways to determine what hosts are available on the network,
16 what services (application name and version) those hosts are offering,
17 what operating systems (and OS versions) they are running, what type of
18 packet filters/firewalls are in use, and dozens of other
19 characteristics. While Nmap is commonly used for security audits, many
20 systems and network administrators find it useful for routine tasks
21 such as network inventory, managing service upgrade schedules, and
22 monitoring host or service uptime.
23
24 The output from Nmap is a list of scanned targets, with supplemental
25 information on each depending on the options used. Key among that
26 information is the “interesting ports table”. That table lists the
27 port number and protocol, service name, and state. The state is either
28 open, filtered, closed, or unfiltered. Open means that an application
29 on the target machine is listening for connections/packets on that
30 port. Filtered means that a firewall, filter, or other network
31 obstacle is blocking the port so that Nmap cannot tell whether it is
32 open or closed. Closed ports have no application listening on them,
33 though they could open up at any time. Ports are classified as
34 unfiltered when they are responsive to Nmap's probes, but Nmap cannot
35 determine whether they are open or closed. Nmap reports the state
36 combinations open|filtered and closed|filtered when it cannot determine
37 which of the two states describe a port. The port table may also
38 include software version details when version detection has been
39 requested. When an IP protocol scan is requested (-sO), Nmap provides
40 information on supported IP protocols rather than listening ports.
41
42 In addition to the interesting ports table, Nmap can provide further
43 information on targets, including reverse DNS names, operating system
44 guesses, device types, and MAC addresses.
45
46 A typical Nmap scan is shown in Example 1. The only Nmap arguments used
47 in this example are -A, to enable OS and version detection, script
48 scanning, and traceroute; -T4 for faster execution; and then the
49 hostname.
50
51 Example 1. A representative Nmap scan
52
53 # nmap -A -T4 scanme.nmap.org
54
55 Nmap scan report for scanme.nmap.org (74.207.244.221)
56 Host is up (0.029s latency).
57 rDNS record for 74.207.244.221: li86-221.members.linode.com
58 Not shown: 995 closed ports
59 PORT STATE SERVICE VERSION
60 22/tcp open ssh OpenSSH 5.3p1 Debian 3ubuntu7 (protocol 2.0)
61 | ssh-hostkey: 1024 8d:60:f1:7c:ca:b7:3d:0a:d6:67:54:9d:69:d9:b9:dd (DSA)
62 |_2048 79:f8:09:ac:d4:e2:32:42:10:49:d3:bd:20:82:85:ec (RSA)
63 80/tcp open http Apache httpd 2.2.14 ((Ubuntu))
64 |_http-title: Go ahead and ScanMe!
65 646/tcp filtered ldp
66 1720/tcp filtered H.323/Q.931
67 9929/tcp open nping-echo Nping echo
68 Device type: general purpose
69 Running: Linux 2.6.X
70 OS CPE: cpe:/o:linux:linux_kernel:2.6.39
71 OS details: Linux 2.6.39
72 Network Distance: 11 hops
73 Service Info: OS: Linux; CPE: cpe:/o:linux:kernel
74
75 TRACEROUTE (using port 53/tcp)
76 HOP RTT ADDRESS
77 [Cut first 10 hops for brevity]
78 11 17.65 ms li86-221.members.linode.com (74.207.244.221)
79
80 Nmap done: 1 IP address (1 host up) scanned in 14.40 seconds
81
82 The newest version of Nmap can be obtained from https://nmap.org. The
83 newest version of this man page is available at
84 https://nmap.org/book/man.html. It is also included as a chapter of
85 Nmap Network Scanning: The Official Nmap Project Guide to Network
86 Discovery and Security Scanning (see https://nmap.org/book/).
87
89 This options summary is printed when Nmap is run with no arguments, and
90 the latest version is always available at
91 https://svn.nmap.org/nmap/docs/nmap.usage.txt. It helps people remember
92 the most common options, but is no substitute for the in-depth
93 documentation in the rest of this manual. Some obscure options aren't
94 even included here.
95
96 Nmap 7.90 ( https://nmap.org )
97 Usage: nmap [Scan Type(s)] [Options] {target specification}
98 TARGET SPECIFICATION:
99 Can pass hostnames, IP addresses, networks, etc.
100 Ex: scanme.nmap.org, 192.168.0.1; 10.0.0-255.1-254
101 -iL <inputfilename>: Input from list of hosts/networks
102 -iR <num hosts>: Choose random targets
103 --exclude <host1[,host2][,host3],...>: Exclude hosts/networks
104 --excludefile <exclude_file>: Exclude list from file
105 HOST DISCOVERY:
106 -sL: List Scan - simply list targets to scan
107 -sn: Ping Scan - disable port scan
108 -Pn: Treat all hosts as online -- skip host discovery
109 -PS/PA/PU/PY[portlist]: TCP SYN/ACK, UDP or SCTP discovery to given ports
110 -PE/PP/PM: ICMP echo, timestamp, and netmask request discovery probes
111 -PO[protocol list]: IP Protocol Ping
112 -n/-R: Never do DNS resolution/Always resolve [default: sometimes]
113 --dns-servers <serv1[,serv2],...>: Specify custom DNS servers
114 --system-dns: Use OS's DNS resolver
115 --traceroute: Trace hop path to each host
116 SCAN TECHNIQUES:
117 -sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon scans
118 -sU: UDP Scan
119 -sN/sF/sX: TCP Null, FIN, and Xmas scans
120 --scanflags <flags>: Customize TCP scan flags
121 -sI <zombie host[:probeport]>: Idle scan
122 -sY/sZ: SCTP INIT/COOKIE-ECHO scans
123 -sO: IP protocol scan
124 -b <FTP relay host>: FTP bounce scan
125 PORT SPECIFICATION AND SCAN ORDER:
126 -p <port ranges>: Only scan specified ports
127 Ex: -p22; -p1-65535; -p U:53,111,137,T:21-25,80,139,8080,S:9
128 --exclude-ports <port ranges>: Exclude the specified ports from scanning
129 -F: Fast mode - Scan fewer ports than the default scan
130 -r: Scan ports consecutively - don't randomize
131 --top-ports <number>: Scan <number> most common ports
132 --port-ratio <ratio>: Scan ports more common than <ratio>
133 SERVICE/VERSION DETECTION:
134 -sV: Probe open ports to determine service/version info
135 --version-intensity <level>: Set from 0 (light) to 9 (try all probes)
136 --version-light: Limit to most likely probes (intensity 2)
137 --version-all: Try every single probe (intensity 9)
138 --version-trace: Show detailed version scan activity (for debugging)
139 SCRIPT SCAN:
140 -sC: equivalent to --script=default
141 --script=<Lua scripts>: <Lua scripts> is a comma separated list of
142 directories, script-files or script-categories
143 --script-args=<n1=v1,[n2=v2,...]>: provide arguments to scripts
144 --script-args-file=filename: provide NSE script args in a file
145 --script-trace: Show all data sent and received
146 --script-updatedb: Update the script database.
147 --script-help=<Lua scripts>: Show help about scripts.
148 <Lua scripts> is a comma-separated list of script-files or
149 script-categories.
150 OS DETECTION:
151 -O: Enable OS detection
152 --osscan-limit: Limit OS detection to promising targets
153 --osscan-guess: Guess OS more aggressively
154 TIMING AND PERFORMANCE:
155 Options which take <time> are in seconds, or append 'ms' (milliseconds),
156 's' (seconds), 'm' (minutes), or 'h' (hours) to the value (e.g. 30m).
157 -T<0-5>: Set timing template (higher is faster)
158 --min-hostgroup/max-hostgroup <size>: Parallel host scan group sizes
159 --min-parallelism/max-parallelism <numprobes>: Probe parallelization
160 --min-rtt-timeout/max-rtt-timeout/initial-rtt-timeout <time>: Specifies
161 probe round trip time.
162 --max-retries <tries>: Caps number of port scan probe retransmissions.
163 --host-timeout <time>: Give up on target after this long
164 --scan-delay/--max-scan-delay <time>: Adjust delay between probes
165 --min-rate <number>: Send packets no slower than <number> per second
166 --max-rate <number>: Send packets no faster than <number> per second
167 FIREWALL/IDS EVASION AND SPOOFING:
168 -f; --mtu <val>: fragment packets (optionally w/given MTU)
169 -D <decoy1,decoy2[,ME],...>: Cloak a scan with decoys
170 -S <IP_Address>: Spoof source address
171 -e <iface>: Use specified interface
172 -g/--source-port <portnum>: Use given port number
173 --proxies <url1,[url2],...>: Relay connections through HTTP/SOCKS4 proxies
174 --data <hex string>: Append a custom payload to sent packets
175 --data-string <string>: Append a custom ASCII string to sent packets
176 --data-length <num>: Append random data to sent packets
177 --ip-options <options>: Send packets with specified ip options
178 --ttl <val>: Set IP time-to-live field
179 --spoof-mac <mac address/prefix/vendor name>: Spoof your MAC address
180 --badsum: Send packets with a bogus TCP/UDP/SCTP checksum
181 OUTPUT:
182 -oN/-oX/-oS/-oG <file>: Output scan in normal, XML, s|<rIpt kIddi3,
183 and Grepable format, respectively, to the given filename.
184 -oA <basename>: Output in the three major formats at once
185 -v: Increase verbosity level (use -vv or more for greater effect)
186 -d: Increase debugging level (use -dd or more for greater effect)
187 --reason: Display the reason a port is in a particular state
188 --open: Only show open (or possibly open) ports
189 --packet-trace: Show all packets sent and received
190 --iflist: Print host interfaces and routes (for debugging)
191 --append-output: Append to rather than clobber specified output files
192 --resume <filename>: Resume an aborted scan
193 --stylesheet <path/URL>: XSL stylesheet to transform XML output to HTML
194 --webxml: Reference stylesheet from Nmap.Org for more portable XML
195 --no-stylesheet: Prevent associating of XSL stylesheet w/XML output
196 MISC:
197 -6: Enable IPv6 scanning
198 -A: Enable OS detection, version detection, script scanning, and traceroute
199 --datadir <dirname>: Specify custom Nmap data file location
200 --send-eth/--send-ip: Send using raw ethernet frames or IP packets
201 --privileged: Assume that the user is fully privileged
202 --unprivileged: Assume the user lacks raw socket privileges
203 -V: Print version number
204 -h: Print this help summary page.
205 EXAMPLES:
206 nmap -v -A scanme.nmap.org
207 nmap -v -sn 192.168.0.0/16 10.0.0.0/8
208 nmap -v -iR 10000 -Pn -p 80
209 SEE THE MAN PAGE (https://nmap.org/book/man.html) FOR MORE OPTIONS AND EXAMPLES
210
212 Everything on the Nmap command-line that isn't an option (or option
213 argument) is treated as a target host specification. The simplest case
214 is to specify a target IP address or hostname for scanning.
215
216 When a hostname is given as a target, it is resolved via the Domain
217 Name System (DNS) to determine the IP address to scan. If the name
218 resolves to more than one IP address, only the first one will be
219 scanned. To make Nmap scan all the resolved addresses instead of only
220 the first one, use the --resolve-all option.
221
222 Sometimes you wish to scan a whole network of adjacent hosts. For this,
223 Nmap supports CIDR-style addressing. You can append /numbits to an IP
224 address or hostname and Nmap will scan every IP address for which the
225 first numbits are the same as for the reference IP or hostname given.
226 For example, 192.168.10.0/24 would scan the 256 hosts between
227 192.168.10.0 (binary: 11000000 10101000 00001010 00000000) and
228 192.168.10.255 (binary: 11000000 10101000 00001010 11111111),
229 inclusive. 192.168.10.40/24 would scan exactly the same targets. Given
230 that the host scanme.nmap.org is at the IP address 64.13.134.52, the
231 specification scanme.nmap.org/16 would scan the 65,536 IP addresses
232 between 64.13.0.0 and 64.13.255.255. The smallest allowed value is /0,
233 which targets the whole Internet. The largest value for IPv4 is /32,
234 which scans just the named host or IP address because all address bits
235 are fixed. The largest value for IPv6 is /128, which does the same
236 thing.
237
238 CIDR notation is short but not always flexible enough. For example, you
239 might want to scan 192.168.0.0/16 but skip any IPs ending with .0 or
240 .255 because they may be used as subnet network and broadcast
241 addresses. Nmap supports this through octet range addressing. Rather
242 than specify a normal IP address, you can specify a comma-separated
243 list of numbers or ranges for each octet. For example,
244 192.168.0-255.1-254 will skip all addresses in the range that end in .0
245 or .255, and 192.168.3-5,7.1 will scan the four addresses 192.168.3.1,
246 192.168.4.1, 192.168.5.1, and 192.168.7.1. Either side of a range may
247 be omitted; the default values are 0 on the left and 255 on the right.
248 Using - by itself is the same as 0-255, but remember to use 0- in the
249 first octet so the target specification doesn't look like a
250 command-line option. Ranges need not be limited to the final octets:
251 the specifier 0-255.0-255.13.37 will perform an Internet-wide scan for
252 all IP addresses ending in 13.37. This sort of broad sampling can be
253 useful for Internet surveys and research.
254
255 IPv6 addresses can be specified by their fully qualified IPv6 address
256 or hostname or with CIDR notation for subnets. Octet ranges aren't yet
257 supported for IPv6.
258
259 IPv6 addresses with non-global scope need to have a zone ID suffix. On
260 Unix systems, this is a percent sign followed by an interface name; a
261 complete address might be fe80::a8bb:ccff:fedd:eeff%eth0. On Windows,
262 use an interface index number in place of an interface name:
263 fe80::a8bb:ccff:fedd:eeff%1. You can see a list of interface indexes by
264 running the command netsh.exe interface ipv6 show interface.
265
266 Nmap accepts multiple host specifications on the command line, and they
267 don't need to be the same type. The command nmap scanme.nmap.org
268 192.168.0.0/8 10.0.0,1,3-7.- does what you would expect.
269
270 While targets are usually specified on the command lines, the following
271 options are also available to control target selection:
272
273 -iL inputfilename (Input from list)
274 Reads target specifications from inputfilename. Passing a huge list
275 of hosts is often awkward on the command line, yet it is a common
276 desire. For example, your DHCP server might export a list of 10,000
277 current leases that you wish to scan. Or maybe you want to scan all
278 IP addresses except for those to locate hosts using unauthorized
279 static IP addresses. Simply generate the list of hosts to scan and
280 pass that filename to Nmap as an argument to the -iL option.
281 Entries can be in any of the formats accepted by Nmap on the
282 command line (IP address, hostname, CIDR, IPv6, or octet ranges).
283 Each entry must be separated by one or more spaces, tabs, or
284 newlines. You can specify a hyphen (-) as the filename if you want
285 Nmap to read hosts from standard input rather than an actual file.
286
287 The input file may contain comments that start with # and extend to
288 the end of the line.
289
290 -iR num hosts (Choose random targets)
291 For Internet-wide surveys and other research, you may want to
292 choose targets at random. The num hosts argument tells Nmap how
293 many IPs to generate. Undesirable IPs such as those in certain
294 private, multicast, or unallocated address ranges are automatically
295 skipped. The argument 0 can be specified for a never-ending scan.
296 Keep in mind that some network administrators bristle at
297 unauthorized scans of their networks and may complain. Use this
298 option at your own risk! If you find yourself really bored one
299 rainy afternoon, try the command nmap -Pn -sS -p 80 -iR 0 --open to
300 locate random web servers for browsing.
301
302 --exclude host1[,host2[,...]] (Exclude hosts/networks)
303 Specifies a comma-separated list of targets to be excluded from the
304 scan even if they are part of the overall network range you
305 specify. The list you pass in uses normal Nmap syntax, so it can
306 include hostnames, CIDR netblocks, octet ranges, etc. This can be
307 useful when the network you wish to scan includes untouchable
308 mission-critical servers, systems that are known to react adversely
309 to port scans, or subnets administered by other people.
310
311 --excludefile exclude_file (Exclude list from file)
312 This offers the same functionality as the --exclude option, except
313 that the excluded targets are provided in a newline-, space-, or
314 tab-delimited exclude_file rather than on the command line.
315
316 The exclude file may contain comments that start with # and extend
317 to the end of the line.
318
320 One of the very first steps in any network reconnaissance mission is to
321 reduce a (sometimes huge) set of IP ranges into a list of active or
322 interesting hosts. Scanning every port of every single IP address is
323 slow and usually unnecessary. Of course what makes a host interesting
324 depends greatly on the scan purposes. Network administrators may only
325 be interested in hosts running a certain service, while security
326 auditors may care about every single device with an IP address. An
327 administrator may be comfortable using just an ICMP ping to locate
328 hosts on his internal network, while an external penetration tester may
329 use a diverse set of dozens of probes in an attempt to evade firewall
330 restrictions.
331
332 Because host discovery needs are so diverse, Nmap offers a wide variety
333 of options for customizing the techniques used. Host discovery is
334 sometimes called ping scan, but it goes well beyond the simple ICMP
335 echo request packets associated with the ubiquitous ping tool. Users
336 can skip the discovery step entirely with a list scan (-sL) or by
337 disabling host discovery (-Pn), or engage the network with arbitrary
338 combinations of multi-port TCP SYN/ACK, UDP, SCTP INIT and ICMP probes.
339 The goal of these probes is to solicit responses which demonstrate that
340 an IP address is actually active (is being used by a host or network
341 device). On many networks, only a small percentage of IP addresses are
342 active at any given time. This is particularly common with private
343 address space such as 10.0.0.0/8. That network has 16 million IPs, but
344 I have seen it used by companies with less than a thousand machines.
345 Host discovery can find those machines in a sparsely allocated sea of
346 IP addresses.
347
348 If no host discovery options are given, Nmap sends an ICMP echo
349 request, a TCP SYN packet to port 443, a TCP ACK packet to port 80, and
350 an ICMP timestamp request. (For IPv6, the ICMP timestamp request is
351 omitted because it is not part of ICMPv6.) These defaults are
352 equivalent to the -PE -PS443 -PA80 -PP options. The exceptions to this
353 are the ARP (for IPv4) and Neighbor Discovery (for IPv6) scans which
354 are used for any targets on a local ethernet network. For unprivileged
355 Unix shell users, the default probes are a SYN packet to ports 80 and
356 443 using the connect system call. This host discovery is often
357 sufficient when scanning local networks, but a more comprehensive set
358 of discovery probes is recommended for security auditing.
359
360 The -P* options (which select ping types) can be combined. You can
361 increase your odds of penetrating strict firewalls by sending many
362 probe types using different TCP ports/flags and ICMP codes. Also note
363 that ARP/Neighbor Discovery is done by default against targets on a
364 local Ethernet network even if you specify other -P* options, because
365 it is almost always faster and more effective.
366
367 By default, Nmap does host discovery and then performs a port scan
368 against each host it determines is online. This is true even if you
369 specify non-default host discovery types such as UDP probes (-PU). Read
370 about the -sn option to learn how to perform only host discovery, or
371 use -Pn to skip host discovery and port scan all target addresses. The
372 following options control host discovery:
373
374 -sL (List Scan)
375 The list scan is a degenerate form of host discovery that simply
376 lists each host of the network(s) specified, without sending any
377 packets to the target hosts. By default, Nmap still does
378 reverse-DNS resolution on the hosts to learn their names. It is
379 often surprising how much useful information simple hostnames give
380 out. For example, fw.chi is the name of one company's Chicago
381 firewall.
382
383 Nmap also reports the total number of IP addresses at the end. The
384 list scan is a good sanity check to ensure that you have proper IP
385 addresses for your targets. If the hosts sport domain names you do
386 not recognize, it is worth investigating further to prevent
387 scanning the wrong company's network.
388
389 Since the idea is to simply print a list of target hosts, options
390 for higher level functionality such as port scanning, OS detection,
391 or host discovery cannot be combined with this. If you wish to
392 disable host discovery while still performing such higher level
393 functionality, read up on the -Pn (skip host discovery) option.
394
395 -sn (No port scan)
396 This option tells Nmap not to do a port scan after host discovery,
397 and only print out the available hosts that responded to the host
398 discovery probes. This is often known as a “ping scan”, but you can
399 also request that traceroute and NSE host scripts be run. This is
400 by default one step more intrusive than the list scan, and can
401 often be used for the same purposes. It allows light reconnaissance
402 of a target network without attracting much attention. Knowing how
403 many hosts are up is more valuable to attackers than the list
404 provided by list scan of every single IP and host name.
405
406 Systems administrators often find this option valuable as well. It
407 can easily be used to count available machines on a network or
408 monitor server availability. This is often called a ping sweep, and
409 is more reliable than pinging the broadcast address because many
410 hosts do not reply to broadcast queries.
411
412 The default host discovery done with -sn consists of an ICMP echo
413 request, TCP SYN to port 443, TCP ACK to port 80, and an ICMP
414 timestamp request by default. When executed by an unprivileged
415 user, only SYN packets are sent (using a connect call) to ports 80
416 and 443 on the target. When a privileged user tries to scan targets
417 on a local ethernet network, ARP requests are used unless --send-ip
418 was specified. The -sn option can be combined with any of the
419 discovery probe types (the -P* options) for greater flexibility. If
420 any of those probe type and port number options are used, the
421 default probes are overridden. When strict firewalls are in place
422 between the source host running Nmap and the target network, using
423 those advanced techniques is recommended. Otherwise hosts could be
424 missed when the firewall drops probes or their responses.
425
426 In previous releases of Nmap, -sn was known as -sP.
427
428 -Pn (No ping)
429 This option skips the host discovery stage altogether. Normally,
430 Nmap uses this stage to determine active machines for heavier
431 scanning and to gauge the speed of the network. By default, Nmap
432 only performs heavy probing such as port scans, version detection,
433 or OS detection against hosts that are found to be up. Disabling
434 host discovery with -Pn causes Nmap to attempt the requested
435 scanning functions against every target IP address specified. So if
436 a /16 sized network is specified on the command line, all 65,536 IP
437 addresses are scanned. Proper host discovery is skipped as with the
438 list scan, but instead of stopping and printing the target list,
439 Nmap continues to perform requested functions as if each target IP
440 is active. Default timing parameters are used, which may result in
441 slower scans. To skip host discovery and port scan, while still
442 allowing NSE to run, use the two options -Pn -sn together.
443
444 For machines on a local ethernet network, ARP scanning will still
445 be performed (unless --disable-arp-ping or --send-ip is specified)
446 because Nmap needs MAC addresses to further scan target hosts. In
447 previous versions of Nmap, -Pn was -P0 and -PN.
448
449 -PS port list (TCP SYN Ping)
450 This option sends an empty TCP packet with the SYN flag set. The
451 default destination port is 80 (configurable at compile time by
452 changing DEFAULT_TCP_PROBE_PORT_SPEC in nmap.h). Alternate ports
453 can be specified as a parameter. The syntax is the same as for the
454 -p except that port type specifiers like T: are not allowed.
455 Examples are -PS22 and -PS22-25,80,113,1050,35000. Note that there
456 can be no space between -PS and the port list. If multiple probes
457 are specified they will be sent in parallel.
458
459 The SYN flag suggests to the remote system that you are attempting
460 to establish a connection. Normally the destination port will be
461 closed, and a RST (reset) packet sent back. If the port happens to
462 be open, the target will take the second step of a TCP
463 three-way-handshake by responding with a SYN/ACK TCP packet. The
464 machine running Nmap then tears down the nascent connection by
465 responding with a RST rather than sending an ACK packet which would
466 complete the three-way-handshake and establish a full connection.
467 The RST packet is sent by the kernel of the machine running Nmap in
468 response to the unexpected SYN/ACK, not by Nmap itself.
469
470 Nmap does not care whether the port is open or closed. Either the
471 RST or SYN/ACK response discussed previously tell Nmap that the
472 host is available and responsive.
473
474 On Unix boxes, only the privileged user root is generally able to
475 send and receive raw TCP packets. For unprivileged users, a
476 workaround is automatically employed whereby the connect system
477 call is initiated against each target port. This has the effect of
478 sending a SYN packet to the target host, in an attempt to establish
479 a connection. If connect returns with a quick success or an
480 ECONNREFUSED failure, the underlying TCP stack must have received a
481 SYN/ACK or RST and the host is marked available. If the connection
482 attempt is left hanging until a timeout is reached, the host is
483 marked as down.
484
485 -PA port list (TCP ACK Ping)
486 The TCP ACK ping is quite similar to the just-discussed SYN ping.
487 The difference, as you could likely guess, is that the TCP ACK flag
488 is set instead of the SYN flag. Such an ACK packet purports to be
489 acknowledging data over an established TCP connection, but no such
490 connection exists. So remote hosts should always respond with a RST
491 packet, disclosing their existence in the process.
492
493 The -PA option uses the same default port as the SYN probe (80) and
494 can also take a list of destination ports in the same format. If an
495 unprivileged user tries this, the connect workaround discussed
496 previously is used. This workaround is imperfect because connect is
497 actually sending a SYN packet rather than an ACK.
498
499 The reason for offering both SYN and ACK ping probes is to maximize
500 the chances of bypassing firewalls. Many administrators configure
501 routers and other simple firewalls to block incoming SYN packets
502 except for those destined for public services like the company web
503 site or mail server. This prevents other incoming connections to
504 the organization, while allowing users to make unobstructed
505 outgoing connections to the Internet. This non-stateful approach
506 takes up few resources on the firewall/router and is widely
507 supported by hardware and software filters. The Linux
508 Netfilter/iptables firewall software offers the --syn convenience
509 option to implement this stateless approach. When stateless
510 firewall rules such as this are in place, SYN ping probes (-PS) are
511 likely to be blocked when sent to closed target ports. In such
512 cases, the ACK probe shines as it cuts right through these rules.
513
514 Another common type of firewall uses stateful rules that drop
515 unexpected packets. This feature was initially found mostly on
516 high-end firewalls, though it has become much more common over the
517 years. The Linux Netfilter/iptables system supports this through
518 the --state option, which categorizes packets based on connection
519 state. A SYN probe is more likely to work against such a system, as
520 unexpected ACK packets are generally recognized as bogus and
521 dropped. A solution to this quandary is to send both SYN and ACK
522 probes by specifying -PS and -PA.
523
524 -PU port list (UDP Ping)
525 Another host discovery option is the UDP ping, which sends a UDP
526 packet to the given ports. For most ports, the packet will be
527 empty, though some use a protocol-specific payload that is more
528 likely to elicit a response. The payload database is described at
529 https://nmap.org/book/nmap-payloads.html.
530
531 Packet content can also be affected with the --data, --data-string,
532 and --data-length options.
533
534 The port list takes the same format as with the previously
535 discussed -PS and -PA options. If no ports are specified, the
536 default is 40125. This default can be configured at compile-time
537 by changing DEFAULT_UDP_PROBE_PORT_SPEC in nmap.h. A highly
538 uncommon port is used by default because sending to open ports is
539 often undesirable for this particular scan type.
540
541 Upon hitting a closed port on the target machine, the UDP probe
542 should elicit an ICMP port unreachable packet in return. This
543 signifies to Nmap that the machine is up and available. Many other
544 types of ICMP errors, such as host/network unreachables or TTL
545 exceeded are indicative of a down or unreachable host. A lack of
546 response is also interpreted this way. If an open port is reached,
547 most services simply ignore the empty packet and fail to return any
548 response. This is why the default probe port is 40125, which is
549 highly unlikely to be in use. A few services, such as the Character
550 Generator (chargen) protocol, will respond to an empty UDP packet,
551 and thus disclose to Nmap that the machine is available.
552
553 The primary advantage of this scan type is that it bypasses
554 firewalls and filters that only screen TCP. For example, I once
555 owned a Linksys BEFW11S4 wireless broadband router. The external
556 interface of this device filtered all TCP ports by default, but UDP
557 probes would still elicit port unreachable messages and thus give
558 away the device.
559
560 -PY port list (SCTP INIT Ping)
561 This option sends an SCTP packet containing a minimal INIT chunk.
562 The default destination port is 80 (configurable at compile time by
563 changing DEFAULT_SCTP_PROBE_PORT_SPEC in nmap.h). Alternate ports
564 can be specified as a parameter. The syntax is the same as for the
565 -p except that port type specifiers like S: are not allowed.
566 Examples are -PY22 and -PY22,80,179,5060. Note that there can be no
567 space between -PY and the port list. If multiple probes are
568 specified they will be sent in parallel.
569
570 The INIT chunk suggests to the remote system that you are
571 attempting to establish an association. Normally the destination
572 port will be closed, and an ABORT chunk will be sent back. If the
573 port happens to be open, the target will take the second step of an
574 SCTP four-way-handshake by responding with an INIT-ACK chunk. If
575 the machine running Nmap has a functional SCTP stack, then it tears
576 down the nascent association by responding with an ABORT chunk
577 rather than sending a COOKIE-ECHO chunk which would be the next
578 step in the four-way-handshake. The ABORT packet is sent by the
579 kernel of the machine running Nmap in response to the unexpected
580 INIT-ACK, not by Nmap itself.
581
582 Nmap does not care whether the port is open or closed. Either the
583 ABORT or INIT-ACK response discussed previously tell Nmap that the
584 host is available and responsive.
585
586 On Unix boxes, only the privileged user root is generally able to
587 send and receive raw SCTP packets. Using SCTP INIT Pings is
588 currently not possible for unprivileged users.
589
590 -PE; -PP; -PM (ICMP Ping Types)
591 In addition to the unusual TCP, UDP and SCTP host discovery types
592 discussed previously, Nmap can send the standard packets sent by
593 the ubiquitous ping program. Nmap sends an ICMP type 8 (echo
594 request) packet to the target IP addresses, expecting a type 0
595 (echo reply) in return from available hosts. Unfortunately for
596 network explorers, many hosts and firewalls now block these
597 packets, rather than responding as required by RFC 1122[2]. For
598 this reason, ICMP-only scans are rarely reliable enough against
599 unknown targets over the Internet. But for system administrators
600 monitoring an internal network, they can be a practical and
601 efficient approach. Use the -PE option to enable this echo request
602 behavior.
603
604 While echo request is the standard ICMP ping query, Nmap does not
605 stop there. The ICMP standards (RFC 792[3] and RFC 950[4] ) also
606 specify timestamp request, information request, and address mask
607 request packets as codes 13, 15, and 17, respectively. While the
608 ostensible purpose for these queries is to learn information such
609 as address masks and current times, they can easily be used for
610 host discovery. A system that replies is up and available. Nmap
611 does not currently implement information request packets, as they
612 are not widely supported. RFC 1122 insists that “a host SHOULD NOT
613 implement these messages”. Timestamp and address mask queries can
614 be sent with the -PP and -PM options, respectively. A timestamp
615 reply (ICMP code 14) or address mask reply (code 18) discloses that
616 the host is available. These two queries can be valuable when
617 administrators specifically block echo request packets while
618 forgetting that other ICMP queries can be used for the same
619 purpose.
620
621 -PO protocol list (IP Protocol Ping)
622 One of the newer host discovery options is the IP protocol ping,
623 which sends IP packets with the specified protocol number set in
624 their IP header. The protocol list takes the same format as do port
625 lists in the previously discussed TCP, UDP and SCTP host discovery
626 options. If no protocols are specified, the default is to send
627 multiple IP packets for ICMP (protocol 1), IGMP (protocol 2), and
628 IP-in-IP (protocol 4). The default protocols can be configured at
629 compile-time by changing DEFAULT_PROTO_PROBE_PORT_SPEC in nmap.h.
630 Note that for the ICMP, IGMP, TCP (protocol 6), UDP (protocol 17)
631 and SCTP (protocol 132), the packets are sent with the proper
632 protocol headers while other protocols are sent with no additional
633 data beyond the IP header (unless any of --data, --data-string, or
634 --data-length options are specified).
635
636 This host discovery method looks for either responses using the
637 same protocol as a probe, or ICMP protocol unreachable messages
638 which signify that the given protocol isn't supported on the
639 destination host. Either type of response signifies that the target
640 host is alive.
641
642 --disable-arp-ping (No ARP or ND Ping)
643 Nmap normally does ARP or IPv6 Neighbor Discovery (ND) discovery of
644 locally connected ethernet hosts, even if other host discovery
645 options such as -Pn or -PE are used. To disable this implicit
646 behavior, use the --disable-arp-ping option.
647
648 The default behavior is normally faster, but this option is useful
649 on networks using proxy ARP, in which a router speculatively
650 replies to all ARP requests, making every target appear to be up
651 according to ARP scan.
652
653 --discovery-ignore-rst
654 In some cases, firewalls may spoof TCP reset (RST) replies in
655 response to probes to unoccupied or disallowed addresses. Since
656 Nmap ordinarily considers RST replies to be proof that the target
657 is up, this can lead to wasted time scanning targets that aren't
658 there. Using the --discovery-ignore-rst will prevent Nmap from
659 considering these replies during host discovery. You may need to
660 select extra host discovery options to ensure you don't miss
661 targets in this case.
662
663 --traceroute (Trace path to host)
664 Traceroutes are performed post-scan using information from the scan
665 results to determine the port and protocol most likely to reach the
666 target. It works with all scan types except connect scans (-sT) and
667 idle scans (-sI). All traces use Nmap's dynamic timing model and
668 are performed in parallel.
669
670 Traceroute works by sending packets with a low TTL (time-to-live)
671 in an attempt to elicit ICMP Time Exceeded messages from
672 intermediate hops between the scanner and the target host. Standard
673 traceroute implementations start with a TTL of 1 and increment the
674 TTL until the destination host is reached. Nmap's traceroute starts
675 with a high TTL and then decrements the TTL until it reaches zero.
676 Doing it backwards lets Nmap employ clever caching algorithms to
677 speed up traces over multiple hosts. On average Nmap sends 5–10
678 fewer packets per host, depending on network conditions. If a
679 single subnet is being scanned (i.e. 192.168.0.0/24) Nmap may only
680 have to send two packets to most hosts.
681
682 -n (No DNS resolution)
683
684 Tells Nmap to never do reverse DNS resolution on the active IP
685 addresses it finds. Since DNS can be slow even with Nmap's built-in
686 parallel stub resolver, this option can slash scanning times.
687
688 -R (DNS resolution for all targets)
689 Tells Nmap to always do reverse DNS resolution on the target IP
690 addresses. Normally reverse DNS is only performed against
691 responsive (online) hosts.
692
693 --resolve-all (Scan each resolved address)
694 If a hostname target resolves to more than one address, scan all of
695 them. The default behavior is to only scan the first resolved
696 address. Regardless, only addresses in the appropriate address
697 family will be scanned: IPv4 by default, IPv6 with -6.
698
699 --system-dns (Use system DNS resolver)
700 By default, Nmap reverse-resolves IP addresses by sending queries
701 directly to the name servers configured on your host and then
702 listening for responses. Many requests (often dozens) are performed
703 in parallel to improve performance. Specify this option to use your
704 system resolver instead (one IP at a time via the getnameinfo
705 call). This is slower and rarely useful unless you find a bug in
706 the Nmap parallel resolver (please let us know if you do). The
707 system resolver is always used for forward lookups (getting an IP
708 address from a hostname).
709
710 --dns-servers server1[,server2[,...]] (Servers to use for reverse DNS
711 queries)
712 By default, Nmap determines your DNS servers (for rDNS resolution)
713 from your resolv.conf file (Unix) or the Registry (Win32).
714 Alternatively, you may use this option to specify alternate
715 servers. This option is not honored if you are using --system-dns.
716 Using multiple DNS servers is often faster, especially if you
717 choose authoritative servers for your target IP space. This option
718 can also improve stealth, as your requests can be bounced off just
719 about any recursive DNS server on the Internet.
720
721 This option also comes in handy when scanning private networks.
722 Sometimes only a few name servers provide proper rDNS information,
723 and you may not even know where they are. You can scan the network
724 for port 53 (perhaps with version detection), then try Nmap list
725 scans (-sL) specifying each name server one at a time with
726 --dns-servers until you find one which works.
727
728 This option might not be honored if the DNS response exceeds the
729 size of a UDP packet. In such a situation our DNS resolver will
730 make the best effort to extract a response from the truncated
731 packet, and if not successful it will fall back to using the system
732 resolver. Also, responses that contain CNAME aliases will fall back
733 to the system resolver.
734
736 While Nmap has grown in functionality over the years, it began as an
737 efficient port scanner, and that remains its core function. The simple
738 command nmap target scans 1,000 TCP ports on the host target. While
739 many port scanners have traditionally lumped all ports into the open or
740 closed states, Nmap is much more granular. It divides ports into six
741 states: open, closed, filtered, unfiltered, open|filtered, or
742 closed|filtered.
743
744 These states are not intrinsic properties of the port itself, but
745 describe how Nmap sees them. For example, an Nmap scan from the same
746 network as the target may show port 135/tcp as open, while a scan at
747 the same time with the same options from across the Internet might show
748 that port as filtered.
749
750 The six port states recognized by Nmap
751
752 open
753 An application is actively accepting TCP connections, UDP datagrams
754 or SCTP associations on this port. Finding these is often the
755 primary goal of port scanning. Security-minded people know that
756 each open port is an avenue for attack. Attackers and pen-testers
757 want to exploit the open ports, while administrators try to close
758 or protect them with firewalls without thwarting legitimate users.
759 Open ports are also interesting for non-security scans because they
760 show services available for use on the network.
761
762 closed
763 A closed port is accessible (it receives and responds to Nmap probe
764 packets), but there is no application listening on it. They can be
765 helpful in showing that a host is up on an IP address (host
766 discovery, or ping scanning), and as part of OS detection. Because
767 closed ports are reachable, it may be worth scanning later in case
768 some open up. Administrators may want to consider blocking such
769 ports with a firewall. Then they would appear in the filtered
770 state, discussed next.
771
772 filtered
773 Nmap cannot determine whether the port is open because packet
774 filtering prevents its probes from reaching the port. The filtering
775 could be from a dedicated firewall device, router rules, or
776 host-based firewall software. These ports frustrate attackers
777 because they provide so little information. Sometimes they respond
778 with ICMP error messages such as type 3 code 13 (destination
779 unreachable: communication administratively prohibited), but
780 filters that simply drop probes without responding are far more
781 common. This forces Nmap to retry several times just in case the
782 probe was dropped due to network congestion rather than filtering.
783 This slows down the scan dramatically.
784
785 unfiltered
786 The unfiltered state means that a port is accessible, but Nmap is
787 unable to determine whether it is open or closed. Only the ACK
788 scan, which is used to map firewall rulesets, classifies ports into
789 this state. Scanning unfiltered ports with other scan types such as
790 Window scan, SYN scan, or FIN scan, may help resolve whether the
791 port is open.
792
793 open|filtered
794 Nmap places ports in this state when it is unable to determine
795 whether a port is open or filtered. This occurs for scan types in
796 which open ports give no response. The lack of response could also
797 mean that a packet filter dropped the probe or any response it
798 elicited. So Nmap does not know for sure whether the port is open
799 or being filtered. The UDP, IP protocol, FIN, NULL, and Xmas scans
800 classify ports this way.
801
802 closed|filtered
803 This state is used when Nmap is unable to determine whether a port
804 is closed or filtered. It is only used for the IP ID idle scan.
805
807 As a novice performing automotive repair, I can struggle for hours
808 trying to fit my rudimentary tools (hammer, duct tape, wrench, etc.) to
809 the task at hand. When I fail miserably and tow my jalopy to a real
810 mechanic, he invariably fishes around in a huge tool chest until
811 pulling out the perfect gizmo which makes the job seem effortless. The
812 art of port scanning is similar. Experts understand the dozens of scan
813 techniques and choose the appropriate one (or combination) for a given
814 task. Inexperienced users and script kiddies, on the other hand, try to
815 solve every problem with the default SYN scan. Since Nmap is free, the
816 only barrier to port scanning mastery is knowledge. That certainly
817 beats the automotive world, where it may take great skill to determine
818 that you need a strut spring compressor, then you still have to pay
819 thousands of dollars for it.
820
821 Most of the scan types are only available to privileged users. This is
822 because they send and receive raw packets, which requires root access
823 on Unix systems. Using an administrator account on Windows is
824 recommended, though Nmap sometimes works for unprivileged users on that
825 platform when Npcap has already been loaded into the OS. Requiring root
826 privileges was a serious limitation when Nmap was released in 1997, as
827 many users only had access to shared shell accounts. Now, the world is
828 different. Computers are cheaper, far more people have always-on direct
829 Internet access, and desktop Unix systems (including Linux and Mac OS
830 X) are prevalent. A Windows version of Nmap is now available, allowing
831 it to run on even more desktops. For all these reasons, users have less
832 need to run Nmap from limited shared shell accounts. This is fortunate,
833 as the privileged options make Nmap far more powerful and flexible.
834
835 While Nmap attempts to produce accurate results, keep in mind that all
836 of its insights are based on packets returned by the target machines
837 (or firewalls in front of them). Such hosts may be untrustworthy and
838 send responses intended to confuse or mislead Nmap. Much more common
839 are non-RFC-compliant hosts that do not respond as they should to Nmap
840 probes. FIN, NULL, and Xmas scans are particularly susceptible to this
841 problem. Such issues are specific to certain scan types and so are
842 discussed in the individual scan type entries.
843
844 This section documents the dozen or so port scan techniques supported
845 by Nmap. Only one method may be used at a time, except that UDP scan
846 (-sU) and any one of the SCTP scan types (-sY, -sZ) may be combined
847 with any one of the TCP scan types. As a memory aid, port scan type
848 options are of the form -sC, where C is a prominent character in the
849 scan name, usually the first. The one exception to this is the
850 deprecated FTP bounce scan (-b). By default, Nmap performs a SYN Scan,
851 though it substitutes a connect scan if the user does not have proper
852 privileges to send raw packets (requires root access on Unix). Of the
853 scans listed in this section, unprivileged users can only execute
854 connect and FTP bounce scans.
855
856 -sS (TCP SYN scan)
857 SYN scan is the default and most popular scan option for good
858 reasons. It can be performed quickly, scanning thousands of ports
859 per second on a fast network not hampered by restrictive firewalls.
860 It is also relatively unobtrusive and stealthy since it never
861 completes TCP connections. SYN scan works against any compliant TCP
862 stack rather than depending on idiosyncrasies of specific platforms
863 as Nmap's FIN/NULL/Xmas, Maimon and idle scans do. It also allows
864 clear, reliable differentiation between the open, closed, and
865 filtered states.
866
867 This technique is often referred to as half-open scanning, because
868 you don't open a full TCP connection. You send a SYN packet, as if
869 you are going to open a real connection and then wait for a
870 response. A SYN/ACK indicates the port is listening (open), while a
871 RST (reset) is indicative of a non-listener. If no response is
872 received after several retransmissions, the port is marked as
873 filtered. The port is also marked filtered if an ICMP unreachable
874 error (type 3, code 0, 1, 2, 3, 9, 10, or 13) is received. The port
875 is also considered open if a SYN packet (without the ACK flag) is
876 received in response. This can be due to an extremely rare TCP
877 feature known as a simultaneous open or split handshake connection
878 (see https://nmap.org/misc/split-handshake.pdf).
879
880 -sT (TCP connect scan)
881 TCP connect scan is the default TCP scan type when SYN scan is not
882 an option. This is the case when a user does not have raw packet
883 privileges. Instead of writing raw packets as most other scan types
884 do, Nmap asks the underlying operating system to establish a
885 connection with the target machine and port by issuing the connect
886 system call. This is the same high-level system call that web
887 browsers, P2P clients, and most other network-enabled applications
888 use to establish a connection. It is part of a programming
889 interface known as the Berkeley Sockets API. Rather than read raw
890 packet responses off the wire, Nmap uses this API to obtain status
891 information on each connection attempt.
892
893 When SYN scan is available, it is usually a better choice. Nmap has
894 less control over the high level connect call than with raw
895 packets, making it less efficient. The system call completes
896 connections to open target ports rather than performing the
897 half-open reset that SYN scan does. Not only does this take longer
898 and require more packets to obtain the same information, but target
899 machines are more likely to log the connection. A decent IDS will
900 catch either, but most machines have no such alarm system. Many
901 services on your average Unix system will add a note to syslog, and
902 sometimes a cryptic error message, when Nmap connects and then
903 closes the connection without sending data. Truly pathetic services
904 crash when this happens, though that is uncommon. An administrator
905 who sees a bunch of connection attempts in her logs from a single
906 system should know that she has been connect scanned.
907
908 -sU (UDP scans)
909 While most popular services on the Internet run over the TCP
910 protocol, UDP[5] services are widely deployed. DNS, SNMP, and DHCP
911 (registered ports 53, 161/162, and 67/68) are three of the most
912 common. Because UDP scanning is generally slower and more difficult
913 than TCP, some security auditors ignore these ports. This is a
914 mistake, as exploitable UDP services are quite common and attackers
915 certainly don't ignore the whole protocol. Fortunately, Nmap can
916 help inventory UDP ports.
917
918 UDP scan is activated with the -sU option. It can be combined with
919 a TCP scan type such as SYN scan (-sS) to check both protocols
920 during the same run.
921
922 UDP scan works by sending a UDP packet to every targeted port. For
923 some common ports such as 53 and 161, a protocol-specific payload
924 is sent to increase response rate, but for most ports the packet is
925 empty unless the --data, --data-string, or --data-length options
926 are specified. If an ICMP port unreachable error (type 3, code 3)
927 is returned, the port is closed. Other ICMP unreachable errors
928 (type 3, codes 0, 1, 2, 9, 10, or 13) mark the port as filtered.
929 Occasionally, a service will respond with a UDP packet, proving
930 that it is open. If no response is received after retransmissions,
931 the port is classified as open|filtered. This means that the port
932 could be open, or perhaps packet filters are blocking the
933 communication. Version detection (-sV) can be used to help
934 differentiate the truly open ports from the filtered ones.
935
936 A big challenge with UDP scanning is doing it quickly. Open and
937 filtered ports rarely send any response, leaving Nmap to time out
938 and then conduct retransmissions just in case the probe or response
939 were lost. Closed ports are often an even bigger problem. They
940 usually send back an ICMP port unreachable error. But unlike the
941 RST packets sent by closed TCP ports in response to a SYN or
942 connect scan, many hosts rate limit ICMP port unreachable messages
943 by default. Linux and Solaris are particularly strict about this.
944 For example, the Linux 2.4.20 kernel limits destination unreachable
945 messages to one per second (in net/ipv4/icmp.c).
946
947 Nmap detects rate limiting and slows down accordingly to avoid
948 flooding the network with useless packets that the target machine
949 will drop. Unfortunately, a Linux-style limit of one packet per
950 second makes a 65,536-port scan take more than 18 hours. Ideas for
951 speeding your UDP scans up include scanning more hosts in parallel,
952 doing a quick scan of just the popular ports first, scanning from
953 behind the firewall, and using --host-timeout to skip slow hosts.
954
955 -sY (SCTP INIT scan)
956 SCTP[6] is a relatively new alternative to the TCP and UDP
957 protocols, combining most characteristics of TCP and UDP, and also
958 adding new features like multi-homing and multi-streaming. It is
959 mostly being used for SS7/SIGTRAN related services but has the
960 potential to be used for other applications as well. SCTP INIT scan
961 is the SCTP equivalent of a TCP SYN scan. It can be performed
962 quickly, scanning thousands of ports per second on a fast network
963 not hampered by restrictive firewalls. Like SYN scan, INIT scan is
964 relatively unobtrusive and stealthy, since it never completes SCTP
965 associations. It also allows clear, reliable differentiation
966 between the open, closed, and filtered states.
967
968 This technique is often referred to as half-open scanning, because
969 you don't open a full SCTP association. You send an INIT chunk, as
970 if you are going to open a real association and then wait for a
971 response. An INIT-ACK chunk indicates the port is listening (open),
972 while an ABORT chunk is indicative of a non-listener. If no
973 response is received after several retransmissions, the port is
974 marked as filtered. The port is also marked filtered if an ICMP
975 unreachable error (type 3, code 0, 1, 2, 3, 9, 10, or 13) is
976 received.
977
978 -sN; -sF; -sX (TCP NULL, FIN, and Xmas scans)
979 These three scan types (even more are possible with the --scanflags
980 option described in the next section) exploit a subtle loophole in
981 the TCP RFC[7] to differentiate between open and closed ports. Page
982 65 of RFC 793 says that “if the [destination] port state is CLOSED
983 .... an incoming segment not containing a RST causes a RST to be
984 sent in response.” Then the next page discusses packets sent to
985 open ports without the SYN, RST, or ACK bits set, stating that:
986 “you are unlikely to get here, but if you do, drop the segment, and
987 return.”
988
989 When scanning systems compliant with this RFC text, any packet not
990 containing SYN, RST, or ACK bits will result in a returned RST if
991 the port is closed and no response at all if the port is open. As
992 long as none of those three bits are included, any combination of
993 the other three (FIN, PSH, and URG) are OK. Nmap exploits this with
994 three scan types:
995
996 Null scan (-sN)
997 Does not set any bits (TCP flag header is 0)
998
999 FIN scan (-sF)
1000 Sets just the TCP FIN bit.
1001
1002 Xmas scan (-sX)
1003 Sets the FIN, PSH, and URG flags, lighting the packet up like a
1004 Christmas tree.
1005
1006 These three scan types are exactly the same in behavior except for
1007 the TCP flags set in probe packets. If a RST packet is received,
1008 the port is considered closed, while no response means it is
1009 open|filtered. The port is marked filtered if an ICMP unreachable
1010 error (type 3, code 0, 1, 2, 3, 9, 10, or 13) is received.
1011
1012 The key advantage to these scan types is that they can sneak
1013 through certain non-stateful firewalls and packet filtering
1014 routers. Another advantage is that these scan types are a little
1015 more stealthy than even a SYN scan. Don't count on this though—most
1016 modern IDS products can be configured to detect them. The big
1017 downside is that not all systems follow RFC 793 to the letter. A
1018 number of systems send RST responses to the probes regardless of
1019 whether the port is open or not. This causes all of the ports to be
1020 labeled closed. Major operating systems that do this are Microsoft
1021 Windows, many Cisco devices, BSDI, and IBM OS/400. This scan does
1022 work against most Unix-based systems though. Another downside of
1023 these scans is that they can't distinguish open ports from certain
1024 filtered ones, leaving you with the response open|filtered.
1025
1026 -sA (TCP ACK scan)
1027 This scan is different than the others discussed so far in that it
1028 never determines open (or even open|filtered) ports. It is used to
1029 map out firewall rulesets, determining whether they are stateful or
1030 not and which ports are filtered.
1031
1032 The ACK scan probe packet has only the ACK flag set (unless you use
1033 --scanflags). When scanning unfiltered systems, open and closed
1034 ports will both return a RST packet. Nmap then labels them as
1035 unfiltered, meaning that they are reachable by the ACK packet, but
1036 whether they are open or closed is undetermined. Ports that don't
1037 respond, or send certain ICMP error messages back (type 3, code 0,
1038 1, 2, 3, 9, 10, or 13), are labeled filtered.
1039
1040 -sW (TCP Window scan)
1041 Window scan is exactly the same as ACK scan except that it exploits
1042 an implementation detail of certain systems to differentiate open
1043 ports from closed ones, rather than always printing unfiltered when
1044 a RST is returned. It does this by examining the TCP Window field
1045 of the RST packets returned. On some systems, open ports use a
1046 positive window size (even for RST packets) while closed ones have
1047 a zero window. So instead of always listing a port as unfiltered
1048 when it receives a RST back, Window scan lists the port as open or
1049 closed if the TCP Window value in that reset is positive or zero,
1050 respectively.
1051
1052 This scan relies on an implementation detail of a minority of
1053 systems out on the Internet, so you can't always trust it. Systems
1054 that don't support it will usually return all ports closed. Of
1055 course, it is possible that the machine really has no open ports.
1056 If most scanned ports are closed but a few common port numbers
1057 (such as 22, 25, 53) are filtered, the system is most likely
1058 susceptible. Occasionally, systems will even show the exact
1059 opposite behavior. If your scan shows 1,000 open ports and three
1060 closed or filtered ports, then those three may very well be the
1061 truly open ones.
1062
1063 -sM (TCP Maimon scan)
1064 The Maimon scan is named after its discoverer, Uriel Maimon. He
1065 described the technique in Phrack Magazine issue #49 (November
1066 1996). Nmap, which included this technique, was released two
1067 issues later. This technique is exactly the same as NULL, FIN, and
1068 Xmas scans, except that the probe is FIN/ACK. According to RFC
1069 793[7] (TCP), a RST packet should be generated in response to such
1070 a probe whether the port is open or closed. However, Uriel noticed
1071 that many BSD-derived systems simply drop the packet if the port is
1072 open.
1073
1074 --scanflags (Custom TCP scan)
1075 Truly advanced Nmap users need not limit themselves to the canned
1076 scan types offered. The --scanflags option allows you to design
1077 your own scan by specifying arbitrary TCP flags. Let your creative
1078 juices flow, while evading intrusion detection systems whose
1079 vendors simply paged through the Nmap man page adding specific
1080 rules!
1081
1082 The --scanflags argument can be a numerical flag value such as 9
1083 (PSH and FIN), but using symbolic names is easier. Just mash
1084 together any combination of URG, ACK, PSH, RST, SYN, and FIN. For
1085 example, --scanflags URGACKPSHRSTSYNFIN sets everything, though
1086 it's not very useful for scanning. The order these are specified in
1087 is irrelevant.
1088
1089 In addition to specifying the desired flags, you can specify a TCP
1090 scan type (such as -sA or -sF). That base type tells Nmap how to
1091 interpret responses. For example, a SYN scan considers no-response
1092 to indicate a filtered port, while a FIN scan treats the same as
1093 open|filtered. Nmap will behave the same way it does for the base
1094 scan type, except that it will use the TCP flags you specify
1095 instead. If you don't specify a base type, SYN scan is used.
1096
1097 -sZ (SCTP COOKIE ECHO scan)
1098 SCTP COOKIE ECHO scan is a more advanced SCTP scan. It takes
1099 advantage of the fact that SCTP implementations should silently
1100 drop packets containing COOKIE ECHO chunks on open ports, but send
1101 an ABORT if the port is closed. The advantage of this scan type is
1102 that it is not as obvious a port scan than an INIT scan. Also,
1103 there may be non-stateful firewall rulesets blocking INIT chunks,
1104 but not COOKIE ECHO chunks. Don't be fooled into thinking that this
1105 will make a port scan invisible; a good IDS will be able to detect
1106 SCTP COOKIE ECHO scans too. The downside is that SCTP COOKIE ECHO
1107 scans cannot differentiate between open and filtered ports, leaving
1108 you with the state open|filtered in both cases.
1109
1110 -sI zombie host[:probeport] (idle scan)
1111 This advanced scan method allows for a truly blind TCP port scan of
1112 the target (meaning no packets are sent to the target from your
1113 real IP address). Instead, a unique side-channel attack exploits
1114 predictable IP fragmentation ID sequence generation on the zombie
1115 host to glean information about the open ports on the target. IDS
1116 systems will display the scan as coming from the zombie machine you
1117 specify (which must be up and meet certain criteria). This
1118 fascinating scan type is too complex to fully describe in this
1119 reference guide, so I wrote and posted an informal paper with full
1120 details at https://nmap.org/book/idlescan.html.
1121
1122 Besides being extraordinarily stealthy (due to its blind nature),
1123 this scan type permits mapping out IP-based trust relationships
1124 between machines. The port listing shows open ports from the
1125 perspective of the zombie host. So you can try scanning a target
1126 using various zombies that you think might be trusted (via
1127 router/packet filter rules).
1128
1129 You can add a colon followed by a port number to the zombie host if
1130 you wish to probe a particular port on the zombie for IP ID
1131 changes. Otherwise Nmap will use the port it uses by default for
1132 TCP pings (80).
1133
1134 -sO (IP protocol scan)
1135 IP protocol scan allows you to determine which IP protocols (TCP,
1136 ICMP, IGMP, etc.) are supported by target machines. This isn't
1137 technically a port scan, since it cycles through IP protocol
1138 numbers rather than TCP or UDP port numbers. Yet it still uses the
1139 -p option to select scanned protocol numbers, reports its results
1140 within the normal port table format, and even uses the same
1141 underlying scan engine as the true port scanning methods. So it is
1142 close enough to a port scan that it belongs here.
1143
1144 Besides being useful in its own right, protocol scan demonstrates
1145 the power of open-source software. While the fundamental idea is
1146 pretty simple, I had not thought to add it nor received any
1147 requests for such functionality. Then in the summer of 2000,
1148 Gerhard Rieger conceived the idea, wrote an excellent patch
1149 implementing it, and sent it to the announce mailing list (then
1150 called nmap-hackers). I incorporated that patch into the Nmap tree
1151 and released a new version the next day. Few pieces of commercial
1152 software have users enthusiastic enough to design and contribute
1153 their own improvements!
1154
1155 Protocol scan works in a similar fashion to UDP scan. Instead of
1156 iterating through the port number field of a UDP packet, it sends
1157 IP packet headers and iterates through the eight-bit IP protocol
1158 field. The headers are usually empty, containing no data and not
1159 even the proper header for the claimed protocol. The exceptions are
1160 TCP, UDP, ICMP, SCTP, and IGMP. A proper protocol header for those
1161 is included since some systems won't send them otherwise and
1162 because Nmap already has functions to create them. Instead of
1163 watching for ICMP port unreachable messages, protocol scan is on
1164 the lookout for ICMP protocol unreachable messages. If Nmap
1165 receives any response in any protocol from the target host, Nmap
1166 marks that protocol as open. An ICMP protocol unreachable error
1167 (type 3, code 2) causes the protocol to be marked as closed while
1168 port unreachable (type 3, code 3) marks the protocol open. Other
1169 ICMP unreachable errors (type 3, code 0, 1, 9, 10, or 13) cause the
1170 protocol to be marked filtered (though they prove that ICMP is open
1171 at the same time). If no response is received after
1172 retransmissions, the protocol is marked open|filtered
1173
1174 -b FTP relay host (FTP bounce scan)
1175 An interesting feature of the FTP protocol (RFC 959[8]) is support
1176 for so-called proxy FTP connections. This allows a user to connect
1177 to one FTP server, then ask that files be sent to a third-party
1178 server. Such a feature is ripe for abuse on many levels, so most
1179 servers have ceased supporting it. One of the abuses this feature
1180 allows is causing the FTP server to port scan other hosts. Simply
1181 ask the FTP server to send a file to each interesting port of a
1182 target host in turn. The error message will describe whether the
1183 port is open or not. This is a good way to bypass firewalls because
1184 organizational FTP servers are often placed where they have more
1185 access to other internal hosts than any old Internet host would.
1186 Nmap supports FTP bounce scan with the -b option. It takes an
1187 argument of the form username:password@server:port. Server is the
1188 name or IP address of a vulnerable FTP server. As with a normal
1189 URL, you may omit username:password, in which case anonymous login
1190 credentials (user: anonymous password:-wwwuser@) are used. The port
1191 number (and preceding colon) may be omitted as well, in which case
1192 the default FTP port (21) on server is used.
1193
1194 This vulnerability was widespread in 1997 when Nmap was released,
1195 but has largely been fixed. Vulnerable servers are still around, so
1196 it is worth trying when all else fails. If bypassing a firewall is
1197 your goal, scan the target network for port 21 (or even for any FTP
1198 services if you scan all ports with version detection) and use the
1199 ftp-bounce NSE script. Nmap will tell you whether the host is
1200 vulnerable or not. If you are just trying to cover your tracks, you
1201 don't need to (and, in fact, shouldn't) limit yourself to hosts on
1202 the target network. Before you go scanning random Internet
1203 addresses for vulnerable FTP servers, consider that sysadmins may
1204 not appreciate you abusing their servers in this way.
1205
1207 In addition to all of the scan methods discussed previously, Nmap
1208 offers options for specifying which ports are scanned and whether the
1209 scan order is randomized or sequential. By default, Nmap scans the most
1210 common 1,000 ports for each protocol.
1211
1212
1213 -p port ranges (Only scan specified ports)
1214 This option specifies which ports you want to scan and overrides
1215 the default. Individual port numbers are OK, as are ranges
1216 separated by a hyphen (e.g. 1-1023). The beginning and/or end
1217 values of a range may be omitted, causing Nmap to use 1 and 65535,
1218 respectively. So you can specify -p- to scan ports from 1 through
1219 65535. Scanning port zero is allowed if you specify it explicitly.
1220 For IP protocol scanning (-sO), this option specifies the protocol
1221 numbers you wish to scan for (0–255).
1222
1223 When scanning a combination of protocols (e.g. TCP and UDP), you
1224 can specify a particular protocol by preceding the port numbers by
1225 T: for TCP, U: for UDP, S: for SCTP, or P: for IP Protocol. The
1226 qualifier lasts until you specify another qualifier. For example,
1227 the argument -p U:53,111,137,T:21-25,80,139,8080 would scan UDP
1228 ports 53, 111,and 137, as well as the listed TCP ports. Note that
1229 to scan both UDP and TCP, you have to specify -sU and at least one
1230 TCP scan type (such as -sS, -sF, or -sT). If no protocol qualifier
1231 is given, the port numbers are added to all protocol lists. Ports
1232 can also be specified by name according to what the port is
1233 referred to in the nmap-services. You can even use the wildcards *
1234 and ? with the names. For example, to scan FTP and all ports whose
1235 names begin with “http”, use -p ftp,http*. Be careful about shell
1236 expansions and quote the argument to -p if unsure.
1237
1238 Ranges of ports can be surrounded by square brackets to indicate
1239 ports inside that range that appear in nmap-services. For example,
1240 the following will scan all ports in nmap-services equal to or
1241 below 1024: -p [-1024]. Be careful with shell expansions and quote
1242 the argument to -p if unsure.
1243
1244 --exclude-ports port ranges (Exclude the specified ports from scanning)
1245 This option specifies which ports you do want Nmap to exclude from
1246 scanning. The port ranges are specified similar to -p. For IP
1247 protocol scanning (-sO), this option specifies the protocol numbers
1248 you wish to exclude (0–255).
1249
1250 When ports are asked to be excluded, they are excluded from all
1251 types of scans (i.e. they will not be scanned under any
1252 circumstances). This also includes the discovery phase.
1253
1254 -F (Fast (limited port) scan)
1255 Specifies that you wish to scan fewer ports than the default.
1256 Normally Nmap scans the most common 1,000 ports for each scanned
1257 protocol. With -F, this is reduced to 100.
1258
1259 Nmap needs an nmap-services file with frequency information in
1260 order to know which ports are the most common. If port frequency
1261 information isn't available, perhaps because of the use of a custom
1262 nmap-services file, Nmap scans all named ports plus ports 1-1024.
1263 In that case, -F means to scan only ports that are named in the
1264 services file.
1265
1266 -r (Don't randomize ports)
1267 By default, Nmap randomizes the scanned port order (except that
1268 certain commonly accessible ports are moved near the beginning for
1269 efficiency reasons). This randomization is normally desirable, but
1270 you can specify -r for sequential (sorted from lowest to highest)
1271 port scanning instead.
1272
1273 --port-ratio ratio<decimal number between 0 and 1>
1274 Scans all ports in nmap-services file with a ratio greater than the
1275 one given. ratio must be between 0.0 and 1.0.
1276
1277 --top-ports n
1278 Scans the n highest-ratio ports found in nmap-services file after
1279 excluding all ports specified by --exclude-ports. n must be 1 or
1280 greater.
1281
1283 Point Nmap at a remote machine and it might tell you that ports 25/tcp,
1284 80/tcp, and 53/udp are open. Using its nmap-services database of about
1285 2,200 well-known services, Nmap would report that those ports probably
1286 correspond to a mail server (SMTP), web server (HTTP), and name server
1287 (DNS) respectively. This lookup is usually accurate—the vast majority
1288 of daemons listening on TCP port 25 are, in fact, mail servers.
1289 However, you should not bet your security on this! People can and do
1290 run services on strange ports.
1291
1292 Even if Nmap is right, and the hypothetical server above is running
1293 SMTP, HTTP, and DNS servers, that is not a lot of information. When
1294 doing vulnerability assessments (or even simple network inventories) of
1295 your companies or clients, you really want to know which mail and DNS
1296 servers and versions are running. Having an accurate version number
1297 helps dramatically in determining which exploits a server is vulnerable
1298 to. Version detection helps you obtain this information.
1299
1300 After TCP and/or UDP ports are discovered using one of the other scan
1301 methods, version detection interrogates those ports to determine more
1302 about what is actually running. The nmap-service-probes database
1303 contains probes for querying various services and match expressions to
1304 recognize and parse responses. Nmap tries to determine the service
1305 protocol (e.g. FTP, SSH, Telnet, HTTP), the application name (e.g. ISC
1306 BIND, Apache httpd, Solaris telnetd), the version number, hostname,
1307 device type (e.g. printer, router), the OS family (e.g. Windows,
1308 Linux). When possible, Nmap also gets the Common Platform Enumeration
1309 (CPE) representation of this information. Sometimes miscellaneous
1310 details like whether an X server is open to connections, the SSH
1311 protocol version, or the KaZaA user name, are available. Of course,
1312 most services don't provide all of this information. If Nmap was
1313 compiled with OpenSSL support, it will connect to SSL servers to deduce
1314 the service listening behind that encryption layer. Some UDP ports are
1315 left in the open|filtered state after a UDP port scan is unable to
1316 determine whether the port is open or filtered. Version detection will
1317 try to elicit a response from these ports (just as it does with open
1318 ports), and change the state to open if it succeeds. open|filtered TCP
1319 ports are treated the same way. Note that the Nmap -A option enables
1320 version detection among other things. A paper documenting the
1321 workings, usage, and customization of version detection is available at
1322 https://nmap.org/book/vscan.html.
1323
1324 When RPC services are discovered, the Nmap RPC grinder is automatically
1325 used to determine the RPC program and version numbers. It takes all the
1326 TCP/UDP ports detected as RPC and floods them with SunRPC program NULL
1327 commands in an attempt to determine whether they are RPC ports, and if
1328 so, what program and version number they serve up. Thus you can
1329 effectively obtain the same info as rpcinfo -p even if the target's
1330 portmapper is behind a firewall (or protected by TCP wrappers). Decoys
1331 do not currently work with RPC scan.
1332
1333 When Nmap receives responses from a service but cannot match them to
1334 its database, it prints out a special fingerprint and a URL for you to
1335 submit it to if you know for sure what is running on the port. Please
1336 take a couple minutes to make the submission so that your find can
1337 benefit everyone. Thanks to these submissions, Nmap has about 6,500
1338 pattern matches for more than 650 protocols such as SMTP, FTP, HTTP,
1339 etc.
1340
1341 Version detection is enabled and controlled with the following options:
1342
1343 -sV (Version detection)
1344 Enables version detection, as discussed above. Alternatively, you
1345 can use -A, which enables version detection among other things.
1346
1347 -sR is an alias for -sV. Prior to March 2011, it was used to active
1348 the RPC grinder separately from version detection, but now these
1349 options are always combined.
1350
1351 --allports (Don't exclude any ports from version detection)
1352 By default, Nmap version detection skips TCP port 9100 because some
1353 printers simply print anything sent to that port, leading to dozens
1354 of pages of HTTP GET requests, binary SSL session requests, etc.
1355 This behavior can be changed by modifying or removing the Exclude
1356 directive in nmap-service-probes, or you can specify --allports to
1357 scan all ports regardless of any Exclude directive.
1358
1359 --version-intensity intensity (Set version scan intensity)
1360 When performing a version scan (-sV), Nmap sends a series of
1361 probes, each of which is assigned a rarity value between one and
1362 nine. The lower-numbered probes are effective against a wide
1363 variety of common services, while the higher-numbered ones are
1364 rarely useful. The intensity level specifies which probes should be
1365 applied. The higher the number, the more likely it is the service
1366 will be correctly identified. However, high intensity scans take
1367 longer. The intensity must be between 0 and 9. The default is 7.
1368 When a probe is registered to the target port via the
1369 nmap-service-probes ports directive, that probe is tried regardless
1370 of intensity level. This ensures that the DNS probes will always be
1371 attempted against any open port 53, the SSL probe will be done
1372 against 443, etc.
1373
1374 --version-light (Enable light mode)
1375 This is a convenience alias for --version-intensity 2. This light
1376 mode makes version scanning much faster, but it is slightly less
1377 likely to identify services.
1378
1379 --version-all (Try every single probe)
1380 An alias for --version-intensity 9, ensuring that every single
1381 probe is attempted against each port.
1382
1383 --version-trace (Trace version scan activity)
1384 This causes Nmap to print out extensive debugging info about what
1385 version scanning is doing. It is a subset of what you get with
1386 --packet-trace.
1387
1389 One of Nmap's best-known features is remote OS detection using TCP/IP
1390 stack fingerprinting. Nmap sends a series of TCP and UDP packets to the
1391 remote host and examines practically every bit in the responses. After
1392 performing dozens of tests such as TCP ISN sampling, TCP options
1393 support and ordering, IP ID sampling, and the initial window size
1394 check, Nmap compares the results to its nmap-os-db database of more
1395 than 2,600 known OS fingerprints and prints out the OS details if there
1396 is a match. Each fingerprint includes a freeform textual description of
1397 the OS, and a classification which provides the vendor name (e.g. Sun),
1398 underlying OS (e.g. Solaris), OS generation (e.g. 10), and device type
1399 (general purpose, router, switch, game console, etc). Most fingerprints
1400 also have a Common Platform Enumeration (CPE) representation, like
1401 cpe:/o:linux:linux_kernel:2.6.
1402
1403 If Nmap is unable to guess the OS of a machine, and conditions are good
1404 (e.g. at least one open port and one closed port were found), Nmap will
1405 provide a URL you can use to submit the fingerprint if you know (for
1406 sure) the OS running on the machine. By doing this you contribute to
1407 the pool of operating systems known to Nmap and thus it will be more
1408 accurate for everyone.
1409
1410 OS detection enables some other tests which make use of information
1411 that is gathered during the process anyway. One of these is TCP
1412 Sequence Predictability Classification. This measures approximately how
1413 hard it is to establish a forged TCP connection against the remote
1414 host. It is useful for exploiting source-IP based trust relationships
1415 (rlogin, firewall filters, etc) or for hiding the source of an attack.
1416 This sort of spoofing is rarely performed any more, but many machines
1417 are still vulnerable to it. The actual difficulty number is based on
1418 statistical sampling and may fluctuate. It is generally better to use
1419 the English classification such as “worthy challenge” or “trivial
1420 joke”. This is only reported in normal output in verbose (-v) mode.
1421 When verbose mode is enabled along with -O, IP ID sequence generation
1422 is also reported. Most machines are in the “incremental” class, which
1423 means that they increment the ID field in the IP header for each packet
1424 they send. This makes them vulnerable to several advanced information
1425 gathering and spoofing attacks.
1426
1427 Another bit of extra information enabled by OS detection is a guess at
1428 a target's uptime. This uses the TCP timestamp option (RFC 1323[9]) to
1429 guess when a machine was last rebooted. The guess can be inaccurate due
1430 to the timestamp counter not being initialized to zero or the counter
1431 overflowing and wrapping around, so it is printed only in verbose mode.
1432
1433 A paper documenting the workings, usage, and customization of OS
1434 detection is available at https://nmap.org/book/osdetect.html.
1435
1436 OS detection is enabled and controlled with the following options:
1437
1438 -O (Enable OS detection)
1439 Enables OS detection, as discussed above. Alternatively, you can
1440 use -A to enable OS detection along with other things.
1441
1442 --osscan-limit (Limit OS detection to promising targets)
1443 OS detection is far more effective if at least one open and one
1444 closed TCP port are found. Set this option and Nmap will not even
1445 try OS detection against hosts that do not meet this criteria. This
1446 can save substantial time, particularly on -Pn scans against many
1447 hosts. It only matters when OS detection is requested with -O or
1448 -A.
1449
1450 --osscan-guess; --fuzzy (Guess OS detection results)
1451 When Nmap is unable to detect a perfect OS match, it sometimes
1452 offers up near-matches as possibilities. The match has to be very
1453 close for Nmap to do this by default. Either of these (equivalent)
1454 options make Nmap guess more aggressively. Nmap will still tell you
1455 when an imperfect match is printed and display its confidence level
1456 (percentage) for each guess.
1457
1458 --max-os-tries (Set the maximum number of OS detection tries against a
1459 target)
1460 When Nmap performs OS detection against a target and fails to find
1461 a perfect match, it usually repeats the attempt. By default, Nmap
1462 tries five times if conditions are favorable for OS fingerprint
1463 submission, and twice when conditions aren't so good. Specifying a
1464 lower --max-os-tries value (such as 1) speeds Nmap up, though you
1465 miss out on retries which could potentially identify the OS.
1466 Alternatively, a high value may be set to allow even more retries
1467 when conditions are favorable. This is rarely done, except to
1468 generate better fingerprints for submission and integration into
1469 the Nmap OS database.
1470
1472 The Nmap Scripting Engine (NSE) is one of Nmap's most powerful and
1473 flexible features. It allows users to write (and share) simple scripts
1474 (using the Lua programming language[10]
1475
1476 ) to automate a wide variety of networking tasks. Those scripts are
1477 executed in parallel with the speed and efficiency you expect from
1478 Nmap. Users can rely on the growing and diverse set of scripts
1479 distributed with Nmap, or write their own to meet custom needs.
1480
1481 Tasks we had in mind when creating the system include network
1482 discovery, more sophisticated version detection, vulnerability
1483 detection. NSE can even be used for vulnerability exploitation.
1484
1485 To reflect those different uses and to simplify the choice of which
1486 scripts to run, each script contains a field associating it with one or
1487 more categories. Currently defined categories are auth, broadcast,
1488 default. discovery, dos, exploit, external, fuzzer, intrusive,
1489 malware, safe, version, and vuln. These are all described at
1490 https://nmap.org/book/nse-usage.html#nse-categories.
1491
1492 Scripts are not run in a sandbox and thus could accidentally or
1493 maliciously damage your system or invade your privacy. Never run
1494 scripts from third parties unless you trust the authors or have
1495 carefully audited the scripts yourself.
1496
1497 The Nmap Scripting Engine is described in detail at
1498 https://nmap.org/book/nse.html
1499
1500 and is controlled by the following options:
1501
1502 -sC
1503 Performs a script scan using the default set of scripts. It is
1504 equivalent to --script=default. Some of the scripts in this
1505 category are considered intrusive and should not be run against a
1506 target network without permission.
1507
1508 --script filename|category|directory/|expression[,...]
1509 Runs a script scan using the comma-separated list of filenames,
1510 script categories, and directories. Each element in the list may
1511 also be a Boolean expression describing a more complex set of
1512 scripts. Each element is interpreted first as an expression, then
1513 as a category, and finally as a file or directory name.
1514
1515 There are two special features for advanced users only. One is to
1516 prefix script names and expressions with + to force them to run
1517 even if they normally wouldn't (e.g. the relevant service wasn't
1518 detected on the target port). The other is that the argument all
1519 may be used to specify every script in Nmap's database. Be cautious
1520 with this because NSE contains dangerous scripts such as exploits,
1521 brute force authentication crackers, and denial of service attacks.
1522
1523 File and directory names may be relative or absolute. Absolute
1524 names are used directly. Relative paths are looked for in the
1525 scripts of each of the following places until found:
1526 --datadir
1527 $NMAPDIR
1528 ~/.nmap (not searched on Windows)
1529 APPDATA\nmap (only on Windows)
1530 the directory containing the nmap executable
1531 the directory containing the nmap executable, followed by
1532 ../share/nmap (not searched on Windows)
1533 NMAPDATADIR (not searched on Windows)
1534 the current directory.
1535
1536 When a directory name ending in / is given, Nmap loads every file
1537 in the directory whose name ends with .nse. All other files are
1538 ignored and directories are not searched recursively. When a
1539 filename is given, it does not have to have the .nse extension; it
1540 will be added automatically if necessary. Nmap scripts are stored
1541 in a scripts subdirectory of the Nmap data directory by default
1542 (see https://nmap.org/book/data-files.html).
1543
1544 For efficiency, scripts are indexed in a database stored in
1545 scripts/script.db, which lists the category or categories in which
1546 each script belongs. When referring to scripts from script.db by
1547 name, you can use a shell-style ‘*’ wildcard.
1548
1549 nmap --script "http-*"
1550 Loads all scripts whose name starts with http-, such as
1551 http-auth and http-open-proxy. The argument to --script had to
1552 be in quotes to protect the wildcard from the shell.
1553
1554 More complicated script selection can be done using the and, or,
1555 and not operators to build Boolean expressions. The operators have
1556 the same precedence[11] as in Lua: not is the highest, followed by
1557 and and then or. You can alter precedence by using parentheses.
1558 Because expressions contain space characters it is necessary to
1559 quote them.
1560
1561 nmap --script "not intrusive"
1562 Loads every script except for those in the intrusive category.
1563
1564 nmap --script "default or safe"
1565 This is functionally equivalent to nmap --script
1566 "default,safe". It loads all scripts that are in the default
1567 category or the safe category or both.
1568
1569 nmap --script "default and safe"
1570 Loads those scripts that are in both the default and safe
1571 categories.
1572
1573 nmap --script "(default or safe or intrusive) and not http-*"
1574 Loads scripts in the default, safe, or intrusive categories,
1575 except for those whose names start with http-.
1576
1577 --script-args n1=v1,n2={n3=v3},n4={v4,v5}
1578 Lets you provide arguments to NSE scripts. Arguments are a
1579 comma-separated list of name=value pairs. Names and values may be
1580 strings not containing whitespace or the characters ‘{’, ‘}’, ‘=’,
1581 or ‘,’. To include one of these characters in a string, enclose the
1582 string in single or double quotes. Within a quoted string, ‘\’
1583 escapes a quote. A backslash is only used to escape quotation marks
1584 in this special case; in all other cases a backslash is interpreted
1585 literally. Values may also be tables enclosed in {}, just as in
1586 Lua. A table may contain simple string values or more name-value
1587 pairs, including nested tables. Many scripts qualify their
1588 arguments with the script name, as in xmpp-info.server_name. You
1589 may use that full qualified version to affect just the specified
1590 script, or you may pass the unqualified version (server_name in
1591 this case) to affect all scripts using that argument name. A script
1592 will first check for its fully qualified argument name (the name
1593 specified in its documentation) before it accepts an unqualified
1594 argument name. A complex example of script arguments is
1595 --script-args
1596 'user=foo,pass=",{}=bar",whois={whodb=nofollow+ripe},xmpp-info.server_name=localhost'.
1597 The online NSE Documentation Portal at https://nmap.org/nsedoc/
1598 lists the arguments that each script accepts.
1599
1600 --script-args-file filename
1601 Lets you load arguments to NSE scripts from a file. Any arguments
1602 on the command line supersede ones in the file. The file can be an
1603 absolute path, or a path relative to Nmap's usual search path
1604 (NMAPDIR, etc.) Arguments can be comma-separated or
1605 newline-separated, but otherwise follow the same rules as for
1606 --script-args, without requiring special quoting and escaping,
1607 since they are not parsed by the shell.
1608
1609 --script-help filename|category|directory|expression|all[,...]
1610 Shows help about scripts. For each script matching the given
1611 specification, Nmap prints the script name, its categories, and its
1612 description. The specifications are the same as those accepted by
1613 --script; so for example if you want help about the ftp-anon
1614 script, you would run nmap --script-help ftp-anon. In addition to
1615 getting help for individual scripts, you can use this as a preview
1616 of what scripts will be run for a specification, for example with
1617 nmap --script-help default.
1618
1619 --script-trace
1620 This option does what --packet-trace does, just one ISO layer
1621 higher. If this option is specified all incoming and outgoing
1622 communication performed by a script is printed. The displayed
1623 information includes the communication protocol, the source, the
1624 target and the transmitted data. If more than 5% of all transmitted
1625 data is not printable, then the trace output is in a hex dump
1626 format. Specifying --packet-trace enables script tracing too.
1627
1628 --script-updatedb
1629 This option updates the script database found in scripts/script.db
1630 which is used by Nmap to determine the available default scripts
1631 and categories. It is only necessary to update the database if you
1632 have added or removed NSE scripts from the default scripts
1633 directory or if you have changed the categories of any script. This
1634 option is generally used by itself: nmap --script-updatedb.
1635
1637 One of my highest Nmap development priorities has always been
1638 performance. A default scan (nmap hostname) of a host on my local
1639 network takes a fifth of a second. That is barely enough time to blink,
1640 but adds up when you are scanning hundreds or thousands of hosts.
1641 Moreover, certain scan options such as UDP scanning and version
1642 detection can increase scan times substantially. So can certain
1643 firewall configurations, particularly response rate limiting. While
1644 Nmap utilizes parallelism and many advanced algorithms to accelerate
1645 these scans, the user has ultimate control over how Nmap runs. Expert
1646 users carefully craft Nmap commands to obtain only the information they
1647 care about while meeting their time constraints.
1648
1649 Techniques for improving scan times include omitting non-critical
1650 tests, and upgrading to the latest version of Nmap (performance
1651 enhancements are made frequently). Optimizing timing parameters can
1652 also make a substantial difference. Those options are listed below.
1653
1654 Some options accept a time parameter. This is specified in seconds by
1655 default, though you can append ‘ms’, ‘s’, ‘m’, or ‘h’ to the value to
1656 specify milliseconds, seconds, minutes, or hours. So the --host-timeout
1657 arguments 900000ms, 900, 900s, and 15m all do the same thing.
1658
1659 --min-hostgroup numhosts; --max-hostgroup numhosts (Adjust parallel
1660 scan group sizes)
1661 Nmap has the ability to port scan or version scan multiple hosts in
1662 parallel. Nmap does this by dividing the target IP space into
1663 groups and then scanning one group at a time. In general, larger
1664 groups are more efficient. The downside is that host results can't
1665 be provided until the whole group is finished. So if Nmap started
1666 out with a group size of 50, the user would not receive any reports
1667 (except for the updates offered in verbose mode) until the first 50
1668 hosts are completed.
1669
1670 By default, Nmap takes a compromise approach to this conflict. It
1671 starts out with a group size as low as five so the first results
1672 come quickly and then increases the groupsize to as high as 1024.
1673 The exact default numbers depend on the options given. For
1674 efficiency reasons, Nmap uses larger group sizes for UDP or
1675 few-port TCP scans.
1676
1677 When a maximum group size is specified with --max-hostgroup, Nmap
1678 will never exceed that size. Specify a minimum size with
1679 --min-hostgroup and Nmap will try to keep group sizes above that
1680 level. Nmap may have to use smaller groups than you specify if
1681 there are not enough target hosts left on a given interface to
1682 fulfill the specified minimum. Both may be set to keep the group
1683 size within a specific range, though this is rarely desired.
1684
1685 These options do not have an effect during the host discovery phase
1686 of a scan. This includes plain ping scans (-sn). Host discovery
1687 always works in large groups of hosts to improve speed and
1688 accuracy.
1689
1690 The primary use of these options is to specify a large minimum
1691 group size so that the full scan runs more quickly. A common choice
1692 is 256 to scan a network in /24 sized chunks. For a scan with many
1693 ports, exceeding that number is unlikely to help much. For scans of
1694 just a few port numbers, host group sizes of 2048 or more may be
1695 helpful.
1696
1697 --min-parallelism numprobes; --max-parallelism numprobes (Adjust probe
1698 parallelization)
1699 These options control the total number of probes that may be
1700 outstanding for a host group. They are used for port scanning and
1701 host discovery. By default, Nmap calculates an ever-changing ideal
1702 parallelism based on network performance. If packets are being
1703 dropped, Nmap slows down and allows fewer outstanding probes. The
1704 ideal probe number slowly rises as the network proves itself
1705 worthy. These options place minimum or maximum bounds on that
1706 variable. By default, the ideal parallelism can drop to one if the
1707 network proves unreliable and rise to several hundred in perfect
1708 conditions.
1709
1710 The most common usage is to set --min-parallelism to a number
1711 higher than one to speed up scans of poorly performing hosts or
1712 networks. This is a risky option to play with, as setting it too
1713 high may affect accuracy. Setting this also reduces Nmap's ability
1714 to control parallelism dynamically based on network conditions. A
1715 value of 10 might be reasonable, though I only adjust this value as
1716 a last resort.
1717
1718 The --max-parallelism option is sometimes set to one to prevent
1719 Nmap from sending more than one probe at a time to hosts. The
1720 --scan-delay option, discussed later, is another way to do this.
1721
1722 --min-rtt-timeout time, --max-rtt-timeout time, --initial-rtt-timeout
1723 time (Adjust probe timeouts)
1724 Nmap maintains a running timeout value for determining how long it
1725 will wait for a probe response before giving up or retransmitting
1726 the probe. This is calculated based on the response times of
1727 previous probes.
1728
1729 If the network latency shows itself to be significant and variable,
1730 this timeout can grow to several seconds. It also starts at a
1731 conservative (high) level and may stay that way for a while when
1732 Nmap scans unresponsive hosts.
1733
1734 Specifying a lower --max-rtt-timeout and --initial-rtt-timeout than
1735 the defaults can cut scan times significantly. This is particularly
1736 true for pingless (-Pn) scans, and those against heavily filtered
1737 networks. Don't get too aggressive though. The scan can end up
1738 taking longer if you specify such a low value that many probes are
1739 timing out and retransmitting while the response is in transit.
1740
1741 If all the hosts are on a local network, 100 milliseconds
1742 (--max-rtt-timeout 100ms) is a reasonable aggressive value. If
1743 routing is involved, ping a host on the network first with the ICMP
1744 ping utility, or with a custom packet crafter such as Nping that is
1745 more likely to get through a firewall. Look at the maximum round
1746 trip time out of ten packets or so. You might want to double that
1747 for the --initial-rtt-timeout and triple or quadruple it for the
1748 --max-rtt-timeout. I generally do not set the maximum RTT below
1749 100 ms, no matter what the ping times are. Nor do I exceed 1000 ms.
1750
1751 --min-rtt-timeout is a rarely used option that could be useful when
1752 a network is so unreliable that even Nmap's default is too
1753 aggressive. Since Nmap only reduces the timeout down to the minimum
1754 when the network seems to be reliable, this need is unusual and
1755 should be reported as a bug to the nmap-dev mailing list.
1756
1757 --max-retries numtries (Specify the maximum number of port scan probe
1758 retransmissions)
1759 When Nmap receives no response to a port scan probe, it could mean
1760 the port is filtered. Or maybe the probe or response was simply
1761 lost on the network. It is also possible that the target host has
1762 rate limiting enabled that temporarily blocked the response. So
1763 Nmap tries again by retransmitting the initial probe. If Nmap
1764 detects poor network reliability, it may try many more times before
1765 giving up on a port. While this benefits accuracy, it also
1766 lengthens scan times. When performance is critical, scans may be
1767 sped up by limiting the number of retransmissions allowed. You can
1768 even specify --max-retries 0 to prevent any retransmissions, though
1769 that is only recommended for situations such as informal surveys
1770 where occasional missed ports and hosts are acceptable.
1771
1772 The default (with no -T template) is to allow ten retransmissions.
1773 If a network seems reliable and the target hosts aren't rate
1774 limiting, Nmap usually only does one retransmission. So most target
1775 scans aren't even affected by dropping --max-retries to a low value
1776 such as three. Such values can substantially speed scans of slow
1777 (rate limited) hosts. You usually lose some information when Nmap
1778 gives up on ports early, though that may be preferable to letting
1779 the --host-timeout expire and losing all information about the
1780 target.
1781
1782 --host-timeout time (Give up on slow target hosts)
1783 Some hosts simply take a long time to scan. This may be due to
1784 poorly performing or unreliable networking hardware or software,
1785 packet rate limiting, or a restrictive firewall. The slowest few
1786 percent of the scanned hosts can eat up a majority of the scan
1787 time. Sometimes it is best to cut your losses and skip those hosts
1788 initially. Specify --host-timeout with the maximum amount of time
1789 you are willing to wait. For example, specify 30m to ensure that
1790 Nmap doesn't waste more than half an hour on a single host. Note
1791 that Nmap may be scanning other hosts at the same time during that
1792 half an hour, so it isn't a complete loss. A host that times out is
1793 skipped. No port table, OS detection, or version detection results
1794 are printed for that host.
1795
1796 --script-timeout time
1797 While some scripts complete in fractions of a second, others can
1798 take hours or more depending on the nature of the script, arguments
1799 passed in, network and application conditions, and more. The
1800 --script-timeout option sets a ceiling on script execution time.
1801 Any script instance which exceeds that time will be terminated and
1802 no output will be shown. If debugging (-d) is enabled, Nmap will
1803 report on each timeout. For host and service scripts, a script
1804 instance only scans a single target host or port and the timeout
1805 period will be reset for the next instance.
1806
1807 --scan-delay time; --max-scan-delay time (Adjust delay between probes)
1808 This option causes Nmap to wait at least the given amount of time
1809 between each probe it sends to a given host. This is particularly
1810 useful in the case of rate limiting. Solaris machines (among many
1811 others) will usually respond to UDP scan probe packets with only
1812 one ICMP message per second. Any more than that sent by Nmap will
1813 be wasteful. A --scan-delay of 1s will keep Nmap at that slow rate.
1814 Nmap tries to detect rate limiting and adjust the scan delay
1815 accordingly, but it doesn't hurt to specify it explicitly if you
1816 already know what rate works best.
1817
1818 When Nmap adjusts the scan delay upward to cope with rate limiting,
1819 the scan slows down dramatically. The --max-scan-delay option
1820 specifies the largest delay that Nmap will allow. A low
1821 --max-scan-delay can speed up Nmap, but it is risky. Setting this
1822 value too low can lead to wasteful packet retransmissions and
1823 possible missed ports when the target implements strict rate
1824 limiting.
1825
1826 Another use of --scan-delay is to evade threshold based intrusion
1827 detection and prevention systems (IDS/IPS).
1828
1829 --min-rate number; --max-rate number (Directly control the scanning
1830 rate)
1831 Nmap's dynamic timing does a good job of finding an appropriate
1832 speed at which to scan. Sometimes, however, you may happen to know
1833 an appropriate scanning rate for a network, or you may have to
1834 guarantee that a scan will be finished by a certain time. Or
1835 perhaps you must keep Nmap from scanning too quickly. The
1836 --min-rate and --max-rate options are designed for these
1837 situations.
1838
1839 When the --min-rate option is given Nmap will do its best to send
1840 packets as fast as or faster than the given rate. The argument is a
1841 positive real number representing a packet rate in packets per
1842 second. For example, specifying --min-rate 300 means that Nmap will
1843 try to keep the sending rate at or above 300 packets per second.
1844 Specifying a minimum rate does not keep Nmap from going faster if
1845 conditions warrant.
1846
1847 Likewise, --max-rate limits a scan's sending rate to a given
1848 maximum. Use --max-rate 100, for example, to limit sending to 100
1849 packets per second on a fast network. Use --max-rate 0.1 for a slow
1850 scan of one packet every ten seconds. Use --min-rate and --max-rate
1851 together to keep the rate inside a certain range.
1852
1853 These two options are global, affecting an entire scan, not
1854 individual hosts. They only affect port scans and host discovery
1855 scans. Other features like OS detection implement their own timing.
1856
1857 There are two conditions when the actual scanning rate may fall
1858 below the requested minimum. The first is if the minimum is faster
1859 than the fastest rate at which Nmap can send, which is dependent on
1860 hardware. In this case Nmap will simply send packets as fast as
1861 possible, but be aware that such high rates are likely to cause a
1862 loss of accuracy. The second case is when Nmap has nothing to send,
1863 for example at the end of a scan when the last probes have been
1864 sent and Nmap is waiting for them to time out or be responded to.
1865 It's normal to see the scanning rate drop at the end of a scan or
1866 in between hostgroups. The sending rate may temporarily exceed the
1867 maximum to make up for unpredictable delays, but on average the
1868 rate will stay at or below the maximum.
1869
1870 Specifying a minimum rate should be done with care. Scanning faster
1871 than a network can support may lead to a loss of accuracy. In some
1872 cases, using a faster rate can make a scan take longer than it
1873 would with a slower rate. This is because Nmap's adaptive
1874 retransmission algorithms will detect the network congestion caused
1875 by an excessive scanning rate and increase the number of
1876 retransmissions in order to improve accuracy. So even though
1877 packets are sent at a higher rate, more packets are sent overall.
1878 Cap the number of retransmissions with the --max-retries option if
1879 you need to set an upper limit on total scan time.
1880
1881 --defeat-rst-ratelimit
1882 Many hosts have long used rate limiting to reduce the number of
1883 ICMP error messages (such as port-unreachable errors) they send.
1884 Some systems now apply similar rate limits to the RST (reset)
1885 packets they generate. This can slow Nmap down dramatically as it
1886 adjusts its timing to reflect those rate limits. You can tell Nmap
1887 to ignore those rate limits (for port scans such as SYN scan which
1888 don't treat non-responsive ports as open) by specifying
1889 --defeat-rst-ratelimit.
1890
1891 Using this option can reduce accuracy, as some ports will appear
1892 non-responsive because Nmap didn't wait long enough for a
1893 rate-limited RST response. With a SYN scan, the non-response
1894 results in the port being labeled filtered rather than the closed
1895 state we see when RST packets are received. This option is useful
1896 when you only care about open ports, and distinguishing between
1897 closed and filtered ports isn't worth the extra time.
1898
1899 --defeat-icmp-ratelimit
1900 Similar to --defeat-rst-ratelimit, the --defeat-icmp-ratelimit
1901 option trades accuracy for speed, increasing UDP scanning speed
1902 against hosts that rate-limit ICMP error messages. Because this
1903 option causes Nmap to not delay in order to receive the port
1904 unreachable messages, a non-responsive port will be labeled
1905 closed|filtered instead of the default open|filtered. This has the
1906 effect of only treating ports which actually respond via UDP as
1907 open. Since many UDP services do not respond in this way, the
1908 chance for inaccuracy is greater with this option than with
1909 --defeat-rst-ratelimit.
1910
1911 --nsock-engine epoll|kqueue|poll|select
1912 Enforce use of a given nsock IO multiplexing engine. Only the
1913 select(2)-based fallback engine is guaranteed to be available on
1914 your system. Engines are named after the name of the IO management
1915 facility they leverage. Engines currently implemented are epoll,
1916 kqueue, poll, and select, but not all will be present on any
1917 platform. Use nmap -V to see which engines are supported.
1918
1919 -T paranoid|sneaky|polite|normal|aggressive|insane (Set a timing
1920 template)
1921 While the fine-grained timing controls discussed in the previous
1922 section are powerful and effective, some people find them
1923 confusing. Moreover, choosing the appropriate values can sometimes
1924 take more time than the scan you are trying to optimize.
1925 Fortunately, Nmap offers a simpler approach, with six timing
1926 templates. You can specify them with the -T option and their number
1927 (0–5) or their name. The template names are paranoid (0),
1928 sneaky (1), polite (2), normal (3), aggressive (4), and insane (5).
1929 The first two are for IDS evasion. Polite mode slows down the scan
1930 to use less bandwidth and target machine resources. Normal mode is
1931 the default and so -T3 does nothing. Aggressive mode speeds scans
1932 up by making the assumption that you are on a reasonably fast and
1933 reliable network. Finally insane mode assumes that you are on an
1934 extraordinarily fast network or are willing to sacrifice some
1935 accuracy for speed.
1936
1937 These templates allow the user to specify how aggressive they wish
1938 to be, while leaving Nmap to pick the exact timing values. The
1939 templates also make some minor speed adjustments for which
1940 fine-grained control options do not currently exist. For example,
1941 -T4 prohibits the dynamic scan delay from exceeding 10 ms for TCP
1942 ports and -T5 caps that value at 5 ms. Templates can be used in
1943 combination with fine-grained controls, and the fine-grained
1944 controls that you specify will take precedence over the timing
1945 template default for that parameter. I recommend using -T4 when
1946 scanning reasonably modern and reliable networks. Keep that option
1947 even when you add fine-grained controls so that you benefit from
1948 those extra minor optimizations that it enables.
1949
1950 If you are on a decent broadband or ethernet connection, I would
1951 recommend always using -T4. Some people love -T5 though it is too
1952 aggressive for my taste. People sometimes specify -T2 because they
1953 think it is less likely to crash hosts or because they consider
1954 themselves to be polite in general. They often don't realize just
1955 how slow -T polite really is. Their scan may take ten times longer
1956 than a default scan. Machine crashes and bandwidth problems are
1957 rare with the default timing options (-T3) and so I normally
1958 recommend that for cautious scanners. Omitting version detection is
1959 far more effective than playing with timing values at reducing
1960 these problems.
1961
1962 While -T0 and -T1 may be useful for avoiding IDS alerts, they will
1963 take an extraordinarily long time to scan thousands of machines or
1964 ports. For such a long scan, you may prefer to set the exact timing
1965 values you need rather than rely on the canned -T0 and -T1 values.
1966
1967 The main effects of T0 are serializing the scan so only one port is
1968 scanned at a time, and waiting five minutes between sending each
1969 probe. T1 and T2 are similar but they only wait 15 seconds and 0.4
1970 seconds, respectively, between probes. T3 is Nmap's default
1971 behavior, which includes parallelization. -T4 does the equivalent
1972 of --max-rtt-timeout 1250ms --min-rtt-timeout 100ms
1973 --initial-rtt-timeout 500ms --max-retries 6 and sets the maximum
1974 TCP scan delay to 10 milliseconds. T5 does the equivalent of
1975 --max-rtt-timeout 300ms --min-rtt-timeout 50ms
1976 --initial-rtt-timeout 250ms --max-retries 2 --host-timeout 15m
1977 --script-timeout 10m as well as setting the maximum TCP scan delay
1978 to 5 ms.
1979
1981 Many Internet pioneers envisioned a global open network with a
1982 universal IP address space allowing virtual connections between any two
1983 nodes. This allows hosts to act as true peers, serving and retrieving
1984 information from each other. People could access all of their home
1985 systems from work, changing the climate control settings or unlocking
1986 the doors for early guests. This vision of universal connectivity has
1987 been stifled by address space shortages and security concerns. In the
1988 early 1990s, organizations began deploying firewalls for the express
1989 purpose of reducing connectivity. Huge networks were cordoned off from
1990 the unfiltered Internet by application proxies, network address
1991 translation, and packet filters. The unrestricted flow of information
1992 gave way to tight regulation of approved communication channels and the
1993 content that passes over them.
1994
1995 Network obstructions such as firewalls can make mapping a network
1996 exceedingly difficult. It will not get any easier, as stifling casual
1997 reconnaissance is often a key goal of implementing the devices.
1998 Nevertheless, Nmap offers many features to help understand these
1999 complex networks, and to verify that filters are working as intended.
2000 It even supports mechanisms for bypassing poorly implemented defenses.
2001 One of the best methods of understanding your network security posture
2002 is to try to defeat it. Place yourself in the mind-set of an attacker,
2003 and deploy techniques from this section against your networks. Launch
2004 an FTP bounce scan, idle scan, fragmentation attack, or try to tunnel
2005 through one of your own proxies.
2006
2007 In addition to restricting network activity, companies are increasingly
2008 monitoring traffic with intrusion detection systems (IDS). All of the
2009 major IDSs ship with rules designed to detect Nmap scans because scans
2010 are sometimes a precursor to attacks. Many of these products have
2011 recently morphed into intrusion prevention systems (IPS) that actively
2012 block traffic deemed malicious. Unfortunately for network
2013 administrators and IDS vendors, reliably detecting bad intentions by
2014 analyzing packet data is a tough problem. Attackers with patience,
2015 skill, and the help of certain Nmap options can usually pass by IDSs
2016 undetected. Meanwhile, administrators must cope with large numbers of
2017 false positive results where innocent activity is misdiagnosed and
2018 alerted on or blocked.
2019
2020 Occasionally people suggest that Nmap should not offer features for
2021 evading firewall rules or sneaking past IDSs. They argue that these
2022 features are just as likely to be misused by attackers as used by
2023 administrators to enhance security. The problem with this logic is that
2024 these methods would still be used by attackers, who would just find
2025 other tools or patch the functionality into Nmap. Meanwhile,
2026 administrators would find it that much harder to do their jobs.
2027 Deploying only modern, patched FTP servers is a far more powerful
2028 defense than trying to prevent the distribution of tools implementing
2029 the FTP bounce attack.
2030
2031 There is no magic bullet (or Nmap option) for detecting and subverting
2032 firewalls and IDS systems. It takes skill and experience. A tutorial is
2033 beyond the scope of this reference guide, which only lists the relevant
2034 options and describes what they do.
2035
2036 -f (fragment packets); --mtu (using the specified MTU)
2037 The -f option causes the requested scan (including host discovery
2038 scans) to use tiny fragmented IP packets. The idea is to split up
2039 the TCP header over several packets to make it harder for packet
2040 filters, intrusion detection systems, and other annoyances to
2041 detect what you are doing. Be careful with this! Some programs have
2042 trouble handling these tiny packets. The old-school sniffer named
2043 Sniffit segmentation faulted immediately upon receiving the first
2044 fragment. Specify this option once, and Nmap splits the packets
2045 into eight bytes or less after the IP header. So a 20-byte TCP
2046 header would be split into three packets. Two with eight bytes of
2047 the TCP header, and one with the final four. Of course each
2048 fragment also has an IP header. Specify -f again to use 16 bytes
2049 per fragment (reducing the number of fragments). Or you can
2050 specify your own offset size with the --mtu option. Don't also
2051 specify -f if you use --mtu. The offset must be a multiple of
2052 eight. While fragmented packets won't get by packet filters and
2053 firewalls that queue all IP fragments, such as the
2054 CONFIG_IP_ALWAYS_DEFRAG option in the Linux kernel, some networks
2055 can't afford the performance hit this causes and thus leave it
2056 disabled. Others can't enable this because fragments may take
2057 different routes into their networks. Some source systems
2058 defragment outgoing packets in the kernel. Linux with the iptables
2059 connection tracking module is one such example. Do a scan while a
2060 sniffer such as Wireshark is running to ensure that sent packets
2061 are fragmented. If your host OS is causing problems, try the
2062 --send-eth option to bypass the IP layer and send raw ethernet
2063 frames.
2064
2065 Fragmentation is only supported for Nmap's raw packet features,
2066 which includes TCP and UDP port scans (except connect scan and FTP
2067 bounce scan) and OS detection. Features such as version detection
2068 and the Nmap Scripting Engine generally don't support fragmentation
2069 because they rely on your host's TCP stack to communicate with
2070 target services.
2071
2072 -D decoy1[,decoy2][,ME][,...] (Cloak a scan with decoys)
2073 Causes a decoy scan to be performed, which makes it appear to the
2074 remote host that the host(s) you specify as decoys are scanning the
2075 target network too. Thus their IDS might report 5–10 port scans
2076 from unique IP addresses, but they won't know which IP was scanning
2077 them and which were innocent decoys. While this can be defeated
2078 through router path tracing, response-dropping, and other active
2079 mechanisms, it is generally an effective technique for hiding your
2080 IP address.
2081
2082 Separate each decoy host with commas, and you can optionally use ME
2083 as one of the decoys to represent the position for your real IP
2084 address. If you put ME in the sixth position or later, some common
2085 port scan detectors (such as Solar Designer's excellent Scanlogd)
2086 are unlikely to show your IP address at all. If you don't use ME,
2087 Nmap will put you in a random position. You can also use RND to
2088 generate a random, non-reserved IP address, or RND:number to
2089 generate number addresses.
2090
2091 Note that the hosts you use as decoys should be up or you might
2092 accidentally SYN flood your targets. Also it will be pretty easy to
2093 determine which host is scanning if only one is actually up on the
2094 network. You might want to use IP addresses instead of names (so
2095 the decoy networks don't see you in their nameserver logs). Right
2096 now random IP address generation is only supported with IPv4
2097
2098 Decoys are used both in the initial host discovery scan (using
2099 ICMP, SYN, ACK, or whatever) and during the actual port scanning
2100 phase. Decoys are also used during remote OS detection (-O). Decoys
2101 do not work with version detection or TCP connect scan. When a scan
2102 delay is in effect, the delay is enforced between each batch of
2103 spoofed probes, not between each individual probe. Because decoys
2104 are sent as a batch all at once, they may temporarily violate
2105 congestion control limits.
2106
2107 It is worth noting that using too many decoys may slow your scan
2108 and potentially even make it less accurate. Also, some ISPs will
2109 filter out your spoofed packets, but many do not restrict spoofed
2110 IP packets at all.
2111
2112 -S IP_Address (Spoof source address)
2113 In some circumstances, Nmap may not be able to determine your
2114 source address (Nmap will tell you if this is the case). In this
2115 situation, use -S with the IP address of the interface you wish to
2116 send packets through.
2117
2118 Another possible use of this flag is to spoof the scan to make the
2119 targets think that someone else is scanning them. Imagine a company
2120 being repeatedly port scanned by a competitor! The -e option and
2121 -Pn are generally required for this sort of usage. Note that you
2122 usually won't receive reply packets back (they will be addressed to
2123 the IP you are spoofing), so Nmap won't produce useful reports.
2124
2125 -e interface (Use specified interface)
2126 Tells Nmap what interface to send and receive packets on. Nmap
2127 should be able to detect this automatically, but it will tell you
2128 if it cannot.
2129
2130 --source-port portnumber; -g portnumber (Spoof source port number)
2131 One surprisingly common misconfiguration is to trust traffic based
2132 only on the source port number. It is easy to understand how this
2133 comes about. An administrator will set up a shiny new firewall,
2134 only to be flooded with complaints from ungrateful users whose
2135 applications stopped working. In particular, DNS may be broken
2136 because the UDP DNS replies from external servers can no longer
2137 enter the network. FTP is another common example. In active FTP
2138 transfers, the remote server tries to establish a connection back
2139 to the client to transfer the requested file.
2140
2141 Secure solutions to these problems exist, often in the form of
2142 application-level proxies or protocol-parsing firewall modules.
2143 Unfortunately there are also easier, insecure solutions. Noting
2144 that DNS replies come from port 53 and active FTP from port 20,
2145 many administrators have fallen into the trap of simply allowing
2146 incoming traffic from those ports. They often assume that no
2147 attacker would notice and exploit such firewall holes. In other
2148 cases, administrators consider this a short-term stop-gap measure
2149 until they can implement a more secure solution. Then they forget
2150 the security upgrade.
2151
2152 Overworked network administrators are not the only ones to fall
2153 into this trap. Numerous products have shipped with these insecure
2154 rules. Even Microsoft has been guilty. The IPsec filters that
2155 shipped with Windows 2000 and Windows XP contain an implicit rule
2156 that allows all TCP or UDP traffic from port 88 (Kerberos). In
2157 another well-known case, versions of the Zone Alarm personal
2158 firewall up to 2.1.25 allowed any incoming UDP packets with the
2159 source port 53 (DNS) or 67 (DHCP).
2160
2161 Nmap offers the -g and --source-port options (they are equivalent)
2162 to exploit these weaknesses. Simply provide a port number and Nmap
2163 will send packets from that port where possible. Most scanning
2164 operations that use raw sockets, including SYN and UDP scans,
2165 support the option completely. The option notably doesn't have an
2166 effect for any operations that use normal operating system sockets,
2167 including DNS requests, TCP connect scan, version detection, and
2168 script scanning. Setting the source port also doesn't work for OS
2169 detection, because Nmap must use different port numbers for certain
2170 OS detection tests to work properly.
2171
2172 --data hex string (Append custom binary data to sent packets)
2173 This option lets you include binary data as payload in sent
2174 packets. hex string may be specified in any of the following
2175 formats: 0xAABBCCDDEEFF..., AABBCCDDEEFF... or
2176 \xAA\xBB\xCC\xDD\xEE\xFF.... Examples of use are --data 0xdeadbeef
2177 and --data \xCA\xFE\x09. Note that if you specify a number like
2178 0x00ff no byte-order conversion is performed. Make sure you specify
2179 the information in the byte order expected by the receiver.
2180
2181 --data-string string (Append custom string to sent packets)
2182 This option lets you include a regular string as payload in sent
2183 packets. string can contain any string. However, note that some
2184 characters may depend on your system's locale and the receiver may
2185 not see the same information. Also, make sure you enclose the
2186 string in double quotes and escape any special characters from the
2187 shell. Examples: --data-string "Scan conducted by Security Ops,
2188 extension 7192" or --data-string "Ph34r my l33t skills". Keep in
2189 mind that nobody is likely to actually see any comments left by
2190 this option unless they are carefully monitoring the network with a
2191 sniffer or custom IDS rules.
2192
2193 --data-length number (Append random data to sent packets)
2194 Normally Nmap sends minimalist packets containing only a header. So
2195 its TCP packets are generally 40 bytes and ICMP echo requests are
2196 just 28. Some UDP ports and IP protocols get a custom payload by
2197 default. This option tells Nmap to append the given number of
2198 random bytes to most of the packets it sends, and not to use any
2199 protocol-specific payloads. (Use --data-length 0 for no random or
2200 protocol-specific payloads. OS detection (-O) packets are not
2201 affected because accuracy there requires probe consistency, but
2202 most pinging and portscan packets support this. It slows things
2203 down a little, but can make a scan slightly less conspicuous.
2204
2205 --ip-options S|R [route]|L [route]|T|U ... ; --ip-options hex string
2206 (Send packets with specified ip options)
2207 The IP protocol[12] offers several options which may be placed in
2208 packet headers. Unlike the ubiquitous TCP options, IP options are
2209 rarely seen due to practicality and security concerns. In fact,
2210 many Internet routers block the most dangerous options such as
2211 source routing. Yet options can still be useful in some cases for
2212 determining and manipulating the network route to target machines.
2213 For example, you may be able to use the record route option to
2214 determine a path to a target even when more traditional
2215 traceroute-style approaches fail. Or if your packets are being
2216 dropped by a certain firewall, you may be able to specify a
2217 different route with the strict or loose source routing options.
2218
2219 The most powerful way to specify IP options is to simply pass in
2220 values as the argument to --ip-options. Precede each hex number
2221 with \x then the two digits. You may repeat certain characters by
2222 following them with an asterisk and then the number of times you
2223 wish them to repeat. For example, \x01\x07\x04\x00*36\x01 is a hex
2224 string containing 36 NUL bytes.
2225
2226 Nmap also offers a shortcut mechanism for specifying options.
2227 Simply pass the letter R, T, or U to request record-route,
2228 record-timestamp, or both options together, respectively. Loose or
2229 strict source routing may be specified with an L or S followed by a
2230 space and then a space-separated list of IP addresses.
2231
2232 If you wish to see the options in packets sent and received,
2233 specify --packet-trace. For more information and examples of using
2234 IP options with Nmap, see http://seclists.org/nmap-dev/2006/q3/52.
2235
2236 --ttl value (Set IP time-to-live field)
2237 Sets the IPv4 time-to-live field in sent packets to the given
2238 value.
2239
2240 --randomize-hosts (Randomize target host order)
2241 Tells Nmap to shuffle each group of up to 16384 hosts before it
2242 scans them. This can make the scans less obvious to various network
2243 monitoring systems, especially when you combine it with slow timing
2244 options. If you want to randomize over larger group sizes, increase
2245 PING_GROUP_SZ in nmap.h and recompile. An alternative solution is
2246 to generate the target IP list with a list scan (-sL -n -oN
2247 filename), randomize it with a Perl script, then provide the whole
2248 list to Nmap with -iL.
2249
2250 --spoof-mac MAC address, prefix, or vendor name (Spoof MAC address)
2251 Asks Nmap to use the given MAC address
2252
2253 for all of the raw ethernet frames it sends. This option implies
2254 --send-eth to ensure that Nmap actually sends ethernet-level
2255 packets. The MAC given can take several formats. If it is simply
2256 the number 0, Nmap chooses a completely random MAC address for the
2257 session. If the given string is an even number of hex digits (with
2258 the pairs optionally separated by a colon), Nmap will use those as
2259 the MAC. If fewer than 12 hex digits are provided, Nmap fills in
2260 the remainder of the six bytes with random values. If the argument
2261 isn't a zero or hex string, Nmap looks through nmap-mac-prefixes to
2262 find a vendor name containing the given string (it is case
2263 insensitive). If a match is found, Nmap uses the vendor's OUI
2264 (three-byte prefix) and fills out the remaining three bytes
2265 randomly. Valid --spoof-mac argument examples are Apple, 0,
2266 01:02:03:04:05:06, deadbeefcafe, 0020F2, and Cisco. This option
2267 only affects raw packet scans such as SYN scan or OS detection, not
2268 connection-oriented features such as version detection or the Nmap
2269 Scripting Engine.
2270
2271 --proxies Comma-separated list of proxy URLs (Relay TCP connections
2272 through a chain of proxies)
2273 Asks Nmap to establish TCP connections with a final target through
2274 supplied chain of one or more HTTP or SOCKS4
2275
2276 proxies. Proxies can help hide the true source of a scan or evade
2277 certain firewall restrictions, but they can hamper scan performance
2278 by increasing latency. Users may need to adjust Nmap timeouts and
2279 other scan parameters accordingly. In particular, a lower
2280 --max-parallelism may help because some proxies refuse to handle as
2281 many concurrent connections as Nmap opens by default.
2282
2283 This option takes a list of proxies as argument, expressed as URLs
2284 in the format proto://host:port. Use commas to separate node URLs
2285 in a chain. No authentication is supported yet. Valid protocols are
2286 HTTP and SOCKS4.
2287
2288 Warning: this feature is still under development and has
2289 limitations. It is implemented within the nsock library and thus
2290 has no effect on the ping, port scanning and OS discovery phases of
2291 a scan. Only NSE and version scan benefit from this option so far—
2292 other features may disclose your true address. SSL connections are
2293 not yet supported, nor is proxy-side DNS resolution (hostnames are
2294 always resolved by Nmap).
2295
2296 --badsum (Send packets with bogus TCP/UDP checksums)
2297 Asks Nmap to use an invalid TCP, UDP or SCTP checksum for packets
2298 sent to target hosts. Since virtually all host IP stacks properly
2299 drop these packets, any responses received are likely coming from a
2300 firewall or IDS that didn't bother to verify the checksum. For more
2301 details on this technique, see https://nmap.org/p60-12.html
2302
2303 --adler32 (Use deprecated Adler32 instead of CRC32C for SCTP checksums)
2304 Asks Nmap to use the deprecated Adler32 algorithm for calculating
2305 the SCTP checksum. If --adler32 is not given, CRC-32C (Castagnoli)
2306 is used. RFC 2960[13] originally defined Adler32 as checksum
2307 algorithm for SCTP; RFC 4960[6] later redefined the SCTP checksums
2308 to use CRC-32C. Current SCTP implementations should be using
2309 CRC-32C, but in order to elicit responses from old, legacy SCTP
2310 implementations, it may be preferable to use Adler32.
2311
2313 Any security tool is only as useful as the output it generates. Complex
2314 tests and algorithms are of little value if they aren't presented in an
2315 organized and comprehensible fashion. Given the number of ways Nmap is
2316 used by people and other software, no single format can please
2317 everyone. So Nmap offers several formats, including the interactive
2318 mode for humans to read directly and XML for easy parsing by software.
2319
2320 In addition to offering different output formats, Nmap provides options
2321 for controlling the verbosity of output as well as debugging messages.
2322 Output types may be sent to standard output or to named files, which
2323 Nmap can append to or clobber. Output files may also be used to resume
2324 aborted scans.
2325
2326 Nmap makes output available in five different formats. The default is
2327 called interactive output, and it is sent to standard output (stdout).
2328 There is also normal output, which is similar to interactive except
2329 that it displays less runtime information and warnings since it is
2330 expected to be analyzed after the scan completes rather than
2331 interactively.
2332
2333 XML output is one of the most important output types, as it can be
2334 converted to HTML, easily parsed by programs such as Nmap graphical
2335 user interfaces, or imported into databases.
2336
2337 The two remaining output types are the simple grepable output which
2338 includes most information for a target host on a single line, and
2339 sCRiPt KiDDi3 0utPUt for users who consider themselves |<-r4d.
2340
2341 While interactive output is the default and has no associated
2342 command-line options, the other four format options use the same
2343 syntax. They take one argument, which is the filename that results
2344 should be stored in. Multiple formats may be specified, but each format
2345 may only be specified once. For example, you may wish to save normal
2346 output for your own review while saving XML of the same scan for
2347 programmatic analysis. You might do this with the options -oX
2348 myscan.xml -oN myscan.nmap. While this chapter uses the simple names
2349 like myscan.xml for brevity, more descriptive names are generally
2350 recommended. The names chosen are a matter of personal preference,
2351 though I use long ones that incorporate the scan date and a word or two
2352 describing the scan, placed in a directory named after the company I'm
2353 scanning.
2354
2355 While these options save results to files, Nmap still prints
2356 interactive output to stdout as usual. For example, the command nmap
2357 -oX myscan.xml target prints XML to myscan.xml and fills standard
2358 output with the same interactive results it would have printed if -oX
2359 wasn't specified at all. You can change this by passing a hyphen
2360 character as the argument to one of the format types. This causes Nmap
2361 to deactivate interactive output, and instead print results in the
2362 format you specified to the standard output stream. So the command nmap
2363 -oX - target will send only XML output to stdout. Serious errors may
2364 still be printed to the normal error stream, stderr.
2365
2366 Unlike some Nmap arguments, the space between the logfile option flag
2367 (such as -oX) and the filename or hyphen is mandatory. If you omit the
2368 flags and give arguments such as -oG- or -oXscan.xml, a backwards
2369 compatibility feature of Nmap will cause the creation of normal format
2370 output files named G- and Xscan.xml respectively.
2371
2372 All of these arguments support strftime-like conversions in the
2373 filename. %H, %M, %S, %m, %d, %y, and %Y are all exactly the same as
2374 in strftime. %T is the same as %H%M%S, %R is the same as %H%M, and %D
2375 is the same as %m%d%y. A % followed by any other character just yields
2376 that character (%% gives you a percent symbol). So -oX 'scan-%T-%D.xml'
2377 will use an XML file with a name in the form of scan-144840-121307.xml.
2378
2379 Nmap also offers options to control scan verbosity and to append to
2380 output files rather than clobbering them. All of these options are
2381 described below.
2382
2383 Nmap Output Formats
2384
2385 -oN filespec (normal output)
2386 Requests that normal output be directed to the given filename. As
2387 discussed above, this differs slightly from interactive output.
2388
2389 -oX filespec (XML output)
2390 Requests that XML output be directed to the given filename. Nmap
2391 includes a document type definition (DTD) which allows XML parsers
2392 to validate Nmap XML output. While it is primarily intended for
2393 programmatic use, it can also help humans interpret Nmap XML
2394 output. The DTD defines the legal elements of the format, and often
2395 enumerates the attributes and values they can take on. The latest
2396 version is always available from
2397 https://svn.nmap.org/nmap/docs/nmap.dtd.
2398
2399 XML offers a stable format that is easily parsed by software. Free
2400 XML parsers are available for all major computer languages,
2401 including C/C++, Perl, Python, and Java. People have even written
2402 bindings for most of these languages to handle Nmap output and
2403 execution specifically. Examples are Nmap::Scanner[14] and
2404 Nmap::Parser[15] in Perl CPAN. In almost all cases that a
2405 non-trivial application interfaces with Nmap, XML is the preferred
2406 format.
2407
2408 The XML output references an XSL stylesheet which can be used to
2409 format the results as HTML. The easiest way to use this is simply
2410 to load the XML output in a web browser such as Firefox or IE. By
2411 default, this will only work on the machine you ran Nmap on (or a
2412 similarly configured one) due to the hard-coded nmap.xsl filesystem
2413 path. Use the --webxml or --stylesheet options to create portable
2414 XML files that render as HTML on any web-connected machine.
2415
2416 -oS filespec (ScRipT KIdd|3 oUTpuT)
2417 Script kiddie output is like interactive output, except that it is
2418 post-processed to better suit the l33t HaXXorZ who previously
2419 looked down on Nmap due to its consistent capitalization and
2420 spelling. Humor impaired people should note that this option is
2421 making fun of the script kiddies before flaming me for supposedly
2422 “helping them”.
2423
2424 -oG filespec (grepable output)
2425 This output format is covered last because it is deprecated. The
2426 XML output format is far more powerful, and is nearly as convenient
2427 for experienced users. XML is a standard for which dozens of
2428 excellent parsers are available, while grepable output is my own
2429 simple hack. XML is extensible to support new Nmap features as they
2430 are released, while I often must omit those features from grepable
2431 output for lack of a place to put them.
2432
2433 Nevertheless, grepable output is still quite popular. It is a
2434 simple format that lists each host on one line and can be trivially
2435 searched and parsed with standard Unix tools such as grep, awk,
2436 cut, sed, diff, and Perl. Even I usually use it for one-off tests
2437 done at the command line. Finding all the hosts with the SSH port
2438 open or that are running Solaris takes only a simple grep to
2439 identify the hosts, piped to an awk or cut command to print the
2440 desired fields.
2441
2442 Grepable output consists of comments (lines starting with a pound
2443 (#)) and target lines. A target line includes a combination of six
2444 labeled fields, separated by tabs and followed with a colon. The
2445 fields are Host, Ports, Protocols, Ignored State, OS, Seq Index, IP
2446 ID, and Status.
2447
2448 The most important of these fields is generally Ports, which gives
2449 details on each interesting port. It is a comma separated list of
2450 port entries. Each port entry represents one interesting port, and
2451 takes the form of seven slash (/) separated subfields. Those
2452 subfields are: Port number, State, Protocol, Owner, Service, SunRPC
2453 info, and Version info.
2454
2455 As with XML output, this man page does not allow for documenting
2456 the entire format. A more detailed look at the Nmap grepable output
2457 format is available from
2458 https://nmap.org/book/output-formats-grepable-output.html.
2459
2460 -oA basename (Output to all formats)
2461 As a convenience, you may specify -oA basename to store scan
2462 results in normal, XML, and grepable formats at once. They are
2463 stored in basename.nmap, basename.xml, and basename.gnmap,
2464 respectively. As with most programs, you can prefix the filenames
2465 with a directory path, such as ~/nmaplogs/foocorp/ on Unix or
2466 c:\hacking\sco on Windows.
2467
2468 Verbosity and debugging options
2469
2470 -v (Increase verbosity level), -vlevel (Set verbosity level)
2471 Increases the verbosity level, causing Nmap to print more
2472 information about the scan in progress. Open ports are shown as
2473 they are found and completion time estimates are provided when Nmap
2474 thinks a scan will take more than a few minutes. Use it twice or
2475 more for even greater verbosity: -vv, or give a verbosity level
2476 directly, for example -v3.
2477
2478 Most changes only affect interactive output, and some also affect
2479 normal and script kiddie output. The other output types are meant
2480 to be processed by machines, so Nmap can give substantial detail by
2481 default in those formats without fatiguing a human user. However,
2482 there are a few changes in other modes where output size can be
2483 reduced substantially by omitting some detail. For example, a
2484 comment line in the grepable output that provides a list of all
2485 ports scanned is only printed in verbose mode because it can be
2486 quite long.
2487
2488 -d (Increase debugging level), -dlevel (Set debugging level)
2489 When even verbose mode doesn't provide sufficient data for you,
2490 debugging is available to flood you with much more! As with the
2491 verbosity option (-v), debugging is enabled with a command-line
2492 flag (-d) and the debug level can be increased by specifying it
2493 multiple times, as in -dd, or by setting a level directly. For
2494 example, -d9 sets level nine. That is the highest effective level
2495 and will produce thousands of lines unless you run a very simple
2496 scan with very few ports and targets.
2497
2498 Debugging output is useful when a bug is suspected in Nmap, or if
2499 you are simply confused as to what Nmap is doing and why. As this
2500 feature is mostly intended for developers, debug lines aren't
2501 always self-explanatory. You may get something like: Timeout vals:
2502 srtt: -1 rttvar: -1 to: 1000000 delta 14987 ==> srtt: 14987 rttvar:
2503 14987 to: 100000. If you don't understand a line, your only
2504 recourses are to ignore it, look it up in the source code, or
2505 request help from the development list (nmap-dev). Some lines are
2506 self explanatory, but the messages become more obscure as the debug
2507 level is increased.
2508
2509 --reason (Host and port state reasons)
2510 Shows the reason each port is set to a specific state and the
2511 reason each host is up or down. This option displays the type of
2512 the packet that determined a port or hosts state. For example, A
2513 RST packet from a closed port or an echo reply from an alive host.
2514 The information Nmap can provide is determined by the type of scan
2515 or ping. The SYN scan and SYN ping (-sS and -PS) are very detailed,
2516 but the TCP connect scan (-sT) is limited by the implementation of
2517 the connect system call. This feature is automatically enabled by
2518 the debug option (-d) and the results are stored in XML log files
2519 even if this option is not specified.
2520
2521 --stats-every time (Print periodic timing stats)
2522 Periodically prints a timing status message after each interval of
2523 time. The time is a specification of the kind described in the
2524 section called “TIMING AND PERFORMANCE”; so for example, use
2525 --stats-every 10s to get a status update every 10 seconds. Updates
2526 are printed to interactive output (the screen) and XML output.
2527
2528 --packet-trace (Trace packets and data sent and received)
2529 Causes Nmap to print a summary of every packet sent or received.
2530 This is often used for debugging, but is also a valuable way for
2531 new users to understand exactly what Nmap is doing under the
2532 covers. To avoid printing thousands of lines, you may want to
2533 specify a limited number of ports to scan, such as -p20-30. If you
2534 only care about the goings on of the version detection subsystem,
2535 use --version-trace instead. If you only care about script tracing,
2536 specify --script-trace. With --packet-trace, you get all of the
2537 above.
2538
2539 --open (Show only open (or possibly open) ports)
2540 Sometimes you only care about ports you can actually connect to
2541 (open ones), and don't want results cluttered with closed,
2542 filtered, and closed|filtered ports. Output customization is
2543 normally done after the scan using tools such as grep, awk, and
2544 Perl, but this feature was added due to overwhelming requests.
2545 Specify --open to only see hosts with at least one open,
2546 open|filtered, or unfiltered port, and only see ports in those
2547 states. These three states are treated just as they normally are,
2548 which means that open|filtered and unfiltered may be condensed into
2549 counts if there are an overwhelming number of them.
2550
2551 Beginning with Nmap 7.40, the --open option implies
2552
2553 --defeat-rst-ratelimit, because that option only affects closed and
2554 filtered ports, which are hidden by --open.
2555
2556 --iflist (List interfaces and routes)
2557 Prints the interface list and system routes as detected by Nmap and
2558 quits. This is useful for debugging routing problems or device
2559 mischaracterization (such as Nmap treating a PPP connection as
2560 ethernet).
2561
2562 Miscellaneous output options
2563
2564 --append-output (Append to rather than clobber output files)
2565 When you specify a filename to an output format flag such as -oX or
2566 -oN, that file is overwritten by default. If you prefer to keep the
2567 existing content of the file and append the new results, specify
2568 the --append-output option. All output filenames specified in that
2569 Nmap execution will then be appended to rather than clobbered. This
2570 doesn't work well for XML (-oX) scan data as the resultant file
2571 generally won't parse properly until you fix it up by hand.
2572
2573 --resume filename (Resume aborted scan)
2574 Some extensive Nmap runs take a very long time—on the order of
2575 days. Such scans don't always run to completion. Restrictions may
2576 prevent Nmap from being run during working hours, the network could
2577 go down, the machine Nmap is running on might suffer a planned or
2578 unplanned reboot, or Nmap itself could crash. The administrator
2579 running Nmap could cancel it for any other reason as well, by
2580 pressing ctrl-C. Restarting the whole scan from the beginning may
2581 be undesirable. Fortunately, if scan output files were kept, the
2582 user can ask Nmap to resume scanning with the target it was working
2583 on when execution ceased. Simply specify the --resume option and
2584 pass the output file as its argument. No other arguments are
2585 permitted, as Nmap parses the output file to use the same ones
2586 specified previously. Simply call Nmap as nmap --resume
2587 logfilename. Nmap will append new results to the data files
2588 specified in the previous execution. Scans can be resumed from any
2589 of the 3 major output formats: Normal, Grepable, or XML
2590
2591 --stylesheet path or URL (Set XSL stylesheet to transform XML output)
2592 Nmap ships with an XSL stylesheet named nmap.xsl for viewing or
2593 translating XML output to HTML. The XML output includes an
2594 xml-stylesheet directive which points to nmap.xml where it was
2595 initially installed by Nmap. Run the XML file through an XSLT
2596 processor such as xsltproc[16] to produce an HTML file. Directly
2597 opening the XML file in a browser no longer works well because
2598 modern browsers limit the locations a stylesheet may be loaded
2599 from. If you wish to use a different stylesheet, specify it as the
2600 argument to --stylesheet. You must pass the full pathname or URL.
2601 One common invocation is --stylesheet
2602 https://nmap.org/svn/docs/nmap.xsl. This tells an XSLT processor to
2603 load the latest version of the stylesheet from Nmap.Org. The
2604 --webxml option does the same thing with less typing and
2605 memorization. Loading the XSL from Nmap.Org makes it easier to view
2606 results on a machine that doesn't have Nmap (and thus nmap.xsl)
2607 installed. So the URL is often more useful, but the local
2608 filesystem location of nmap.xsl is used by default for privacy
2609 reasons.
2610
2611 --webxml (Load stylesheet from Nmap.Org)
2612 This is a convenience option, nothing more than an alias for
2613 --stylesheet https://nmap.org/svn/docs/nmap.xsl.
2614
2615 --no-stylesheet (Omit XSL stylesheet declaration from XML)
2616 Specify this option to prevent Nmap from associating any XSL
2617 stylesheet with its XML output. The xml-stylesheet directive is
2618 omitted.
2619
2621 This section describes some important (and not-so-important) options
2622 that don't really fit anywhere else.
2623
2624 -6 (Enable IPv6 scanning)
2625 Nmap has IPv6 support for its most popular features. Ping scanning,
2626 port scanning, version detection, and the Nmap Scripting Engine all
2627 support IPv6. The command syntax is the same as usual except that
2628 you also add the -6 option. Of course, you must use IPv6 syntax if
2629 you specify an address rather than a hostname. An address might
2630 look like 3ffe:7501:4819:2000:210:f3ff:fe03:14d0, so hostnames are
2631 recommended. The output looks the same as usual, with the IPv6
2632 address on the “interesting ports” line being the only IPv6
2633 giveaway.
2634
2635 While IPv6 hasn't exactly taken the world by storm, it gets
2636 significant use in some (usually Asian) countries and most modern
2637 operating systems support it. To use Nmap with IPv6, both the
2638 source and target of your scan must be configured for IPv6. If your
2639 ISP (like most of them) does not allocate IPv6 addresses to you,
2640 free tunnel brokers are widely available and work fine with Nmap. I
2641 use the free IPv6 tunnel broker service at
2642 http://www.tunnelbroker.net. Other tunnel brokers are listed at
2643 Wikipedia[17]. 6to4 tunnels are another popular, free approach.
2644
2645 On Windows, raw-socket IPv6 scans are supported only on ethernet
2646 devices (not tunnels), and only on Windows Vista and later. Use the
2647 --unprivileged option in other situations.
2648
2649 -A (Aggressive scan options)
2650 This option enables additional advanced and aggressive options.
2651 Presently this enables OS detection (-O), version scanning (-sV),
2652 script scanning (-sC) and traceroute (--traceroute). More features
2653 may be added in the future. The point is to enable a comprehensive
2654 set of scan options without people having to remember a large set
2655 of flags. However, because script scanning with the default set is
2656 considered intrusive, you should not use -A against target networks
2657 without permission. This option only enables features, and not
2658 timing options (such as -T4) or verbosity options (-v) that you
2659 might want as well. Options which require privileges (e.g. root
2660 access) such as OS detection and traceroute will only be enabled if
2661 those privileges are available.
2662
2663 --datadir directoryname (Specify custom Nmap data file location)
2664 Nmap obtains some special data at runtime in files named
2665 nmap-service-probes, nmap-services, nmap-protocols, nmap-rpc,
2666 nmap-mac-prefixes, and nmap-os-db. If the location of any of these
2667 files has been specified (using the --servicedb or --versiondb
2668 options), that location is used for that file. After that, Nmap
2669 searches these files in the directory specified with the --datadir
2670 option (if any). Any files not found there, are searched for in the
2671 directory specified by the NMAPDIR environment variable. Next comes
2672 ~/.nmap for real and effective UIDs; or on Windows,
2673 HOME\AppData\Roaming\nmap (where HOME is the user's home directory,
2674 like C:\Users\user). This is followed by the location of the nmap
2675 executable and the same location with ../share/nmap appended. Then
2676 a compiled-in location such as /usr/local/share/nmap or
2677 /usr/share/nmap.
2678
2679 --servicedb services file (Specify custom services file)
2680 Asks Nmap to use the specified services file rather than the
2681 nmap-services data file that comes with Nmap. Using this option
2682 also causes a fast scan (-F) to be used. See the description for
2683 --datadir for more information on Nmap's data files.
2684
2685 --versiondb service probes file (Specify custom service probes file)
2686 Asks Nmap to use the specified service probes file rather than the
2687 nmap-service-probes data file that comes with Nmap. See the
2688 description for --datadir for more information on Nmap's data
2689 files.
2690
2691 --send-eth (Use raw ethernet sending)
2692 Asks Nmap to send packets at the raw ethernet (data link) layer
2693 rather than the higher IP (network) layer. By default, Nmap chooses
2694 the one which is generally best for the platform it is running on.
2695 Raw sockets (IP layer) are generally most efficient for Unix
2696 machines, while ethernet frames are required for Windows operation
2697 since Microsoft disabled raw socket support. Nmap still uses raw IP
2698 packets on Unix despite this option when there is no other choice
2699 (such as non-ethernet connections).
2700
2701 --send-ip (Send at raw IP level)
2702 Asks Nmap to send packets via raw IP sockets rather than sending
2703 lower level ethernet frames. It is the complement to the --send-eth
2704 option discussed previously.
2705
2706 --privileged (Assume that the user is fully privileged)
2707 Tells Nmap to simply assume that it is privileged enough to perform
2708 raw socket sends, packet sniffing, and similar operations that
2709 usually require root privileges on Unix systems. By default Nmap
2710 quits if such operations are requested but geteuid is not zero.
2711 --privileged is useful with Linux kernel capabilities and similar
2712 systems that may be configured to allow unprivileged users to
2713 perform raw-packet scans. Be sure to provide this option flag
2714 before any flags for options that require privileges (SYN scan, OS
2715 detection, etc.). The NMAP_PRIVILEGED environment variable may be
2716 set as an equivalent alternative to --privileged.
2717
2718 --unprivileged (Assume that the user lacks raw socket privileges)
2719 This option is the opposite of --privileged. It tells Nmap to treat
2720 the user as lacking network raw socket and sniffing privileges.
2721 This is useful for testing, debugging, or when the raw network
2722 functionality of your operating system is somehow broken. The
2723 NMAP_UNPRIVILEGED environment variable may be set as an equivalent
2724 alternative to --unprivileged.
2725
2726 --release-memory (Release memory before quitting)
2727 This option is only useful for memory-leak debugging. It causes
2728 Nmap to release allocated memory just before it quits so that
2729 actual memory leaks are easier to spot. Normally Nmap skips this as
2730 the OS does this anyway upon process termination.
2731
2732 -V; --version (Print version number)
2733 Prints the Nmap version number and exits.
2734
2735 -h; --help (Print help summary page)
2736 Prints a short help screen with the most common command flags.
2737 Running Nmap without any arguments does the same thing.
2738
2740 During the execution of Nmap, all key presses are captured. This allows
2741 you to interact with the program without aborting and restarting it.
2742 Certain special keys will change options, while any other keys will
2743 print out a status message telling you about the scan. The convention
2744 is that lowercase letters increase the amount of printing, and
2745 uppercase letters decrease the printing. You may also press ‘?’ for
2746 help.
2747
2748 v / V
2749 Increase / decrease the verbosity level
2750
2751 d / D
2752 Increase / decrease the debugging Level
2753
2754 p / P
2755 Turn on / off packet tracing
2756
2757 ?
2758 Print a runtime interaction help screen
2759
2760 Anything else
2761 Print out a status message like this:
2762
2763 Stats: 0:00:07 elapsed; 20 hosts completed (1 up), 1 undergoing Service Scan
2764 Service scan Timing: About 33.33% done; ETC: 20:57 (0:00:12 remaining)
2765
2767 Here are some Nmap usage examples, from the simple and routine to a
2768 little more complex and esoteric. Some actual IP addresses and domain
2769 names are used to make things more concrete. In their place you should
2770 substitute addresses/names from your own network. While I don't think
2771 port scanning other networks is or should be illegal, some network
2772 administrators don't appreciate unsolicited scanning of their networks
2773 and may complain. Getting permission first is the best approach.
2774
2775 For testing purposes, you have permission to scan the host
2776 scanme.nmap.org. This permission only includes scanning via Nmap and
2777 not testing exploits or denial of service attacks. To conserve
2778 bandwidth, please do not initiate more than a dozen scans against that
2779 host per day. If this free scanning target service is abused, it will
2780 be taken down and Nmap will report Failed to resolve given hostname/IP:
2781 scanme.nmap.org. These permissions also apply to the hosts
2782 scanme2.nmap.org, scanme3.nmap.org, and so on, though those hosts do
2783 not currently exist.
2784
2785 nmap -v scanme.nmap.org
2786
2787 This option scans all reserved TCP ports on the machine scanme.nmap.org
2788 . The -v option enables verbose mode.
2789
2790 nmap -sS -O scanme.nmap.org/24
2791
2792
2793 Launches a stealth SYN scan against each machine that is up out of the
2794 256 IPs on the /24 sized network where Scanme resides. It also tries to
2795 determine what operating system is running on each host that is up and
2796 running. This requires root privileges because of the SYN scan and OS
2797 detection.
2798
2799 nmap -sV -p 22,53,110,143,4564 198.116.0-255.1-127
2800
2801 Launches host enumeration and a TCP scan at the first half of each of
2802 the 255 possible eight-bit subnets in the 198.116.0.0/16 address space.
2803 This tests whether the systems run SSH, DNS, POP3, or IMAP on their
2804 standard ports, or anything on port 4564. For any of these ports found
2805 open, version detection is used to determine what application is
2806 running.
2807
2808 nmap -v -iR 100000 -Pn -p 80
2809
2810
2811 Asks Nmap to choose 100,000 hosts at random and scan them for web
2812 servers (port 80). Host enumeration is disabled with -Pn since first
2813 sending a couple probes to determine whether a host is up is wasteful
2814 when you are only probing one port on each target host anyway.
2815
2816 nmap -Pn -p80 -oX logs/pb-port80scan.xml -oG logs/pb-port80scan.gnmap
2817 216.163.128.20/20
2818
2819
2820 This scans 4096 IPs for any web servers (without pinging them) and
2821 saves the output in grepable and XML formats.
2822
2824 While this reference guide details all material Nmap options, it can't
2825 fully demonstrate how to apply those features to quickly solve
2826 real-world tasks. For that, we released Nmap Network Scanning: The
2827 Official Nmap Project Guide to Network Discovery and Security Scanning.
2828 Topics include subverting firewalls and intrusion detection systems,
2829 optimizing Nmap performance, and automating common networking tasks
2830 with the Nmap Scripting Engine. Hints and instructions are provided for
2831 common Nmap tasks such as taking network inventory, penetration
2832 testing, detecting rogue wireless access points, and quashing network
2833 worm outbreaks. Examples and diagrams show actual communication on the
2834 wire. More than half of the book is available free online. See
2835 https://nmap.org/book for more information.
2836
2838 Like its author, Nmap isn't perfect. But you can help make it better by
2839 sending bug reports or even writing patches. If Nmap doesn't behave the
2840 way you expect, first upgrade to the latest version available from
2841 https://nmap.org. If the problem persists, do some research to
2842 determine whether it has already been discovered and addressed. Try
2843 searching for the problem or error message on Google since that
2844 aggregates so many forums. If nothing comes of this, create an Issue on
2845 our tracker (http://issues.nmap.org) and/or mail a bug report to
2846 <dev@nmap.org>. If you subscribe to the nmap-dev list before posting,
2847 your message will bypass moderation and get through more quickly.
2848 Subscribe at https://nmap.org/mailman/listinfo/dev. Please include
2849 everything you have learned about the problem, as well as what version
2850 of Nmap you are using and what operating system version it is running
2851 on. Other suggestions for improving Nmap may be sent to the Nmap dev
2852 mailing list as well.
2853
2854 If you are able to write a patch improving Nmap or fixing a bug, that
2855 is even better! Instructions for submitting patches or git pull
2856 requests are available from
2857 https://github.com/nmap/nmap/blob/master/CONTRIBUTING.md
2858
2859 Particularly sensitive issues such as a security reports may be sent
2860 directly to Nmap's author Fyodor directly at <fyodor@nmap.org>. All
2861 other reports and comments should use the dev list or issue tracker
2862 instead because more people read, follow, and respond to those.
2863
2865 Gordon “Fyodor” Lyon <fyodor@nmap.org> wrote and released Nmap in 1997.
2866 Since then, hundreds of people have made valuable contributions, as
2867 detailed in the CHANGELOG file distributed with Nmap and also available
2868 from https://nmap.org/changelog.html. David Fifield and Daniel Miller
2869 deserve special recognition for their enormous multi-year
2870 contributions!
2871
2873 Nmap Copyright and Licensing
2874 The Nmap Security Scanner is (C) 1996–2020 Insecure.Com LLC ("The Nmap
2875 Project"). Nmap is also a registered trademark of the Nmap Project. It
2876 is published under the Nmap Public Source License[18]. This generally
2877 allows end users to download and use Nmap for free. It doesn't not
2878 allow Nmap to be used and redistributed within commercial software or
2879 hardware products (including appliances, virtual machines, and
2880 traditional applications). We fund the project by selling a special
2881 Nmap OEM Edition for this purpose, as described at
2882 https://nmap.org/oem. Hundreds of large and small software vendors have
2883 already purchased OEM licenses to embed Nmap technology such as host
2884 discovery, port scanning, OS detection, version detection, and the Nmap
2885 Scripting Engine within their products.
2886
2887 The Nmap Project has permission to redistribute Npcap, a packet
2888 capturing driver and library for the Microsoft Windows platform. Npcap
2889 is a separate work with it's own license rather than this Nmap license.
2890 Since the Npcap license does not permit redistribution without special
2891 permission, our Nmap Windows binary packages which contain Npcap may
2892 not be redistributed without special permission.
2893
2894 Even though the NPSL is based on GPLv2, it contains different
2895 provisions and is not directly compatible. It is incompatible with some
2896 other open source licenses as well. In some cases we can relicense
2897 portions of Nmap or grant special permissions to use it in other open
2898 source software. Please contact fyodor@nmap.org with any such requests.
2899 Similarly, we don't incorporate incompatible open source software into
2900 Nmap without special permission from the copyright holders.
2901
2902 If you have received a written license agreement or contract for Nmap
2903 stating terms other than these, you may choose to use and redistribute
2904 Nmap under those terms instead.
2905
2906 Creative Commons License for this Nmap Guide
2907 This Nmap Reference Guide is (C) 2005–2020 Insecure.Com LLC. It is
2908 hereby placed under version 3.0 of the Creative Commons Attribution
2909 License[19]. This allows you redistribute and modify the work as you
2910 desire, as long as you credit the original source. Alternatively, you
2911 may choose to treat this document as falling under the same license as
2912 Nmap itself (discussed previously).
2913
2914 Source Code Availability and Community Contributions
2915 Source is provided to this software because we believe users have a
2916 right to know exactly what a program is going to do before they run it.
2917 This also allows you to audit the software for security holes.
2918
2919 Source code also allows you to port Nmap to new platforms, fix bugs,
2920 and add new features. You are highly encouraged to submit your changes
2921 as Github Pull Requests (PR) or send them to <dev@nmap.org> for
2922 possible incorporation into the main distribution. By submitting such
2923 changes, it is assumed that you are offering the Nmap Project the
2924 unlimited, non-exclusive right to reuse, modify, and relicense the
2925 code. This is important because the inability to relicense code has
2926 caused devastating problems for other Free Software projects (such as
2927 KDE and NASM). We also sell commercial licenses to Nmap OEM[20]. If you
2928 wish to specify special license conditions of your contributions, just
2929 say so when you send them.
2930
2931 No Warranty
2932 This program is distributed in the hope that it will be useful, but
2933 WITHOUT ANY WARRANTY; without even the implied warranty of
2934 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2935
2936 It should also be noted that Nmap has occasionally been known to crash
2937 poorly written applications, TCP/IP stacks, and even operating systems.
2938 While this is extremely rare, it is important to keep in mind. Nmap
2939 should never be run against mission critical systems unless you are
2940 prepared to suffer downtime. We acknowledge here that Nmap may crash
2941 your systems or networks and we disclaim all liability for any damage
2942 or problems Nmap could cause.
2943
2944 Inappropriate Usage
2945 Because of the slight risk of crashes and because a few black hats like
2946 to use Nmap for reconnaissance prior to attacking systems, there are
2947 administrators who become upset and may complain when their system is
2948 scanned. Thus, it is often advisable to request permission before doing
2949 even a light scan of a network.
2950
2951 Nmap should never be installed with special privileges (e.g. suid
2952 root). That would open up a major security vulnerability as other
2953 users on the system (or attackers) could use it for privilege
2954 escalation.
2955
2956 Nmap is not designed, manufactured, or intended for use in hazardous
2957 environments requiring fail- safe performance where the failure of the
2958 software could lead directly to death, personal injury, or significant
2959 physical or environmental damage.
2960
2961 Third-Party Software and Funding Notices
2962 This product includes software developed by the Apache Software
2963 Foundation[21]. A modified version of the Libpcap portable packet
2964 capture library[22] is distributed along with Nmap. The Windows version
2965 of Nmap utilizes the Libpcap-derived Ncap library[23] instead. Regular
2966 expression support is provided by the PCRE library[24], which is
2967 open-source software, written by Philip Hazel. Certain raw networking
2968 functions use the Libdnet[25] networking library, which was written by
2969 Dug Song. A modified version is distributed with Nmap. Nmap can
2970 optionally link with the OpenSSL cryptography toolkit[26] for SSL
2971 version detection support. The Nmap Scripting Engine uses an embedded
2972 version of the Lua programming language[27]. The Liblinear linear
2973 classification library[28] is used for our IPv6 OS detection machine
2974 learning techniques[29].
2975
2976 All of the third-party software described in this paragraph is freely
2977 redistributable under BSD-style software licenses.
2978
2979 Binary packages for Windows and Mac OS X include support libraries
2980 necessary to run Zenmap and Ndiff with Python and PyGTK. (Unix
2981 platforms commonly make these libraries easy to install, so they are
2982 not part of the packages.) A listing of these support libraries and
2983 their licenses is included in the LICENSES files.
2984
2985 This software was supported in part through the Google Summer of
2986 Code[30] and the DARPA CINDER program[31] (DARPA-BAA-10-84).
2987
2988 United States Export Control
2989 Nmap only uses encryption when compiled with the optional OpenSSL
2990 support and linked with OpenSSL. When compiled without OpenSSL support,
2991 the Nmap Project believes that Nmap is not subject to U.S. Export
2992 Administration Regulations (EAR)[32] export control. As such, there is
2993 no applicable ECCN (export control classification number) and
2994 exportation does not require any special license, permit, or other
2995 governmental authorization.
2996
2997 When compiled with OpenSSL support or distributed as source code, the
2998 Nmap Project believes that Nmap falls under U.S. ECCN 5D002[33]
2999 (“Information Security Software”). We distribute Nmap under the TSU
3000 exception for publicly available encryption software defined in EAR
3001 740.13(e)[34].
3002
3004 1. Nmap Network Scanning: The Official Nmap Project Guide to Network
3005 Discovery and Security Scanning
3006 https://nmap.org/book/
3007
3008 2. RFC 1122
3009 http://www.rfc-editor.org/rfc/rfc1122.txt
3010
3011 3. RFC 792
3012 http://www.rfc-editor.org/rfc/rfc792.txt
3013
3014 4. RFC 950
3015 http://www.rfc-editor.org/rfc/rfc950.txt
3016
3017 5. UDP
3018 http://www.rfc-editor.org/rfc/rfc768.txt
3019
3020 6. SCTP
3021 http://www.rfc-editor.org/rfc/rfc4960.txt
3022
3023 7. TCP RFC
3024 http://www.rfc-editor.org/rfc/rfc793.txt
3025
3026 8. RFC 959
3027 http://www.rfc-editor.org/rfc/rfc959.txt
3028
3029 9. RFC 1323
3030 http://www.rfc-editor.org/rfc/rfc1323.txt
3031
3032 10. Lua programming language
3033 http://lua.org
3034
3035 11. precedence
3036 http://www.lua.org/manual/5.1/manual.html#2.5.3
3037
3038 12. IP protocol
3039 http://www.rfc-editor.org/rfc/rfc791.txt
3040
3041 13. RFC 2960
3042 http://www.rfc-editor.org/rfc/rfc2960.txt
3043
3044 14. Nmap::Scanner
3045 http://sourceforge.net/projects/nmap-scanner/
3046
3047 15. Nmap::Parser
3048 http://nmapparser.wordpress.com/
3049
3050 16. xsltproc
3051 http://xmlsoft.org/XSLT/
3052
3053 17. listed at Wikipedia
3054 http://en.wikipedia.org/wiki/List_of_IPv6_tunnel_brokers
3055
3056 18. Nmap Public Source License
3057 https://nmap.org/npsl
3058
3059 19. Creative Commons Attribution License
3060 http://creativecommons.org/licenses/by/3.0/
3061
3062 20. Nmap OEM
3063 https://nmap.org/oem
3064
3065 21. Apache Software Foundation
3066 https://www.apache.org
3067
3068 22. Libpcap portable packet capture library
3069 https://www.tcpdump.org
3070
3071 23. Ncap library
3072 https://npcap.org
3073
3074 24. PCRE library
3075 https://pcre.org
3076
3077 25. Libdnet
3078 http://libdnet.sourceforge.net
3079
3080 26. OpenSSL cryptography toolkit
3081 https://openssl.org
3082
3083 27. Lua programming language
3084 https://lua.org
3085
3086 28. Liblinear linear classification library
3087 https://www.csie.ntu.edu.tw/~cjlin/liblinear/
3088
3089 29. IPv6 OS detection machine learning techniques
3090 https://nmap.org/book/osdetect-guess.html#osdetect-guess-ipv6
3091
3092 30. Google Summer of Code
3093 https://nmap.org/soc/
3094
3095 31. DARPA CINDER program
3096 https://www.fbo.gov/index?s=opportunity&mode=form&id=585e02a51f77af5cb3c9e06b9cc82c48&tab=core&_cview=1
3097
3098 32. Export Administration Regulations (EAR)
3099 https://www.bis.doc.gov/index.php/regulations/export-administration-regulations-ear
3100
3101 33. 5D002
3102 https://www.bis.doc.gov/index.php/documents/regulations-docs/federal-register-notices/federal-register-2014/951-ccl5-pt2/file
3103
3104 34. EAR 740.13(e)
3105 https://www.bis.doc.gov/index.php/documents/regulations-docs/2341-740-2/file
3106
3107
3108
3109Nmap 10/01/2020 NMAP(1)