1NMAP(1)                      Nmap Reference Guide                      NMAP(1)
2
3
4

NAME

6       nmap - Network exploration tool and security / port scanner
7

SYNOPSIS

9       nmap [Scan Type...] [Options] {target specification}
10

DESCRIPTION

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

OPTIONS SUMMARY

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.92 ( 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             --noninteractive: Disable runtime interactions via keyboard
194             --stylesheet <path/URL>: XSL stylesheet to transform XML output to HTML
195             --webxml: Reference stylesheet from Nmap.Org for more portable XML
196             --no-stylesheet: Prevent associating of XSL stylesheet w/XML output
197           MISC:
198             -6: Enable IPv6 scanning
199             -A: Enable OS detection, version detection, script scanning, and traceroute
200             --datadir <dirname>: Specify custom Nmap data file location
201             --send-eth/--send-ip: Send using raw ethernet frames or IP packets
202             --privileged: Assume that the user is fully privileged
203             --unprivileged: Assume the user lacks raw socket privileges
204             -V: Print version number
205             -h: Print this help summary page.
206           EXAMPLES:
207             nmap -v -A scanme.nmap.org
208             nmap -v -sn 192.168.0.0/16 10.0.0.0/8
209             nmap -v -iR 10000 -Pn -p 80
210           SEE THE MAN PAGE (https://nmap.org/book/man.html) FOR MORE OPTIONS AND EXAMPLES
211

TARGET SPECIFICATION

213       Everything on the Nmap command-line that isn't an option (or option
214       argument) is treated as a target host specification. The simplest case
215       is to specify a target IP address or hostname for scanning.
216
217       When a hostname is given as a target, it is resolved via the Domain
218       Name System (DNS) to determine the IP address to scan. If the name
219       resolves to more than one IP address, only the first one will be
220       scanned. To make Nmap scan all the resolved addresses instead of only
221       the first one, use the --resolve-all option.
222
223       Sometimes you wish to scan a whole network of adjacent hosts. For this,
224       Nmap supports CIDR-style addressing. You can append /numbits to an IP
225       address or hostname and Nmap will scan every IP address for which the
226       first numbits are the same as for the reference IP or hostname given.
227       For example, 192.168.10.0/24 would scan the 256 hosts between
228       192.168.10.0 (binary: 11000000 10101000 00001010 00000000) and
229       192.168.10.255 (binary: 11000000 10101000 00001010 11111111),
230       inclusive.  192.168.10.40/24 would scan exactly the same targets. Given
231       that the host scanme.nmap.org is at the IP address 64.13.134.52, the
232       specification scanme.nmap.org/16 would scan the 65,536 IP addresses
233       between 64.13.0.0 and 64.13.255.255. The smallest allowed value is /0,
234       which targets the whole Internet. The largest value for IPv4 is /32,
235       which scans just the named host or IP address because all address bits
236       are fixed. The largest value for IPv6 is /128, which does the same
237       thing.
238
239       CIDR notation is short but not always flexible enough. For example, you
240       might want to scan 192.168.0.0/16 but skip any IPs ending with .0 or
241       .255 because they may be used as subnet network and broadcast
242       addresses. Nmap supports this through octet range addressing. Rather
243       than specify a normal IP address, you can specify a comma-separated
244       list of numbers or ranges for each octet. For example,
245       192.168.0-255.1-254 will skip all addresses in the range that end in .0
246       or .255, and 192.168.3-5,7.1 will scan the four addresses 192.168.3.1,
247       192.168.4.1, 192.168.5.1, and 192.168.7.1. Either side of a range may
248       be omitted; the default values are 0 on the left and 255 on the right.
249       Using - by itself is the same as 0-255, but remember to use 0- in the
250       first octet so the target specification doesn't look like a
251       command-line option. Ranges need not be limited to the final octets:
252       the specifier 0-255.0-255.13.37 will perform an Internet-wide scan for
253       all IP addresses ending in 13.37. This sort of broad sampling can be
254       useful for Internet surveys and research.
255
256       IPv6 addresses can be specified by their fully qualified IPv6 address
257       or hostname or with CIDR notation for subnets. Octet ranges aren't yet
258       supported for IPv6.
259
260       IPv6 addresses with non-global scope need to have a zone ID suffix. On
261       Unix systems, this is a percent sign followed by an interface name; a
262       complete address might be fe80::a8bb:ccff:fedd:eeff%eth0. On Windows,
263       use an interface index number in place of an interface name:
264       fe80::a8bb:ccff:fedd:eeff%1. You can see a list of interface indexes by
265       running the command netsh.exe interface ipv6 show interface.
266
267       Nmap accepts multiple host specifications on the command line, and they
268       don't need to be the same type. The command nmap scanme.nmap.org
269       192.168.0.0/8 10.0.0,1,3-7.- does what you would expect.
270
271       While targets are usually specified on the command lines, the following
272       options are also available to control target selection:
273
274       -iL inputfilename (Input from list)
275           Reads target specifications from inputfilename. Passing a huge list
276           of hosts is often awkward on the command line, yet it is a common
277           desire. For example, your DHCP server might export a list of 10,000
278           current leases that you wish to scan. Or maybe you want to scan all
279           IP addresses except for those to locate hosts using unauthorized
280           static IP addresses. Simply generate the list of hosts to scan and
281           pass that filename to Nmap as an argument to the -iL option.
282           Entries can be in any of the formats accepted by Nmap on the
283           command line (IP address, hostname, CIDR, IPv6, or octet ranges).
284           Each entry must be separated by one or more spaces, tabs, or
285           newlines. You can specify a hyphen (-) as the filename if you want
286           Nmap to read hosts from standard input rather than an actual file.
287
288           The input file may contain comments that start with # and extend to
289           the end of the line.
290
291       -iR num hosts (Choose random targets)
292           For Internet-wide surveys and other research, you may want to
293           choose targets at random. The num hosts argument tells Nmap how
294           many IPs to generate. Undesirable IPs such as those in certain
295           private, multicast, or unallocated address ranges are automatically
296           skipped. The argument 0 can be specified for a never-ending scan.
297           Keep in mind that some network administrators bristle at
298           unauthorized scans of their networks and may complain. Use this
299           option at your own risk! If you find yourself really bored one
300           rainy afternoon, try the command nmap -Pn -sS -p 80 -iR 0 --open to
301           locate random web servers for browsing.
302
303       --exclude host1[,host2[,...]] (Exclude hosts/networks)
304           Specifies a comma-separated list of targets to be excluded from the
305           scan even if they are part of the overall network range you
306           specify. The list you pass in uses normal Nmap syntax, so it can
307           include hostnames, CIDR netblocks, octet ranges, etc. This can be
308           useful when the network you wish to scan includes untouchable
309           mission-critical servers, systems that are known to react adversely
310           to port scans, or subnets administered by other people.
311
312       --excludefile exclude_file (Exclude list from file)
313           This offers the same functionality as the --exclude option, except
314           that the excluded targets are provided in a newline-, space-, or
315           tab-delimited exclude_file rather than on the command line.
316
317           The exclude file may contain comments that start with # and extend
318           to the end of the line.
319

HOST DISCOVERY

321       One of the very first steps in any network reconnaissance mission is to
322       reduce a (sometimes huge) set of IP ranges into a list of active or
323       interesting hosts. Scanning every port of every single IP address is
324       slow and usually unnecessary. Of course what makes a host interesting
325       depends greatly on the scan purposes. Network administrators may only
326       be interested in hosts running a certain service, while security
327       auditors may care about every single device with an IP address. An
328       administrator may be comfortable using just an ICMP ping to locate
329       hosts on his internal network, while an external penetration tester may
330       use a diverse set of dozens of probes in an attempt to evade firewall
331       restrictions.
332
333       Because host discovery needs are so diverse, Nmap offers a wide variety
334       of options for customizing the techniques used. Host discovery is
335       sometimes called ping scan, but it goes well beyond the simple ICMP
336       echo request packets associated with the ubiquitous ping tool. Users
337       can skip the discovery step entirely with a list scan (-sL) or by
338       disabling host discovery (-Pn), or engage the network with arbitrary
339       combinations of multi-port TCP SYN/ACK, UDP, SCTP INIT and ICMP probes.
340       The goal of these probes is to solicit responses which demonstrate that
341       an IP address is actually active (is being used by a host or network
342       device). On many networks, only a small percentage of IP addresses are
343       active at any given time. This is particularly common with private
344       address space such as 10.0.0.0/8. That network has 16 million IPs, but
345       I have seen it used by companies with less than a thousand machines.
346       Host discovery can find those machines in a sparsely allocated sea of
347       IP addresses.
348
349       If no host discovery options are given, Nmap sends an ICMP echo
350       request, a TCP SYN packet to port 443, a TCP ACK packet to port 80, and
351       an ICMP timestamp request. (For IPv6, the ICMP timestamp request is
352       omitted because it is not part of ICMPv6.) These defaults are
353       equivalent to the -PE -PS443 -PA80 -PP options. The exceptions to this
354       are the ARP (for IPv4) and Neighbor Discovery (for IPv6) scans which
355       are used for any targets on a local ethernet network. For unprivileged
356       Unix shell users, the default probes are a SYN packet to ports 80 and
357       443 using the connect system call.  This host discovery is often
358       sufficient when scanning local networks, but a more comprehensive set
359       of discovery probes is recommended for security auditing.
360
361       The -P* options (which select ping types) can be combined. You can
362       increase your odds of penetrating strict firewalls by sending many
363       probe types using different TCP ports/flags and ICMP codes. Also note
364       that ARP/Neighbor Discovery is done by default against targets on a
365       local Ethernet network even if you specify other -P* options, because
366       it is almost always faster and more effective.
367
368       By default, Nmap does host discovery and then performs a port scan
369       against each host it determines is online. This is true even if you
370       specify non-default host discovery types such as UDP probes (-PU). Read
371       about the -sn option to learn how to perform only host discovery, or
372       use -Pn to skip host discovery and port scan all target addresses. The
373       following options control host discovery:
374
375       -sL (List Scan)
376           The list scan is a degenerate form of host discovery that simply
377           lists each host of the network(s) specified, without sending any
378           packets to the target hosts. By default, Nmap still does
379           reverse-DNS resolution on the hosts to learn their names. It is
380           often surprising how much useful information simple hostnames give
381           out. For example, fw.chi is the name of one company's Chicago
382           firewall.
383
384           Nmap also reports the total number of IP addresses at the end. The
385           list scan is a good sanity check to ensure that you have proper IP
386           addresses for your targets. If the hosts sport domain names you do
387           not recognize, it is worth investigating further to prevent
388           scanning the wrong company's network.
389
390           Since the idea is to simply print a list of target hosts, options
391           for higher level functionality such as port scanning, OS detection,
392           or host discovery cannot be combined with this. If you wish to
393           disable host discovery while still performing such higher level
394           functionality, read up on the -Pn (skip host discovery) option.
395
396       -sn (No port scan)
397           This option tells Nmap not to do a port scan after host discovery,
398           and only print out the available hosts that responded to the host
399           discovery probes. This is often known as a “ping scan”, but you can
400           also request that traceroute and NSE host scripts be run. This is
401           by default one step more intrusive than the list scan, and can
402           often be used for the same purposes. It allows light reconnaissance
403           of a target network without attracting much attention. Knowing how
404           many hosts are up is more valuable to attackers than the list
405           provided by list scan of every single IP and host name.
406
407           Systems administrators often find this option valuable as well. It
408           can easily be used to count available machines on a network or
409           monitor server availability. This is often called a ping sweep, and
410           is more reliable than pinging the broadcast address because many
411           hosts do not reply to broadcast queries.
412
413           The default host discovery done with -sn consists of an ICMP echo
414           request, TCP SYN to port 443, TCP ACK to port 80, and an ICMP
415           timestamp request by default. When executed by an unprivileged
416           user, only SYN packets are sent (using a connect call) to ports 80
417           and 443 on the target. When a privileged user tries to scan targets
418           on a local ethernet network, ARP requests are used unless --send-ip
419           was specified. The -sn option can be combined with any of the
420           discovery probe types (the -P* options) for greater flexibility. If
421           any of those probe type and port number options are used, the
422           default probes are overridden. When strict firewalls are in place
423           between the source host running Nmap and the target network, using
424           those advanced techniques is recommended. Otherwise hosts could be
425           missed when the firewall drops probes or their responses.
426
427           In previous releases of Nmap, -sn was known as -sP.
428
429       -Pn (No ping)
430           This option skips the host discovery stage altogether. Normally,
431           Nmap uses this stage to determine active machines for heavier
432           scanning and to gauge the speed of the network. By default, Nmap
433           only performs heavy probing such as port scans, version detection,
434           or OS detection against hosts that are found to be up. Disabling
435           host discovery with -Pn causes Nmap to attempt the requested
436           scanning functions against every target IP address specified. So if
437           a /16 sized network is specified on the command line, all 65,536 IP
438           addresses are scanned. Proper host discovery is skipped as with the
439           list scan, but instead of stopping and printing the target list,
440           Nmap continues to perform requested functions as if each target IP
441           is active. Default timing parameters are used, which may result in
442           slower scans. To skip host discovery and port scan, while still
443           allowing NSE to run, use the two options -Pn -sn together.
444
445           For machines on a local ethernet network, ARP scanning will still
446           be performed (unless --disable-arp-ping or --send-ip is specified)
447           because Nmap needs MAC addresses to further scan target hosts. In
448           previous versions of Nmap, -Pn was -P0 and -PN.
449
450       -PS port list (TCP SYN Ping)
451           This option sends an empty TCP packet with the SYN flag set. The
452           default destination port is 80 (configurable at compile time by
453           changing DEFAULT_TCP_PROBE_PORT_SPEC in nmap.h).  Alternate ports
454           can be specified as a parameter. The syntax is the same as for the
455           -p except that port type specifiers like T: are not allowed.
456           Examples are -PS22 and -PS22-25,80,113,1050,35000. Note that there
457           can be no space between -PS and the port list. If multiple probes
458           are specified they will be sent in parallel.
459
460           The SYN flag suggests to the remote system that you are attempting
461           to establish a connection. Normally the destination port will be
462           closed, and a RST (reset) packet sent back. If the port happens to
463           be open, the target will take the second step of a TCP
464           three-way-handshake by responding with a SYN/ACK TCP packet. The
465           machine running Nmap then tears down the nascent connection by
466           responding with a RST rather than sending an ACK packet which would
467           complete the three-way-handshake and establish a full connection.
468           The RST packet is sent by the kernel of the machine running Nmap in
469           response to the unexpected SYN/ACK, not by Nmap itself.
470
471           Nmap does not care whether the port is open or closed. Either the
472           RST or SYN/ACK response discussed previously tell Nmap that the
473           host is available and responsive.
474
475           On Unix boxes, only the privileged user root is generally able to
476           send and receive raw TCP packets.  For unprivileged users, a
477           workaround is automatically employed whereby the connect system
478           call is initiated against each target port. This has the effect of
479           sending a SYN packet to the target host, in an attempt to establish
480           a connection. If connect returns with a quick success or an
481           ECONNREFUSED failure, the underlying TCP stack must have received a
482           SYN/ACK or RST and the host is marked available. If the connection
483           attempt is left hanging until a timeout is reached, the host is
484           marked as down.
485
486       -PA port list (TCP ACK Ping)
487           The TCP ACK ping is quite similar to the just-discussed SYN ping.
488           The difference, as you could likely guess, is that the TCP ACK flag
489           is set instead of the SYN flag. Such an ACK packet purports to be
490           acknowledging data over an established TCP connection, but no such
491           connection exists. So remote hosts should always respond with a RST
492           packet, disclosing their existence in the process.
493
494           The -PA option uses the same default port as the SYN probe (80) and
495           can also take a list of destination ports in the same format. If an
496           unprivileged user tries this, the connect workaround discussed
497           previously is used. This workaround is imperfect because connect is
498           actually sending a SYN packet rather than an ACK.
499
500           The reason for offering both SYN and ACK ping probes is to maximize
501           the chances of bypassing firewalls. Many administrators configure
502           routers and other simple firewalls to block incoming SYN packets
503           except for those destined for public services like the company web
504           site or mail server. This prevents other incoming connections to
505           the organization, while allowing users to make unobstructed
506           outgoing connections to the Internet. This non-stateful approach
507           takes up few resources on the firewall/router and is widely
508           supported by hardware and software filters. The Linux
509           Netfilter/iptables firewall software offers the --syn convenience
510           option to implement this stateless approach. When stateless
511           firewall rules such as this are in place, SYN ping probes (-PS) are
512           likely to be blocked when sent to closed target ports. In such
513           cases, the ACK probe shines as it cuts right through these rules.
514
515           Another common type of firewall uses stateful rules that drop
516           unexpected packets. This feature was initially found mostly on
517           high-end firewalls, though it has become much more common over the
518           years. The Linux Netfilter/iptables system supports this through
519           the --state option, which categorizes packets based on connection
520           state. A SYN probe is more likely to work against such a system, as
521           unexpected ACK packets are generally recognized as bogus and
522           dropped. A solution to this quandary is to send both SYN and ACK
523           probes by specifying -PS and -PA.
524
525       -PU port list (UDP Ping)
526           Another host discovery option is the UDP ping, which sends a UDP
527           packet to the given ports. For most ports, the packet will be
528           empty, though some use a protocol-specific payload that is more
529           likely to elicit a response.  The payload database is described at
530           https://nmap.org/book/nmap-payloads.html.
531
532           Packet content can also be affected with the --data, --data-string,
533           and --data-length options.
534
535           The port list takes the same format as with the previously
536           discussed -PS and -PA options. If no ports are specified, the
537           default is 40125.  This default can be configured at compile-time
538           by changing DEFAULT_UDP_PROBE_PORT_SPEC in nmap.h.  A highly
539           uncommon port is used by default because sending to open ports is
540           often undesirable for this particular scan type.
541
542           Upon hitting a closed port on the target machine, the UDP probe
543           should elicit an ICMP port unreachable packet in return. This
544           signifies to Nmap that the machine is up and available. Many other
545           types of ICMP errors, such as host/network unreachables or TTL
546           exceeded are indicative of a down or unreachable host. A lack of
547           response is also interpreted this way. If an open port is reached,
548           most services simply ignore the empty packet and fail to return any
549           response. This is why the default probe port is 40125, which is
550           highly unlikely to be in use. A few services, such as the Character
551           Generator (chargen) protocol, will respond to an empty UDP packet,
552           and thus disclose to Nmap that the machine is available.
553
554           The primary advantage of this scan type is that it bypasses
555           firewalls and filters that only screen TCP. For example, I once
556           owned a Linksys BEFW11S4 wireless broadband router. The external
557           interface of this device filtered all TCP ports by default, but UDP
558           probes would still elicit port unreachable messages and thus give
559           away the device.
560
561       -PY port list (SCTP INIT Ping)
562           This option sends an SCTP packet containing a minimal INIT chunk.
563           The default destination port is 80 (configurable at compile time by
564           changing DEFAULT_SCTP_PROBE_PORT_SPEC in nmap.h). Alternate ports
565           can be specified as a parameter. The syntax is the same as for the
566           -p except that port type specifiers like S: are not allowed.
567           Examples are -PY22 and -PY22,80,179,5060. Note that there can be no
568           space between -PY and the port list. If multiple probes are
569           specified they will be sent in parallel.
570
571           The INIT chunk suggests to the remote system that you are
572           attempting to establish an association. Normally the destination
573           port will be closed, and an ABORT chunk will be sent back. If the
574           port happens to be open, the target will take the second step of an
575           SCTP four-way-handshake by responding with an INIT-ACK chunk. If
576           the machine running Nmap has a functional SCTP stack, then it tears
577           down the nascent association by responding with an ABORT chunk
578           rather than sending a COOKIE-ECHO chunk which would be the next
579           step in the four-way-handshake. The ABORT packet is sent by the
580           kernel of the machine running Nmap in response to the unexpected
581           INIT-ACK, not by Nmap itself.
582
583           Nmap does not care whether the port is open or closed. Either the
584           ABORT or INIT-ACK response discussed previously tell Nmap that the
585           host is available and responsive.
586
587           On Unix boxes, only the privileged user root is generally able to
588           send and receive raw SCTP packets.  Using SCTP INIT Pings is
589           currently not possible for unprivileged users.
590
591       -PE; -PP; -PM (ICMP Ping Types)
592           In addition to the unusual TCP, UDP and SCTP host discovery types
593           discussed previously, Nmap can send the standard packets sent by
594           the ubiquitous ping program. Nmap sends an ICMP type 8 (echo
595           request) packet to the target IP addresses, expecting a type 0
596           (echo reply) in return from available hosts.  Unfortunately for
597           network explorers, many hosts and firewalls now block these
598           packets, rather than responding as required by RFC 1122[2].  For
599           this reason, ICMP-only scans are rarely reliable enough against
600           unknown targets over the Internet. But for system administrators
601           monitoring an internal network, they can be a practical and
602           efficient approach. Use the -PE option to enable this echo request
603           behavior.
604
605           While echo request is the standard ICMP ping query, Nmap does not
606           stop there. The ICMP standards (RFC 792[3] and RFC 950[4] ) also
607           specify timestamp request, information request, and address mask
608           request packets as codes 13, 15, and 17, respectively. While the
609           ostensible purpose for these queries is to learn information such
610           as address masks and current times, they can easily be used for
611           host discovery. A system that replies is up and available. Nmap
612           does not currently implement information request packets, as they
613           are not widely supported. RFC 1122 insists that “a host SHOULD NOT
614           implement these messages”. Timestamp and address mask queries can
615           be sent with the -PP and -PM options, respectively. A timestamp
616           reply (ICMP code 14) or address mask reply (code 18) discloses that
617           the host is available. These two queries can be valuable when
618           administrators specifically block echo request packets while
619           forgetting that other ICMP queries can be used for the same
620           purpose.
621
622       -PO protocol list (IP Protocol Ping)
623           One of the newer host discovery options is the IP protocol ping,
624           which sends IP packets with the specified protocol number set in
625           their IP header. The protocol list takes the same format as do port
626           lists in the previously discussed TCP, UDP and SCTP host discovery
627           options. If no protocols are specified, the default is to send
628           multiple IP packets for ICMP (protocol 1), IGMP (protocol 2), and
629           IP-in-IP (protocol 4). The default protocols can be configured at
630           compile-time by changing DEFAULT_PROTO_PROBE_PORT_SPEC in nmap.h.
631           Note that for the ICMP, IGMP, TCP (protocol 6), UDP (protocol 17)
632           and SCTP (protocol 132), the packets are sent with the proper
633           protocol headers while other protocols are sent with no additional
634           data beyond the IP header (unless any of --data, --data-string, or
635           --data-length options are specified).
636
637           This host discovery method looks for either responses using the
638           same protocol as a probe, or ICMP protocol unreachable messages
639           which signify that the given protocol isn't supported on the
640           destination host. Either type of response signifies that the target
641           host is alive.
642
643       --disable-arp-ping (No ARP or ND Ping)
644           Nmap normally does ARP or IPv6 Neighbor Discovery (ND) discovery of
645           locally connected ethernet hosts, even if other host discovery
646           options such as -Pn or -PE are used. To disable this implicit
647           behavior, use the --disable-arp-ping option.
648
649           The default behavior is normally faster, but this option is useful
650           on networks using proxy ARP, in which a router speculatively
651           replies to all ARP requests, making every target appear to be up
652           according to ARP scan.
653
654       --discovery-ignore-rst
655           In some cases, firewalls may spoof TCP reset (RST) replies in
656           response to probes to unoccupied or disallowed addresses. Since
657           Nmap ordinarily considers RST replies to be proof that the target
658           is up, this can lead to wasted time scanning targets that aren't
659           there. Using the --discovery-ignore-rst will prevent Nmap from
660           considering these replies during host discovery. You may need to
661           select extra host discovery options to ensure you don't miss
662           targets in this case.
663
664       --traceroute (Trace path to host)
665           Traceroutes are performed post-scan using information from the scan
666           results to determine the port and protocol most likely to reach the
667           target. It works with all scan types except connect scans (-sT) and
668           idle scans (-sI). All traces use Nmap's dynamic timing model and
669           are performed in parallel.
670
671           Traceroute works by sending packets with a low TTL (time-to-live)
672           in an attempt to elicit ICMP Time Exceeded messages from
673           intermediate hops between the scanner and the target host. Standard
674           traceroute implementations start with a TTL of 1 and increment the
675           TTL until the destination host is reached. Nmap's traceroute starts
676           with a high TTL and then decrements the TTL until it reaches zero.
677           Doing it backwards lets Nmap employ clever caching algorithms to
678           speed up traces over multiple hosts. On average Nmap sends 5–10
679           fewer packets per host, depending on network conditions. If a
680           single subnet is being scanned (i.e. 192.168.0.0/24) Nmap may only
681           have to send two packets to most hosts.
682
683       -n (No DNS resolution)
684
685           Tells Nmap to never do reverse DNS resolution on the active IP
686           addresses it finds. Since DNS can be slow even with Nmap's built-in
687           parallel stub resolver, this option can slash scanning times.
688
689       -R (DNS resolution for all targets)
690           Tells Nmap to always do reverse DNS resolution on the target IP
691           addresses. Normally reverse DNS is only performed against
692           responsive (online) hosts.
693
694       --resolve-all (Scan each resolved address)
695           If a hostname target resolves to more than one address, scan all of
696           them. The default behavior is to only scan the first resolved
697           address. Regardless, only addresses in the appropriate address
698           family will be scanned: IPv4 by default, IPv6 with -6.
699
700       --system-dns (Use system DNS resolver)
701           By default, Nmap reverse-resolves IP addresses by sending queries
702           directly to the name servers configured on your host and then
703           listening for responses. Many requests (often dozens) are performed
704           in parallel to improve performance. Specify this option to use your
705           system resolver instead (one IP at a time via the getnameinfo
706           call). This is slower and rarely useful unless you find a bug in
707           the Nmap parallel resolver (please let us know if you do). The
708           system resolver is always used for forward lookups (getting an IP
709           address from a hostname).
710
711       --dns-servers server1[,server2[,...]]  (Servers to use for reverse DNS
712       queries)
713           By default, Nmap determines your DNS servers (for rDNS resolution)
714           from your resolv.conf file (Unix) or the Registry (Win32).
715           Alternatively, you may use this option to specify alternate
716           servers. This option is not honored if you are using --system-dns.
717           Using multiple DNS servers is often faster, especially if you
718           choose authoritative servers for your target IP space. This option
719           can also improve stealth, as your requests can be bounced off just
720           about any recursive DNS server on the Internet.
721
722           This option also comes in handy when scanning private networks.
723           Sometimes only a few name servers provide proper rDNS information,
724           and you may not even know where they are. You can scan the network
725           for port 53 (perhaps with version detection), then try Nmap list
726           scans (-sL) specifying each name server one at a time with
727           --dns-servers until you find one which works.
728
729           This option might not be honored if the DNS response exceeds the
730           size of a UDP packet. In such a situation our DNS resolver will
731           make the best effort to extract a response from the truncated
732           packet, and if not successful it will fall back to using the system
733           resolver. Also, responses that contain CNAME aliases will fall back
734           to the system resolver.
735

PORT SCANNING BASICS

737       While Nmap has grown in functionality over the years, it began as an
738       efficient port scanner, and that remains its core function. The simple
739       command nmap target scans 1,000 TCP ports on the host target. While
740       many port scanners have traditionally lumped all ports into the open or
741       closed states, Nmap is much more granular. It divides ports into six
742       states: open, closed, filtered, unfiltered, open|filtered, or
743       closed|filtered.
744
745       These states are not intrinsic properties of the port itself, but
746       describe how Nmap sees them. For example, an Nmap scan from the same
747       network as the target may show port 135/tcp as open, while a scan at
748       the same time with the same options from across the Internet might show
749       that port as filtered.
750
751       The six port states recognized by Nmap
752
753       open
754           An application is actively accepting TCP connections, UDP datagrams
755           or SCTP associations on this port. Finding these is often the
756           primary goal of port scanning. Security-minded people know that
757           each open port is an avenue for attack. Attackers and pen-testers
758           want to exploit the open ports, while administrators try to close
759           or protect them with firewalls without thwarting legitimate users.
760           Open ports are also interesting for non-security scans because they
761           show services available for use on the network.
762
763       closed
764           A closed port is accessible (it receives and responds to Nmap probe
765           packets), but there is no application listening on it. They can be
766           helpful in showing that a host is up on an IP address (host
767           discovery, or ping scanning), and as part of OS detection. Because
768           closed ports are reachable, it may be worth scanning later in case
769           some open up. Administrators may want to consider blocking such
770           ports with a firewall. Then they would appear in the filtered
771           state, discussed next.
772
773       filtered
774           Nmap cannot determine whether the port is open because packet
775           filtering prevents its probes from reaching the port. The filtering
776           could be from a dedicated firewall device, router rules, or
777           host-based firewall software. These ports frustrate attackers
778           because they provide so little information. Sometimes they respond
779           with ICMP error messages such as type 3 code 13 (destination
780           unreachable: communication administratively prohibited), but
781           filters that simply drop probes without responding are far more
782           common. This forces Nmap to retry several times just in case the
783           probe was dropped due to network congestion rather than filtering.
784           This slows down the scan dramatically.
785
786       unfiltered
787           The unfiltered state means that a port is accessible, but Nmap is
788           unable to determine whether it is open or closed. Only the ACK
789           scan, which is used to map firewall rulesets, classifies ports into
790           this state. Scanning unfiltered ports with other scan types such as
791           Window scan, SYN scan, or FIN scan, may help resolve whether the
792           port is open.
793
794       open|filtered
795           Nmap places ports in this state when it is unable to determine
796           whether a port is open or filtered. This occurs for scan types in
797           which open ports give no response. The lack of response could also
798           mean that a packet filter dropped the probe or any response it
799           elicited. So Nmap does not know for sure whether the port is open
800           or being filtered. The UDP, IP protocol, FIN, NULL, and Xmas scans
801           classify ports this way.
802
803       closed|filtered
804           This state is used when Nmap is unable to determine whether a port
805           is closed or filtered. It is only used for the IP ID idle scan.
806

PORT SCANNING TECHNIQUES

808       As a novice performing automotive repair, I can struggle for hours
809       trying to fit my rudimentary tools (hammer, duct tape, wrench, etc.) to
810       the task at hand. When I fail miserably and tow my jalopy to a real
811       mechanic, he invariably fishes around in a huge tool chest until
812       pulling out the perfect gizmo which makes the job seem effortless. The
813       art of port scanning is similar. Experts understand the dozens of scan
814       techniques and choose the appropriate one (or combination) for a given
815       task. Inexperienced users and script kiddies, on the other hand, try to
816       solve every problem with the default SYN scan. Since Nmap is free, the
817       only barrier to port scanning mastery is knowledge. That certainly
818       beats the automotive world, where it may take great skill to determine
819       that you need a strut spring compressor, then you still have to pay
820       thousands of dollars for it.
821
822       Most of the scan types are only available to privileged users.  This is
823       because they send and receive raw packets, which requires root access
824       on Unix systems. Using an administrator account on Windows is
825       recommended, though Nmap sometimes works for unprivileged users on that
826       platform when Npcap has already been loaded into the OS. Requiring root
827       privileges was a serious limitation when Nmap was released in 1997, as
828       many users only had access to shared shell accounts. Now, the world is
829       different. Computers are cheaper, far more people have always-on direct
830       Internet access, and desktop Unix systems (including Linux and Mac OS
831       X) are prevalent. A Windows version of Nmap is now available, allowing
832       it to run on even more desktops. For all these reasons, users have less
833       need to run Nmap from limited shared shell accounts. This is fortunate,
834       as the privileged options make Nmap far more powerful and flexible.
835
836       While Nmap attempts to produce accurate results, keep in mind that all
837       of its insights are based on packets returned by the target machines
838       (or firewalls in front of them). Such hosts may be untrustworthy and
839       send responses intended to confuse or mislead Nmap. Much more common
840       are non-RFC-compliant hosts that do not respond as they should to Nmap
841       probes. FIN, NULL, and Xmas scans are particularly susceptible to this
842       problem. Such issues are specific to certain scan types and so are
843       discussed in the individual scan type entries.
844
845       This section documents the dozen or so port scan techniques supported
846       by Nmap. Only one method may be used at a time, except that UDP scan
847       (-sU) and any one of the SCTP scan types (-sY, -sZ) may be combined
848       with any one of the TCP scan types. As a memory aid, port scan type
849       options are of the form -sC, where C is a prominent character in the
850       scan name, usually the first. The one exception to this is the
851       deprecated FTP bounce scan (-b). By default, Nmap performs a SYN Scan,
852       though it substitutes a connect scan if the user does not have proper
853       privileges to send raw packets (requires root access on Unix). Of the
854       scans listed in this section, unprivileged users can only execute
855       connect and FTP bounce scans.
856
857       -sS (TCP SYN scan)
858           SYN scan is the default and most popular scan option for good
859           reasons. It can be performed quickly, scanning thousands of ports
860           per second on a fast network not hampered by restrictive firewalls.
861           It is also relatively unobtrusive and stealthy since it never
862           completes TCP connections. SYN scan works against any compliant TCP
863           stack rather than depending on idiosyncrasies of specific platforms
864           as Nmap's FIN/NULL/Xmas, Maimon and idle scans do. It also allows
865           clear, reliable differentiation between the open, closed, and
866           filtered states.
867
868           This technique is often referred to as half-open scanning, because
869           you don't open a full TCP connection. You send a SYN packet, as if
870           you are going to open a real connection and then wait for a
871           response. A SYN/ACK indicates the port is listening (open), while a
872           RST (reset) is indicative of a non-listener. If no response is
873           received after several retransmissions, the port is marked as
874           filtered. The port is also marked filtered if an ICMP unreachable
875           error (type 3, code 0, 1, 2, 3, 9, 10, or 13) is received. The port
876           is also considered open if a SYN packet (without the ACK flag) is
877           received in response. This can be due to an extremely rare TCP
878           feature known as a simultaneous open or split handshake connection
879           (see https://nmap.org/misc/split-handshake.pdf).
880
881       -sT (TCP connect scan)
882           TCP connect scan is the default TCP scan type when SYN scan is not
883           an option. This is the case when a user does not have raw packet
884           privileges. Instead of writing raw packets as most other scan types
885           do, Nmap asks the underlying operating system to establish a
886           connection with the target machine and port by issuing the connect
887           system call. This is the same high-level system call that web
888           browsers, P2P clients, and most other network-enabled applications
889           use to establish a connection. It is part of a programming
890           interface known as the Berkeley Sockets API. Rather than read raw
891           packet responses off the wire, Nmap uses this API to obtain status
892           information on each connection attempt.
893
894           When SYN scan is available, it is usually a better choice. Nmap has
895           less control over the high level connect call than with raw
896           packets, making it less efficient. The system call completes
897           connections to open target ports rather than performing the
898           half-open reset that SYN scan does. Not only does this take longer
899           and require more packets to obtain the same information, but target
900           machines are more likely to log the connection. A decent IDS will
901           catch either, but most machines have no such alarm system. Many
902           services on your average Unix system will add a note to syslog, and
903           sometimes a cryptic error message, when Nmap connects and then
904           closes the connection without sending data. Truly pathetic services
905           crash when this happens, though that is uncommon. An administrator
906           who sees a bunch of connection attempts in her logs from a single
907           system should know that she has been connect scanned.
908
909       -sU (UDP scans)
910           While most popular services on the Internet run over the TCP
911           protocol, UDP[5] services are widely deployed. DNS, SNMP, and DHCP
912           (registered ports 53, 161/162, and 67/68) are three of the most
913           common. Because UDP scanning is generally slower and more difficult
914           than TCP, some security auditors ignore these ports. This is a
915           mistake, as exploitable UDP services are quite common and attackers
916           certainly don't ignore the whole protocol. Fortunately, Nmap can
917           help inventory UDP ports.
918
919           UDP scan is activated with the -sU option. It can be combined with
920           a TCP scan type such as SYN scan (-sS) to check both protocols
921           during the same run.
922
923           UDP scan works by sending a UDP packet to every targeted port. For
924           some common ports such as 53 and 161, a protocol-specific payload
925           is sent to increase response rate, but for most ports the packet is
926           empty unless the --data, --data-string, or --data-length options
927           are specified. If an ICMP port unreachable error (type 3, code 3)
928           is returned, the port is closed. Other ICMP unreachable errors
929           (type 3, codes 0, 1, 2, 9, 10, or 13) mark the port as filtered.
930           Occasionally, a service will respond with a UDP packet, proving
931           that it is open. If no response is received after retransmissions,
932           the port is classified as open|filtered. This means that the port
933           could be open, or perhaps packet filters are blocking the
934           communication. Version detection (-sV) can be used to help
935           differentiate the truly open ports from the filtered ones.
936
937           A big challenge with UDP scanning is doing it quickly. Open and
938           filtered ports rarely send any response, leaving Nmap to time out
939           and then conduct retransmissions just in case the probe or response
940           were lost. Closed ports are often an even bigger problem. They
941           usually send back an ICMP port unreachable error. But unlike the
942           RST packets sent by closed TCP ports in response to a SYN or
943           connect scan, many hosts rate limit ICMP port unreachable messages
944           by default. Linux and Solaris are particularly strict about this.
945           For example, the Linux 2.4.20 kernel limits destination unreachable
946           messages to one per second (in net/ipv4/icmp.c).
947
948           Nmap detects rate limiting and slows down accordingly to avoid
949           flooding the network with useless packets that the target machine
950           will drop. Unfortunately, a Linux-style limit of one packet per
951           second makes a 65,536-port scan take more than 18 hours. Ideas for
952           speeding your UDP scans up include scanning more hosts in parallel,
953           doing a quick scan of just the popular ports first, scanning from
954           behind the firewall, and using --host-timeout to skip slow hosts.
955
956       -sY (SCTP INIT scan)
957           SCTP[6] is a relatively new alternative to the TCP and UDP
958           protocols, combining most characteristics of TCP and UDP, and also
959           adding new features like multi-homing and multi-streaming. It is
960           mostly being used for SS7/SIGTRAN related services but has the
961           potential to be used for other applications as well. SCTP INIT scan
962           is the SCTP equivalent of a TCP SYN scan. It can be performed
963           quickly, scanning thousands of ports per second on a fast network
964           not hampered by restrictive firewalls. Like SYN scan, INIT scan is
965           relatively unobtrusive and stealthy, since it never completes SCTP
966           associations. It also allows clear, reliable differentiation
967           between the open, closed, and filtered states.
968
969           This technique is often referred to as half-open scanning, because
970           you don't open a full SCTP association. You send an INIT chunk, as
971           if you are going to open a real association and then wait for a
972           response. An INIT-ACK chunk indicates the port is listening (open),
973           while an ABORT chunk is indicative of a non-listener. If no
974           response is received after several retransmissions, the port is
975           marked as filtered. The port is also marked filtered if an ICMP
976           unreachable error (type 3, code 0, 1, 2, 3, 9, 10, or 13) is
977           received.
978
979       -sN; -sF; -sX (TCP NULL, FIN, and Xmas scans)
980           These three scan types (even more are possible with the --scanflags
981           option described in the next section) exploit a subtle loophole in
982           the TCP RFC[7] to differentiate between open and closed ports. Page
983           65 of RFC 793 says that “if the [destination] port state is CLOSED
984           .... an incoming segment not containing a RST causes a RST to be
985           sent in response.”  Then the next page discusses packets sent to
986           open ports without the SYN, RST, or ACK bits set, stating that:
987           “you are unlikely to get here, but if you do, drop the segment, and
988           return.”
989
990           When scanning systems compliant with this RFC text, any packet not
991           containing SYN, RST, or ACK bits will result in a returned RST if
992           the port is closed and no response at all if the port is open. As
993           long as none of those three bits are included, any combination of
994           the other three (FIN, PSH, and URG) are OK. Nmap exploits this with
995           three scan types:
996
997           Null scan (-sN)
998               Does not set any bits (TCP flag header is 0)
999
1000           FIN scan (-sF)
1001               Sets just the TCP FIN bit.
1002
1003           Xmas scan (-sX)
1004               Sets the FIN, PSH, and URG flags, lighting the packet up like a
1005               Christmas tree.
1006
1007           These three scan types are exactly the same in behavior except for
1008           the TCP flags set in probe packets. If a RST packet is received,
1009           the port is considered closed, while no response means it is
1010           open|filtered. The port is marked filtered if an ICMP unreachable
1011           error (type 3, code 0, 1, 2, 3, 9, 10, or 13) is received.
1012
1013           The key advantage to these scan types is that they can sneak
1014           through certain non-stateful firewalls and packet filtering
1015           routers. Another advantage is that these scan types are a little
1016           more stealthy than even a SYN scan. Don't count on this though—most
1017           modern IDS products can be configured to detect them. The big
1018           downside is that not all systems follow RFC 793 to the letter. A
1019           number of systems send RST responses to the probes regardless of
1020           whether the port is open or not. This causes all of the ports to be
1021           labeled closed. Major operating systems that do this are Microsoft
1022           Windows, many Cisco devices, BSDI, and IBM OS/400. This scan does
1023           work against most Unix-based systems though. Another downside of
1024           these scans is that they can't distinguish open ports from certain
1025           filtered ones, leaving you with the response open|filtered.
1026
1027       -sA (TCP ACK scan)
1028           This scan is different than the others discussed so far in that it
1029           never determines open (or even open|filtered) ports. It is used to
1030           map out firewall rulesets, determining whether they are stateful or
1031           not and which ports are filtered.
1032
1033           The ACK scan probe packet has only the ACK flag set (unless you use
1034           --scanflags). When scanning unfiltered systems, open and closed
1035           ports will both return a RST packet. Nmap then labels them as
1036           unfiltered, meaning that they are reachable by the ACK packet, but
1037           whether they are open or closed is undetermined. Ports that don't
1038           respond, or send certain ICMP error messages back (type 3, code 0,
1039           1, 2, 3, 9, 10, or 13), are labeled filtered.
1040
1041       -sW (TCP Window scan)
1042           Window scan is exactly the same as ACK scan except that it exploits
1043           an implementation detail of certain systems to differentiate open
1044           ports from closed ones, rather than always printing unfiltered when
1045           a RST is returned. It does this by examining the TCP Window field
1046           of the RST packets returned. On some systems, open ports use a
1047           positive window size (even for RST packets) while closed ones have
1048           a zero window. So instead of always listing a port as unfiltered
1049           when it receives a RST back, Window scan lists the port as open or
1050           closed if the TCP Window value in that reset is positive or zero,
1051           respectively.
1052
1053           This scan relies on an implementation detail of a minority of
1054           systems out on the Internet, so you can't always trust it. Systems
1055           that don't support it will usually return all ports closed. Of
1056           course, it is possible that the machine really has no open ports.
1057           If most scanned ports are closed but a few common port numbers
1058           (such as 22, 25, 53) are filtered, the system is most likely
1059           susceptible. Occasionally, systems will even show the exact
1060           opposite behavior. If your scan shows 1,000 open ports and three
1061           closed or filtered ports, then those three may very well be the
1062           truly open ones.
1063
1064       -sM (TCP Maimon scan)
1065           The Maimon scan is named after its discoverer, Uriel Maimon.  He
1066           described the technique in Phrack Magazine issue #49 (November
1067           1996).  Nmap, which included this technique, was released two
1068           issues later. This technique is exactly the same as NULL, FIN, and
1069           Xmas scans, except that the probe is FIN/ACK. According to RFC
1070           793[7] (TCP), a RST packet should be generated in response to such
1071           a probe whether the port is open or closed. However, Uriel noticed
1072           that many BSD-derived systems simply drop the packet if the port is
1073           open.
1074
1075       --scanflags (Custom TCP scan)
1076           Truly advanced Nmap users need not limit themselves to the canned
1077           scan types offered. The --scanflags option allows you to design
1078           your own scan by specifying arbitrary TCP flags.  Let your creative
1079           juices flow, while evading intrusion detection systems whose
1080           vendors simply paged through the Nmap man page adding specific
1081           rules!
1082
1083           The --scanflags argument can be a numerical flag value such as 9
1084           (PSH and FIN), but using symbolic names is easier. Just mash
1085           together any combination of URG, ACK, PSH, RST, SYN, and FIN. For
1086           example, --scanflags URGACKPSHRSTSYNFIN sets everything, though
1087           it's not very useful for scanning. The order these are specified in
1088           is irrelevant.
1089
1090           In addition to specifying the desired flags, you can specify a TCP
1091           scan type (such as -sA or -sF). That base type tells Nmap how to
1092           interpret responses. For example, a SYN scan considers no-response
1093           to indicate a filtered port, while a FIN scan treats the same as
1094           open|filtered. Nmap will behave the same way it does for the base
1095           scan type, except that it will use the TCP flags you specify
1096           instead. If you don't specify a base type, SYN scan is used.
1097
1098       -sZ (SCTP COOKIE ECHO scan)
1099           SCTP COOKIE ECHO scan is a more advanced SCTP scan. It takes
1100           advantage of the fact that SCTP implementations should silently
1101           drop packets containing COOKIE ECHO chunks on open ports, but send
1102           an ABORT if the port is closed. The advantage of this scan type is
1103           that it is not as obvious a port scan than an INIT scan. Also,
1104           there may be non-stateful firewall rulesets blocking INIT chunks,
1105           but not COOKIE ECHO chunks. Don't be fooled into thinking that this
1106           will make a port scan invisible; a good IDS will be able to detect
1107           SCTP COOKIE ECHO scans too. The downside is that SCTP COOKIE ECHO
1108           scans cannot differentiate between open and filtered ports, leaving
1109           you with the state open|filtered in both cases.
1110
1111       -sI zombie host[:probeport] (idle scan)
1112           This advanced scan method allows for a truly blind TCP port scan of
1113           the target (meaning no packets are sent to the target from your
1114           real IP address). Instead, a unique side-channel attack exploits
1115           predictable IP fragmentation ID sequence generation on the zombie
1116           host to glean information about the open ports on the target. IDS
1117           systems will display the scan as coming from the zombie machine you
1118           specify (which must be up and meet certain criteria).  This
1119           fascinating scan type is too complex to fully describe in this
1120           reference guide, so I wrote and posted an informal paper with full
1121           details at https://nmap.org/book/idlescan.html.
1122
1123           Besides being extraordinarily stealthy (due to its blind nature),
1124           this scan type permits mapping out IP-based trust relationships
1125           between machines. The port listing shows open ports from the
1126           perspective of the zombie host.  So you can try scanning a target
1127           using various zombies that you think might be trusted (via
1128           router/packet filter rules).
1129
1130           You can add a colon followed by a port number to the zombie host if
1131           you wish to probe a particular port on the zombie for IP ID
1132           changes. Otherwise Nmap will use the port it uses by default for
1133           TCP pings (80).
1134
1135       -sO (IP protocol scan)
1136           IP protocol scan allows you to determine which IP protocols (TCP,
1137           ICMP, IGMP, etc.) are supported by target machines. This isn't
1138           technically a port scan, since it cycles through IP protocol
1139           numbers rather than TCP or UDP port numbers. Yet it still uses the
1140           -p option to select scanned protocol numbers, reports its results
1141           within the normal port table format, and even uses the same
1142           underlying scan engine as the true port scanning methods. So it is
1143           close enough to a port scan that it belongs here.
1144
1145           Besides being useful in its own right, protocol scan demonstrates
1146           the power of open-source software. While the fundamental idea is
1147           pretty simple, I had not thought to add it nor received any
1148           requests for such functionality. Then in the summer of 2000,
1149           Gerhard Rieger conceived the idea, wrote an excellent patch
1150           implementing it, and sent it to the announce mailing list (then
1151           called nmap-hackers).  I incorporated that patch into the Nmap tree
1152           and released a new version the next day. Few pieces of commercial
1153           software have users enthusiastic enough to design and contribute
1154           their own improvements!
1155
1156           Protocol scan works in a similar fashion to UDP scan. Instead of
1157           iterating through the port number field of a UDP packet, it sends
1158           IP packet headers and iterates through the eight-bit IP protocol
1159           field. The headers are usually empty, containing no data and not
1160           even the proper header for the claimed protocol. The exceptions are
1161           TCP, UDP, ICMP, SCTP, and IGMP. A proper protocol header for those
1162           is included since some systems won't send them otherwise and
1163           because Nmap already has functions to create them. Instead of
1164           watching for ICMP port unreachable messages, protocol scan is on
1165           the lookout for ICMP protocol unreachable messages. If Nmap
1166           receives any response in any protocol from the target host, Nmap
1167           marks that protocol as open. An ICMP protocol unreachable error
1168           (type 3, code 2) causes the protocol to be marked as closed while
1169           port unreachable (type 3, code 3) marks the protocol open. Other
1170           ICMP unreachable errors (type 3, code 0, 1, 9, 10, or 13) cause the
1171           protocol to be marked filtered (though they prove that ICMP is open
1172           at the same time). If no response is received after
1173           retransmissions, the protocol is marked open|filtered
1174
1175       -b FTP relay host (FTP bounce scan)
1176           An interesting feature of the FTP protocol (RFC 959[8]) is support
1177           for so-called proxy FTP connections. This allows a user to connect
1178           to one FTP server, then ask that files be sent to a third-party
1179           server. Such a feature is ripe for abuse on many levels, so most
1180           servers have ceased supporting it. One of the abuses this feature
1181           allows is causing the FTP server to port scan other hosts. Simply
1182           ask the FTP server to send a file to each interesting port of a
1183           target host in turn. The error message will describe whether the
1184           port is open or not. This is a good way to bypass firewalls because
1185           organizational FTP servers are often placed where they have more
1186           access to other internal hosts than any old Internet host would.
1187           Nmap supports FTP bounce scan with the -b option. It takes an
1188           argument of the form username:password@server:port.  Server is the
1189           name or IP address of a vulnerable FTP server. As with a normal
1190           URL, you may omit username:password, in which case anonymous login
1191           credentials (user: anonymous password:-wwwuser@) are used. The port
1192           number (and preceding colon) may be omitted as well, in which case
1193           the default FTP port (21) on server is used.
1194
1195           This vulnerability was widespread in 1997 when Nmap was released,
1196           but has largely been fixed. Vulnerable servers are still around, so
1197           it is worth trying when all else fails. If bypassing a firewall is
1198           your goal, scan the target network for port 21 (or even for any FTP
1199           services if you scan all ports with version detection) and use the
1200           ftp-bounce NSE script. Nmap will tell you whether the host is
1201           vulnerable or not. If you are just trying to cover your tracks, you
1202           don't need to (and, in fact, shouldn't) limit yourself to hosts on
1203           the target network. Before you go scanning random Internet
1204           addresses for vulnerable FTP servers, consider that sysadmins may
1205           not appreciate you abusing their servers in this way.
1206

PORT SPECIFICATION AND SCAN ORDER

1208       In addition to all of the scan methods discussed previously, Nmap
1209       offers options for specifying which ports are scanned and whether the
1210       scan order is randomized or sequential. By default, Nmap scans the most
1211       common 1,000 ports for each protocol.
1212
1213
1214       -p port ranges (Only scan specified ports)
1215           This option specifies which ports you want to scan and overrides
1216           the default. Individual port numbers are OK, as are ranges
1217           separated by a hyphen (e.g.  1-1023). The beginning and/or end
1218           values of a range may be omitted, causing Nmap to use 1 and 65535,
1219           respectively. So you can specify -p- to scan ports from 1 through
1220           65535. Scanning port zero is allowed if you specify it explicitly.
1221           For IP protocol scanning (-sO), this option specifies the protocol
1222           numbers you wish to scan for (0–255).
1223
1224           When scanning a combination of protocols (e.g. TCP and UDP), you
1225           can specify a particular protocol by preceding the port numbers by
1226           T: for TCP, U: for UDP, S: for SCTP, or P: for IP Protocol. The
1227           qualifier lasts until you specify another qualifier. For example,
1228           the argument -p U:53,111,137,T:21-25,80,139,8080 would scan UDP
1229           ports 53, 111,and 137, as well as the listed TCP ports. Note that
1230           to scan both UDP and TCP, you have to specify -sU and at least one
1231           TCP scan type (such as -sS, -sF, or -sT). If no protocol qualifier
1232           is given, the port numbers are added to all protocol lists.  Ports
1233           can also be specified by name according to what the port is
1234           referred to in the nmap-services. You can even use the wildcards *
1235           and ?  with the names. For example, to scan FTP and all ports whose
1236           names begin with “http”, use -p ftp,http*. Be careful about shell
1237           expansions and quote the argument to -p if unsure.
1238
1239           Ranges of ports can be surrounded by square brackets to indicate
1240           ports inside that range that appear in nmap-services. For example,
1241           the following will scan all ports in nmap-services equal to or
1242           below 1024: -p [-1024]. Be careful with shell expansions and quote
1243           the argument to -p if unsure.
1244
1245       --exclude-ports port ranges (Exclude the specified ports from scanning)
1246           This option specifies which ports you do want Nmap to exclude from
1247           scanning. The port ranges are specified similar to -p. For IP
1248           protocol scanning (-sO), this option specifies the protocol numbers
1249           you wish to exclude (0–255).
1250
1251           When ports are asked to be excluded, they are excluded from all
1252           types of scans (i.e. they will not be scanned under any
1253           circumstances). This also includes the discovery phase.
1254
1255       -F (Fast (limited port) scan)
1256           Specifies that you wish to scan fewer ports than the default.
1257           Normally Nmap scans the most common 1,000 ports for each scanned
1258           protocol. With -F, this is reduced to 100.
1259
1260           Nmap needs an nmap-services file with frequency information in
1261           order to know which ports are the most common. If port frequency
1262           information isn't available, perhaps because of the use of a custom
1263           nmap-services file, Nmap scans all named ports plus ports 1-1024.
1264           In that case, -F means to scan only ports that are named in the
1265           services file.
1266
1267       -r (Don't randomize ports)
1268           By default, Nmap randomizes the scanned port order (except that
1269           certain commonly accessible ports are moved near the beginning for
1270           efficiency reasons). This randomization is normally desirable, but
1271           you can specify -r for sequential (sorted from lowest to highest)
1272           port scanning instead.
1273
1274       --port-ratio ratio<decimal number between 0 and 1>
1275           Scans all ports in nmap-services file with a ratio greater than the
1276           one given.  ratio must be between 0.0 and 1.0.
1277
1278       --top-ports n
1279           Scans the n highest-ratio ports found in nmap-services file after
1280           excluding all ports specified by --exclude-ports.  n must be 1 or
1281           greater.
1282

SERVICE AND VERSION DETECTION

1284       Point Nmap at a remote machine and it might tell you that ports 25/tcp,
1285       80/tcp, and 53/udp are open. Using its nmap-services database of about
1286       2,200 well-known services, Nmap would report that those ports probably
1287       correspond to a mail server (SMTP), web server (HTTP), and name server
1288       (DNS) respectively. This lookup is usually accurate—the vast majority
1289       of daemons listening on TCP port 25 are, in fact, mail servers.
1290       However, you should not bet your security on this! People can and do
1291       run services on strange ports.
1292
1293       Even if Nmap is right, and the hypothetical server above is running
1294       SMTP, HTTP, and DNS servers, that is not a lot of information. When
1295       doing vulnerability assessments (or even simple network inventories) of
1296       your companies or clients, you really want to know which mail and DNS
1297       servers and versions are running. Having an accurate version number
1298       helps dramatically in determining which exploits a server is vulnerable
1299       to. Version detection helps you obtain this information.
1300
1301       After TCP and/or UDP ports are discovered using one of the other scan
1302       methods, version detection interrogates those ports to determine more
1303       about what is actually running. The nmap-service-probes database
1304       contains probes for querying various services and match expressions to
1305       recognize and parse responses. Nmap tries to determine the service
1306       protocol (e.g. FTP, SSH, Telnet, HTTP), the application name (e.g. ISC
1307       BIND, Apache httpd, Solaris telnetd), the version number, hostname,
1308       device type (e.g. printer, router), the OS family (e.g. Windows,
1309       Linux). When possible, Nmap also gets the Common Platform Enumeration
1310       (CPE) representation of this information. Sometimes miscellaneous
1311       details like whether an X server is open to connections, the SSH
1312       protocol version, or the KaZaA user name, are available. Of course,
1313       most services don't provide all of this information. If Nmap was
1314       compiled with OpenSSL support, it will connect to SSL servers to deduce
1315       the service listening behind that encryption layer.  Some UDP ports are
1316       left in the open|filtered state after a UDP port scan is unable to
1317       determine whether the port is open or filtered. Version detection will
1318       try to elicit a response from these ports (just as it does with open
1319       ports), and change the state to open if it succeeds.  open|filtered TCP
1320       ports are treated the same way. Note that the Nmap -A option enables
1321       version detection among other things.  A paper documenting the
1322       workings, usage, and customization of version detection is available at
1323       https://nmap.org/book/vscan.html.
1324
1325       When RPC services are discovered, the Nmap RPC grinder is automatically
1326       used to determine the RPC program and version numbers. It takes all the
1327       TCP/UDP ports detected as RPC and floods them with SunRPC program NULL
1328       commands in an attempt to determine whether they are RPC ports, and if
1329       so, what program and version number they serve up. Thus you can
1330       effectively obtain the same info as rpcinfo -p even if the target's
1331       portmapper is behind a firewall (or protected by TCP wrappers). Decoys
1332       do not currently work with RPC scan.
1333
1334       When Nmap receives responses from a service but cannot match them to
1335       its database, it prints out a special fingerprint and a URL for you to
1336       submit it to if you know for sure what is running on the port. Please
1337       take a couple minutes to make the submission so that your find can
1338       benefit everyone. Thanks to these submissions, Nmap has about 6,500
1339       pattern matches for more than 650 protocols such as SMTP, FTP, HTTP,
1340       etc.
1341
1342       Version detection is enabled and controlled with the following options:
1343
1344       -sV (Version detection)
1345           Enables version detection, as discussed above. Alternatively, you
1346           can use -A, which enables version detection among other things.
1347
1348           -sR is an alias for -sV. Prior to March 2011, it was used to active
1349           the RPC grinder separately from version detection, but now these
1350           options are always combined.
1351
1352       --allports (Don't exclude any ports from version detection)
1353           By default, Nmap version detection skips TCP port 9100 because some
1354           printers simply print anything sent to that port, leading to dozens
1355           of pages of HTTP GET requests, binary SSL session requests, etc.
1356           This behavior can be changed by modifying or removing the Exclude
1357           directive in nmap-service-probes, or you can specify --allports to
1358           scan all ports regardless of any Exclude directive.
1359
1360       --version-intensity intensity (Set version scan intensity)
1361           When performing a version scan (-sV), Nmap sends a series of
1362           probes, each of which is assigned a rarity value between one and
1363           nine. The lower-numbered probes are effective against a wide
1364           variety of common services, while the higher-numbered ones are
1365           rarely useful. The intensity level specifies which probes should be
1366           applied. The higher the number, the more likely it is the service
1367           will be correctly identified. However, high intensity scans take
1368           longer. The intensity must be between 0 and 9.  The default is 7.
1369           When a probe is registered to the target port via the
1370           nmap-service-probes ports directive, that probe is tried regardless
1371           of intensity level. This ensures that the DNS probes will always be
1372           attempted against any open port 53, the SSL probe will be done
1373           against 443, etc.
1374
1375       --version-light (Enable light mode)
1376           This is a convenience alias for --version-intensity 2. This light
1377           mode makes version scanning much faster, but it is slightly less
1378           likely to identify services.
1379
1380       --version-all (Try every single probe)
1381           An alias for --version-intensity 9, ensuring that every single
1382           probe is attempted against each port.
1383
1384       --version-trace (Trace version scan activity)
1385           This causes Nmap to print out extensive debugging info about what
1386           version scanning is doing. It is a subset of what you get with
1387           --packet-trace.
1388

OS DETECTION

1390       One of Nmap's best-known features is remote OS detection using TCP/IP
1391       stack fingerprinting. Nmap sends a series of TCP and UDP packets to the
1392       remote host and examines practically every bit in the responses. After
1393       performing dozens of tests such as TCP ISN sampling, TCP options
1394       support and ordering, IP ID sampling, and the initial window size
1395       check, Nmap compares the results to its nmap-os-db database of more
1396       than 2,600 known OS fingerprints and prints out the OS details if there
1397       is a match. Each fingerprint includes a freeform textual description of
1398       the OS, and a classification which provides the vendor name (e.g. Sun),
1399       underlying OS (e.g. Solaris), OS generation (e.g. 10), and device type
1400       (general purpose, router, switch, game console, etc). Most fingerprints
1401       also have a Common Platform Enumeration (CPE) representation, like
1402       cpe:/o:linux:linux_kernel:2.6.
1403
1404       If Nmap is unable to guess the OS of a machine, and conditions are good
1405       (e.g. at least one open port and one closed port were found), Nmap will
1406       provide a URL you can use to submit the fingerprint if you know (for
1407       sure) the OS running on the machine. By doing this you contribute to
1408       the pool of operating systems known to Nmap and thus it will be more
1409       accurate for everyone.
1410
1411       OS detection enables some other tests which make use of information
1412       that is gathered during the process anyway. One of these is TCP
1413       Sequence Predictability Classification. This measures approximately how
1414       hard it is to establish a forged TCP connection against the remote
1415       host. It is useful for exploiting source-IP based trust relationships
1416       (rlogin, firewall filters, etc) or for hiding the source of an attack.
1417       This sort of spoofing is rarely performed any more, but many machines
1418       are still vulnerable to it. The actual difficulty number is based on
1419       statistical sampling and may fluctuate. It is generally better to use
1420       the English classification such as “worthy challenge” or “trivial
1421       joke”. This is only reported in normal output in verbose (-v) mode.
1422       When verbose mode is enabled along with -O, IP ID sequence generation
1423       is also reported. Most machines are in the “incremental” class, which
1424       means that they increment the ID field in the IP header for each packet
1425       they send. This makes them vulnerable to several advanced information
1426       gathering and spoofing attacks.
1427
1428       Another bit of extra information enabled by OS detection is a guess at
1429       a target's uptime. This uses the TCP timestamp option (RFC 1323[9]) to
1430       guess when a machine was last rebooted. The guess can be inaccurate due
1431       to the timestamp counter not being initialized to zero or the counter
1432       overflowing and wrapping around, so it is printed only in verbose mode.
1433
1434       A paper documenting the workings, usage, and customization of OS
1435       detection is available at https://nmap.org/book/osdetect.html.
1436
1437       OS detection is enabled and controlled with the following options:
1438
1439       -O (Enable OS detection)
1440           Enables OS detection, as discussed above. Alternatively, you can
1441           use -A to enable OS detection along with other things.
1442
1443       --osscan-limit (Limit OS detection to promising targets)
1444           OS detection is far more effective if at least one open and one
1445           closed TCP port are found. Set this option and Nmap will not even
1446           try OS detection against hosts that do not meet this criteria. This
1447           can save substantial time, particularly on -Pn scans against many
1448           hosts. It only matters when OS detection is requested with -O or
1449           -A.
1450
1451       --osscan-guess; --fuzzy (Guess OS detection results)
1452           When Nmap is unable to detect a perfect OS match, it sometimes
1453           offers up near-matches as possibilities. The match has to be very
1454           close for Nmap to do this by default. Either of these (equivalent)
1455           options make Nmap guess more aggressively. Nmap will still tell you
1456           when an imperfect match is printed and display its confidence level
1457           (percentage) for each guess.
1458
1459       --max-os-tries (Set the maximum number of OS detection tries against a
1460       target)
1461           When Nmap performs OS detection against a target and fails to find
1462           a perfect match, it usually repeats the attempt. By default, Nmap
1463           tries five times if conditions are favorable for OS fingerprint
1464           submission, and twice when conditions aren't so good. Specifying a
1465           lower --max-os-tries value (such as 1) speeds Nmap up, though you
1466           miss out on retries which could potentially identify the OS.
1467           Alternatively, a high value may be set to allow even more retries
1468           when conditions are favorable. This is rarely done, except to
1469           generate better fingerprints for submission and integration into
1470           the Nmap OS database.
1471

NMAP SCRIPTING ENGINE (NSE)

1473       The Nmap Scripting Engine (NSE) is one of Nmap's most powerful and
1474       flexible features. It allows users to write (and share) simple scripts
1475       (using the Lua programming language[10]
1476
1477       ) to automate a wide variety of networking tasks. Those scripts are
1478       executed in parallel with the speed and efficiency you expect from
1479       Nmap. Users can rely on the growing and diverse set of scripts
1480       distributed with Nmap, or write their own to meet custom needs.
1481
1482       Tasks we had in mind when creating the system include network
1483       discovery, more sophisticated version detection, vulnerability
1484       detection. NSE can even be used for vulnerability exploitation.
1485
1486       To reflect those different uses and to simplify the choice of which
1487       scripts to run, each script contains a field associating it with one or
1488       more categories. Currently defined categories are auth, broadcast,
1489       default.  discovery, dos, exploit, external, fuzzer, intrusive,
1490       malware, safe, version, and vuln. These are all described at
1491       https://nmap.org/book/nse-usage.html#nse-categories.
1492
1493       Scripts are not run in a sandbox and thus could accidentally or
1494       maliciously damage your system or invade your privacy. Never run
1495       scripts from third parties unless you trust the authors or have
1496       carefully audited the scripts yourself.
1497
1498       The Nmap Scripting Engine is described in detail at
1499       https://nmap.org/book/nse.html
1500
1501       and is controlled by the following options:
1502
1503       -sC
1504           Performs a script scan using the default set of scripts. It is
1505           equivalent to --script=default. Some of the scripts in this
1506           category are considered intrusive and should not be run against a
1507           target network without permission.
1508
1509       --script filename|category|directory/|expression[,...]
1510           Runs a script scan using the comma-separated list of filenames,
1511           script categories, and directories. Each element in the list may
1512           also be a Boolean expression describing a more complex set of
1513           scripts. Each element is interpreted first as an expression, then
1514           as a category, and finally as a file or directory name.
1515
1516           There are two special features for advanced users only. One is to
1517           prefix script names and expressions with + to force them to run
1518           even if they normally wouldn't (e.g. the relevant service wasn't
1519           detected on the target port). The other is that the argument all
1520           may be used to specify every script in Nmap's database. Be cautious
1521           with this because NSE contains dangerous scripts such as exploits,
1522           brute force authentication crackers, and denial of service attacks.
1523
1524           File and directory names may be relative or absolute. Absolute
1525           names are used directly. Relative paths are looked for in the
1526           scripts of each of the following places until found:
1527               --datadir
1528               $NMAPDIR
1529               ~/.nmap (not searched on Windows)
1530               APPDATA\nmap (only on Windows)
1531               the directory containing the nmap executable
1532               the directory containing the nmap executable, followed by
1533               ../share/nmap (not searched on Windows)
1534               NMAPDATADIR (not searched on Windows)
1535               the current directory.
1536
1537           When a directory name ending in / is given, Nmap loads every file
1538           in the directory whose name ends with .nse. All other files are
1539           ignored and directories are not searched recursively. When a
1540           filename is given, it does not have to have the .nse extension; it
1541           will be added automatically if necessary.  Nmap scripts are stored
1542           in a scripts subdirectory of the Nmap data directory by default
1543           (see https://nmap.org/book/data-files.html).
1544
1545           For efficiency, scripts are indexed in a database stored in
1546           scripts/script.db, which lists the category or categories in which
1547           each script belongs.  When referring to scripts from script.db by
1548           name, you can use a shell-style ‘*’ wildcard.
1549
1550           nmap --script "http-*"
1551               Loads all scripts whose name starts with http-, such as
1552               http-auth and http-open-proxy. The argument to --script had to
1553               be in quotes to protect the wildcard from the shell.
1554
1555           More complicated script selection can be done using the and, or,
1556           and not operators to build Boolean expressions. The operators have
1557           the same precedence[11] as in Lua: not is the highest, followed by
1558           and and then or. You can alter precedence by using parentheses.
1559           Because expressions contain space characters it is necessary to
1560           quote them.
1561
1562           nmap --script "not intrusive"
1563               Loads every script except for those in the intrusive category.
1564
1565           nmap --script "default or safe"
1566               This is functionally equivalent to nmap --script
1567               "default,safe". It loads all scripts that are in the default
1568               category or the safe category or both.
1569
1570           nmap --script "default and safe"
1571               Loads those scripts that are in both the default and safe
1572               categories.
1573
1574           nmap --script "(default or safe or intrusive) and not http-*"
1575               Loads scripts in the default, safe, or intrusive categories,
1576               except for those whose names start with http-.
1577
1578       --script-args n1=v1,n2={n3=v3},n4={v4,v5}
1579           Lets you provide arguments to NSE scripts. Arguments are a
1580           comma-separated list of name=value pairs. Names and values may be
1581           strings not containing whitespace or the characters ‘{’, ‘}’, ‘=’,
1582           or ‘,’. To include one of these characters in a string, enclose the
1583           string in single or double quotes. Within a quoted string, ‘\’
1584           escapes a quote. A backslash is only used to escape quotation marks
1585           in this special case; in all other cases a backslash is interpreted
1586           literally. Values may also be tables enclosed in {}, just as in
1587           Lua. A table may contain simple string values or more name-value
1588           pairs, including nested tables. Many scripts qualify their
1589           arguments with the script name, as in xmpp-info.server_name. You
1590           may use that full qualified version to affect just the specified
1591           script, or you may pass the unqualified version (server_name in
1592           this case) to affect all scripts using that argument name. A script
1593           will first check for its fully qualified argument name (the name
1594           specified in its documentation) before it accepts an unqualified
1595           argument name. A complex example of script arguments is
1596           --script-args
1597           'user=foo,pass=",{}=bar",whois={whodb=nofollow+ripe},xmpp-info.server_name=localhost'.
1598           The online NSE Documentation Portal at https://nmap.org/nsedoc/
1599           lists the arguments that each script accepts.
1600
1601       --script-args-file filename
1602           Lets you load arguments to NSE scripts from a file. Any arguments
1603           on the command line supersede ones in the file. The file can be an
1604           absolute path, or a path relative to Nmap's usual search path
1605           (NMAPDIR, etc.) Arguments can be comma-separated or
1606           newline-separated, but otherwise follow the same rules as for
1607           --script-args, without requiring special quoting and escaping,
1608           since they are not parsed by the shell.
1609
1610       --script-help filename|category|directory|expression|all[,...]
1611           Shows help about scripts. For each script matching the given
1612           specification, Nmap prints the script name, its categories, and its
1613           description. The specifications are the same as those accepted by
1614           --script; so for example if you want help about the ftp-anon
1615           script, you would run nmap --script-help ftp-anon. In addition to
1616           getting help for individual scripts, you can use this as a preview
1617           of what scripts will be run for a specification, for example with
1618           nmap --script-help default.
1619
1620       --script-trace
1621           This option does what --packet-trace does, just one ISO layer
1622           higher. If this option is specified all incoming and outgoing
1623           communication performed by a script is printed. The displayed
1624           information includes the communication protocol, the source, the
1625           target and the transmitted data. If more than 5% of all transmitted
1626           data is not printable, then the trace output is in a hex dump
1627           format. Specifying --packet-trace enables script tracing too.
1628
1629       --script-updatedb
1630           This option updates the script database found in scripts/script.db
1631           which is used by Nmap to determine the available default scripts
1632           and categories. It is only necessary to update the database if you
1633           have added or removed NSE scripts from the default scripts
1634           directory or if you have changed the categories of any script. This
1635           option is generally used by itself: nmap --script-updatedb.
1636

TIMING AND PERFORMANCE

1638       One of my highest Nmap development priorities has always been
1639       performance. A default scan (nmap hostname) of a host on my local
1640       network takes a fifth of a second. That is barely enough time to blink,
1641       but adds up when you are scanning hundreds or thousands of hosts.
1642       Moreover, certain scan options such as UDP scanning and version
1643       detection can increase scan times substantially. So can certain
1644       firewall configurations, particularly response rate limiting. While
1645       Nmap utilizes parallelism and many advanced algorithms to accelerate
1646       these scans, the user has ultimate control over how Nmap runs. Expert
1647       users carefully craft Nmap commands to obtain only the information they
1648       care about while meeting their time constraints.
1649
1650       Techniques for improving scan times include omitting non-critical
1651       tests, and upgrading to the latest version of Nmap (performance
1652       enhancements are made frequently). Optimizing timing parameters can
1653       also make a substantial difference. Those options are listed below.
1654
1655       Some options accept a time parameter. This is specified in seconds by
1656       default, though you can append ‘ms’, ‘s’, ‘m’, or ‘h’ to the value to
1657       specify milliseconds, seconds, minutes, or hours. So the --host-timeout
1658       arguments 900000ms, 900, 900s, and 15m all do the same thing.
1659
1660       --min-hostgroup numhosts; --max-hostgroup numhosts (Adjust parallel
1661       scan group sizes)
1662           Nmap has the ability to port scan or version scan multiple hosts in
1663           parallel. Nmap does this by dividing the target IP space into
1664           groups and then scanning one group at a time. In general, larger
1665           groups are more efficient. The downside is that host results can't
1666           be provided until the whole group is finished. So if Nmap started
1667           out with a group size of 50, the user would not receive any reports
1668           (except for the updates offered in verbose mode) until the first 50
1669           hosts are completed.
1670
1671           By default, Nmap takes a compromise approach to this conflict. It
1672           starts out with a group size as low as five so the first results
1673           come quickly and then increases the groupsize to as high as 1024.
1674           The exact default numbers depend on the options given. For
1675           efficiency reasons, Nmap uses larger group sizes for UDP or
1676           few-port TCP scans.
1677
1678           When a maximum group size is specified with --max-hostgroup, Nmap
1679           will never exceed that size. Specify a minimum size with
1680           --min-hostgroup and Nmap will try to keep group sizes above that
1681           level. Nmap may have to use smaller groups than you specify if
1682           there are not enough target hosts left on a given interface to
1683           fulfill the specified minimum. Both may be set to keep the group
1684           size within a specific range, though this is rarely desired.
1685
1686           These options do not have an effect during the host discovery phase
1687           of a scan. This includes plain ping scans (-sn). Host discovery
1688           always works in large groups of hosts to improve speed and
1689           accuracy.
1690
1691           The primary use of these options is to specify a large minimum
1692           group size so that the full scan runs more quickly. A common choice
1693           is 256 to scan a network in /24 sized chunks. For a scan with many
1694           ports, exceeding that number is unlikely to help much. For scans of
1695           just a few port numbers, host group sizes of 2048 or more may be
1696           helpful.
1697
1698       --min-parallelism numprobes; --max-parallelism numprobes (Adjust probe
1699       parallelization)
1700           These options control the total number of probes that may be
1701           outstanding for a host group. They are used for port scanning and
1702           host discovery. By default, Nmap calculates an ever-changing ideal
1703           parallelism based on network performance. If packets are being
1704           dropped, Nmap slows down and allows fewer outstanding probes. The
1705           ideal probe number slowly rises as the network proves itself
1706           worthy. These options place minimum or maximum bounds on that
1707           variable. By default, the ideal parallelism can drop to one if the
1708           network proves unreliable and rise to several hundred in perfect
1709           conditions.
1710
1711           The most common usage is to set --min-parallelism to a number
1712           higher than one to speed up scans of poorly performing hosts or
1713           networks. This is a risky option to play with, as setting it too
1714           high may affect accuracy. Setting this also reduces Nmap's ability
1715           to control parallelism dynamically based on network conditions. A
1716           value of 10 might be reasonable, though I only adjust this value as
1717           a last resort.
1718
1719           The --max-parallelism option is sometimes set to one to prevent
1720           Nmap from sending more than one probe at a time to hosts. The
1721           --scan-delay option, discussed later, is another way to do this.
1722
1723       --min-rtt-timeout time, --max-rtt-timeout time, --initial-rtt-timeout
1724       time (Adjust probe timeouts)
1725           Nmap maintains a running timeout value for determining how long it
1726           will wait for a probe response before giving up or retransmitting
1727           the probe. This is calculated based on the response times of
1728           previous probes.
1729
1730           If the network latency shows itself to be significant and variable,
1731           this timeout can grow to several seconds. It also starts at a
1732           conservative (high) level and may stay that way for a while when
1733           Nmap scans unresponsive hosts.
1734
1735           Specifying a lower --max-rtt-timeout and --initial-rtt-timeout than
1736           the defaults can cut scan times significantly. This is particularly
1737           true for pingless (-Pn) scans, and those against heavily filtered
1738           networks. Don't get too aggressive though. The scan can end up
1739           taking longer if you specify such a low value that many probes are
1740           timing out and retransmitting while the response is in transit.
1741
1742           If all the hosts are on a local network, 100 milliseconds
1743           (--max-rtt-timeout 100ms) is a reasonable aggressive value. If
1744           routing is involved, ping a host on the network first with the ICMP
1745           ping utility, or with a custom packet crafter such as Nping that is
1746           more likely to get through a firewall. Look at the maximum round
1747           trip time out of ten packets or so. You might want to double that
1748           for the --initial-rtt-timeout and triple or quadruple it for the
1749           --max-rtt-timeout. I generally do not set the maximum RTT below
1750           100 ms, no matter what the ping times are. Nor do I exceed 1000 ms.
1751
1752           --min-rtt-timeout is a rarely used option that could be useful when
1753           a network is so unreliable that even Nmap's default is too
1754           aggressive. Since Nmap only reduces the timeout down to the minimum
1755           when the network seems to be reliable, this need is unusual and
1756           should be reported as a bug to the nmap-dev mailing list.
1757
1758       --max-retries numtries (Specify the maximum number of port scan probe
1759       retransmissions)
1760           When Nmap receives no response to a port scan probe, it could mean
1761           the port is filtered. Or maybe the probe or response was simply
1762           lost on the network. It is also possible that the target host has
1763           rate limiting enabled that temporarily blocked the response. So
1764           Nmap tries again by retransmitting the initial probe. If Nmap
1765           detects poor network reliability, it may try many more times before
1766           giving up on a port. While this benefits accuracy, it also
1767           lengthens scan times. When performance is critical, scans may be
1768           sped up by limiting the number of retransmissions allowed. You can
1769           even specify --max-retries 0 to prevent any retransmissions, though
1770           that is only recommended for situations such as informal surveys
1771           where occasional missed ports and hosts are acceptable.
1772
1773           The default (with no -T template) is to allow ten retransmissions.
1774           If a network seems reliable and the target hosts aren't rate
1775           limiting, Nmap usually only does one retransmission. So most target
1776           scans aren't even affected by dropping --max-retries to a low value
1777           such as three. Such values can substantially speed scans of slow
1778           (rate limited) hosts. You usually lose some information when Nmap
1779           gives up on ports early, though that may be preferable to letting
1780           the --host-timeout expire and losing all information about the
1781           target.
1782
1783       --host-timeout time (Give up on slow target hosts)
1784           Some hosts simply take a long time to scan. This may be due to
1785           poorly performing or unreliable networking hardware or software,
1786           packet rate limiting, or a restrictive firewall. The slowest few
1787           percent of the scanned hosts can eat up a majority of the scan
1788           time. Sometimes it is best to cut your losses and skip those hosts
1789           initially. Specify --host-timeout with the maximum amount of time
1790           you are willing to wait. For example, specify 30m to ensure that
1791           Nmap doesn't waste more than half an hour on a single host. Note
1792           that Nmap may be scanning other hosts at the same time during that
1793           half an hour, so it isn't a complete loss. A host that times out is
1794           skipped. No port table, OS detection, or version detection results
1795           are printed for that host.
1796
1797           The special value 0 can be used to mean “no timeout”, which can be
1798           used to override the T5 timing template, which sets the host
1799           timeout to 15 minutes.
1800
1801       --script-timeout time
1802           While some scripts complete in fractions of a second, others can
1803           take hours or more depending on the nature of the script, arguments
1804           passed in, network and application conditions, and more. The
1805           --script-timeout option sets a ceiling on script execution time.
1806           Any script instance which exceeds that time will be terminated and
1807           no output will be shown. If debugging (-d) is enabled, Nmap will
1808           report on each timeout. For host and service scripts, a script
1809           instance only scans a single target host or port and the timeout
1810           period will be reset for the next instance.
1811
1812           The special value 0 can be used to mean “no timeout”, which can be
1813           used to override the T5 timing template, which sets the script
1814           timeout to 10 minutes.
1815
1816       --scan-delay time; --max-scan-delay time (Adjust delay between probes)
1817           This option causes Nmap to wait at least the given amount of time
1818           between each probe it sends to a given host. This is particularly
1819           useful in the case of rate limiting.  Solaris machines (among many
1820           others) will usually respond to UDP scan probe packets with only
1821           one ICMP message per second. Any more than that sent by Nmap will
1822           be wasteful. A --scan-delay of 1s will keep Nmap at that slow rate.
1823           Nmap tries to detect rate limiting and adjust the scan delay
1824           accordingly, but it doesn't hurt to specify it explicitly if you
1825           already know what rate works best.
1826
1827           When Nmap adjusts the scan delay upward to cope with rate limiting,
1828           the scan slows down dramatically. The --max-scan-delay option
1829           specifies the largest delay that Nmap will allow. A low
1830           --max-scan-delay can speed up Nmap, but it is risky. Setting this
1831           value too low can lead to wasteful packet retransmissions and
1832           possible missed ports when the target implements strict rate
1833           limiting.
1834
1835           Another use of --scan-delay is to evade threshold based intrusion
1836           detection and prevention systems (IDS/IPS).
1837
1838       --min-rate number; --max-rate number (Directly control the scanning
1839       rate)
1840           Nmap's dynamic timing does a good job of finding an appropriate
1841           speed at which to scan. Sometimes, however, you may happen to know
1842           an appropriate scanning rate for a network, or you may have to
1843           guarantee that a scan will be finished by a certain time. Or
1844           perhaps you must keep Nmap from scanning too quickly. The
1845           --min-rate and --max-rate options are designed for these
1846           situations.
1847
1848           When the --min-rate option is given Nmap will do its best to send
1849           packets as fast as or faster than the given rate. The argument is a
1850           positive real number representing a packet rate in packets per
1851           second. For example, specifying --min-rate 300 means that Nmap will
1852           try to keep the sending rate at or above 300 packets per second.
1853           Specifying a minimum rate does not keep Nmap from going faster if
1854           conditions warrant.
1855
1856           Likewise, --max-rate limits a scan's sending rate to a given
1857           maximum. Use --max-rate 100, for example, to limit sending to 100
1858           packets per second on a fast network. Use --max-rate 0.1 for a slow
1859           scan of one packet every ten seconds. Use --min-rate and --max-rate
1860           together to keep the rate inside a certain range.
1861
1862           These two options are global, affecting an entire scan, not
1863           individual hosts. They only affect port scans and host discovery
1864           scans. Other features like OS detection implement their own timing.
1865
1866           There are two conditions when the actual scanning rate may fall
1867           below the requested minimum. The first is if the minimum is faster
1868           than the fastest rate at which Nmap can send, which is dependent on
1869           hardware. In this case Nmap will simply send packets as fast as
1870           possible, but be aware that such high rates are likely to cause a
1871           loss of accuracy. The second case is when Nmap has nothing to send,
1872           for example at the end of a scan when the last probes have been
1873           sent and Nmap is waiting for them to time out or be responded to.
1874           It's normal to see the scanning rate drop at the end of a scan or
1875           in between hostgroups. The sending rate may temporarily exceed the
1876           maximum to make up for unpredictable delays, but on average the
1877           rate will stay at or below the maximum.
1878
1879           Specifying a minimum rate should be done with care. Scanning faster
1880           than a network can support may lead to a loss of accuracy. In some
1881           cases, using a faster rate can make a scan take longer than it
1882           would with a slower rate. This is because Nmap's adaptive
1883           retransmission algorithms will detect the network congestion caused
1884           by an excessive scanning rate and increase the number of
1885           retransmissions in order to improve accuracy. So even though
1886           packets are sent at a higher rate, more packets are sent overall.
1887           Cap the number of retransmissions with the --max-retries option if
1888           you need to set an upper limit on total scan time.
1889
1890       --defeat-rst-ratelimit
1891           Many hosts have long used rate limiting to reduce the number of
1892           ICMP error messages (such as port-unreachable errors) they send.
1893           Some systems now apply similar rate limits to the RST (reset)
1894           packets they generate. This can slow Nmap down dramatically as it
1895           adjusts its timing to reflect those rate limits. You can tell Nmap
1896           to ignore those rate limits (for port scans such as SYN scan which
1897           don't treat non-responsive ports as open) by specifying
1898           --defeat-rst-ratelimit.
1899
1900           Using this option can reduce accuracy, as some ports will appear
1901           non-responsive because Nmap didn't wait long enough for a
1902           rate-limited RST response. With a SYN scan, the non-response
1903           results in the port being labeled filtered rather than the closed
1904           state we see when RST packets are received. This option is useful
1905           when you only care about open ports, and distinguishing between
1906           closed and filtered ports isn't worth the extra time.
1907
1908       --defeat-icmp-ratelimit
1909           Similar to --defeat-rst-ratelimit, the --defeat-icmp-ratelimit
1910           option trades accuracy for speed, increasing UDP scanning speed
1911           against hosts that rate-limit ICMP error messages. Because this
1912           option causes Nmap to not delay in order to receive the port
1913           unreachable messages, a non-responsive port will be labeled
1914           closed|filtered instead of the default open|filtered. This has the
1915           effect of only treating ports which actually respond via UDP as
1916           open. Since many UDP services do not respond in this way, the
1917           chance for inaccuracy is greater with this option than with
1918           --defeat-rst-ratelimit.
1919
1920       --nsock-engine iocp|epoll|kqueue|poll|select
1921           Enforce use of a given nsock IO multiplexing engine. Only the
1922           select(2)-based fallback engine is guaranteed to be available on
1923           your system. Engines are named after the name of the IO management
1924           facility they leverage. Engines currently implemented are epoll,
1925           kqueue, poll, and select, but not all will be present on any
1926           platform. By default, Nmap will use the "best" engine, i.e. the
1927           first one in this list that is supported. Use nmap -V to see which
1928           engines are supported on your platform.
1929
1930       -T paranoid|sneaky|polite|normal|aggressive|insane (Set a timing
1931       template)
1932           While the fine-grained timing controls discussed in the previous
1933           section are powerful and effective, some people find them
1934           confusing. Moreover, choosing the appropriate values can sometimes
1935           take more time than the scan you are trying to optimize.
1936           Fortunately, Nmap offers a simpler approach, with six timing
1937           templates. You can specify them with the -T option and their number
1938           (0–5) or their name. The template names are paranoid (0),
1939           sneaky (1), polite (2), normal (3), aggressive (4), and insane (5).
1940           The first two are for IDS evasion. Polite mode slows down the scan
1941           to use less bandwidth and target machine resources. Normal mode is
1942           the default and so -T3 does nothing. Aggressive mode speeds scans
1943           up by making the assumption that you are on a reasonably fast and
1944           reliable network. Finally insane mode assumes that you are on an
1945           extraordinarily fast network or are willing to sacrifice some
1946           accuracy for speed.
1947
1948           These templates allow the user to specify how aggressive they wish
1949           to be, while leaving Nmap to pick the exact timing values. The
1950           templates also make some minor speed adjustments for which
1951           fine-grained control options do not currently exist. For example,
1952           -T4 prohibits the dynamic scan delay from exceeding 10 ms for TCP
1953           ports and -T5 caps that value at 5 ms. Templates can be used in
1954           combination with fine-grained controls, and the fine-grained
1955           controls that you specify will take precedence over the timing
1956           template default for that parameter. I recommend using -T4 when
1957           scanning reasonably modern and reliable networks. Keep that option
1958           even when you add fine-grained controls so that you benefit from
1959           those extra minor optimizations that it enables.
1960
1961           If you are on a decent broadband or ethernet connection, I would
1962           recommend always using -T4. Some people love -T5 though it is too
1963           aggressive for my taste. People sometimes specify -T2 because they
1964           think it is less likely to crash hosts or because they consider
1965           themselves to be polite in general. They often don't realize just
1966           how slow -T polite really is. Their scan may take ten times longer
1967           than a default scan. Machine crashes and bandwidth problems are
1968           rare with the default timing options (-T3) and so I normally
1969           recommend that for cautious scanners. Omitting version detection is
1970           far more effective than playing with timing values at reducing
1971           these problems.
1972
1973           While -T0 and -T1 may be useful for avoiding IDS alerts, they will
1974           take an extraordinarily long time to scan thousands of machines or
1975           ports. For such a long scan, you may prefer to set the exact timing
1976           values you need rather than rely on the canned -T0 and -T1 values.
1977
1978           The main effects of T0 are serializing the scan so only one port is
1979           scanned at a time, and waiting five minutes between sending each
1980           probe.  T1 and T2 are similar but they only wait 15 seconds and 0.4
1981           seconds, respectively, between probes.  T3 is Nmap's default
1982           behavior, which includes parallelization.  -T4 does the equivalent
1983           of --max-rtt-timeout 1250ms --min-rtt-timeout 100ms
1984           --initial-rtt-timeout 500ms --max-retries 6 and sets the maximum
1985           TCP and SCTP scan delay to 10ms.  T5 does the equivalent of
1986           --max-rtt-timeout 300ms --min-rtt-timeout 50ms
1987           --initial-rtt-timeout 250ms --max-retries 2 --host-timeout 15m
1988           --script-timeout 10m --max-scan-delay as well as setting the
1989           maximum TCP and SCTP scan delay to 5ms. Maximum UDP scan delay is
1990           not set by T4 or T5, but it can be set with the --max-scan-delay
1991           option.
1992

FIREWALL/IDS EVASION AND SPOOFING

1994       Many Internet pioneers envisioned a global open network with a
1995       universal IP address space allowing virtual connections between any two
1996       nodes. This allows hosts to act as true peers, serving and retrieving
1997       information from each other. People could access all of their home
1998       systems from work, changing the climate control settings or unlocking
1999       the doors for early guests. This vision of universal connectivity has
2000       been stifled by address space shortages and security concerns. In the
2001       early 1990s, organizations began deploying firewalls for the express
2002       purpose of reducing connectivity. Huge networks were cordoned off from
2003       the unfiltered Internet by application proxies, network address
2004       translation, and packet filters. The unrestricted flow of information
2005       gave way to tight regulation of approved communication channels and the
2006       content that passes over them.
2007
2008       Network obstructions such as firewalls can make mapping a network
2009       exceedingly difficult. It will not get any easier, as stifling casual
2010       reconnaissance is often a key goal of implementing the devices.
2011       Nevertheless, Nmap offers many features to help understand these
2012       complex networks, and to verify that filters are working as intended.
2013       It even supports mechanisms for bypassing poorly implemented defenses.
2014       One of the best methods of understanding your network security posture
2015       is to try to defeat it. Place yourself in the mind-set of an attacker,
2016       and deploy techniques from this section against your networks. Launch
2017       an FTP bounce scan, idle scan, fragmentation attack, or try to tunnel
2018       through one of your own proxies.
2019
2020       In addition to restricting network activity, companies are increasingly
2021       monitoring traffic with intrusion detection systems (IDS). All of the
2022       major IDSs ship with rules designed to detect Nmap scans because scans
2023       are sometimes a precursor to attacks. Many of these products have
2024       recently morphed into intrusion prevention systems (IPS) that actively
2025       block traffic deemed malicious. Unfortunately for network
2026       administrators and IDS vendors, reliably detecting bad intentions by
2027       analyzing packet data is a tough problem. Attackers with patience,
2028       skill, and the help of certain Nmap options can usually pass by IDSs
2029       undetected. Meanwhile, administrators must cope with large numbers of
2030       false positive results where innocent activity is misdiagnosed and
2031       alerted on or blocked.
2032
2033       Occasionally people suggest that Nmap should not offer features for
2034       evading firewall rules or sneaking past IDSs. They argue that these
2035       features are just as likely to be misused by attackers as used by
2036       administrators to enhance security. The problem with this logic is that
2037       these methods would still be used by attackers, who would just find
2038       other tools or patch the functionality into Nmap. Meanwhile,
2039       administrators would find it that much harder to do their jobs.
2040       Deploying only modern, patched FTP servers is a far more powerful
2041       defense than trying to prevent the distribution of tools implementing
2042       the FTP bounce attack.
2043
2044       There is no magic bullet (or Nmap option) for detecting and subverting
2045       firewalls and IDS systems. It takes skill and experience. A tutorial is
2046       beyond the scope of this reference guide, which only lists the relevant
2047       options and describes what they do.
2048
2049       -f (fragment packets); --mtu (using the specified MTU)
2050           The -f option causes the requested scan (including host discovery
2051           scans) to use tiny fragmented IP packets. The idea is to split up
2052           the TCP header over several packets to make it harder for packet
2053           filters, intrusion detection systems, and other annoyances to
2054           detect what you are doing. Be careful with this! Some programs have
2055           trouble handling these tiny packets. The old-school sniffer named
2056           Sniffit segmentation faulted immediately upon receiving the first
2057           fragment. Specify this option once, and Nmap splits the packets
2058           into eight bytes or less after the IP header. So a 20-byte TCP
2059           header would be split into three packets. Two with eight bytes of
2060           the TCP header, and one with the final four. Of course each
2061           fragment also has an IP header. Specify -f again to use 16 bytes
2062           per fragment (reducing the number of fragments).  Or you can
2063           specify your own offset size with the --mtu option. Don't also
2064           specify -f if you use --mtu. The offset must be a multiple of
2065           eight. While fragmented packets won't get by packet filters and
2066           firewalls that queue all IP fragments, such as the
2067           CONFIG_IP_ALWAYS_DEFRAG option in the Linux kernel, some networks
2068           can't afford the performance hit this causes and thus leave it
2069           disabled. Others can't enable this because fragments may take
2070           different routes into their networks. Some source systems
2071           defragment outgoing packets in the kernel. Linux with the iptables
2072           connection tracking module is one such example. Do a scan while a
2073           sniffer such as Wireshark is running to ensure that sent packets
2074           are fragmented. If your host OS is causing problems, try the
2075           --send-eth option to bypass the IP layer and send raw ethernet
2076           frames.
2077
2078           Fragmentation is only supported for Nmap's raw packet features,
2079           which includes TCP and UDP port scans (except connect scan and FTP
2080           bounce scan) and OS detection. Features such as version detection
2081           and the Nmap Scripting Engine generally don't support fragmentation
2082           because they rely on your host's TCP stack to communicate with
2083           target services.
2084
2085       -D decoy1[,decoy2][,ME][,...] (Cloak a scan with decoys)
2086           Causes a decoy scan to be performed, which makes it appear to the
2087           remote host that the host(s) you specify as decoys are scanning the
2088           target network too. Thus their IDS might report 5–10 port scans
2089           from unique IP addresses, but they won't know which IP was scanning
2090           them and which were innocent decoys. While this can be defeated
2091           through router path tracing, response-dropping, and other active
2092           mechanisms, it is generally an effective technique for hiding your
2093           IP address.
2094
2095           Separate each decoy host with commas, and you can optionally use ME
2096           as one of the decoys to represent the position for your real IP
2097           address. If you put ME in the sixth position or later, some common
2098           port scan detectors (such as Solar Designer's excellent Scanlogd)
2099           are unlikely to show your IP address at all. If you don't use ME,
2100           Nmap will put you in a random position. You can also use RND to
2101           generate a random, non-reserved IP address, or RND:number to
2102           generate number addresses.
2103
2104           Note that the hosts you use as decoys should be up or you might
2105           accidentally SYN flood your targets. Also it will be pretty easy to
2106           determine which host is scanning if only one is actually up on the
2107           network. You might want to use IP addresses instead of names (so
2108           the decoy networks don't see you in their nameserver logs). Right
2109           now random IP address generation is only supported with IPv4
2110
2111           Decoys are used both in the initial host discovery scan (using
2112           ICMP, SYN, ACK, or whatever) and during the actual port scanning
2113           phase. Decoys are also used during remote OS detection (-O). Decoys
2114           do not work with version detection or TCP connect scan. When a scan
2115           delay is in effect, the delay is enforced between each batch of
2116           spoofed probes, not between each individual probe. Because decoys
2117           are sent as a batch all at once, they may temporarily violate
2118           congestion control limits.
2119
2120           It is worth noting that using too many decoys may slow your scan
2121           and potentially even make it less accurate. Also, some ISPs will
2122           filter out your spoofed packets, but many do not restrict spoofed
2123           IP packets at all.
2124
2125       -S IP_Address (Spoof source address)
2126           In some circumstances, Nmap may not be able to determine your
2127           source address (Nmap will tell you if this is the case). In this
2128           situation, use -S with the IP address of the interface you wish to
2129           send packets through.
2130
2131           Another possible use of this flag is to spoof the scan to make the
2132           targets think that someone else is scanning them. Imagine a company
2133           being repeatedly port scanned by a competitor! The -e option and
2134           -Pn are generally required for this sort of usage. Note that you
2135           usually won't receive reply packets back (they will be addressed to
2136           the IP you are spoofing), so Nmap won't produce useful reports.
2137
2138       -e interface (Use specified interface)
2139           Tells Nmap what interface to send and receive packets on. Nmap
2140           should be able to detect this automatically, but it will tell you
2141           if it cannot.
2142
2143       --source-port portnumber; -g portnumber (Spoof source port number)
2144           One surprisingly common misconfiguration is to trust traffic based
2145           only on the source port number. It is easy to understand how this
2146           comes about. An administrator will set up a shiny new firewall,
2147           only to be flooded with complaints from ungrateful users whose
2148           applications stopped working. In particular, DNS may be broken
2149           because the UDP DNS replies from external servers can no longer
2150           enter the network. FTP is another common example. In active FTP
2151           transfers, the remote server tries to establish a connection back
2152           to the client to transfer the requested file.
2153
2154           Secure solutions to these problems exist, often in the form of
2155           application-level proxies or protocol-parsing firewall modules.
2156           Unfortunately there are also easier, insecure solutions. Noting
2157           that DNS replies come from port 53 and active FTP from port 20,
2158           many administrators have fallen into the trap of simply allowing
2159           incoming traffic from those ports. They often assume that no
2160           attacker would notice and exploit such firewall holes. In other
2161           cases, administrators consider this a short-term stop-gap measure
2162           until they can implement a more secure solution. Then they forget
2163           the security upgrade.
2164
2165           Overworked network administrators are not the only ones to fall
2166           into this trap. Numerous products have shipped with these insecure
2167           rules. Even Microsoft has been guilty. The IPsec filters that
2168           shipped with Windows 2000 and Windows XP contain an implicit rule
2169           that allows all TCP or UDP traffic from port 88 (Kerberos). In
2170           another well-known case, versions of the Zone Alarm personal
2171           firewall up to 2.1.25 allowed any incoming UDP packets with the
2172           source port 53 (DNS) or 67 (DHCP).
2173
2174           Nmap offers the -g and --source-port options (they are equivalent)
2175           to exploit these weaknesses. Simply provide a port number and Nmap
2176           will send packets from that port where possible. Most scanning
2177           operations that use raw sockets, including SYN and UDP scans,
2178           support the option completely. The option notably doesn't have an
2179           effect for any operations that use normal operating system sockets,
2180           including DNS requests, TCP connect scan, version detection, and
2181           script scanning. Setting the source port also doesn't work for OS
2182           detection, because Nmap must use different port numbers for certain
2183           OS detection tests to work properly.
2184
2185       --data hex string (Append custom binary data to sent packets)
2186           This option lets you include binary data as payload in sent
2187           packets.  hex string may be specified in any of the following
2188           formats: 0xAABBCCDDEEFF..., AABBCCDDEEFF...  or
2189           \xAA\xBB\xCC\xDD\xEE\xFF.... Examples of use are --data 0xdeadbeef
2190           and --data \xCA\xFE\x09. Note that if you specify a number like
2191           0x00ff no byte-order conversion is performed. Make sure you specify
2192           the information in the byte order expected by the receiver.
2193
2194       --data-string string (Append custom string to sent packets)
2195           This option lets you include a regular string as payload in sent
2196           packets.  string can contain any string. However, note that some
2197           characters may depend on your system's locale and the receiver may
2198           not see the same information. Also, make sure you enclose the
2199           string in double quotes and escape any special characters from the
2200           shell. Examples: --data-string "Scan conducted by Security Ops,
2201           extension 7192" or --data-string "Ph34r my l33t skills". Keep in
2202           mind that nobody is likely to actually see any comments left by
2203           this option unless they are carefully monitoring the network with a
2204           sniffer or custom IDS rules.
2205
2206       --data-length number (Append random data to sent packets)
2207           Normally Nmap sends minimalist packets containing only a header. So
2208           its TCP packets are generally 40 bytes and ICMP echo requests are
2209           just 28. Some UDP ports and IP protocols get a custom payload by
2210           default. This option tells Nmap to append the given number of
2211           random bytes to most of the packets it sends, and not to use any
2212           protocol-specific payloads. (Use --data-length 0 for no random or
2213           protocol-specific payloads.  OS detection (-O) packets are not
2214           affected because accuracy there requires probe consistency, but
2215           most pinging and portscan packets support this. It slows things
2216           down a little, but can make a scan slightly less conspicuous.
2217
2218       --ip-options S|R [route]|L [route]|T|U ... ; --ip-options hex string
2219       (Send packets with specified ip options)
2220           The IP protocol[12] offers several options which may be placed in
2221           packet headers. Unlike the ubiquitous TCP options, IP options are
2222           rarely seen due to practicality and security concerns. In fact,
2223           many Internet routers block the most dangerous options such as
2224           source routing. Yet options can still be useful in some cases for
2225           determining and manipulating the network route to target machines.
2226           For example, you may be able to use the record route option to
2227           determine a path to a target even when more traditional
2228           traceroute-style approaches fail. Or if your packets are being
2229           dropped by a certain firewall, you may be able to specify a
2230           different route with the strict or loose source routing options.
2231
2232           The most powerful way to specify IP options is to simply pass in
2233           values as the argument to --ip-options. Precede each hex number
2234           with \x then the two digits. You may repeat certain characters by
2235           following them with an asterisk and then the number of times you
2236           wish them to repeat. For example, \x01\x07\x04\x00*36\x01 is a hex
2237           string containing 36 NUL bytes.
2238
2239           Nmap also offers a shortcut mechanism for specifying options.
2240           Simply pass the letter R, T, or U to request record-route,
2241           record-timestamp, or both options together, respectively. Loose or
2242           strict source routing may be specified with an L or S followed by a
2243           space and then a space-separated list of IP addresses.
2244
2245           If you wish to see the options in packets sent and received,
2246           specify --packet-trace. For more information and examples of using
2247           IP options with Nmap, see http://seclists.org/nmap-dev/2006/q3/52.
2248
2249       --ttl value (Set IP time-to-live field)
2250           Sets the IPv4 time-to-live field in sent packets to the given
2251           value.
2252
2253       --randomize-hosts (Randomize target host order)
2254           Tells Nmap to shuffle each group of up to 16384 hosts before it
2255           scans them. This can make the scans less obvious to various network
2256           monitoring systems, especially when you combine it with slow timing
2257           options. If you want to randomize over larger group sizes, increase
2258           PING_GROUP_SZ in nmap.h and recompile. An alternative solution is
2259           to generate the target IP list with a list scan (-sL -n -oN
2260           filename), randomize it with a Perl script, then provide the whole
2261           list to Nmap with -iL.
2262
2263       --spoof-mac MAC address, prefix, or vendor name (Spoof MAC address)
2264           Asks Nmap to use the given MAC address
2265
2266           for all of the raw ethernet frames it sends. This option implies
2267           --send-eth to ensure that Nmap actually sends ethernet-level
2268           packets. The MAC given can take several formats. If it is simply
2269           the number 0, Nmap chooses a completely random MAC address for the
2270           session. If the given string is an even number of hex digits (with
2271           the pairs optionally separated by a colon), Nmap will use those as
2272           the MAC. If fewer than 12 hex digits are provided, Nmap fills in
2273           the remainder of the six bytes with random values. If the argument
2274           isn't a zero or hex string, Nmap looks through nmap-mac-prefixes to
2275           find a vendor name containing the given string (it is case
2276           insensitive). If a match is found, Nmap uses the vendor's OUI
2277           (three-byte prefix) and fills out the remaining three bytes
2278           randomly. Valid --spoof-mac argument examples are Apple, 0,
2279           01:02:03:04:05:06, deadbeefcafe, 0020F2, and Cisco. This option
2280           only affects raw packet scans such as SYN scan or OS detection, not
2281           connection-oriented features such as version detection or the Nmap
2282           Scripting Engine.
2283
2284       --proxies Comma-separated list of proxy URLs (Relay TCP connections
2285       through a chain of proxies)
2286           Asks Nmap to establish TCP connections with a final target through
2287           supplied chain of one or more HTTP or SOCKS4 proxies. Proxies can
2288           help hide the true source of a scan or evade certain firewall
2289           restrictions, but they can hamper scan performance by increasing
2290           latency. Users may need to adjust Nmap timeouts and other scan
2291           parameters accordingly. In particular, a lower --max-parallelism
2292           may help because some proxies refuse to handle as many concurrent
2293           connections as Nmap opens by default.
2294
2295           This option takes a list of proxies as argument, expressed as URLs
2296           in the format proto://host:port. Use commas to separate node URLs
2297           in a chain. No authentication is supported yet. Valid protocols are
2298           HTTP and SOCKS4.
2299
2300           Warning: this feature is still under development and has
2301           limitations. It is implemented within the nsock library and thus
2302           has no effect on the ping, port scanning and OS discovery phases of
2303           a scan. Only NSE and version scan benefit from this option so far—
2304           other features may disclose your true address. SSL connections are
2305           not yet supported, nor is proxy-side DNS resolution (hostnames are
2306           always resolved by Nmap).
2307
2308       --badsum (Send packets with bogus TCP/UDP checksums)
2309           Asks Nmap to use an invalid TCP, UDP or SCTP checksum for packets
2310           sent to target hosts. Since virtually all host IP stacks properly
2311           drop these packets, any responses received are likely coming from a
2312           firewall or IDS that didn't bother to verify the checksum. For more
2313           details on this technique, see https://nmap.org/p60-12.html
2314
2315       --adler32 (Use deprecated Adler32 instead of CRC32C for SCTP checksums)
2316           Asks Nmap to use the deprecated Adler32 algorithm for calculating
2317           the SCTP checksum. If --adler32 is not given, CRC-32C (Castagnoli)
2318           is used.  RFC 2960[13] originally defined Adler32 as checksum
2319           algorithm for SCTP; RFC 4960[6] later redefined the SCTP checksums
2320           to use CRC-32C. Current SCTP implementations should be using
2321           CRC-32C, but in order to elicit responses from old, legacy SCTP
2322           implementations, it may be preferable to use Adler32.
2323

OUTPUT

2325       Any security tool is only as useful as the output it generates. Complex
2326       tests and algorithms are of little value if they aren't presented in an
2327       organized and comprehensible fashion. Given the number of ways Nmap is
2328       used by people and other software, no single format can please
2329       everyone. So Nmap offers several formats, including the interactive
2330       mode for humans to read directly and XML for easy parsing by software.
2331
2332       In addition to offering different output formats, Nmap provides options
2333       for controlling the verbosity of output as well as debugging messages.
2334       Output types may be sent to standard output or to named files, which
2335       Nmap can append to or clobber. Output files may also be used to resume
2336       aborted scans.
2337
2338       Nmap makes output available in five different formats. The default is
2339       called interactive output, and it is sent to standard output (stdout).
2340       There is also normal output, which is similar to interactive except
2341       that it displays less runtime information and warnings since it is
2342       expected to be analyzed after the scan completes rather than
2343       interactively.
2344
2345       XML output is one of the most important output types, as it can be
2346       converted to HTML, easily parsed by programs such as Nmap graphical
2347       user interfaces, or imported into databases.
2348
2349       The two remaining output types are the simple grepable output which
2350       includes most information for a target host on a single line, and
2351       sCRiPt KiDDi3 0utPUt for users who consider themselves |<-r4d.
2352
2353       While interactive output is the default and has no associated
2354       command-line options, the other four format options use the same
2355       syntax. They take one argument, which is the filename that results
2356       should be stored in. Multiple formats may be specified, but each format
2357       may only be specified once. For example, you may wish to save normal
2358       output for your own review while saving XML of the same scan for
2359       programmatic analysis. You might do this with the options -oX
2360       myscan.xml -oN myscan.nmap. While this chapter uses the simple names
2361       like myscan.xml for brevity, more descriptive names are generally
2362       recommended. The names chosen are a matter of personal preference,
2363       though I use long ones that incorporate the scan date and a word or two
2364       describing the scan, placed in a directory named after the company I'm
2365       scanning.
2366
2367       While these options save results to files, Nmap still prints
2368       interactive output to stdout as usual. For example, the command nmap
2369       -oX myscan.xml target prints XML to myscan.xml and fills standard
2370       output with the same interactive results it would have printed if -oX
2371       wasn't specified at all. You can change this by passing a hyphen
2372       character as the argument to one of the format types. This causes Nmap
2373       to deactivate interactive output, and instead print results in the
2374       format you specified to the standard output stream. So the command nmap
2375       -oX - target will send only XML output to stdout.  Serious errors may
2376       still be printed to the normal error stream, stderr.
2377
2378       Unlike some Nmap arguments, the space between the logfile option flag
2379       (such as -oX) and the filename or hyphen is mandatory. If you omit the
2380       flags and give arguments such as -oG- or -oXscan.xml, a backwards
2381       compatibility feature of Nmap will cause the creation of normal format
2382       output files named G- and Xscan.xml respectively.
2383
2384       All of these arguments support strftime-like conversions in the
2385       filename.  %H, %M, %S, %m, %d, %y, and %Y are all exactly the same as
2386       in strftime.  %T is the same as %H%M%S, %R is the same as %H%M, and %D
2387       is the same as %m%d%y. A % followed by any other character just yields
2388       that character (%% gives you a percent symbol). So -oX 'scan-%T-%D.xml'
2389       will use an XML file with a name in the form of scan-144840-121307.xml.
2390
2391       Nmap also offers options to control scan verbosity and to append to
2392       output files rather than clobbering them. All of these options are
2393       described below.
2394
2395       Nmap Output Formats
2396
2397       -oN filespec (normal output)
2398           Requests that normal output be directed to the given filename. As
2399           discussed above, this differs slightly from interactive output.
2400
2401       -oX filespec (XML output)
2402           Requests that XML output be directed to the given filename. Nmap
2403           includes a document type definition (DTD) which allows XML parsers
2404           to validate Nmap XML output. While it is primarily intended for
2405           programmatic use, it can also help humans interpret Nmap XML
2406           output. The DTD defines the legal elements of the format, and often
2407           enumerates the attributes and values they can take on. The latest
2408           version is always available from
2409           https://svn.nmap.org/nmap/docs/nmap.dtd.
2410
2411           XML offers a stable format that is easily parsed by software. Free
2412           XML parsers are available for all major computer languages,
2413           including C/C++, Perl, Python, and Java. People have even written
2414           bindings for most of these languages to handle Nmap output and
2415           execution specifically. Examples are Nmap::Scanner[14] and
2416           Nmap::Parser[15] in Perl CPAN. In almost all cases that a
2417           non-trivial application interfaces with Nmap, XML is the preferred
2418           format.
2419
2420           The XML output references an XSL stylesheet which can be used to
2421           format the results as HTML. The easiest way to use this is simply
2422           to load the XML output in a web browser such as Firefox or IE. By
2423           default, this will only work on the machine you ran Nmap on (or a
2424           similarly configured one) due to the hard-coded nmap.xsl filesystem
2425           path. Use the --webxml or --stylesheet options to create portable
2426           XML files that render as HTML on any web-connected machine.
2427
2428       -oS filespec (ScRipT KIdd|3 oUTpuT)
2429           Script kiddie output is like interactive output, except that it is
2430           post-processed to better suit the l33t HaXXorZ who previously
2431           looked down on Nmap due to its consistent capitalization and
2432           spelling. Humor impaired people should note that this option is
2433           making fun of the script kiddies before flaming me for supposedly
2434           “helping them”.
2435
2436       -oG filespec (grepable output)
2437           This output format is covered last because it is deprecated. The
2438           XML output format is far more powerful, and is nearly as convenient
2439           for experienced users. XML is a standard for which dozens of
2440           excellent parsers are available, while grepable output is my own
2441           simple hack. XML is extensible to support new Nmap features as they
2442           are released, while I often must omit those features from grepable
2443           output for lack of a place to put them.
2444
2445           Nevertheless, grepable output is still quite popular. It is a
2446           simple format that lists each host on one line and can be trivially
2447           searched and parsed with standard Unix tools such as grep, awk,
2448           cut, sed, diff, and Perl. Even I usually use it for one-off tests
2449           done at the command line. Finding all the hosts with the SSH port
2450           open or that are running Solaris takes only a simple grep to
2451           identify the hosts, piped to an awk or cut command to print the
2452           desired fields.
2453
2454           Grepable output consists of comments (lines starting with a pound
2455           (#)) and target lines. A target line includes a combination of six
2456           labeled fields, separated by tabs and followed with a colon. The
2457           fields are Host, Ports, Protocols, Ignored State, OS, Seq Index, IP
2458           ID, and Status.
2459
2460           The most important of these fields is generally Ports, which gives
2461           details on each interesting port. It is a comma separated list of
2462           port entries. Each port entry represents one interesting port, and
2463           takes the form of seven slash (/) separated subfields. Those
2464           subfields are: Port number, State, Protocol, Owner, Service, SunRPC
2465           info, and Version info.
2466
2467           As with XML output, this man page does not allow for documenting
2468           the entire format. A more detailed look at the Nmap grepable output
2469           format is available from
2470           https://nmap.org/book/output-formats-grepable-output.html.
2471
2472       -oA basename (Output to all formats)
2473           As a convenience, you may specify -oA basename to store scan
2474           results in normal, XML, and grepable formats at once. They are
2475           stored in basename.nmap, basename.xml, and basename.gnmap,
2476           respectively. As with most programs, you can prefix the filenames
2477           with a directory path, such as ~/nmaplogs/foocorp/ on Unix or
2478           c:\hacking\sco on Windows.
2479
2480       Verbosity and debugging options
2481
2482       -v (Increase verbosity level), -vlevel (Set verbosity level)
2483           Increases the verbosity level, causing Nmap to print more
2484           information about the scan in progress. Open ports are shown as
2485           they are found and completion time estimates are provided when Nmap
2486           thinks a scan will take more than a few minutes. Use it twice or
2487           more for even greater verbosity: -vv, or give a verbosity level
2488           directly, for example -v3.
2489
2490           Most changes only affect interactive output, and some also affect
2491           normal and script kiddie output. The other output types are meant
2492           to be processed by machines, so Nmap can give substantial detail by
2493           default in those formats without fatiguing a human user. However,
2494           there are a few changes in other modes where output size can be
2495           reduced substantially by omitting some detail. For example, a
2496           comment line in the grepable output that provides a list of all
2497           ports scanned is only printed in verbose mode because it can be
2498           quite long.
2499
2500       -d (Increase debugging level), -dlevel (Set debugging level)
2501           When even verbose mode doesn't provide sufficient data for you,
2502           debugging is available to flood you with much more! As with the
2503           verbosity option (-v), debugging is enabled with a command-line
2504           flag (-d) and the debug level can be increased by specifying it
2505           multiple times, as in -dd, or by setting a level directly. For
2506           example, -d9 sets level nine. That is the highest effective level
2507           and will produce thousands of lines unless you run a very simple
2508           scan with very few ports and targets.
2509
2510           Debugging output is useful when a bug is suspected in Nmap, or if
2511           you are simply confused as to what Nmap is doing and why. As this
2512           feature is mostly intended for developers, debug lines aren't
2513           always self-explanatory. You may get something like: Timeout vals:
2514           srtt: -1 rttvar: -1 to: 1000000 delta 14987 ==> srtt: 14987 rttvar:
2515           14987 to: 100000. If you don't understand a line, your only
2516           recourses are to ignore it, look it up in the source code, or
2517           request help from the development list (nmap-dev).  Some lines are
2518           self explanatory, but the messages become more obscure as the debug
2519           level is increased.
2520
2521       --reason (Host and port state reasons)
2522           Shows the reason each port is set to a specific state and the
2523           reason each host is up or down. This option displays the type of
2524           the packet that determined a port or hosts state. For example, A
2525           RST packet from a closed port or an echo reply from an alive host.
2526           The information Nmap can provide is determined by the type of scan
2527           or ping. The SYN scan and SYN ping (-sS and -PS) are very detailed,
2528           but the TCP connect scan (-sT) is limited by the implementation of
2529           the connect system call. This feature is automatically enabled by
2530           the debug option (-d) and the results are stored in XML log files
2531           even if this option is not specified.
2532
2533       --stats-every time (Print periodic timing stats)
2534           Periodically prints a timing status message after each interval of
2535           time. The time is a specification of the kind described in the
2536           section called “TIMING AND PERFORMANCE”; so for example, use
2537           --stats-every 10s to get a status update every 10 seconds. Updates
2538           are printed to interactive output (the screen) and XML output.
2539
2540       --packet-trace (Trace packets and data sent and received)
2541           Causes Nmap to print a summary of every packet sent or received.
2542           This is often used for debugging, but is also a valuable way for
2543           new users to understand exactly what Nmap is doing under the
2544           covers. To avoid printing thousands of lines, you may want to
2545           specify a limited number of ports to scan, such as -p20-30. If you
2546           only care about the goings on of the version detection subsystem,
2547           use --version-trace instead. If you only care about script tracing,
2548           specify --script-trace. With --packet-trace, you get all of the
2549           above.
2550
2551       --open (Show only open (or possibly open) ports)
2552           Sometimes you only care about ports you can actually connect to
2553           (open ones), and don't want results cluttered with closed,
2554           filtered, and closed|filtered ports. Output customization is
2555           normally done after the scan using tools such as grep, awk, and
2556           Perl, but this feature was added due to overwhelming requests.
2557           Specify --open to only see hosts with at least one open,
2558           open|filtered, or unfiltered port, and only see ports in those
2559           states. These three states are treated just as they normally are,
2560           which means that open|filtered and unfiltered may be condensed into
2561           counts if there are an overwhelming number of them.
2562
2563           Beginning with Nmap 7.40, the --open option implies
2564
2565           --defeat-rst-ratelimit, because that option only affects closed and
2566           filtered ports, which are hidden by --open.
2567
2568       --iflist (List interfaces and routes)
2569           Prints the interface list and system routes as detected by Nmap and
2570           quits. This is useful for debugging routing problems or device
2571           mischaracterization (such as Nmap treating a PPP connection as
2572           ethernet).
2573
2574       Miscellaneous output options
2575
2576       --append-output (Append to rather than clobber output files)
2577           When you specify a filename to an output format flag such as -oX or
2578           -oN, that file is overwritten by default. If you prefer to keep the
2579           existing content of the file and append the new results, specify
2580           the --append-output option. All output filenames specified in that
2581           Nmap execution will then be appended to rather than clobbered. This
2582           doesn't work well for XML (-oX) scan data as the resultant file
2583           generally won't parse properly until you fix it up by hand.
2584
2585       --resume filename (Resume aborted scan)
2586           Some extensive Nmap runs take a very long time—on the order of
2587           days. Such scans don't always run to completion. Restrictions may
2588           prevent Nmap from being run during working hours, the network could
2589           go down, the machine Nmap is running on might suffer a planned or
2590           unplanned reboot, or Nmap itself could crash. The administrator
2591           running Nmap could cancel it for any other reason as well, by
2592           pressing ctrl-C. Restarting the whole scan from the beginning may
2593           be undesirable. Fortunately, if scan output files were kept, the
2594           user can ask Nmap to resume scanning with the target it was working
2595           on when execution ceased. Simply specify the --resume option and
2596           pass the output file as its argument. No other arguments are
2597           permitted, as Nmap parses the output file to use the same ones
2598           specified previously. Simply call Nmap as nmap --resume
2599           logfilename. Nmap will append new results to the data files
2600           specified in the previous execution. Scans can be resumed from any
2601           of the 3 major output formats: Normal, Grepable, or XML
2602
2603       --noninteractive (Disable runtime interactions)
2604           At times, such as when running Nmap in a shell background, it might
2605           be undesirable for Nmap to monitor and respond to user keyboard
2606           input when running. (See the section called “RUNTIME INTERACTION”
2607           about how to control Nmap during a scan.) Use option
2608           --noninteractive to prevent Nmap taking control of the terminal.
2609
2610       --stylesheet path or URL (Set XSL stylesheet to transform XML output)
2611           Nmap ships with an XSL stylesheet named nmap.xsl for viewing or
2612           translating XML output to HTML.  The XML output includes an
2613           xml-stylesheet directive which points to nmap.xml where it was
2614           initially installed by Nmap. Run the XML file through an XSLT
2615           processor such as xsltproc[16] to produce an HTML file. Directly
2616           opening the XML file in a browser no longer works well because
2617           modern browsers limit the locations a stylesheet may be loaded
2618           from. If you wish to use a different stylesheet, specify it as the
2619           argument to --stylesheet. You must pass the full pathname or URL.
2620           One common invocation is --stylesheet
2621           https://nmap.org/svn/docs/nmap.xsl. This tells an XSLT processor to
2622           load the latest version of the stylesheet from Nmap.Org. The
2623           --webxml option does the same thing with less typing and
2624           memorization. Loading the XSL from Nmap.Org makes it easier to view
2625           results on a machine that doesn't have Nmap (and thus nmap.xsl)
2626           installed. So the URL is often more useful, but the local
2627           filesystem location of nmap.xsl is used by default for privacy
2628           reasons.
2629
2630       --webxml (Load stylesheet from Nmap.Org)
2631           This is a convenience option, nothing more than an alias for
2632           --stylesheet https://nmap.org/svn/docs/nmap.xsl.
2633
2634       --no-stylesheet (Omit XSL stylesheet declaration from XML)
2635           Specify this option to prevent Nmap from associating any XSL
2636           stylesheet with its XML output. The xml-stylesheet directive is
2637           omitted.
2638

MISCELLANEOUS OPTIONS

2640       This section describes some important (and not-so-important) options
2641       that don't really fit anywhere else.
2642
2643       -6 (Enable IPv6 scanning)
2644           Nmap has IPv6 support for its most popular features. Ping scanning,
2645           port scanning, version detection, and the Nmap Scripting Engine all
2646           support IPv6. The command syntax is the same as usual except that
2647           you also add the -6 option. Of course, you must use IPv6 syntax if
2648           you specify an address rather than a hostname. An address might
2649           look like 3ffe:7501:4819:2000:210:f3ff:fe03:14d0, so hostnames are
2650           recommended. The output looks the same as usual, with the IPv6
2651           address on the “interesting ports” line being the only IPv6
2652           giveaway.
2653
2654           While IPv6 hasn't exactly taken the world by storm, it gets
2655           significant use in some (usually Asian) countries and most modern
2656           operating systems support it. To use Nmap with IPv6, both the
2657           source and target of your scan must be configured for IPv6. If your
2658           ISP (like most of them) does not allocate IPv6 addresses to you,
2659           free tunnel brokers are widely available and work fine with Nmap. I
2660           use the free IPv6 tunnel broker service at
2661           http://www.tunnelbroker.net. Other tunnel brokers are listed at
2662           Wikipedia[17]. 6to4 tunnels are another popular, free approach.
2663
2664           On Windows, raw-socket IPv6 scans are supported only on ethernet
2665           devices (not tunnels), and only on Windows Vista and later. Use the
2666           --unprivileged option in other situations.
2667
2668       -A (Aggressive scan options)
2669           This option enables additional advanced and aggressive options.
2670           Presently this enables OS detection (-O), version scanning (-sV),
2671           script scanning (-sC) and traceroute (--traceroute).  More features
2672           may be added in the future. The point is to enable a comprehensive
2673           set of scan options without people having to remember a large set
2674           of flags. However, because script scanning with the default set is
2675           considered intrusive, you should not use -A against target networks
2676           without permission. This option only enables features, and not
2677           timing options (such as -T4) or verbosity options (-v) that you
2678           might want as well. Options which require privileges (e.g. root
2679           access) such as OS detection and traceroute will only be enabled if
2680           those privileges are available.
2681
2682       --datadir directoryname (Specify custom Nmap data file location)
2683           Nmap obtains some special data at runtime in files named
2684           nmap-service-probes, nmap-services, nmap-protocols, nmap-rpc,
2685           nmap-mac-prefixes, and nmap-os-db. If the location of any of these
2686           files has been specified (using the --servicedb or --versiondb
2687           options), that location is used for that file. After that, Nmap
2688           searches these files in the directory specified with the --datadir
2689           option (if any). Any files not found there, are searched for in the
2690           directory specified by the NMAPDIR environment variable. Next comes
2691           ~/.nmap for real and effective UIDs; or on Windows,
2692           HOME\AppData\Roaming\nmap (where HOME is the user's home directory,
2693           like C:\Users\user). This is followed by the location of the nmap
2694           executable and the same location with ../share/nmap appended. Then
2695           a compiled-in location such as /usr/local/share/nmap or
2696           /usr/share/nmap.
2697
2698       --servicedb services file (Specify custom services file)
2699           Asks Nmap to use the specified services file rather than the
2700           nmap-services data file that comes with Nmap. Using this option
2701           also causes a fast scan (-F) to be used. See the description for
2702           --datadir for more information on Nmap's data files.
2703
2704       --versiondb service probes file (Specify custom service probes file)
2705           Asks Nmap to use the specified service probes file rather than the
2706           nmap-service-probes data file that comes with Nmap. See the
2707           description for --datadir for more information on Nmap's data
2708           files.
2709
2710       --send-eth (Use raw ethernet sending)
2711           Asks Nmap to send packets at the raw ethernet (data link) layer
2712           rather than the higher IP (network) layer. By default, Nmap chooses
2713           the one which is generally best for the platform it is running on.
2714           Raw sockets (IP layer) are generally most efficient for Unix
2715           machines, while ethernet frames are required for Windows operation
2716           since Microsoft disabled raw socket support. Nmap still uses raw IP
2717           packets on Unix despite this option when there is no other choice
2718           (such as non-ethernet connections).
2719
2720       --send-ip (Send at raw IP level)
2721           Asks Nmap to send packets via raw IP sockets rather than sending
2722           lower level ethernet frames. It is the complement to the --send-eth
2723           option discussed previously.
2724
2725       --privileged (Assume that the user is fully privileged)
2726           Tells Nmap to simply assume that it is privileged enough to perform
2727           raw socket sends, packet sniffing, and similar operations that
2728           usually require root privileges on Unix systems. By default Nmap
2729           quits if such operations are requested but geteuid is not zero.
2730           --privileged is useful with Linux kernel capabilities and similar
2731           systems that may be configured to allow unprivileged users to
2732           perform raw-packet scans. Be sure to provide this option flag
2733           before any flags for options that require privileges (SYN scan, OS
2734           detection, etc.). The NMAP_PRIVILEGED environment variable may be
2735           set as an equivalent alternative to --privileged.
2736
2737       --unprivileged (Assume that the user lacks raw socket privileges)
2738           This option is the opposite of --privileged. It tells Nmap to treat
2739           the user as lacking network raw socket and sniffing privileges.
2740           This is useful for testing, debugging, or when the raw network
2741           functionality of your operating system is somehow broken. The
2742           NMAP_UNPRIVILEGED environment variable may be set as an equivalent
2743           alternative to --unprivileged.
2744
2745       --release-memory (Release memory before quitting)
2746           This option is only useful for memory-leak debugging. It causes
2747           Nmap to release allocated memory just before it quits so that
2748           actual memory leaks are easier to spot. Normally Nmap skips this as
2749           the OS does this anyway upon process termination.
2750
2751       -V; --version (Print version number)
2752           Prints the Nmap version number and exits.
2753
2754       -h; --help (Print help summary page)
2755           Prints a short help screen with the most common command flags.
2756           Running Nmap without any arguments does the same thing.
2757

RUNTIME INTERACTION

2759       During the execution of Nmap, all key presses are captured. This allows
2760       you to interact with the program without aborting and restarting it.
2761       Certain special keys will change options, while any other keys will
2762       print out a status message telling you about the scan. The convention
2763       is that lowercase letters increase the amount of printing, and
2764       uppercase letters decrease the printing. You may also press ‘?’ for
2765       help.
2766
2767       v / V
2768           Increase / decrease the verbosity level
2769
2770       d / D
2771           Increase / decrease the debugging Level
2772
2773       p / P
2774           Turn on / off packet tracing
2775
2776       ?
2777           Print a runtime interaction help screen
2778
2779       Anything else
2780           Print out a status message like this:
2781
2782               Stats: 0:00:07 elapsed; 20 hosts completed (1 up), 1 undergoing Service Scan
2783               Service scan Timing: About 33.33% done; ETC: 20:57 (0:00:12 remaining)
2784

EXAMPLES

2786       Here are some Nmap usage examples, from the simple and routine to a
2787       little more complex and esoteric. Some actual IP addresses and domain
2788       names are used to make things more concrete. In their place you should
2789       substitute addresses/names from your own network. While I don't think
2790       port scanning other networks is or should be illegal, some network
2791       administrators don't appreciate unsolicited scanning of their networks
2792       and may complain. Getting permission first is the best approach.
2793
2794       For testing purposes, you have permission to scan the host
2795       scanme.nmap.org.  This permission only includes scanning via Nmap and
2796       not testing exploits or denial of service attacks. To conserve
2797       bandwidth, please do not initiate more than a dozen scans against that
2798       host per day. If this free scanning target service is abused, it will
2799       be taken down and Nmap will report Failed to resolve given hostname/IP:
2800       scanme.nmap.org. These permissions also apply to the hosts
2801       scanme2.nmap.org, scanme3.nmap.org, and so on, though those hosts do
2802       not currently exist.
2803
2804       nmap -v scanme.nmap.org
2805
2806       This option scans all reserved TCP ports on the machine scanme.nmap.org
2807       . The -v option enables verbose mode.
2808
2809       nmap -sS -O scanme.nmap.org/24
2810
2811
2812       Launches a stealth SYN scan against each machine that is up out of the
2813       256 IPs on the /24 sized network where Scanme resides. It also tries to
2814       determine what operating system is running on each host that is up and
2815       running. This requires root privileges because of the SYN scan and OS
2816       detection.
2817
2818       nmap -sV -p 22,53,110,143,4564 198.116.0-255.1-127
2819
2820       Launches host enumeration and a TCP scan at the first half of each of
2821       the 255 possible eight-bit subnets in the 198.116.0.0/16 address space.
2822       This tests whether the systems run SSH, DNS, POP3, or IMAP on their
2823       standard ports, or anything on port 4564. For any of these ports found
2824       open, version detection is used to determine what application is
2825       running.
2826
2827       nmap -v -iR 100000 -Pn -p 80
2828
2829
2830       Asks Nmap to choose 100,000 hosts at random and scan them for web
2831       servers (port 80). Host enumeration is disabled with -Pn since first
2832       sending a couple probes to determine whether a host is up is wasteful
2833       when you are only probing one port on each target host anyway.
2834
2835       nmap -Pn -p80 -oX logs/pb-port80scan.xml -oG logs/pb-port80scan.gnmap
2836       216.163.128.20/20
2837
2838
2839       This scans 4096 IPs for any web servers (without pinging them) and
2840       saves the output in grepable and XML formats.
2841

NMAP BOOK

2843       While this reference guide details all material Nmap options, it can't
2844       fully demonstrate how to apply those features to quickly solve
2845       real-world tasks. For that, we released Nmap Network Scanning: The
2846       Official Nmap Project Guide to Network Discovery and Security Scanning.
2847       Topics include subverting firewalls and intrusion detection systems,
2848       optimizing Nmap performance, and automating common networking tasks
2849       with the Nmap Scripting Engine. Hints and instructions are provided for
2850       common Nmap tasks such as taking network inventory, penetration
2851       testing, detecting rogue wireless access points, and quashing network
2852       worm outbreaks. Examples and diagrams show actual communication on the
2853       wire. More than half of the book is available free online. See
2854       https://nmap.org/book for more information.
2855

BUGS

2857       Like its author, Nmap isn't perfect. But you can help make it better by
2858       sending bug reports or even writing patches. If Nmap doesn't behave the
2859       way you expect, first upgrade to the latest version available from
2860       https://nmap.org. If the problem persists, do some research to
2861       determine whether it has already been discovered and addressed. Try
2862       searching for the problem or error message on Google since that
2863       aggregates so many forums. If nothing comes of this, create an Issue on
2864       our tracker (http://issues.nmap.org) and/or mail a bug report to
2865       <dev@nmap.org>. If you subscribe to the nmap-dev list before posting,
2866       your message will bypass moderation and get through more quickly.
2867       Subscribe at https://nmap.org/mailman/listinfo/dev. Please include
2868       everything you have learned about the problem, as well as what version
2869       of Nmap you are using and what operating system version it is running
2870       on. Other suggestions for improving Nmap may be sent to the Nmap dev
2871       mailing list as well.
2872
2873       If you are able to write a patch improving Nmap or fixing a bug, that
2874       is even better! Instructions for submitting patches or git pull
2875       requests are available from
2876       https://github.com/nmap/nmap/blob/master/CONTRIBUTING.md
2877
2878       Particularly sensitive issues such as a security reports may be sent
2879       directly to Nmap's author Fyodor directly at <fyodor@nmap.org>. All
2880       other reports and comments should use the dev list or issue tracker
2881       instead because more people read, follow, and respond to those.
2882

AUTHORS

2884       Gordon “Fyodor” Lyon <fyodor@nmap.org> wrote and released Nmap in 1997.
2885       Since then, hundreds of people have made valuable contributions, as
2886       detailed in the CHANGELOG file distributed with Nmap and also available
2887       from https://nmap.org/changelog.html. David Fifield and Daniel Miller
2888       deserve special recognition for their enormous multi-year
2889       contributions!
2890
2892   Nmap Copyright and Licensing
2893       The Nmap Security Scanner is (C) 1996–2020 Insecure.Com LLC ("The Nmap
2894       Project"). Nmap is also a registered trademark of the Nmap Project. It
2895       is published under the Nmap Public Source License[18]. This generally
2896       allows end users to download and use Nmap for free. It doesn't not
2897       allow Nmap to be used and redistributed within commercial software or
2898       hardware products (including appliances, virtual machines, and
2899       traditional applications). We fund the project by selling a special
2900       Nmap OEM Edition for this purpose, as described at
2901       https://nmap.org/oem. Hundreds of large and small software vendors have
2902       already purchased OEM licenses to embed Nmap technology such as host
2903       discovery, port scanning, OS detection, version detection, and the Nmap
2904       Scripting Engine within their products.
2905
2906       The Nmap Project has permission to redistribute Npcap, a packet
2907       capturing driver and library for the Microsoft Windows platform. Npcap
2908       is a separate work with it's own license rather than this Nmap license.
2909       Since the Npcap license does not permit redistribution without special
2910       permission, our Nmap Windows binary packages which contain Npcap may
2911       not be redistributed without special permission.
2912
2913       Even though the NPSL is based on GPLv2, it contains different
2914       provisions and is not directly compatible. It is incompatible with some
2915       other open source licenses as well. In some cases we can relicense
2916       portions of Nmap or grant special permissions to use it in other open
2917       source software. Please contact fyodor@nmap.org with any such requests.
2918       Similarly, we don't incorporate incompatible open source software into
2919       Nmap without special permission from the copyright holders.
2920
2921       If you have received a written license agreement or contract for Nmap
2922       stating terms other than these, you may choose to use and redistribute
2923       Nmap under those terms instead.
2924
2925   Creative Commons License for this Nmap Guide
2926       This Nmap Reference Guide is (C) 2005–2020 Insecure.Com LLC. It is
2927       hereby placed under version 3.0 of the Creative Commons Attribution
2928       License[19]. This allows you redistribute and modify the work as you
2929       desire, as long as you credit the original source. Alternatively, you
2930       may choose to treat this document as falling under the same license as
2931       Nmap itself (discussed previously).
2932
2933   Source Code Availability and Community Contributions
2934       Source is provided to this software because we believe users have a
2935       right to know exactly what a program is going to do before they run it.
2936       This also allows you to audit the software for security holes.
2937
2938       Source code also allows you to port Nmap to new platforms, fix bugs,
2939       and add new features. You are highly encouraged to submit your changes
2940       as Github Pull Requests (PR) or send them to <dev@nmap.org> for
2941       possible incorporation into the main distribution. By submitting such
2942       changes, it is assumed that you are offering the Nmap Project the
2943       unlimited, non-exclusive right to reuse, modify, and relicense the
2944       code. This is important because the inability to relicense code has
2945       caused devastating problems for other Free Software projects (such as
2946       KDE and NASM). We also sell commercial licenses to Nmap OEM[20]. If you
2947       wish to specify special license conditions of your contributions, just
2948       say so when you send them.
2949
2950   No Warranty
2951       This program is distributed in the hope that it will be useful, but
2952       WITHOUT ANY WARRANTY; without even the implied warranty of
2953       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2954
2955       It should also be noted that Nmap has occasionally been known to crash
2956       poorly written applications, TCP/IP stacks, and even operating systems.
2957       While this is extremely rare, it is important to keep in mind.  Nmap
2958       should never be run against mission critical systems unless you are
2959       prepared to suffer downtime. We acknowledge here that Nmap may crash
2960       your systems or networks and we disclaim all liability for any damage
2961       or problems Nmap could cause.
2962
2963   Inappropriate Usage
2964       Because of the slight risk of crashes and because a few black hats like
2965       to use Nmap for reconnaissance prior to attacking systems, there are
2966       administrators who become upset and may complain when their system is
2967       scanned. Thus, it is often advisable to request permission before doing
2968       even a light scan of a network.
2969
2970       Nmap should never be installed with special privileges (e.g. suid
2971       root).  That would open up a major security vulnerability as other
2972       users on the system (or attackers) could use it for privilege
2973       escalation.
2974
2975       Nmap is not designed, manufactured, or intended for use in hazardous
2976       environments requiring fail- safe performance where the failure of the
2977       software could lead directly to death, personal injury, or significant
2978       physical or environmental damage.
2979
2980   Third-Party Software and Funding Notices
2981       This product includes software developed by the Apache Software
2982       Foundation[21]. A modified version of the Libpcap portable packet
2983       capture library[22] is distributed along with Nmap. The Windows version
2984       of Nmap utilizes the Libpcap-derived Ncap library[23] instead. Regular
2985       expression support is provided by the PCRE library[24], which is
2986       open-source software, written by Philip Hazel.  Certain raw networking
2987       functions use the Libdnet[25] networking library, which was written by
2988       Dug Song.  A modified version is distributed with Nmap. Nmap can
2989       optionally link with the OpenSSL cryptography toolkit[26] for SSL
2990       version detection support. The Nmap Scripting Engine uses an embedded
2991       version of the Lua programming language[27].  The Liblinear linear
2992       classification library[28] is used for our IPv6 OS detection machine
2993       learning techniques[29].
2994
2995       All of the third-party software described in this paragraph is freely
2996       redistributable under BSD-style software licenses.
2997
2998       Binary packages for Windows and Mac OS X include support libraries
2999       necessary to run Zenmap and Ndiff with Python and PyGTK. (Unix
3000       platforms commonly make these libraries easy to install, so they are
3001       not part of the packages.) A listing of these support libraries and
3002       their licenses is included in the LICENSES files.
3003
3004       This software was supported in part through the Google Summer of
3005       Code[30] and the DARPA CINDER program[31] (DARPA-BAA-10-84).
3006
3007   United States Export Control
3008       Nmap only uses encryption when compiled with the optional OpenSSL
3009       support and linked with OpenSSL. When compiled without OpenSSL support,
3010       the Nmap Project believes that Nmap is not subject to U.S.  Export
3011       Administration Regulations (EAR)[32] export control. As such, there is
3012       no applicable ECCN (export control classification number) and
3013       exportation does not require any special license, permit, or other
3014       governmental authorization.
3015
3016       When compiled with OpenSSL support or distributed as source code, the
3017       Nmap Project believes that Nmap falls under U.S. ECCN 5D002[33]
3018       (“Information Security Software”). We distribute Nmap under the TSU
3019       exception for publicly available encryption software defined in EAR
3020       740.13(e)[34].
3021

NOTES

3023        1. Nmap Network Scanning: The Official Nmap Project Guide to Network
3024           Discovery and Security Scanning
3025           https://nmap.org/book/
3026
3027        2. RFC 1122
3028           http://www.rfc-editor.org/rfc/rfc1122.txt
3029
3030        3. RFC 792
3031           http://www.rfc-editor.org/rfc/rfc792.txt
3032
3033        4. RFC 950
3034           http://www.rfc-editor.org/rfc/rfc950.txt
3035
3036        5. UDP
3037           http://www.rfc-editor.org/rfc/rfc768.txt
3038
3039        6. SCTP
3040           http://www.rfc-editor.org/rfc/rfc4960.txt
3041
3042        7. TCP RFC
3043           http://www.rfc-editor.org/rfc/rfc793.txt
3044
3045        8. RFC 959
3046           http://www.rfc-editor.org/rfc/rfc959.txt
3047
3048        9. RFC 1323
3049           http://www.rfc-editor.org/rfc/rfc1323.txt
3050
3051       10. Lua programming language
3052           http://lua.org
3053
3054       11. precedence
3055           http://www.lua.org/manual/5.1/manual.html#2.5.3
3056
3057       12. IP protocol
3058           http://www.rfc-editor.org/rfc/rfc791.txt
3059
3060       13. RFC 2960
3061           http://www.rfc-editor.org/rfc/rfc2960.txt
3062
3063       14. Nmap::Scanner
3064           http://sourceforge.net/projects/nmap-scanner/
3065
3066       15. Nmap::Parser
3067           http://nmapparser.wordpress.com/
3068
3069       16. xsltproc
3070           http://xmlsoft.org/XSLT/
3071
3072       17. listed at Wikipedia
3073           http://en.wikipedia.org/wiki/List_of_IPv6_tunnel_brokers
3074
3075       18. Nmap Public Source License
3076           https://nmap.org/npsl
3077
3078       19. Creative Commons Attribution License
3079           http://creativecommons.org/licenses/by/3.0/
3080
3081       20. Nmap OEM
3082           https://nmap.org/oem
3083
3084       21. Apache Software Foundation
3085           https://www.apache.org
3086
3087       22. Libpcap portable packet capture library
3088           https://www.tcpdump.org
3089
3090       23. Ncap library
3091           https://npcap.org
3092
3093       24. PCRE library
3094           https://pcre.org
3095
3096       25. Libdnet
3097           http://libdnet.sourceforge.net
3098
3099       26. OpenSSL cryptography toolkit
3100           https://openssl.org
3101
3102       27. Lua programming language
3103           https://lua.org
3104
3105       28. Liblinear linear classification library
3106           https://www.csie.ntu.edu.tw/~cjlin/liblinear/
3107
3108       29. IPv6 OS detection machine learning techniques
3109           https://nmap.org/book/osdetect-guess.html#osdetect-guess-ipv6
3110
3111       30. Google Summer of Code
3112           https://nmap.org/soc/
3113
3114       31. DARPA CINDER program
3115           https://www.fbo.gov/index?s=opportunity&mode=form&id=585e02a51f77af5cb3c9e06b9cc82c48&tab=core&_cview=1
3116
3117       32. Export Administration Regulations (EAR)
3118           https://www.bis.doc.gov/index.php/regulations/export-administration-regulations-ear
3119
3120       33. 5D002
3121           https://www.bis.doc.gov/index.php/documents/regulations-docs/federal-register-notices/federal-register-2014/951-ccl5-pt2/file
3122
3123       34. EAR 740.13(e)
3124           https://www.bis.doc.gov/index.php/documents/regulations-docs/2341-740-2/file
3125
3126
3127
3128Nmap                              08/06/2021                           NMAP(1)
Impressum