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.93 ( 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 sequentially - 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
320       -n (No DNS resolution)
321
322           Tells Nmap to never do reverse DNS resolution on the active IP
323           addresses it finds. Since DNS can be slow even with Nmap's built-in
324           parallel stub resolver, this option can slash scanning times.
325
326       -R (DNS resolution for all targets)
327           Tells Nmap to always do reverse DNS resolution on the target IP
328           addresses. Normally reverse DNS is only performed against
329           responsive (online) hosts.
330
331       --resolve-all (Scan each resolved address)
332           If a hostname target resolves to more than one address, scan all of
333           them. The default behavior is to only scan the first resolved
334           address. Regardless, only addresses in the appropriate address
335           family will be scanned: IPv4 by default, IPv6 with -6.
336
337       --unique (Scan each address only once)
338           Scan each IP address only once. The default behavior is to scan
339           each address as many times as it is specified in the target list,
340           such as when network ranges overlap or different hostnames resolve
341           to the same address.
342
343       --system-dns (Use system DNS resolver)
344           By default, Nmap reverse-resolves IP addresses by sending queries
345           directly to the name servers configured on your host and then
346           listening for responses. Many requests (often dozens) are performed
347           in parallel to improve performance. Specify this option to use your
348           system resolver instead (one IP at a time via the getnameinfo
349           call). This is slower and rarely useful unless you find a bug in
350           the Nmap parallel resolver (please let us know if you do). The
351           system resolver is always used for forward lookups (getting an IP
352           address from a hostname).
353
354       --dns-servers server1[,server2[,...]]  (Servers to use for reverse DNS
355       queries)
356           By default, Nmap determines your DNS servers (for rDNS resolution)
357           from your resolv.conf file (Unix) or the Registry (Win32).
358           Alternatively, you may use this option to specify alternate
359           servers. This option is not honored if you are using --system-dns.
360           Using multiple DNS servers is often faster, especially if you
361           choose authoritative servers for your target IP space. This option
362           can also improve stealth, as your requests can be bounced off just
363           about any recursive DNS server on the Internet.
364
365           This option also comes in handy when scanning private networks.
366           Sometimes only a few name servers provide proper rDNS information,
367           and you may not even know where they are. You can scan the network
368           for port 53 (perhaps with version detection), then try Nmap list
369           scans (-sL) specifying each name server one at a time with
370           --dns-servers until you find one which works.
371
372           This option might not be honored if the DNS response exceeds the
373           size of a UDP packet. In such a situation our DNS resolver will
374           make the best effort to extract a response from the truncated
375           packet, and if not successful it will fall back to using the system
376           resolver. Also, responses that contain CNAME aliases will fall back
377           to the system resolver.
378

HOST DISCOVERY

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

PORT SCANNING BASICS

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

PORT SCANNING TECHNIQUES

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

PORT SPECIFICATION AND SCAN ORDER

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

SERVICE AND VERSION DETECTION

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

OS DETECTION

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

NMAP SCRIPTING ENGINE (NSE)

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

TIMING AND PERFORMANCE

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

FIREWALL/IDS EVASION AND SPOOFING

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

OUTPUT

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

MISCELLANEOUS OPTIONS

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

RUNTIME INTERACTION

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

EXAMPLES

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

NMAP BOOK

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

BUGS

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

AUTHORS

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

NOTES

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