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.70 ( https://nmap.org )
97           Usage: nmap [Scan Type(s)] [Options] {target specification}
98           TARGET SPECIFICATION:
99             Can pass hostnames, IP addresses, networks, etc.
100             Ex: scanme.nmap.org, 192.168.0.1; 10.0.0-255.1-254
101             -iL <inputfilename>: Input from list of hosts/networks
102             -iR <num hosts>: Choose random targets
103             --exclude <host1[,host2][,host3],...>: Exclude hosts/networks
104             --excludefile <exclude_file>: Exclude list from file
105           HOST DISCOVERY:
106             -sL: List Scan - simply list targets to scan
107             -sn: Ping Scan - disable port scan
108             -Pn: Treat all hosts as online -- skip host discovery
109             -PS/PA/PU/PY[portlist]: TCP SYN/ACK, UDP or SCTP discovery to given ports
110             -PE/PP/PM: ICMP echo, timestamp, and netmask request discovery probes
111             -PO[protocol list]: IP Protocol Ping
112             -n/-R: Never do DNS resolution/Always resolve [default: sometimes]
113             --dns-servers <serv1[,serv2],...>: Specify custom DNS servers
114             --system-dns: Use OS's DNS resolver
115             --traceroute: Trace hop path to each host
116           SCAN TECHNIQUES:
117             -sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon scans
118             -sU: UDP Scan
119             -sN/sF/sX: TCP Null, FIN, and Xmas scans
120             --scanflags <flags>: Customize TCP scan flags
121             -sI <zombie host[:probeport]>: Idle scan
122             -sY/sZ: SCTP INIT/COOKIE-ECHO scans
123             -sO: IP protocol scan
124             -b <FTP relay host>: FTP bounce scan
125           PORT SPECIFICATION AND SCAN ORDER:
126             -p <port ranges>: Only scan specified ports
127               Ex: -p22; -p1-65535; -p U:53,111,137,T:21-25,80,139,8080,S:9
128             --exclude-ports <port ranges>: Exclude the specified ports from scanning
129             -F: Fast mode - Scan fewer ports than the default scan
130             -r: Scan ports consecutively - don't randomize
131             --top-ports <number>: Scan <number> most common ports
132             --port-ratio <ratio>: Scan ports more common than <ratio>
133           SERVICE/VERSION DETECTION:
134             -sV: Probe open ports to determine service/version info
135             --version-intensity <level>: Set from 0 (light) to 9 (try all probes)
136             --version-light: Limit to most likely probes (intensity 2)
137             --version-all: Try every single probe (intensity 9)
138             --version-trace: Show detailed version scan activity (for debugging)
139           SCRIPT SCAN:
140             -sC: equivalent to --script=default
141             --script=<Lua scripts>: <Lua scripts> is a comma separated list of
142                      directories, script-files or script-categories
143             --script-args=<n1=v1,[n2=v2,...]>: provide arguments to scripts
144             --script-args-file=filename: provide NSE script args in a file
145             --script-trace: Show all data sent and received
146             --script-updatedb: Update the script database.
147             --script-help=<Lua scripts>: Show help about scripts.
148                      <Lua scripts> is a comma-separated list of script-files or
149                      script-categories.
150           OS DETECTION:
151             -O: Enable OS detection
152             --osscan-limit: Limit OS detection to promising targets
153             --osscan-guess: Guess OS more aggressively
154           TIMING AND PERFORMANCE:
155             Options which take <time> are in seconds, or append 'ms' (milliseconds),
156             's' (seconds), 'm' (minutes), or 'h' (hours) to the value (e.g. 30m).
157             -T<0-5>: Set timing template (higher is faster)
158             --min-hostgroup/max-hostgroup <size>: Parallel host scan group sizes
159             --min-parallelism/max-parallelism <numprobes>: Probe parallelization
160             --min-rtt-timeout/max-rtt-timeout/initial-rtt-timeout <time>: Specifies
161                 probe round trip time.
162             --max-retries <tries>: Caps number of port scan probe retransmissions.
163             --host-timeout <time>: Give up on target after this long
164             --scan-delay/--max-scan-delay <time>: Adjust delay between probes
165             --min-rate <number>: Send packets no slower than <number> per second
166             --max-rate <number>: Send packets no faster than <number> per second
167           FIREWALL/IDS EVASION AND SPOOFING:
168             -f; --mtu <val>: fragment packets (optionally w/given MTU)
169             -D <decoy1,decoy2[,ME],...>: Cloak a scan with decoys
170             -S <IP_Address>: Spoof source address
171             -e <iface>: Use specified interface
172             -g/--source-port <portnum>: Use given port number
173             --proxies <url1,[url2],...>: Relay connections through HTTP/SOCKS4 proxies
174             --data <hex string>: Append a custom payload to sent packets
175             --data-string <string>: Append a custom ASCII string to sent packets
176             --data-length <num>: Append random data to sent packets
177             --ip-options <options>: Send packets with specified ip options
178             --ttl <val>: Set IP time-to-live field
179             --spoof-mac <mac address/prefix/vendor name>: Spoof your MAC address
180             --badsum: Send packets with a bogus TCP/UDP/SCTP checksum
181           OUTPUT:
182             -oN/-oX/-oS/-oG <file>: Output scan in normal, XML, s|<rIpt kIddi3,
183                and Grepable format, respectively, to the given filename.
184             -oA <basename>: Output in the three major formats at once
185             -v: Increase verbosity level (use -vv or more for greater effect)
186             -d: Increase debugging level (use -dd or more for greater effect)
187             --reason: Display the reason a port is in a particular state
188             --open: Only show open (or possibly open) ports
189             --packet-trace: Show all packets sent and received
190             --iflist: Print host interfaces and routes (for debugging)
191             --append-output: Append to rather than clobber specified output files
192             --resume <filename>: Resume an aborted scan
193             --stylesheet <path/URL>: XSL stylesheet to transform XML output to HTML
194             --webxml: Reference stylesheet from Nmap.Org for more portable XML
195             --no-stylesheet: Prevent associating of XSL stylesheet w/XML output
196           MISC:
197             -6: Enable IPv6 scanning
198             -A: Enable OS detection, version detection, script scanning, and traceroute
199             --datadir <dirname>: Specify custom Nmap data file location
200             --send-eth/--send-ip: Send using raw ethernet frames or IP packets
201             --privileged: Assume that the user is fully privileged
202             --unprivileged: Assume the user lacks raw socket privileges
203             -V: Print version number
204             -h: Print this help summary page.
205           EXAMPLES:
206             nmap -v -A scanme.nmap.org
207             nmap -v -sn 192.168.0.0/16 10.0.0.0/8
208             nmap -v -iR 10000 -Pn -p 80
209           SEE THE MAN PAGE (https://nmap.org/book/man.html) FOR MORE OPTIONS AND EXAMPLES
210

TARGET SPECIFICATION

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

HOST DISCOVERY

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

PORT SCANNING BASICS

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

PORT SCANNING TECHNIQUES

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

PORT SPECIFICATION AND SCAN ORDER

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

SERVICE AND VERSION DETECTION

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

OS DETECTION

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

NMAP SCRIPTING ENGINE (NSE)

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

TIMING AND PERFORMANCE

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

FIREWALL/IDS EVASION AND SPOOFING

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

OUTPUT

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

MISCELLANEOUS OPTIONS

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

RUNTIME INTERACTION

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

EXAMPLES

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

NMAP BOOK

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

BUGS

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

AUTHOR

2878       Gordon “Fyodor” Lyon <fyodor@nmap.org> (http://insecure.org)
2879
2880       Hundreds of people have made valuable contributions to Nmap over the
2881       years. These are detailed in the CHANGELOG file which is distributed
2882       with Nmap and also available from https://nmap.org/changelog.html.
2883
2885   Nmap Copyright and Licensing
2886       The Nmap Security Scanner is (C) 1996–2018 Insecure.Com LLC ("The Nmap
2887       Project"). Nmap is also a registered trademark of the Nmap Project.
2888       This program free software; you may redistribute and/or modify it under
2889       the terms of the GNU General Public License as published by the Free
2890       Software Foundation; Version 2 (“GPL”), BUT ONLY WITH ALL OF THE
2891       CLARIFICATIONS AND EXCEPTIONS DESCRIBED HEREIN. This guarantees your
2892       right to use, modify, and redistribute this software under certain
2893       conditions. If you wish to embed Nmap technology into proprietary
2894       software, we sell alternative licenses (contact <sales@nmap.com>).
2895       Dozens of software vendors already license Nmap technology such as host
2896       discovery, port scanning, OS detection, version detection, and the Nmap
2897       Scripting Engine.
2898
2899       Note that the GPL places important restrictions on “derivative works”,
2900       yet it does not provide a detailed definition of that term. To avoid
2901       misunderstandings, we interpret that term as broadly as copyright law
2902       allows. For example, we consider an application to constitute a
2903       derivative work for the purpose of this license if it does any of the
2904       following with any software or content covered by this license
2905       (“Covered Software”):
2906
2907       ·   Integrates source code from Covered Software.
2908
2909       ·   Reads or includes copyrighted data files, such as Nmap's nmap-os-db
2910           or nmap-service-probes.
2911
2912       ·   Is designed specifically to execute Covered Software and parse the
2913           results (as opposed to typical shell or execution-menu apps, which
2914           will execute anything you tell them to).
2915
2916       ·   Includes Covered Software in a proprietary executable installer.
2917           The installers produced by InstallShield are an example of this.
2918           Including Nmap with other software in compressed or archival form
2919           does not trigger this provision, provided appropriate open source
2920           decompression or de-archiving software is widely available for no
2921           charge. For the purposes of this license, an installer is
2922           considered to include Covered Software even if it actually
2923           retrieves a copy of Covered Software from another source during
2924           runtime (such as by downloading it from the Internet).
2925
2926       ·   Links (statically or dynamically) to a library which does any of
2927           the above.
2928
2929       ·   Executes a helper program, module, or script to do any of the
2930           above.
2931
2932       This list is not exclusive, but is meant to clarify our interpretation
2933       of derived works with some common examples. Other people may interpret
2934       the plain GPL differently, so we consider this a special exception to
2935       the GPL that we apply to Covered Software. Works which meet any of
2936       these conditions must conform to all of the terms of this license,
2937       particularly including the GPL Section 3 requirements of providing
2938       source code and allowing free redistribution of the work as a whole.
2939
2940       As another special exception to the GPL terms, the Nmap Project grants
2941       permission to link the code of this program with any version of the
2942       OpenSSL library which is distributed under a license identical to that
2943       listed in the included docs/licenses/OpenSSL.txt file, and distribute
2944       linked combinations including the two.
2945
2946       The Nmap Project has permission to redistribute Npcap, a packet
2947       capturing driver and library for the Microsoft Windows platform. Npcap
2948       is a separate work with it's own license rather than this Nmap license.
2949       Since the Npcap license does not permit redistribution without special
2950       permission, our Nmap Windows binary packages which contain Npcap may
2951       not be redistributed without special permission.
2952
2953       Any redistribution of Covered Software, including any derived works,
2954       must obey and carry forward all of the terms of this license, including
2955       obeying all GPL rules and restrictions. For example, source code of the
2956       whole work must be provided and free redistribution must be allowed.
2957       All GPL references to "this License", are to be treated as including
2958       the terms and conditions of this license text as well.
2959
2960       Because this license imposes special exceptions to the GPL, Covered
2961       Work may not be combined (even as part of a larger work) with plain GPL
2962       software. The terms, conditions, and exceptions of this license must be
2963       included as well. This license is incompatible with some other open
2964       source licenses as well. In some cases we can relicense portions of
2965       Nmap or grant special permissions to use it in other open source
2966       software. Please contact fyodor@nmap.org with any such requests.
2967       Similarly, we don't incorporate incompatible open source software into
2968       Covered Software without special permission from the copyright holders.
2969
2970       If you have any questions about the licensing restrictions on using
2971       Nmap in other works, we are happy to help. As mentioned above, we also
2972       offer an alternative license to integrate Nmap into proprietary
2973       applications and appliances. These contracts have been sold to dozens
2974       of software vendors, and generally include a perpetual license as well
2975       as providing support and updates. They also fund the continued
2976       development of Nmap. Please email <sales@nmap.com> for further
2977       information.
2978
2979       If you have received a written license agreement or contract for
2980       Covered Software stating terms other than these, you may choose to use
2981       and redistribute Covered Software under those terms instead of these.
2982
2983   Creative Commons License for this Nmap Guide
2984       This Nmap Reference Guide is (C) 2005–2018 Insecure.Com LLC. It is
2985       hereby placed under version 3.0 of the Creative Commons Attribution
2986       License[19]. This allows you redistribute and modify the work as you
2987       desire, as long as you credit the original source. Alternatively, you
2988       may choose to treat this document as falling under the same license as
2989       Nmap itself (discussed previously).
2990
2991   Source Code Availability and Community Contributions
2992       Source is provided to this software because we believe users have a
2993       right to know exactly what a program is going to do before they run it.
2994       This also allows you to audit the software for security holes.
2995
2996       Source code also allows you to port Nmap to new platforms, fix bugs,
2997       and add new features. You are highly encouraged to send your changes to
2998       <dev@nmap.org> for possible incorporation into the main distribution.
2999       By sending these changes to Fyodor or one of the Insecure.Org
3000       development mailing lists, it is assumed that you are offering the Nmap
3001       Project the unlimited, non-exclusive right to reuse, modify, and
3002       relicense the code. Nmap will always be available open source, but this
3003       is important because the inability to relicense code has caused
3004       devastating problems for other Free Software projects (such as KDE and
3005       NASM). We also occasionally relicense the code to third parties as
3006       discussed above. If you wish to specify special license conditions of
3007       your contributions, just say so when you send them.
3008
3009   No Warranty
3010       This program is distributed in the hope that it will be useful, but
3011       WITHOUT ANY WARRANTY; without even the implied warranty of
3012       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3013       General Public License v2.0 for more details at
3014       http://www.gnu.org/licenses/gpl-2.0.html, or in the COPYING file
3015       included with Nmap.
3016
3017       It should also be noted that Nmap has occasionally been known to crash
3018       poorly written applications, TCP/IP stacks, and even operating systems.
3019       While this is extremely rare, it is important to keep in mind.  Nmap
3020       should never be run against mission critical systems unless you are
3021       prepared to suffer downtime. We acknowledge here that Nmap may crash
3022       your systems or networks and we disclaim all liability for any damage
3023       or problems Nmap could cause.
3024
3025   Inappropriate Usage
3026       Because of the slight risk of crashes and because a few black hats like
3027       to use Nmap for reconnaissance prior to attacking systems, there are
3028       administrators who become upset and may complain when their system is
3029       scanned. Thus, it is often advisable to request permission before doing
3030       even a light scan of a network.
3031
3032       Nmap should never be installed with special privileges (e.g. suid
3033       root).  That would open up a major security vulnerability as other
3034       users on the system (or attackers) could use it for privilege
3035       escalation.
3036
3037   Third-Party Software and Funding Notices
3038       This product includes software developed by the Apache Software
3039       Foundation[20]. A modified version of the Libpcap portable packet
3040       capture library[21] is distributed along with Nmap. The Windows version
3041       of Nmap utilizes the Libpcap-derived Ncap library[22] instead. Regular
3042       expression support is provided by the PCRE library[23], which is
3043       open-source software, written by Philip Hazel.  Certain raw networking
3044       functions use the Libdnet[24] networking library, which was written by
3045       Dug Song.  A modified version is distributed with Nmap. Nmap can
3046       optionally link with the OpenSSL cryptography toolkit[25] for SSL
3047       version detection support. The Nmap Scripting Engine uses an embedded
3048       version of the Lua programming language[26].  The Liblinear linear
3049       classification library[27] is used for our IPv6 OS detection machine
3050       learning techniques[28].
3051
3052       All of the third-party software described in this paragraph is freely
3053       redistributable under BSD-style software licenses.
3054
3055       Binary packages for Windows and Mac OS X include support libraries
3056       necessary to run Zenmap and Ndiff with Python and PyGTK. (Unix
3057       platforms commonly make these libraries easy to install, so they are
3058       not part of the packages.) A listing of these support libraries and
3059       their licenses is included in the LICENSES files.
3060
3061       This software was supported in part through the Google Summer of
3062       Code[29] and the DARPA CINDER program[30] (DARPA-BAA-10-84).
3063
3064   United States Export Control
3065       Nmap only uses encryption when compiled with the optional OpenSSL
3066       support and linked with OpenSSL. When compiled without OpenSSL support,
3067       the Nmap Project believes that Nmap is not subject to U.S.  Export
3068       Administration Regulations (EAR)[31] export control. It is exempt in
3069       accordance with Scope of the Export Administration Regulations[32] per
3070       §734.2(b)(3)(i) and §734.7(a)(4). As such, there is no applicable ECCN
3071       (export control classification number) and exportation does not require
3072       any special license, permit, or other governmental authorization.
3073
3074       When compiled with OpenSSL support or distributed as source code, the
3075       Nmap Project believes that Nmap falls under U.S. ECCN 5D002[33]
3076       (“Information Security Software”). We distribute Nmap under the TSU
3077       exception for publicly available encryption software defined in EAR
3078       740.13(e)[34].
3079

NOTES

3081        1. Nmap Network Scanning: The Official Nmap Project Guide to Network
3082           Discovery and Security Scanning
3083           https://nmap.org/book/
3084
3085        2. RFC 1122
3086           http://www.rfc-editor.org/rfc/rfc1122.txt
3087
3088        3. RFC 792
3089           http://www.rfc-editor.org/rfc/rfc792.txt
3090
3091        4. RFC 950
3092           http://www.rfc-editor.org/rfc/rfc950.txt
3093
3094        5. RFC 1918
3095           http://www.rfc-editor.org/rfc/rfc1918.txt
3096
3097        6. UDP
3098           http://www.rfc-editor.org/rfc/rfc768.txt
3099
3100        7. SCTP
3101           http://www.rfc-editor.org/rfc/rfc4960.txt
3102
3103        8. TCP RFC
3104           http://www.rfc-editor.org/rfc/rfc793.txt
3105
3106        9. RFC 959
3107           http://www.rfc-editor.org/rfc/rfc959.txt
3108
3109       10. RFC 1323
3110           http://www.rfc-editor.org/rfc/rfc1323.txt
3111
3112       11. Lua programming language
3113           http://lua.org
3114
3115       12. precedence
3116           http://www.lua.org/manual/5.1/manual.html#2.5.3
3117
3118       13. IP protocol
3119           http://www.rfc-editor.org/rfc/rfc791.txt
3120
3121       14. RFC 2960
3122           http://www.rfc-editor.org/rfc/rfc2960.txt
3123
3124       15. Nmap::Scanner
3125           http://sourceforge.net/projects/nmap-scanner/
3126
3127       16. Nmap::Parser
3128           http://nmapparser.wordpress.com/
3129
3130       17. xsltproc
3131           http://xmlsoft.org/XSLT/
3132
3133       18. listed at Wikipedia
3134           http://en.wikipedia.org/wiki/List_of_IPv6_tunnel_brokers
3135
3136       19. Creative Commons Attribution License
3137           http://creativecommons.org/licenses/by/3.0/
3138
3139       20. Apache Software Foundation
3140           http://www.apache.org
3141
3142       21. Libpcap portable packet capture library
3143           http://www.tcpdump.org
3144
3145       22. Ncap library
3146           http://www.npcap.org
3147
3148       23. PCRE library
3149           http://www.pcre.org
3150
3151       24. Libdnet
3152           http://libdnet.sourceforge.net
3153
3154       25. OpenSSL cryptography toolkit
3155           http://www.openssl.org
3156
3157       26. Lua programming language
3158           http://www.lua.org
3159
3160       27. Liblinear linear classification library
3161           http://www.csie.ntu.edu.tw/~cjlin/liblinear/
3162
3163       28. IPv6 OS detection machine learning techniques
3164           https://nmap.org/book/osdetect-guess.html#osdetect-guess-ipv6
3165
3166       29. Google Summer of Code
3167           https://nmap.org/soc/
3168
3169       30. DARPA CINDER program
3170           https://www.fbo.gov/index?s=opportunity&mode=form&id=585e02a51f77af5cb3c9e06b9cc82c48&tab=core&_cview=1
3171
3172       31. Export Administration Regulations (EAR)
3173           http://www.access.gpo.gov/bis/ear/ear_data.html
3174
3175       32. Scope of the Export Administration Regulations
3176           https://bis.doc.gov/index.php/forms-documents/doc_view/412-part-734-scope-of-the-export-administration-regulations
3177
3178       33. 5D002
3179           https://www.bis.doc.gov/index.php/documents/regulations-docs/federal-register-notices/federal-register-2014/951-ccl5-pt2/file
3180
3181       34. EAR 740.13(e)
3182           http://www.access.gpo.gov/bis/ear/pdf/740.pdf
3183
3184
3185
3186Nmap                              03/15/2018                           NMAP(1)
Impressum