http___fossies.org_linux_nmap_docs_nmap.1_2.xml
http___fossies.org_linux_nmap_docs_man-xlate_nmap-hr.1_1.xml
1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 1.11 2.1 3.1 3.2 4.1 4.2 5.1 5.2 5.3 5.4 6.1 6.2 6.3 7.1 7.2 7.3 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 8.10 9.1 9.2 10.1 10.2 10.3 10.4 10.5 10.6 10.7 11.1 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 12.1 12.2 13.1 13.2 13.3 13.4 14.1 14.2 15.1 16.1 17.1 18.1 19.1 20.1 21.1 22.1 22.2 22.3 22.4 22.5 23.1 23.2 23.3 23.4 23.5 23.6 23.7 23.8 24.1 24.2 24.3 24.4 24.5 24.6 25.1 25.2 25.3 26.1 26.2 26.3 26.4 27.1 28.1 28.2 29.1 30.1 30.2 30.3 31.1 31.2 31.3 31.4 31.5 31.6 31.7 32.1 33.1 34.1 34.2 35.1 36.1 36.2 36.3 36.4 36.5 37.1 37.2 38.1 38.2 38.3 38.4 38.5 39.1 40.1 40.2 40.3 41.1 41.2 41.3 41.4 41.5 41.6 41.7 42.1 42.2 42.3 42.4 42.5 43.1 44.1 44.2 45.1 45.2 45.3 45.4 46.1 46.2 46.3 46.4 46.5 46.6 46.7 47.1 47.2 47.3 48.1 49.1 49.2 49.3 49.4 49.5 50.1 50.2 51.1 51.2 52.1 53.1 53.2 53.3 53.4 53.5 54.1 55.1 55.2 56.1 57.1 57.2 57.3 57.4 57.5 57.6 58.1 58.2 59.1 60.1 61.1 62.1 62.2 62.3 62.4 62.5 62.6 63.1 64.1 65.1 66.1 67.1 67.2 67.3 68.1 68.2 68.3 68.4 69.1 69.2 70.1 71.1 71.2 71.3 71.4 71.5 71.6 71.7 72.1 72.2 72.3 72.4 72.5 72.6 72.7 72.8 72.9 73.1 73.2 73.3 73.4 73.5 74.1 74.2 74.3 74.4 74.5 74.6 75.1 76.1 76.2 76.3 76.4 76.5 76.6 76.7 77.1 78.1 78.2 78.3 78.4 78.5 78.6 78.7 78.8 79.1 80.1 80.2 81.1 81.2 81.3 81.4 81.5 81.6 81.7 81.8 81.9 82.1 82.2 82.3 82.4 82.5 82.6 82.7 83.1 83.2 83.3 84.1 85.1 85.2 85.3 85.4 85.5 85.6 86.1 86.2 86.3 86.4 86.5 87.1 88.1 88.2 88.3 89.1 90.1 91.1 92.1 92.2 92.3 93.1 93.2 93.3 93.4 93.5 93.6 93.7 93.8 93.9 94.1 95.1 95.2 95.3 95.4 96.1 97.1 97.2 97.3 97.4 97.5 97.6 98.1 99.1 100.1 100.2 100.3 100.4 101.1 101.2 101.3 101.4 101.5 102.1 103.1 104.1 104.2 104.3 105.1 105.2 106.1 107.1 107.2 107.3 107.4 107.5 108.1 108.2 108.3 108.4 108.5 108.6 108.7 108.8 108.9 109.1 110.1 110.2 110.3 110.4 110.5 110.6 111.1 111.2 112.1 113.1 113.2 113.3 113.4 113.5 113.6 113.7 113.8 113.9 113.10 114.1 114.2 114.3 115.1 116.1 116.2 116.3 117.1 118.1 119.1 120.1 120.2 120.3 120.4 120.5 120.6 121.1 121.2 121.3 121.4 122.1 122.2 122.3 122.4 122.5 122.6 122.7 122.8 122.9 122.10 122.11 122.12 123.1 123.2 123.3 123.4 124.1 124.2 124.3 125.1 126.1 127.1 127.2 128.1 129.1 130.1 131.1 132.1 133.1 133.2 133.3 133.4 133.5 134.1 134.2 135.1 135.2 135.3 135.4 135.5 135.6 135.7 135.8 135.9 135.10 135.11 136.1 136.2 136.3 137.1 138.1 139.1 140.1 141.1 142.1 143.1 143.2 144.1 144.2 145.1 145.2 145.3 145.4 146.1 146.2 147.1 148.1 150.1 151.1 151.2 151.3 151.4 152.1 152.2 152.3 153.1 153.2 153.3 153.4 154.1 154.2 155.1 156.1 156.2 156.3 156.4 157.1 158.1 159.1 160.1 162.1 163.1 164.1 165.1 166.1 166.2 166.3 166.4 166.5 166.6 166.7 167.1 167.2 167.3 168.1 168.2 168.3 169.1 170.1 170.2 170.3 170.4 171.1 171.2 171.3 171.4 172.1 172.2 172.3 173.1 173.2 173.3 173.4 174.1 175.1 175.2 175.3 175.4 176.1 176.2 177.1 178.1 178.2 179.1 179.2 179.3 179.4 180.1 180.2 180.3 180.4 180.5 180.6 181.1 181.2 182.1 183.1 183.2 183.3 183.4 183.5 184.1 185.1 186.1 186.2 186.3 186.4 187.1 188.1 189.1 189.2 189.3 189.4 190.1 190.2 190.3 190.4 191.1 191.2 191.3 192.1 192.2 192.3 192.4 192.5 192.6 193.1 193.2 193.3 193.4 194.1 194.2 194.3 195.1 196.1 196.2 196.3 197.1 198.1 199.1 199.2 199.3 199.4 199.5 199.6 200.1 200.2 200.3 200.4 200.5 200.6 200.7 201.1 201.2 202.1 202.2 202.3 202.4 203.1 203.2 203.3 203.4 203.5 203.6 203.7 204.1 204.2 204.3 204.4 204.5 204.6 204.7 205.1 205.2 205.3 205.4 205.5 205.6 206.1 206.2 206.3 206.4 206.5 207.1 207.2 207.3 208.1 209.1 209.2 210.1 211.1 211.2 211.3 211.4 212.1 212.2 212.3 213.1 213.2 213.3 213.4 213.5 214.1 214.2 215.1 216.1 216.2 216.3 216.4 217.1 218.1 219.1 219.2 219.3 219.4 219.5 219.6 220.1 220.2 220.3 220.4 220.5 221.1 221.2 221.3 221.4 221.5 222.1 223.1 224.1 224.2 224.3 224.4 225.1 225.2 225.3 226.1 226.2 227.1 228.1 229.1 230.1 231.1 231.2 231.3 231.4 232.1 232.2 232.3 232.4 233.1 234.1 235.1 235.2 235.3 235.4 236.1 236.2 236.3 237.1 237.2 237.3 238.1 239.1 240.1 240.2 240.3 240.4 240.5 240.6 240.7 241.1 241.2 241.3 241.4 241.5 241.6 242.1 242.2 243.1 243.2 243.3 243.4 243.5 244.1 244.2 245.1 246.1 247.1 248.1 248.2 248.3 248.4 248.5 249.1 249.2 249.3 249.4 250.1 251.1 252.1 252.2 252.3 252.4 253.1 253.2 253.3 254.1 254.2 254.3 254.4 255.1 255.2 256.1 257.1 258.1 259.1 259.2 259.3 259.4 260.1 261.1 261.2 261.3 261.4 261.5 262.1 263.1 264.1 265.1 266.1 267.1 268.1 269.1 270.1 271.1 271.2 272.1 273.1 274.1 275.1 275.2 275.3 275.4 275.5 275.6 276.1 276.2 277.1 278.1 279.1 280.1 281.1 282.1 283.1 284.1 285.1 286.1 287.1 288.1 288.2 288.3 288.4 288.5 289.1 290.1 291.1 293.1 294.1 295.1 295.2 295.3 295.4 295.5 296.1 296.2 296.3 296.4 296.5 297.1 298.1 298.2 299.1 300.1 300.2 300.3 302.1 302.2 302.3 303.1 304.1 304.2 305.1 306.1 307.1 307.2 307.3 307.4 307.5 307.6 307.7 308.1 308.2 308.3 308.4 308.5 308.6 308.7 308.8 308.9 308.10 308.11 308.12 309.1 309.2 309.3 310.1 311.1 311.2 312.1 312.2 312.3 312.4 312.5 312.6 312.7 312.8 313.1 313.2 313.3 314.1 314.2 314.3 315.1 315.2 316.1 316.2 316.3 317.1 317.2 317.3 317.4 317.5 317.6 318.1 318.2 318.3 318.4 318.5 319.1 320.1 320.2 320.3 320.4 320.5 321.1 321.2 322.1 322.2 322.3 322.4 322.5 322.6 322.7 322.8 323.1 323.2 324.1 324.2 324.3 324.4 325.1 325.2 326.1 326.2 327.1 327.2 327.3 327.4 327.5 327.6 327.7 327.8 327.9 328.1 329.1 329.2 329.3 330.1 331.1 331.2 331.3 331.4 332.1 332.2 332.3
The output from Nmap is a list of scanned targets, with supplemental information on each depending on the options used. Key among that information is the lqinteresting ports tablerq.. That table lists the port number and protocol, service name, and state. The state is either open, filtered, closed, or unfiltered. Open.means that an application on the target machine is listening for connections/packets on that port. Filtered.means that a firewall, filter, or other network obstacle is blocking the port so that Nmap cannot tell whether it is open or closed. Closed.ports have no application listening on them, though they could open up at any time. Ports are classified as unfiltered.when they are responsive to Nmap's probes, but Nmap cannot determine whether they are open or closed. Nmap reports the state combinations open|filtered.and closed|filtered.when it cannot determine which of the two states describe a port. The port table may also include software version details when version detection has been requested. When an IP protocol scan is requested (-sO), Nmap provides information on supported IP protocols rather than listening ports. In addition to the interesting ports table, Nmap can provide further information on targets, including reverse DNS names, operating system guesses, device types, and MAC addresses. A typical Nmap scan is shown in Example 1. The only Nmap arguments used in this example are -A, to enable OS and version detection, script scanning, and traceroute; -T4 for faster execution; and then the two target hostnames. Example 1. A representative Nmap scan # nmap -A -T4 scanme.nmap.org Nmap scan report for scanme.nmap.org (74.207.244.221) Host is up (0.029s latency). rDNS record for 74.207.244.221: li86-221.members.linode.com Not shown: 995 closed ports PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 5.3p1 Debian 3ubuntu7 (protocol 2.0) | ssh-hostkey: 1024 8d:60:f1:7c:ca:b7:3d:0a:d6:67:54:9d:69:d9:b9:dd (DSA) |_2048 79:f8:09:ac:d4:e2:32:42:10:49:d3:bd:20:82:85:ec (RSA) 80/tcp open http Apache httpd 2.2.14 ((Ubuntu)) |_http-title: Go ahead and ScanMe! 646/tcp filtered ldp 1720/tcp filtered H.323/Q.931 9929/tcp open nping-echo Nping echo Device type: general purpose Running: Linux 2.6. X OS CPE: cpe:/o:linux:linux_kernel:2.6.39 OS details: Linux 2.6.39 Network Distance: 11 hops Service Info: OS: Linux; CPE: cpe:/o:linux:kernel TRACEROUTE (using port 53/tcp) HOP RTT ADDRESS [Cut first 10 hops for brevity] 11 17.65 ms li86-221.members.linode.com (74.207.244.221) Nmap done: 1 IP address (1 host up) scanned in 14.40 seconds The newest version of Nmap can be obtained from m[blue]http://nmap.orgm[]. The newest version of this man page is available at m[blue]http://nmap.org/book/man.htmlm[]. It is also included as a chapter of Nmap Network Scanning: The Official Nmap Project Guide to Network Discovery and Security Scanning (see m[blue]http://nmap.org/book/m[]). This options summary is printed when Nmap is run with no arguments, and the latest version is always available at m[blue]https://svn.nmap.org/nmap/docs/nmap.usage.txtm[]. It helps people remember the most common options, but is no substitute for the in-depth documentation in the rest of this manual. Some obscure options aren't even included here. Nmap 6.47 ( http://nmap.org ) Usage: nmap [Scan Type(s)] [Options] {target specification} TARGET SPECIFICATION: Can pass hostnames, IP addresses, networks, etc. Ex: scanme.nmap.org, microsoft.com/24, 192.168.0.1; 10.0.0-255.1-254 -iL  : Input from list of hosts/networks -iR  : Choose random targets --exclude  : Exclude hosts/networks --excludefile  : Exclude list from file HOST DISCOVERY: -sL: List Scan - simply list targets to scan -sn: Ping Scan - disable port scan -Pn: Treat all hosts as online -- skip host discovery -PS/PA/PU/PY[portlist]: TCP SYN/ACK, UDP or SCTP discovery to given ports -PE/PP/PM: ICMP echo, timestamp, and netmask request discovery probes -PO[protocol list]: IP Protocol Ping -n/-R: Never do DNS resolution/Always resolve [default: sometimes] --dns-servers  : Specify custom DNS servers --system-dns: Use OS's DNS resolver --traceroute: Trace hop path to each host SCAN TECHNIQUES: -sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon scans -sU: UDP Scan -sN/sF/sX: TCP Null, FIN, and Xmas scans --scanflags  : Customize TCP scan flags -sI  : Idle scan -sY/sZ: SCTP INIT/COOKIE-ECHO scans -sO: IP protocol scan -b  : FTP bounce scan PORT SPECIFICATION AND SCAN ORDER: -p  : Only scan specified ports Ex: -p22; -p1-65535; -p U:53,111,137,T:21-25,80,139,8080,S:9 -F: Fast mode - Scan fewer ports than the default scan -r: Scan ports consecutively - don't randomize --top-ports  : Scan   most common ports --port-ratio  : Scan ports more common than   SERVICE/VERSION DETECTION: -sV: Probe open ports to determine service/version info --version-intensity  : Set from 0 (light) to 9 (try all probes) --version-light: Limit to most likely probes (intensity 2) --version-all: Try every single probe (intensity 9) --version-trace: Show detailed version scan activity (for debugging) SCRIPT SCAN: -sC: equivalent to --script=default --script= :   is a comma separated list of directories, script-files or script-categories --script-args= : provide arguments to scripts --script-args-file=filename: provide NSE script args in a file --script-trace: Show all data sent and received --script-updatedb: Update the script database. --script-help= : Show help about scripts. is a comma-separated list of script-files or script-categories. OS DETECTION: -O: Enable OS detection --osscan-limit: Limit OS detection to promising targets --osscan-guess: Guess OS more aggressively TIMING AND PERFORMANCE: Options which take   are in seconds, or append 'ms' (milliseconds), 's' (seconds), 'm' (minutes), or 'h' (hours) to the value (e.g. 30m). -T : Set timing template (higher is faster) --min-hostgroup/max-hostgroup  : Parallel host scan group sizes --min-parallelism/max-parallelism  : Probe parallelization --min-rtt-timeout/max-rtt-timeout/initial-rtt-timeout  : Specifies probe round trip time. --max-retries  : Caps number of port scan probe retransmissions. --host-timeout  : Give up on target after this long --scan-delay/--max-scan-delay  : Adjust delay between probes --min-rate  : Send packets no slower than   per second --max-rate  : Send packets no faster than   per second FIREWALL/IDS EVASION AND SPOOFING: -f; --mtu  : fragment packets (optionally w/given MTU) -D  : Cloak a scan with decoys -S  : Spoof source address -e  : Use specified interface -g/--source-port  : Use given port number --proxies  : Relay connections through HTTP/SOCKS4 proxies --data-length  : Append random data to sent packets --ip-options  : Send packets with specified ip options --ttl  : Set IP time-to-live field --spoof-mac  : Spoof your MAC address --badsum: Send packets with a bogus TCP/UDP/SCTP checksum OUTPUT: -oN/-oX/-oS/-oG  : Output scan in normal, XML, s| : Output in the three major formats at once -v: Increase verbosity level (use -vv or more for greater effect) -d: Increase debugging level (use -dd or more for greater effect) --reason: Display the reason a port is in a particular state --open: Only show open (or possibly open) ports --packet-trace: Show all packets sent and received --iflist: Print host interfaces and routes (for debugging) --log-errors: Log errors/warnings to the normal-format output file --append-output: Append to rather than clobber specified output files --resume  : Resume an aborted scan --stylesheet  : XSL stylesheet to transform XML output to HTML --webxml: Reference stylesheet from Nmap. Org for more portable XML --no-stylesheet: Prevent associating of XSL stylesheet w/XML output MISC: -6: Enable IPv6 scanning -A: Enable OS detection, version detection, script scanning, and traceroute --datadir  : Specify custom Nmap data file location --send-eth/--send-ip: Send using raw ethernet frames or IP packets --privileged: Assume that the user is fully privileged --unprivileged: Assume the user lacks raw socket privileges -V: Print version number -h: Print this help summary page. EXAMPLES: nmap -v -A scanme.nmap.org nmap -v -sn 192.168.0.0/16 10.0.0.0/8 nmap -v -iR 10000 -Pn -p 80 SEE THE MAN PAGE (http://nmap.org/book/man.html) FOR MORE OPTIONS AND EXAMPLES Everything on the Nmap command-line that isn't an option (or option argument) is treated as a target host specification. The simplest case is to specify a target IP address or hostname for scanning. Sometimes you wish to scan a whole network of adjacent hosts. For this, Nmap supports CIDR-style.addressing. You can append /numbits to an IPv4 address or hostname and Nmap will scan every IP address for which the first numbits are the same as for the reference IP or hostname given. 192.168.10.40/24 would scan exactly the same targets. Given that the host scanme.nmap.org.is at the IP address 64.13.134.52, the specification scanme.nmap.org/16 would scan the 65,536 IP addresses between 64.13.0.0 and 64.13.255.255. The smallest allowed value is /0, which targets the whole Internet. The largest value is /32, which scans just the named host or IP address because all address bits are fixed. CIDR notation is short but not always flexible enough. For example, you might want to scan 192.168.0.0/16 but skip any IPs ending with .0 or .255 because they may be used as subnet network and broadcast addresses. Nmap supports this through octet range addressing. Rather than specify a normal IP address, you can specify a comma-separated list of numbers or ranges for each octet. For example, 192.168.0-255.1-254 will skip all addresses in the range that end in .0 or .255, and 192.168.3-5,7.1 will scan the four addresses 192.168.3.1, 192.168.4.1, 192.168.5.1, and 192.168.7.1. Either side of a range may be omitted; the default values are 0 on the left and 255 on the right. Using - by itself is the same as 0-255, but remember to use 0- in the first octet so the target specification doesn't look like a command-line option. Ranges need not be limited to the final octets: the specifier 0-255.0-255.13.37 will perform an Internet-wide scan for all IP addresses ending in 13.37. This sort of broad sampling can be useful for Internet surveys and research. IPv6 addresses can only be specified by their fully qualified IPv6 address or hostname. CIDR and octet ranges aren't yet supported for IPv6. IPv6 addresses with non-global scope need to have a zone ID suffix. On Unix systems, this is a percent sign followed by an interface name; a complete address might be fe80::a8bb:ccff:fedd:eeff%eth0. On Windows, use an interface index number in place of an interface name: fe80::a8bb:ccff:fedd:eeff%1. You can see a list of interface indexes by running the command netsh.exe interface ipv6 show interface. Nmap accepts multiple host specifications on the command line, and they don't need to be the same type. The command nmap scanme.nmap.org 192.168.0.0/8 10.0.0,1,3-7.- does what you would expect. While targets are usually specified on the command lines, the following options are also available to control target selection: -iL inputfilename (Input from list) . The input file may contain comments that start with # and extend to the end of the line. -iR num hosts (Choose random targets) . --exclude host1[,host2[,...]] (Exclude hosts/networks) . --excludefile exclude_file (Exclude list from file) . The exclude file may contain comments that start with # and extend to the end of the line. One of the very first steps in any network reconnaissance mission is to reduce a (sometimes huge) set of IP ranges into a list of active or interesting hosts. Scanning every port of every single IP address is slow and usually unnecessary. Of course what makes a host interesting depends greatly on the scan purposes. Network administrators may only be interested in hosts running a certain service, while security auditors may care about every single device with an IP address. An administrator may be comfortable using just an ICMP ping to locate hosts on his internal network, while an external penetration tester may use a diverse set of dozens of probes in an attempt to evade firewall restrictions. Because host discovery needs are so diverse, Nmap offers a wide variety of options for customizing the techniques used. Host discovery is sometimes called ping scan, but it goes well beyond the simple ICMP echo request packets associated with the ubiquitous ping tool. Users can skip the ping step entirely with a list scan (-sL) or by disabling ping (-Pn), or engage the network with arbitrary combinations of multi-port TCP SYN/ACK, UDP, SCTP INIT and ICMP probes. The goal of these probes is to solicit responses which demonstrate that an IP address is actually active (is being used by a host or network device). On many networks, only a small percentage of IP addresses are active at any given time. This is particularly common with private address space such as 10.0.0.0/8. That network has 16 million IPs, but I have seen it used by companies with less than a thousand machines. Host discovery can find those machines in a sparsely allocated sea of IP addresses. If no host discovery options are given, Nmap sends an ICMP echo request, a TCP SYN packet to port 443, a TCP ACK packet to port 80, and an ICMP timestamp request. (For IPv6, the ICMP timestamp request is omitted because it is not part of ICMPv6.) These defaults are equivalent to the -PE -PS443 -PA80 -PP options. The exceptions to this are the ARP (for IPv4) and Neighbor Discovery.(for IPv6) scans which are used for any targets on a local ethernet network. For unprivileged Unix shell users, the default probes are a SYN packet to ports 80 and 443 using the connect system call.. This host discovery is often sufficient when scanning local networks, but a more comprehensive set of discovery probes is recommended for security auditing. The -P* options (which select ping types) can be combined. You can increase your odds of penetrating strict firewalls by sending many probe types using different TCP ports/flags and ICMP codes. Also note that ARP/Neighbor Discovery (-PR).is done by default against targets on a local ethernet network even if you specify other -P* options, because it is almost always faster and more effective. By default, Nmap does host discovery and then performs a port scan against each host it determines is online. This is true even if you specify non-default host discovery types such as UDP probes (-PU). Read about the -sn option to learn how to perform only host discovery, or use -Pn to skip host discovery and port scan all target hosts. The following options control host discovery: -sL (List Scan) . Since the idea is to simply print a list of target hosts, options for higher level functionality such as port scanning, OS detection, or ping scanning cannot be combined with this. If you wish to disable ping scanning while still performing such higher level functionality, read up on the -Pn (skip ping) option. -sn (No port scan) . Systems administrators often find this option valuable as well. It can easily be used to count available machines on a network or monitor server availability. This is often called a ping sweep, and is more reliable than pinging the broadcast address because many hosts do not reply to broadcast queries. The default host discovery done with -sn consists of an ICMP echo request, TCP SYN to port 443, TCP ACK to port 80, and an ICMP timestamp request by default. When executed by an unprivileged user, only SYN packets are sent (using a connect call) to ports 80 and 443 on the target. When a privileged user tries to scan targets on a local ethernet network, ARP requests are used unless --send-ip was specified. The -sn option can be combined with any of the discovery probe types (the -P* options, excluding -Pn) for greater flexibility. If any of those probe type and port number options are used, the default probes are overridden. When strict firewalls are in place between the source host running Nmap and the target network, using those advanced techniques is recommended. Otherwise hosts could be missed when the firewall drops probes or their responses. In previous releases of Nmap, -sn was known as -sP.. -Pn (No ping) . For machines on a local ethernet network, ARP scanning will still be performed (unless --disable-arp-ping or --send-ip is specified) because Nmap needs MAC addresses to further scan target hosts. In previous versions of Nmap, -Pn was -P0.and -PN.. -PS port list (TCP SYN Ping) . The SYN flag suggests to the remote system that you are attempting to establish a connection. Normally the destination port will be closed, and a RST (reset) packet sent back. If the port happens to be open, the target will take the second step of a TCP three-way-handshake.by responding with a SYN/ACK TCP packet. The machine running Nmap then tears down the nascent connection by responding with a RST rather than sending an ACK packet which would complete the three-way-handshake and establish a full connection. The RST packet is sent by the kernel of the machine running Nmap in response to the unexpected SYN/ACK, not by Nmap itself. Nmap does not care whether the port is open or closed. Either the RST or SYN/ACK response discussed previously tell Nmap that the host is available and responsive. On Unix boxes, only the privileged user root.is generally able to send and receive raw TCP packets.. For unprivileged users, a workaround is automatically employed.whereby the connect system call is initiated against each target port. This has the effect of sending a SYN packet to the target host, in an attempt to establish a connection. If connect returns with a quick success or an ECONNREFUSED failure, the underlying TCP stack must have received a SYN/ACK or RST and the host is marked available. If the connection attempt is left hanging until a timeout is reached, the host is marked as down. -PA port list (TCP ACK Ping) . The -PA option uses the same default port as the SYN probe (80) and can also take a list of destination ports in the same format. If an unprivileged user tries this, the connect workaround discussed previously is used. This workaround is imperfect because connect is actually sending a SYN packet rather than an ACK. The reason for offering both SYN and ACK ping probes is to maximize the chances of bypassing firewalls. Many administrators configure routers and other simple firewalls to block incoming SYN packets except for those destined for public services like the company web site or mail server. This prevents other incoming connections to the organization, while allowing users to make unobstructed outgoing connections to the Internet. This non-stateful approach takes up few resources on the firewall/router and is widely supported by hardware and software filters. The Linux Netfilter/iptables.firewall software offers the --syn convenience option to implement this stateless approach. When stateless firewall rules such as this are in place, SYN ping probes (-PS) are likely to be blocked when sent to closed target ports. In such cases, the ACK probe shines as it cuts right through these rules. Another common type of firewall uses stateful rules that drop unexpected packets. This feature was initially found mostly on high-end firewalls, though it has become much more common over the years. The Linux Netfilter/iptables system supports this through the --state option, which categorizes packets based on connection state. A SYN probe is more likely to work against such a system, as unexpected ACK packets are generally recognized as bogus and dropped. A solution to this quandary is to send both SYN and ACK probes by specifying -PS and -PA. -PU port list (UDP Ping) . The --data-length.option can be used to send a fixed-length random payload to every port or (if you specify a value of 0) to disable payloads. You can also disable payloads by specifying --data-length 0. The port list takes the same format as with the previously discussed -PS and -PA options. If no ports are specified, the default is 40125.. This default can be configured at compile-time by changing DEFAULT_UDP_PROBE_PORT_SPEC.in nmap.h.. A highly uncommon port is used by default because sending to open ports is often undesirable for this particular scan type. Upon hitting a closed port on the target machine, the UDP probe should elicit an ICMP port unreachable packet in return. This signifies to Nmap that the machine is up and available. Many other types of ICMP errors, such as host/network unreachables or TTL exceeded are indicative of a down or unreachable host. A lack of response is also interpreted this way. If an open port is reached, most services simply ignore the empty packet and fail to return any response. This is why the default probe port is 40125, which is highly unlikely to be in use. A few services, such as the Character Generator (chargen) protocol, will respond to an empty UDP packet, and thus disclose to Nmap that the machine is available. The primary advantage of this scan type is that it bypasses firewalls and filters that only screen TCP. For example, I once owned a Linksys BEFW11S4 wireless broadband router. The external interface of this device filtered all TCP ports by default, but UDP probes would still elicit port unreachable messages and thus give away the device. -PY port list (SCTP INIT Ping) . The INIT chunk suggests to the remote system that you are attempting to establish an association. Normally the destination port will be closed, and an ABORT chunk will be sent back. If the port happens to be open, the target will take the second step of an SCTP four-way-handshake.by responding with an INIT-ACK chunk. If the machine running Nmap has a functional SCTP stack, then it tears down the nascent association by responding with an ABORT chunk rather than sending a COOKIE-ECHO chunk which would be the next step in the four-way-handshake. The ABORT packet is sent by the kernel of the machine running Nmap in response to the unexpected INIT-ACK, not by Nmap itself. Nmap does not care whether the port is open or closed. Either the ABORT or INIT-ACK response discussed previously tell Nmap that the host is available and responsive. On Unix boxes, only the privileged user root.is generally able to send and receive raw SCTP packets.. Using SCTP INIT Pings is currently not possible for unprivileged users.. -PE; -PP; -PM (ICMP Ping Types) . While echo request is the standard ICMP ping query, Nmap does not stop there. The ICMP standards (m[blue]RFC 792m[][3].and m[blue]RFC 950m[][4].lqa host SHOULD NOT implement these messagesrq. Timestamp and address mask queries can be sent with the -PP and -PM options, respectively. A timestamp reply (ICMP code 14) or address mask reply (code 18) discloses that the host is available. These two queries can be valuable when administrators specifically block echo request packets while forgetting that other ICMP queries can be used for the same purpose. -PO protocol list (IP Protocol Ping) . This host discovery method looks for either responses using the same protocol as a probe, or ICMP protocol unreachable messages which signify that the given protocol isn't supported on the destination host. Either type of response signifies that the target host is alive. -PR (ARP Ping) . ARP scan puts Nmap and its optimized algorithms in charge of ARP requests. And if it gets a response back, Nmap doesn't even need to worry about the IP-based ping packets since it already knows the host is up. This makes ARP scan much faster and more reliable than IP-based scans. So it is done by default when scanning ethernet hosts that Nmap detects are on a local ethernet network. Even if different ping types (such as -PE or -PS) are specified, Nmap uses ARP instead for any of the targets which are on the same LAN. If you absolutely don't want to do an ARP scan, specify --disable-arp-ping. For IPv6 (-6 option), -PR uses ICMPv6 Neighbor Discovery instead of ARP. Neighbor Discovery, defined in RFC 4861, can be seen as the IPv6 equivalent of ARP. --disable-arp-ping (No ARP or ND Ping) . The default behavior is normally faster, but this option is useful on networks using proxy ARP, in which a router speculatively replies to all ARP requests, making every target appear to be up according to ARP scan. --traceroute (Trace path to host) . Traceroute works by sending packets with a low TTL (time-to-live) in an attempt to elicit ICMP Time Exceeded messages from intermediate hops between the scanner and the target host. Standard traceroute implementations start with a TTL of 1 and increment the TTL until the destination host is reached. Nmap's traceroute starts with a high TTL and then decrements the TTL until it reaches zero. Doing it backwards lets Nmap employ clever caching algorithms to speed up traces over multiple hosts. On average Nmap sends 5-10 fewer packets per host, depending on network conditions. If a single subnet is being scanned (i.e. 192.168.0.0/24) Nmap may only have to send two packets to most hosts. -n (No DNS resolution) . -R (DNS resolution for all targets) . --system-dns (Use system DNS resolver) . --dns-servers server1[,server2[,...]] (Servers to use for reverse DNS queries) . This option also comes in handy when scanning private networks. Sometimes only a few name servers provide proper rDNS information, and you may not even know where they are. You can scan the network for port 53 (perhaps with version detection), then try Nmap list scans (-sL) specifying each name server one at a time with --dns-servers until you find one which works. While Nmap has grown in functionality over the years, it began as an efficient port scanner, and that remains its core function. The simple command nmap target scans 1,000 TCP ports on the host target. While many port scanners have traditionally lumped all ports into the open or closed states, Nmap is much more granular. It divides ports into six states: open, closed, filtered, unfiltered, open|filtered, or closed|filtered. These states are not intrinsic properties of the port itself, but describe how Nmap sees them. For example, an Nmap scan from the same network as the target may show port 135/tcp as open, while a scan at the same time with the same options from across the Internet might show that port as filtered. The six port states recognized by Nmap As a novice performing automotive repair, I can struggle for hours trying to fit my rudimentary tools (hammer, duct tape, wrench, etc.) to the task at hand. When I fail miserably and tow my jalopy to a real mechanic, he invariably fishes around in a huge tool chest until pulling out the perfect gizmo which makes the job seem effortless. The art of port scanning is similar. Experts understand the dozens of scan techniques and choose the appropriate one (or combination) for a given task. Inexperienced users and script kiddies,.on the other hand, try to solve every problem with the default SYN scan. Since Nmap is free, the only barrier to port scanning mastery is knowledge. That certainly beats the automotive world, where it may take great skill to determine that you need a strut spring compressor, then you still have to pay thousands of dollars for it. Most of the scan types are only available to privileged users.. This is because they send and receive raw packets,.which requires root access on Unix systems. Using an administrator account on Windows is recommended, though Nmap sometimes works for unprivileged users on that platform when WinPcap has already been loaded into the OS. Requiring root privileges was a serious limitation when Nmap was released in 1997, as many users only had access to shared shell accounts. Now, the world is different. Computers are cheaper, far more people have always-on direct Internet access, and desktop Unix systems (including Linux and Mac OS X) are prevalent. A Windows version of Nmap is now available, allowing it to run on even more desktops. For all these reasons, users have less need to run Nmap from limited shared shell accounts. This is fortunate, as the privileged options make Nmap far more powerful and flexible. While Nmap attempts to produce accurate results, keep in mind that all of its insights are based on packets returned by the target machines (or firewalls in front of them). Such hosts may be untrustworthy and send responses intended to confuse or mislead Nmap. Much more common are non-RFC-compliant hosts that do not respond as they should to Nmap probes. FIN, NULL, and Xmas scans are particularly susceptible to this problem. Such issues are specific to certain scan types and so are discussed in the individual scan type entries. This section documents the dozen or so port scan techniques supported by Nmap. Only one method may be used at a time, except that UDP scan (-sU) and any one of the SCTP scan types (-sY, -sZ) may be combined with any one of the TCP scan types. As a memory aid, port scan type options are of the form -sC, where C is a prominent character in the scan name, usually the first. The one exception to this is the deprecated FTP bounce scan (-b). By default, Nmap performs a SYN Scan, though it substitutes a connect scan if the user does not have proper privileges to send raw packets (requires root access on Unix). Of the scans listed in this section, unprivileged users can only execute connect and FTP bounce scans. -sS (TCP SYN scan) . This technique is often referred to as half-open scanning, because you don't open a full TCP connection. You send a SYN packet, as if you are going to open a real connection and then wait for a response. A SYN/ACK indicates the port is listening (open), while a RST (reset) is indicative of a non-listener. If no response is received after several retransmissions, the port is marked as filtered. The port is also marked filtered if an ICMP unreachable error (type 3, code 1, 2, 3, 9, 10, or 13) is received. The port is also considered open if a SYN packet (without the ACK flag) is received in response. This can be due to an extremely rare TCP feature known as a simultaneous open or split handshake connection (see m[blue]http://nmap.org/misc/split-handshake.pdfm[]). -sT (TCP connect scan) . When SYN scan is available, it is usually a better choice. Nmap has less control over the high level connect call than with raw packets, making it less efficient. The system call completes connections to open target ports rather than performing the half-open reset that SYN scan does. Not only does this take longer and require more packets to obtain the same information, but target machines are more likely to log the connection. A decent IDS will catch either, but most machines have no such alarm system. Many services on your average Unix system will add a note to syslog, and sometimes a cryptic error message, when Nmap connects and then closes the connection without sending data. Truly pathetic services crash when this happens, though that is uncommon. An administrator who sees a bunch of connection attempts in her logs from a single system should know that she has been connect scanned. -sU (UDP scans) . UDP scan is activated with the -sU option. It can be combined with a TCP scan type such as SYN scan (-sS) to check both protocols during the same run. UDP scan works by sending a UDP packet to every targeted port. For some common ports such as 53 and 161, a protocol-specific payload is sent, but for most ports the packet is empty.. The --data-length option can be used to send a fixed-length random payload to every port or (if you specify a value of 0) to disable payloads. If an ICMP port unreachable error (type 3, code 3) is returned, the port is closed. Other ICMP unreachable errors (type 3, codes 1, 2, 9, 10, or 13) mark the port as filtered. Occasionally, a service will respond with a UDP packet, proving that it is open. If no response is received after retransmissions, the port is classified as open|filtered. This means that the port could be open, or perhaps packet filters are blocking the communication. Version detection (-sV) can be used to help differentiate the truly open ports from the filtered ones. A big challenge with UDP scanning is doing it quickly. Open and filtered ports rarely send any response, leaving Nmap to time out and then conduct retransmissions just in case the probe or response were lost. Closed ports are often an even bigger problem. They usually send back an ICMP port unreachable error. But unlike the RST packets sent by closed TCP ports in response to a SYN or connect scan, many hosts rate limit.ICMP port unreachable messages by default. Linux and Solaris are particularly strict about this. For example, the Linux 2.4.20 kernel limits destination unreachable messages to one per second (in net/ipv4/icmp.c). Nmap detects rate limiting and slows down accordingly to avoid flooding the network with useless packets that the target machine will drop. Unfortunately, a Linux-style limit of one packet per second makes a 65,536-port scan take more than 18 hours. Ideas for speeding your UDP scans up include scanning more hosts in parallel, doing a quick scan of just the popular ports first, scanning from behind the firewall, and using --host-timeout to skip slow hosts. -sY (SCTP INIT scan) . m[blue]SCTPm[][7] is a relatively new alternative to the TCP and UDP protocols, combining most characteristics of TCP and UDP, and also adding new features like multi-homing and multi-streaming. It is mostly being used for SS7/SIGTRAN related services but has the potential to be used for other applications as well. SCTP INIT scan is the SCTP equivalent of a TCP SYN scan. It can be performed quickly, scanning thousands of ports per second on a fast network not hampered by restrictive firewalls. Like SYN scan, INIT scan is relatively unobtrusive and stealthy, since it never completes SCTP associations. It also allows clear, reliable differentiation between the open, closed, and filtered states. This technique is often referred to as half-open scanning, because you don't open a full SCTP association. You send an INIT chunk, as if you are going to open a real association and then wait for a response. An INIT-ACK chunk indicates the port is listening (open), while an ABORT chunk is indicative of a non-listener. If no response is received after several retransmissions, the port is marked as filtered. The port is also marked filtered if an ICMP unreachable error (type 3, code 1, 2, 3, 9, 10, or 13) is received. -sN; -sF; -sX (TCP NULL, FIN, and Xmas scans) . When scanning systems compliant with this RFC text, any packet not containing SYN, RST, or ACK bits will result in a returned RST if the port is closed and no response at all if the port is open. As long as none of those three bits are included, any combination of the other three (FIN, PSH, and URG) are OK. Nmap exploits this with three scan types: Null scan (-sN) FIN scan (-sF) Xmas scan (-sX) These three scan types are exactly the same in behavior except for the TCP flags set in probe packets. If a RST packet is received, the port is considered closed, while no response means it is open|filtered. The port is marked filtered if an ICMP unreachable error (type 3, code 1, 2, 3, 9, 10, or 13) is received. The key advantage to these scan types is that they can sneak through certain non-stateful firewalls and packet filtering routers. Another advantage is that these scan types are a little more stealthy than even a SYN scan. Don't count on this though---most modern IDS products can be configured to detect them. The big downside is that not all systems follow RFC 793 to the letter. A number of systems send RST responses to the probes regardless of whether the port is open or not. This causes all of the ports to be labeled closed. Major operating systems that do this are Microsoft Windows, many Cisco devices, BSDI, and IBM OS/400. This scan does work against most Unix-based systems though. Another downside of these scans is that they can't distinguish open ports from certain filtered ones, leaving you with the response open|filtered. -sA (TCP ACK scan) . The ACK scan probe packet has only the ACK flag set (unless you use --scanflags). When scanning unfiltered systems, open and closed ports will both return a RST packet. Nmap then labels them as unfiltered, meaning that they are reachable by the ACK packet, but whether they are open or closed is undetermined. Ports that don't respond, or send certain ICMP error messages back (type 3, code 1, 2, 3, 9, 10, or 13), are labeled filtered. -sW (TCP Window scan) . This scan relies on an implementation detail of a minority of systems out on the Internet, so you can't always trust it. Systems that don't support it will usually return all ports closed. Of course, it is possible that the machine really has no open ports. If most scanned ports are closed but a few common port numbers (such as 22, 25, 53) are filtered, the system is most likely susceptible. Occasionally, systems will even show the exact opposite behavior. If your scan shows 1,000 open ports and three closed or filtered ports, then those three may very well be the truly open ones. -sM (TCP Maimon scan) . --scanflags (Custom TCP scan) . The --scanflags argument can be a numerical flag value such as 9 (PSH and FIN), but using symbolic names is easier. Just mash together any combination of URG, ACK, PSH, RST, SYN, and FIN. For example, --scanflags URGACKPSHRSTSYNFIN sets everything, though it's not very useful for scanning. The order these are specified in is irrelevant. In addition to specifying the desired flags, you can specify a TCP scan type (such as -sA or -sF). That base type tells Nmap how to interpret responses. For example, a SYN scan considers no-response to indicate a filtered port, while a FIN scan treats the same as open|filtered. Nmap will behave the same way it does for the base scan type, except that it will use the TCP flags you specify instead. If you don't specify a base type, SYN scan is used. -sZ (SCTP COOKIE ECHO scan) . -sI zombie host[:probeport] (idle scan) . Besides being extraordinarily stealthy (due to its blind nature), this scan type permits mapping out IP-based trust relationships between machines. The port listing shows open ports from the perspective of the zombie host. So you can try scanning a target using various zombies that you think might be trusted.(via router/packet filter rules). You can add a colon followed by a port number to the zombie host if you wish to probe a particular port on the zombie for IP ID changes. Otherwise Nmap will use the port it uses by default for TCP pings (80). -sO (IP protocol scan) . Besides being useful in its own right, protocol scan demonstrates the power of open-source software. While the fundamental idea is pretty simple, I had not thought to add it nor received any requests for such functionality. Then in the summer of 2000, Gerhard Rieger.conceived the idea, wrote an excellent patch implementing it, and sent it to the announce mailing list.(then called nmap-hackers).. I incorporated that patch into the Nmap tree and released a new version the next day. Few pieces of commercial software have users enthusiastic enough to design and contribute their own improvements! Protocol scan works in a similar fashion to UDP scan. Instead of iterating through the port number field of a UDP packet, it sends IP packet headers and iterates through the eight-bit IP protocol field. The headers are usually empty, containing no data and not even the proper header for the claimed protocol. The exceptions are TCP, UDP, ICMP, SCTP, and IGMP. A proper protocol header for those is included since some systems won't send them otherwise and because Nmap already has functions to create them. Instead of watching for ICMP port unreachable messages, protocol scan is on the lookout for ICMP protocol unreachable messages. If Nmap receives any response in any protocol from the target host, Nmap marks that protocol as open. An ICMP protocol unreachable error (type 3, code 2) causes the protocol to be marked as closed Other ICMP unreachable errors (type 3, code 1, 3, 9, 10, or 13) cause the protocol to be marked filtered (though they prove that ICMP is open at the same time). If no response is received after retransmissions, the protocol is marked open|filtered -b FTP relay host (FTP bounce scan) . This vulnerability was widespread in 1997 when Nmap was released, but has largely been fixed. Vulnerable servers are still around, so it is worth trying when all else fails. If bypassing a firewall is your goal, scan the target network for port 21 (or even for any FTP services if you scan all ports with version detection) and use the ftp-bounce.NSE script. Nmap will tell you whether the host is vulnerable or not. If you are just trying to cover your tracks, you don't need to (and, in fact, shouldn't) limit yourself to hosts on the target network. Before you go scanning random Internet addresses for vulnerable FTP servers, consider that sysadmins may not appreciate you abusing their servers in this way. In addition to all of the scan methods discussed previously, Nmap offers options for specifying which ports are scanned and whether the scan order is randomized or sequential. By default, Nmap scans the most common 1,000 ports for each protocol. -p port ranges (Only scan specified ports) . When scanning a combination of protocols (e.g. TCP and UDP), you can specify a particular protocol by preceding the port numbers by T: for TCP, U: for UDP, S: for SCTP, or P: for IP Protocol. The qualifier lasts until you specify another qualifier. For example, the argument -p U:53,111,137,T:21-25,80,139,8080 would scan UDP ports 53, 111,and 137, as well as the listed TCP ports. Note that to scan both UDP and TCP, you have to specify -sU and at least one TCP scan type (such as -sS, -sF, or -sT). If no protocol qualifier is given, the port numbers are added to all protocol lists. Ports can also be specified by name according to what the port is referred to in the nmap-services. You can even use the wildcards * and ? with the names. For example, to scan FTP and all ports whose names begin with lqhttprq, use -p ftp,http*. Be careful about shell expansions and quote the argument to -p if unsure. Ranges of ports can be surrounded by square brackets to indicate ports inside that range that appear in nmap-services. For example, the following will scan all ports in nmap-services equal to or below 1024: -p [-1024]. Be careful with shell expansions and quote the argument to -p if unsure. -F (Fast (limited port) scan) . Nmap needs an nmap-services file with frequency information in order to know which ports are the most common. If port frequency information isn't available, perhaps because of the use of a custom nmap-services file, Nmap scans all named ports plus ports 1-1024. In that case, -F means to scan only ports that are named in the services file. -r (Don't randomize ports) . --port-ratio ratio --top-ports n Point Nmap at a remote machine and it might tell you that ports 25/tcp, 80/tcp, and 53/udp are open. Using its nmap-services.database of about 2,200 well-known services,. Nmap would report that those ports probably correspond to a mail server (SMTP), web server (HTTP), and name server (DNS) respectively. This lookup is usually accurate---the vast majority of daemons listening on TCP port 25 are, in fact, mail servers. However, you should not bet your security on this! People can and do run services on strange ports.. Even if Nmap is right, and the hypothetical server above is running SMTP, HTTP, and DNS servers, that is not a lot of information. When doing vulnerability assessments (or even simple network inventories) of your companies or clients, you really want to know which mail and DNS servers and versions are running. Having an accurate version number helps dramatically in determining which exploits a server is vulnerable to. Version detection helps you obtain this information. After TCP and/or UDP ports are discovered using one of the other scan methods, version detection interrogates those ports to determine more about what is actually running. The nmap-service-probes.database contains probes for querying various services and match expressions to recognize and parse responses. Nmap tries to determine the service protocol (e.g. FTP, SSH, Telnet, HTTP), the application name (e.g. ISC BIND, Apache httpd, Solaris telnetd), the version number, hostname, device type (e.g. printer, router), the OS family (e.g. Windows, Linux). When possible, Nmap also gets the Common Platform Enumeration (CPE).representation of this information. Sometimes miscellaneous details like whether an X server is open to connections, the SSH protocol version, or the KaZaA user name, are available. Of course, most services don't provide all of this information. If Nmap was compiled with OpenSSL support, it will connect to SSL servers to deduce the service listening behind that encryption layer.. Some UDP ports are left in the open|filtered state after a UDP port scan is unable to determine whether the port is open or filtered. Version detection will try to elicit a response from these ports (just as it does with open ports), and change the state to open if it succeeds. open|filtered TCP ports are treated the same way. Note that the Nmap -A option enables version detection among other things. A paper documenting the workings, usage, and customization of version detection is available at m[blue]http://nmap.org/book/vscan.htmlm[]. When RPC services are discovered, the Nmap RPC grinder.is automatically used to determine the RPC program and version numbers. It takes all the TCP/UDP ports detected as RPC and floods them with SunRPC program NULL commands in an attempt to determine whether they are RPC ports, and if so, what program and version number they serve up. Thus you can effectively obtain the same info as rpcinfo -p even if the target's portmapper is behind a firewall (or protected by TCP wrappers). Decoys do not currently work with RPC scan.. When Nmap receives responses from a service but cannot match them to its database, it prints out a special fingerprint and a URL for you to submit if to if you know for sure what is running on the port. Please take a couple minutes to make the submission so that your find can benefit everyone. Thanks to these submissions, Nmap has about 6,500 pattern matches for more than 650 protocols such as SMTP, FTP, HTTP, etc.. Version detection is enabled and controlled with the following options: -sV (Version detection) . -sR.is an alias for -sV. Prior to March 2011, it was used to active the RPC grinder separately from version detection, but now these options are always combined. --allports (Don't exclude any ports from version detection) . --version-intensity intensity (Set version scan intensity) . --version-light (Enable light mode) . --version-all (Try every single probe) . --version-trace (Trace version scan activity) . One of Nmap's best-known features is remote OS detection using TCP/IP stack fingerprinting. Nmap sends a series of TCP and UDP packets to the remote host and examines practically every bit in the responses. After performing dozens of tests such as TCP ISN sampling, TCP options support and ordering, IP ID sampling, and the initial window size check, Nmap compares the results to its nmap-os-db.database of more than 2,600 known OS fingerprints and prints out the OS details if there is a match. Each fingerprint includes a freeform textual description of the OS, and a classification which provides the vendor name (e.g. Sun), underlying OS (e.g. Solaris), OS generation (e.g. 10), and device type (general purpose, router, switch, game console, etc). Most fingerprints also have a Common Platform Enumeration (CPE).representation, like cpe:/o:linux:linux_kernel:2.6. If Nmap is unable to guess the OS of a machine, and conditions are good (e.g. at least one open port and one closed port were found), Nmap will provide a URL you can use to submit the fingerprint if you know (for sure) the OS running on the machine. By doing this you contribute to the pool of operating systems known to Nmap and thus it will be more accurate for everyone. OS detection enables some other tests which make use of information that is gathered during the process anyway. One of these is TCP Sequence Predictability Classification. This measures approximately how hard it is to establish a forged TCP connection against the remote host. It is useful for exploiting source-IP based trust relationships (rlogin, firewall filters, etc) or for hiding the source of an attack. This sort of spoofing is rarely performed any more, but many machines are still vulnerable to it. The actual difficulty number is based on statistical sampling and may fluctuate. It is generally better to use the English classification such as lqworthy challengerq or lqtrivial jokerq. This is only reported in normal output in verbose (-v) mode. When verbose mode is enabled along with -O, IP ID sequence generation is also reported. Most machines are in the lqincrementalrq class, which means that they increment the ID field in the IP header for each packet they send. This makes them vulnerable to several advanced information gathering and spoofing attacks. Another bit of extra information enabled by OS detection is a guess at a target's uptime. This uses the TCP timestamp option (m[blue]RFC 1323m[][10]) to guess when a machine was last rebooted. The guess can be inaccurate due to the timestamp counter not being initialized to zero or the counter overflowing and wrapping around, so it is printed only in verbose mode. A paper documenting the workings, usage, and customization of OS detection is available at m[blue]http://nmap.org/book/osdetect.htmlm[]. OS detection is enabled and controlled with the following options: -O (Enable OS detection) . --osscan-limit (Limit OS detection to promising targets) . --osscan-guess; --fuzzy (Guess OS detection results) . --max-os-tries (Set the maximum number of OS detection tries against a target) . The Nmap Scripting Engine (NSE) is one of Nmap's most powerful and flexible features. It allows users to write (and share) simple scripts (using the m[blue]Lua programming languagem[][11], Tasks we had in mind when creating the system include network discovery, more sophisticated version detection, vulnerability detection. NSE can even be used for vulnerability exploitation. To reflect those different uses and to simplify the choice of which scripts to run, each script contains a field associating it with one or more categories. Currently defined categories are auth, broadcast, default. discovery, dos, exploit, external, fuzzer, intrusive, malware, safe, version, and vuln. These are all described at m[blue]http://nmap.org/book/nse-usage.html#nse-categoriesm[]. Scripts are not run in a sandbox and thus could accidentally or maliciously damage your system or invade your privacy. Never run scripts from third parties unless you trust the authors or have carefully audited the scripts yourself. The Nmap Scripting Engine is described in detail at m[blue]http://nmap.org/book/nse.htmlm[] and is controlled by the following options: --script filename|category|directory|expression[,...] . There are two special features for advanced users only. One is to prefix script names and expressions with + to force them to run even if they normally wouldn't (e.g. the relevant service wasn't detected on the target port). The other is that the argument all may be used to specify every script in Nmap's database. Be cautious with this because NSE contains dangerous scripts such as exploits, brute force authentication crackers, and denial of service attacks. File and directory names may be relative or absolute. Absolute names are used directly. Relative paths are looked for in the scripts of each of the following places until found: When a directory name is given, Nmap loads every file in the directory whose name ends with .nse. All other files are ignored and directories are not searched recursively. When a filename is given, it does not have to have the .nse extension; it will be added automatically if necessary. Nmap scripts are stored in a scripts subdirectory of the Nmap data directory by default (see m[blue]http://nmap.org/book/data-files.htmlm[]). For efficiency, scripts are indexed in a database stored in scripts/script.db,.which lists the category or categories in which each script belongs. When referring to scripts from script.db by name, you can use a shell-style oq*cq wildcard. nmap --script "http-*" More complicated script selection can be done using the and, or, and not operators to build Boolean expressions. The operators have the same m[blue]precedencem[][12] as in Lua: not is the highest, followed by and and then or. You can alter precedence by using parentheses. Because expressions contain space characters it is necessary to quote them. nmap --script "not intrusive" nmap --script "default or safe" nmap --script "default and safe" nmap --script "(default or safe or intrusive) and not http-*" --script-args-file filename . --script-help filename|category|directory|expression|all[,...] . --script-trace . --script-updatedb . One of my highest Nmap development priorities has always been performance. A default scan (nmap hostname) of a host on my local network takes a fifth of a second. That is barely enough time to blink, but adds up when you are scanning hundreds or thousands of hosts. Moreover, certain scan options such as UDP scanning and version detection can increase scan times substantially. So can certain firewall configurations, particularly response rate limiting. While Nmap utilizes parallelism and many advanced algorithms to accelerate these scans, the user has ultimate control over how Nmap runs. Expert users carefully craft Nmap commands to obtain only the information they care about while meeting their time constraints. Techniques for improving scan times include omitting non-critical tests, and upgrading to the latest version of Nmap (performance enhancements are made frequently). Optimizing timing parameters can also make a substantial difference. Those options are listed below. Some options accept a time parameter. This is specified in seconds by default, though you can append oqmscq, oqscq, oqmcq, or oqhcq to the value to specify milliseconds, seconds, minutes, or hours. So the --host-timeout arguments 900000ms, 900, 900s, and 15m all do the same thing. --min-hostgroup numhosts; --max-hostgroup numhosts (Adjust parallel scan group sizes) . By default, Nmap takes a compromise approach to this conflict. It starts out with a group size as low as five so the first results come quickly and then increases the groupsize to as high as 1024. The exact default numbers depend on the options given. For efficiency reasons, Nmap uses larger group sizes for UDP or few-port TCP scans. When a maximum group size is specified with --max-hostgroup, Nmap will never exceed that size. Specify a minimum size with --min-hostgroup and Nmap will try to keep group sizes above that level. Nmap may have to use smaller groups than you specify if there are not enough target hosts left on a given interface to fulfill the specified minimum. Both may be set to keep the group size within a specific range, though this is rarely desired. These options do not have an effect during the host discovery phase of a scan. This includes plain ping scans (-sn). Host discovery always works in large groups of hosts to improve speed and accuracy. The primary use of these options is to specify a large minimum group size so that the full scan runs more quickly. A common choice is 256 to scan a network in Class C sized chunks. For a scan with many ports, exceeding that number is unlikely to help much. For scans of just a few port numbers, host group sizes of 2048 or more may be helpful. --min-parallelism numprobes; --max-parallelism numprobes (Adjust probe parallelization) . The most common usage is to set --min-parallelism to a number higher than one to speed up scans of poorly performing hosts or networks. This is a risky option to play with, as setting it too high may affect accuracy. Setting this also reduces Nmap's ability to control parallelism dynamically based on network conditions. A value of 10 might be reasonable, though I only adjust this value as a last resort. The --max-parallelism option is sometimes set to one to prevent Nmap from sending more than one probe at a time to hosts. The --scan-delay option, discussed later, is another way to do this. --min-rtt-timeout time, --max-rtt-timeout time, --initial-rtt-timeout time (Adjust probe timeouts) . If the network latency shows itself to be significant and variable, this timeout can grow to several seconds. It also starts at a conservative (high) level and may stay that way for a while when Nmap scans unresponsive hosts. Specifying a lower --max-rtt-timeout and --initial-rtt-timeout than the defaults can cut scan times significantly. This is particularly true for pingless (-Pn) scans, and those against heavily filtered networks. Don't get too aggressive though. The scan can end up taking longer if you specify such a low value that many probes are timing out and retransmitting while the response is in transit. If all the hosts are on a local network, 100 milliseconds (--max-rtt-timeout 100ms) is a reasonable aggressive value. If routing is involved, ping a host on the network first with the ICMP ping utility, or with a custom packet crafter such as Nping.that is more likely to get through a firewall. Look at the maximum round trip time out of ten packets or so. You might want to double that for the --initial-rtt-timeout and triple or quadruple it for the --max-rtt-timeout. I generally do not set the maximum RTT below 100 ms, no matter what the ping times are. Nor do I exceed 1000 ms. --min-rtt-timeout is a rarely used option that could be useful when a network is so unreliable that even Nmap's default is too aggressive. Since Nmap only reduces the timeout down to the minimum when the network seems to be reliable, this need is unusual and should be reported as a bug to the nmap-dev mailing list.. --max-retries numtries (Specify the maximum number of port scan probe retransmissions) . The default (with no -T template) is to allow ten retransmissions. If a network seems reliable and the target hosts aren't rate limiting, Nmap usually only does one retransmission. So most target scans aren't even affected by dropping --max-retries to a low value such as three. Such values can substantially speed scans of slow (rate limited) hosts. You usually lose some information when Nmap gives up on ports early, though that may be preferable to letting the --host-timeout expire and losing all information about the target. --host-timeout time (Give up on slow target hosts) . --scan-delay time; --max-scan-delay time (Adjust delay between probes) . When Nmap adjusts the scan delay upward to cope with rate limiting, the scan slows down dramatically. The --max-scan-delay option specifies the largest delay that Nmap will allow. A low --max-scan-delay can speed up Nmap, but it is risky. Setting this value too low can lead to wasteful packet retransmissions and possible missed ports when the target implements strict rate limiting. Another use of --scan-delay is to evade threshold based intrusion detection and prevention systems (IDS/IPS).. --min-rate number; --max-rate number (Directly control the scanning rate) . When the --min-rate option is given Nmap will do its best to send packets as fast as or faster than the given rate. The argument is a positive real number representing a packet rate in packets per second. For example, specifying --min-rate 300 means that Nmap will try to keep the sending rate at or above 300 packets per second. Specifying a minimum rate does not keep Nmap from going faster if conditions warrant. Likewise, --max-rate limits a scan's sending rate to a given maximum. Use --max-rate 100, for example, to limit sending to 100 packets per second on a fast network. Use --max-rate 0.1 for a slow scan of one packet every ten seconds. Use --min-rate and --max-rate together to keep the rate inside a certain range. These two options are global, affecting an entire scan, not individual hosts. They only affect port scans and host discovery scans. Other features like OS detection implement their own timing. There are two conditions when the actual scanning rate may fall below the requested minimum. The first is if the minimum is faster than the fastest rate at which Nmap can send, which is dependent on hardware. In this case Nmap will simply send packets as fast as possible, but be aware that such high rates are likely to cause a loss of accuracy. The second case is when Nmap has nothing to send, for example at the end of a scan when the last probes have been sent and Nmap is waiting for them to time out or be responded to. It's normal to see the scanning rate drop at the end of a scan or in between hostgroups. The sending rate may temporarily exceed the maximum to make up for unpredictable delays, but on average the rate will stay at or below the maximum. Specifying a minimum rate should be done with care. Scanning faster than a network can support may lead to a loss of accuracy. In some cases, using a faster rate can make a scan take longer than it would with a slower rate. This is because Nmap's adaptive retransmission algorithms will detect the network congestion caused by an excessive scanning rate and increase the number of retransmissions in order to improve accuracy. So even though packets are sent at a higher rate, more packets are sent overall. Cap the number of retransmissions with the --max-retries option if you need to set an upper limit on total scan time. --defeat-rst-ratelimit . Using this option can reduce accuracy, as some ports will appear non-responsive because Nmap didn't wait long enough for a rate-limited RST response. With a SYN scan, the non-response results in the port being labeled filtered rather than the closed state we see when RST packets are received. This option is useful when you only care about open ports, and distinguishing between closed and filtered ports isn't worth the extra time. --nsock-engine epoll|kqueue|poll|select . -T paranoid|sneaky|polite|normal|aggressive|insane (Set a timing template) . These templates allow the user to specify how aggressive they wish to be, while leaving Nmap to pick the exact timing values. The templates also make some minor speed adjustments for which fine-grained control options do not currently exist. For example, -T4.prohibits the dynamic scan delay from exceeding 10 ms for TCP ports and -T5 caps that value at 5 ms. Templates can be used in combination with fine-grained controls, and the fine-grained controls will you specify will take precedence over the timing template default for that parameter. I recommend using -T4 when scanning reasonably modern and reliable networks. Keep that option even when you add fine-grained controls so that you benefit from those extra minor optimizations that it enables. If you are on a decent broadband or ethernet connection, I would recommend always using -T4. Some people love -T5 though it is too aggressive for my taste. People sometimes specify -T2 because they think it is less likely to crash hosts or because they consider themselves to be polite in general. They often don't realize just how slow -T polite.really is. Their scan may take ten times longer than a default scan. Machine crashes and bandwidth problems are rare with the default timing options (-T3) and so I normally recommend that for cautious scanners. Omitting version detection is far more effective than playing with timing values at reducing these problems. While -T0.and -T1.may be useful for avoiding IDS alerts, they will take an extraordinarily long time to scan thousands of machines or ports. For such a long scan, you may prefer to set the exact timing values you need rather than rely on the canned -T0 and -T1 values. The main effects of T0 are serializing the scan so only one port is scanned at a time, and waiting five minutes between sending each probe. T1 and T2 are similar but they only wait 15 seconds and 0.4 seconds, respectively, between probes. T3 is Nmap's default behavior, which includes parallelization..-T4 does the equivalent of --max-rtt-timeout 1250ms --initial-rtt-timeout 500ms --max-retries 6 and sets the maximum TCP scan delay to 10 milliseconds. T5 does the equivalent of --max-rtt-timeout 300ms --min-rtt-timeout 50ms --initial-rtt-timeout 250ms --max-retries 2 --host-timeout 15m as well as setting the maximum TCP scan delay to 5 ms. Many Internet pioneers envisioned a global open network with a universal IP address space allowing virtual connections between any two nodes. This allows hosts to act as true peers, serving and retrieving information from each other. People could access all of their home systems from work, changing the climate control settings or unlocking the doors for early guests. This vision of universal connectivity has been stifled by address space shortages and security concerns. In the early 1990s, organizations began deploying firewalls for the express purpose of reducing connectivity. Huge networks were cordoned off from the unfiltered Internet by application proxies, network address translation, and packet filters. The unrestricted flow of information gave way to tight regulation of approved communication channels and the content that passes over them. Network obstructions such as firewalls can make mapping a network exceedingly difficult. It will not get any easier, as stifling casual reconnaissance is often a key goal of implementing the devices. Nevertheless, Nmap offers many features to help understand these complex networks, and to verify that filters are working as intended. It even supports mechanisms for bypassing poorly implemented defenses. One of the best methods of understanding your network security posture is to try to defeat it. Place yourself in the mind-set of an attacker, and deploy techniques from this section against your networks. Launch an FTP bounce scan, idle scan, fragmentation attack, or try to tunnel through one of your own proxies. In addition to restricting network activity, companies are increasingly monitoring traffic with intrusion detection systems (IDS). All of the major IDSs ship with rules designed to detect Nmap scans because scans are sometimes a precursor to attacks. Many of these products have recently morphed into intrusion prevention systems (IPS).that actively block traffic deemed malicious. Unfortunately for network administrators and IDS vendors, reliably detecting bad intentions by analyzing packet data is a tough problem. Attackers with patience, skill, and the help of certain Nmap options can usually pass by IDSs undetected. Meanwhile, administrators must cope with large numbers of false positive results where innocent activity is misdiagnosed and alerted on or blocked. Occasionally people suggest that Nmap should not offer features for evading firewall rules or sneaking past IDSs. They argue that these features are just as likely to be misused by attackers as used by administrators to enhance security. The problem with this logic is that these methods would still be used by attackers, who would just find other tools or patch the functionality into Nmap. Meanwhile, administrators would find it that much harder to do their jobs. Deploying only modern, patched FTP servers is a far more powerful defense than trying to prevent the distribution of tools implementing the FTP bounce attack. There is no magic bullet (or Nmap option) for detecting and subverting firewalls and IDS systems. It takes skill and experience. A tutorial is beyond the scope of this reference guide, which only lists the relevant options and describes what they do. -f (fragment packets); --mtu (using the specified MTU) . Fragmentation is only supported for Nmap's raw packet features, which includes TCP and UDP port scans (except connect scan and FTP bounce scan) and OS detection. Features such as version detection and the Nmap Scripting Engine generally don't support fragmentation because they rely on your host's TCP stack to communicate with target services. -D decoy1[,decoy2][,ME][,...] (Cloak a scan with decoys) . Separate each decoy host with commas, and you can optionally use ME.as one of the decoys to represent the position for your real IP address. If you put ME in the sixth position or later, some common port scan detectors (such as Solar Designer's.excellent Scanlogd).are unlikely to show your IP address at all. If you don't use ME, Nmap will put you in a random position. You can also use RND.to generate a random, non-reserved IP address, or RND:number to generate number addresses. Note that the hosts you use as decoys should be up or you might accidentally SYN flood your targets. Also it will be pretty easy to determine which host is scanning if only one is actually up on the network. You might want to use IP addresses instead of names (so the decoy networks don't see you in their nameserver logs). Decoys are used both in the initial ping scan (using ICMP, SYN, ACK, or whatever) and during the actual port scanning phase. Decoys are also used during remote OS detection (-O). Decoys do not work with version detection or TCP connect scan. When a scan delay is in effect, the delay is enforced between each batch of spoofed probes, not between each individual probe. Because decoys are sent as a batch all at once, they may temporarily violate congestion control limits. It is worth noting that using too many decoys may slow your scan and potentially even make it less accurate. Also, some ISPs will filter out your spoofed packets, but many do not restrict spoofed IP packets at all. -S IP_Address (Spoof source address) . Another possible use of this flag is to spoof the scan to make the targets think that someone else is scanning them. Imagine a company being repeatedly port scanned by a competitor! The -e option and -Pn are generally required for this sort of usage. Note that you usually won't receive reply packets back (they will be addressed to the IP you are spoofing), so Nmap won't produce useful reports. -e interface (Use specified interface) . --source-port portnumber; -g portnumber (Spoof source port number) . Secure solutions to these problems exist, often in the form of application-level proxies or protocol-parsing firewall modules. Unfortunately there are also easier, insecure solutions. Noting that DNS replies come from port 53 and active FTP from port 20, many administrators have fallen into the trap of simply allowing incoming traffic from those ports. They often assume that no attacker would notice and exploit such firewall holes. In other cases, administrators consider this a short-term stop-gap measure until they can implement a more secure solution. Then they forget the security upgrade. Overworked network administrators are not the only ones to fall into this trap. Numerous products have shipped with these insecure rules. Even Microsoft has been guilty. The IPsec filters that shipped with Windows 2000 and Windows XP contain an implicit rule that allows all TCP or UDP traffic from port 88 (Kerberos). In another well-known case, versions of the Zone Alarm personal firewall up to 2.1.25 allowed any incoming UDP packets with the source port 53 (DNS) or 67 (DHCP). Nmap offers the -g and --source-port options (they are equivalent) to exploit these weaknesses. Simply provide a port number and Nmap will send packets from that port where possible. Most scanning operations that use raw sockets, including SYN and UDP scans, support the option completely. The option notably doesn't have an effect for any operations that use normal operating system sockets, including DNS requests, TCP connect scan,.version detection, and script scanning. Setting the source port also doesn't work for OS detection, because Nmap must use different port numbers for certain OS detection tests to work properly. --data-length number (Append random data to sent packets) . --ip-options S|R [route]|L [route]|T|U ... ; --ip-options hex string (Send packets with specified ip options) . The most powerful way to specify IP options is to simply pass in values as the argument to --ip-options. Precede each hex number with \x then the two digits. You may repeat certain characters by following them with an asterisk and then the number of times you wish them to repeat. For example, \x01\x07\x04\x00*36\x01 is a hex string containing 36 NUL bytes. Nmap also offers a shortcut mechanism for specifying options. Simply pass the letter R, T, or U to request record-route,.record-timestamp,.or both options together, respectively. Loose or strict source routing.may be specified with an L or S followed by a space and then a space-separated list of IP addresses. If you wish to see the options in packets sent and received, specify --packet-trace. For more information and examples of using IP options with Nmap, see m[blue]http://seclists.org/nmap-dev/2006/q3/52m[]. --ttl value (Set IP time-to-live field) . --randomize-hosts (Randomize target host order) . --spoof-mac MAC address, prefix, or vendor name (Spoof MAC address) . --proxies Comma-separated list of proxy URLs (Relay TCP connections through a chain of proxies) . This option takes a list of proxies as argument, expressed as URLs in the format proto://host:port. Use commas to separate node URLs in a chain. No authentication is supported yet. Valid protocols are HTTP and SOCKS4. Warning: this feature is still under development and has limitations. It is implemented within the nsock library and thus has no effect on the ping, port scanning and OS discovery phases of a scan. Only NSE and version scan benefit from this option so far---other features may disclose your true address. SSL connections are not yet supported, nor is proxy-side DNS resolution (hostnames are always resolved by Nmap). --badsum (Send packets with bogus TCP/UDP checksums) . --adler32 (Use deprecated Adler32 instead of CRC32C for SCTP checksums) . Any security tool is only as useful as the output it generates. Complex tests and algorithms are of little value if they aren't presented in an organized and comprehensible fashion. Given the number of ways Nmap is used by people and other software, no single format can please everyone. So Nmap offers several formats, including the interactive mode for humans to read directly and XML for easy parsing by software. In addition to offering different output formats, Nmap provides options for controlling the verbosity of output as well as debugging messages. Output types may be sent to standard output or to named files, which Nmap can append to or clobber. Output files may also be used to resume aborted scans. Nmap makes output available in five different formats. The default is called interactive output,.and it is sent to standard output (stdout).. There is also normal output,.which is similar to interactive except that it displays less runtime information and warnings since it is expected to be analyzed after the scan completes rather than interactively. XML output.is one of the most important output types, as it can be converted to HTML, easily parsed by programs such as Nmap graphical user interfaces, or imported into databases. The two remaining output types are the simple grepable output.which includes most information for a target host on a single line, and sCRiPt KiDDi3 0utPUt.for users who consider themselves |<-r4d. While interactive output is the default and has no associated command-line options, the other four format options use the same syntax. They take one argument, which is the filename that results should be stored in. Multiple formats may be specified, but each format may only be specified once. For example, you may wish to save normal output for your own review while saving XML of the same scan for programmatic analysis. You might do this with the options -oX myscan.xml -oN myscan.nmap. While this chapter uses the simple names like myscan.xml for brevity, more descriptive names are generally recommended. The names chosen are a matter of personal preference, though I use long ones that incorporate the scan date and a word or two describing the scan, placed in a directory named after the company I'm scanning. While these options save results to files, Nmap still prints interactive output to stdout as usual. For example, the command nmap -oX myscan.xml target prints XML to myscan.xml and fills standard output with the same interactive results it would have printed if -oX wasn't specified at all. You can change this by passing a hyphen character as the argument to one of the format types. This causes Nmap to deactivate interactive output, and instead print results in the format you specified to the standard output stream. So the command nmap -oX - target will send only XML output to stdout.. Serious errors may still be printed to the normal error stream, stderr.. Unlike some Nmap arguments, the space between the logfile option flag (such as -oX) and the filename or hyphen is mandatory. If you omit the flags and give arguments such as -oG- or -oXscan.xml, a backwards compatibility feature of Nmap will cause the creation of normal format output files named G- and Xscan.xml respectively. All of these arguments support strftime-like.conversions in the filename. %H, %M, %S, %m, %d, %y, and %Y are all exactly the same as in strftime. %T is the same as %H%M%S, %R is the same as %H%M, and %D is the same as %m%d%y. A % followed by any other character just yields that character (%% gives you a percent symbol). So -oX 'scan-%T-%D.xml' will use an XML file with a name in the form of scan-144840-121307.xml. Nmap also offers options to control scan verbosity and to append to output files rather than clobbering them. All of these options are described below. Nmap Output Formats -oN filespec (normal output) . -oX filespec (XML output) . XML offers a stable format that is easily parsed by software. Free XML parsers are available for all major computer languages, including C/C++, Perl, Python, and Java. People have even written bindings for most of these languages to handle Nmap output and execution specifically. Examples are m[blue]Nmap::Scannerm[][15].and m[blue]Nmap::Parserm[][16].in Perl CPAN. In almost all cases that a non-trivial application interfaces with Nmap, XML is the preferred format. The XML output references an XSL stylesheet which can be used to format the results as HTML. The easiest way to use this is simply to load the XML output in a web browser such as Firefox or IE. By default, this will only work on the machine you ran Nmap on (or a similarly configured one) due to the hard-coded nmap.xsl filesystem path. Use the --webxml or --stylesheet options to create portable XML files that render as HTML on any web-connected machine. -oS filespec (ScRipT KIdd|3 oUTpuT) . -oG filespec (grepable output) . Nevertheless, grepable output is still quite popular. It is a simple format that lists each host on one line and can be trivially searched and parsed with standard Unix tools such as grep, awk, cut, sed, diff, and Perl. Even I usually use it for one-off tests done at the command line. Finding all the hosts with the SSH port open or that are running Solaris takes only a simple grep to identify the hosts, piped to an awk or cut command to print the desired fields. Grepable output consists of comments (lines starting with a pound (#)).and target lines. A target line includes a combination of six labeled fields, separated by tabs and followed with a colon. The fields are Host, Ports, Protocols, Ignored State, OS, Seq Index, IP ID, and Status. The most important of these fields is generally Ports, which gives details on each interesting port. It is a comma separated list of port entries. Each port entry represents one interesting port, and takes the form of seven slash (/) separated subfields. Those subfields are: Port number, State, Protocol, Owner, Service, SunRPC info, and Version info. As with XML output, this man page does not allow for documenting the entire format. A more detailed look at the Nmap grepable output format is available from m[blue]http://nmap.org/book/output-formats-grepable-output.htmlm[]. -oA basename (Output to all formats) . Verbosity and debugging options -v (Increase verbosity level) . Most changes only affect interactive output, and some also affect normal and script kiddie output. The other output types are meant to be processed by machines, so Nmap can give substantial detail by default in those formats without fatiguing a human user. However, there are a few changes in other modes where output size can be reduced substantially by omitting some detail. For example, a comment line in the grepable output that provides a list of all ports scanned is only printed in verbose mode because it can be quite long. -d (Increase debugging level) . Debugging output is useful when a bug is suspected in Nmap, or if you are simply confused as to what Nmap is doing and why. As this feature is mostly intended for developers, debug lines aren't always self-explanatory. You may get something like: Timeout vals: srtt: -1 rttvar: -1 to: 1000000 delta 14987 ==> srtt: 14987 rttvar: 14987 to: 100000. If you don't understand a line, your only recourses are to ignore it, look it up in the source code, or request help from the development list (nmap-dev).. Some lines are self explanatory, but the messages become more obscure as the debug level is increased. --reason (Host and port state reasons) . --stats-every time (Print periodic timing stats) . --packet-trace (Trace packets and data sent and received) . --open (Show only open (or possibly open) ports) . --iflist (List interfaces and routes) . Miscellaneous output options --append-output (Append to rather than clobber output files) . --resume filename (Resume aborted scan) . --stylesheet path or URL (Set XSL stylesheet to transform XML output) . --webxml (Load stylesheet from Nmap. Org) . --no-stylesheet (Omit XSL stylesheet declaration from XML) . This section describes some important (and not-so-important) options that don't really fit anywhere else. -6 (Enable IPv6 scanning) . While IPv6 hasn't exactly taken the world by storm, it gets significant use in some (usually Asian) countries and most modern operating systems support it. To use Nmap with IPv6, both the source and target of your scan must be configured for IPv6. If your ISP (like most of them) does not allocate IPv6 addresses to you, free tunnel brokers are widely available and work fine with Nmap. I use the free IPv6 tunnel broker.service at m[blue]http://www.tunnelbroker.netm[]. Other tunnel brokers are m[blue]listed at Wikipediam[][18]. 6to4 tunnels are another popular, free approach. On Windows, raw-socket IPv6 scans are supported only on ethernet devices (not tunnels), and only on Windows Vista.and later. Use the --unprivileged.option in other situations. -A (Aggressive scan options) . --datadir directoryname (Specify custom Nmap data file location) . --servicedb services file (Specify custom services file) . --versiondb service probes file (Specify custom service probes file) . --send-eth (Use raw ethernet sending) . --send-ip (Send at raw IP level) . --privileged (Assume that the user is fully privileged) . --unprivileged (Assume that the user lacks raw socket privileges) . --release-memory (Release memory before quitting) . -V; --version (Print version number) . -h; --help (Print help summary page) . During the execution of Nmap, all key presses are captured. This allows you to interact with the program without aborting and restarting it. Certain special keys will change options, while any other keys will print out a status message telling you about the scan. The convention is that lowercase letters increase the amount of printing, and uppercase letters decrease the printing. You may also press oq?cq for help. v / V d / D p / P Anything else Stats: 0:00:07 elapsed; 20 hosts completed (1 up), 1 undergoing Service Scan Service scan Timing: About 33.33% done; ETC: 20:57 (0:00:12 remaining) Here are some Nmap usage examples, from the simple and routine to a little more complex and esoteric. Some actual IP addresses and domain names are used to make things more concrete. In their place you should substitute addresses/names from your own network. While I don't think port scanning other networks is or should be illegal, some network administrators don't appreciate unsolicited scanning of their networks and may complain. Getting permission first is the best approach. For testing purposes, you have permission to scan the host scanme.nmap.org.. This permission only includes scanning via Nmap and not testing exploits or denial of service attacks. To conserve bandwidth, please do not initiate more than a dozen scans against that host per day. If this free scanning target service is abused, it will be taken down and Nmap will report Failed to resolve given hostname/IP: scanme.nmap.org. These permissions also apply to the hosts scanme2.nmap.org, scanme3.nmap.org, and so on, though those hosts do not currently exist. nmap -v scanme.nmap.org This option scans all reserved TCP ports on the machine scanme.nmap.org . The -v option enables verbose mode. nmap -sS -O scanme.nmap.org/24 Launches a stealth SYN scan against each machine that is up out of the 256 IPs on the class C sized network where Scanme resides. It also tries to determine what operating system is running on each host that is up and running. This requires root privileges because of the SYN scan and OS detection. Launches host enumeration and a TCP scan at the first half of each of the 255 possible eight-bit subnets in the 198.116 class B address space. This tests whether the systems run SSH, DNS, POP3, or IMAP on their standard ports, or anything on port 4564. For any of these ports found open, version detection is used to determine what application is running. nmap -v -iR 100000 -Pn -p 80 Asks Nmap to choose 100,000 hosts at random and scan them for web servers (port 80). Host enumeration is disabled with -Pn since first sending a couple probes to determine whether a host is up is wasteful when you are only probing one port on each target host anyway. nmap -Pn -p80 -oX logs/pb-port80scan.xml -oG logs/pb-port80scan.gnmap 216.163.128.20/20 This scans 4096 IPs for any web servers (without pinging them) and saves the output in grepable and XML formats. While this reference guide details all material Nmap options, it can't fully demonstrate how to apply those features to quickly solve real-world tasks. For that, we released Nmap Network Scanning: The Official Nmap Project Guide to Network Discovery and Security Scanning. Topics include subverting firewalls and intrusion detection systems, optimizing Nmap performance, and automating common networking tasks with the Nmap Scripting Engine. Hints and instructions are provided for common Nmap tasks such as taking network inventory, penetration testing, detecting rogue wireless access points, and quashing network worm outbreaks. Examples and diagrams show actual communication on the wire. More than half of the book is available free online. See m[blue]http://nmap.org/bookm[] for more information. Like its author, Nmap isn't perfect. But you can help make it better by sending bug reports or even writing patches. If Nmap doesn't behave the way you expect, first upgrade to the latest version available from m[blue]http://nmap.orgm[]. If the problem persists, do some research to determine whether it has already been discovered and addressed. Try searching for the error message on our search page at m[blue]http://insecure.org/search.htmlm[] or at Google. Also try browsing the nmap-dev archives at m[blue]http://seclists.org/m[].. Read this full manual page as well. If nothing comes of this, mail a bug report to dev@nmap.org. Please include everything you have learned about the problem, as well as what version of Nmap you are running and what operating system version it is running on. Problem reports and Nmap usage questions sent to dev@nmap.org are far more likely to be answered than those sent to Fyodor directly. If you subscribe to the nmap-dev list before posting, your message will bypass moderation and get through more quickly. Subscribe at m[blue]http://nmap.org/mailman/listinfo/devm[]. Code patches to fix bugs are even better than bug reports. Basic instructions for creating patch files with your changes are available at m[blue]https://svn.nmap.org/nmap/HACKINGm[]. Patches may be sent to nmap-dev (recommended) or to Fyodor directly. Gordon lqFyodorrq Lyon fyodor@nmap.org (m[blue]http://insecure.orgm[]) Hundreds of people have made valuable contributions to Nmap over the years. These are detailed in the CHANGELOG.file which is distributed with Nmap and also available from m[blue]http://nmap.org/changelog.htmlm[]. The Nmap Security Scanner is (C) 1996-2013 Insecure. Com LLC. Nmap is also a registered trademark of Insecure. Com LLC. This program is free software; you may redistribute and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; Version 2 (lqGPLrq), BUT ONLY WITH ALL OF THE CLARIFICATIONS AND EXCEPTIONS DESCRIBED HEREIN. This guarantees your right to use, modify, and redistribute this software under certain conditions. If you wish to embed Nmap technology into proprietary software, we sell alternative licenses (contact sales@nmap.com). Dozens of software vendors already license Nmap technology such as host discovery, port scanning, OS detection, version detection, and the Nmap Scripting Engine. Note that the GPL places important restrictions on lqderivative worksrq, yet it does not provide a detailed definition of that term. To avoid misunderstandings, we interpret that term as broadly as copyright law allows. For example, we consider an application to constitute a derivative work for the purpose of this license if it does any of the following with any software or content covered by this license (lqCovered Softwarerq): This list is not exclusive, but is meant to clarify our interpretation of derived works with some common examples. Other people may interpret the plain GPL differently, so we consider this a special exception to the GPL that we apply to Covered Software. Works which meet any of these conditions must conform to all of the terms of this license, particularly including the GPL Section 3 requirements of providing source code and allowing free redistribution of the work as a whole. As another special exception to the GPL terms, Insecure. Com LLC grants permission to link the code of this program with any version of the OpenSSL library which is distributed under a license identical to that listed in the included docs/licenses/OpenSSL.txt file, and distribute linked combinations including the two.. Any redistribution of Covered Software, including any derived works, must obey and carry forward all of the terms of this license, including obeying all GPL rules and restrictions. For example, source code of the whole work must be provided and free redistribution must be allowed. All GPL references to "this License", are to be treated as including the terms and conditions of this license text as well. Because this license imposes special exceptions to the GPL, Covered Work may not be combined (even as part of a larger work) with plain GPL software. The terms, conditions, and exceptions of this license must be included as well. This license is incompatible with some other open source licenses as well. In some cases we can relicense portions of Nmap or grant special permissions to use it in other open source software. Please contact fyodor@nmap.org with any such requests. Similarly, we don't incorporate incompatible open source software into Covered Software without special permission from the copyright holders. If you have any questions about the licensing restrictions on using Nmap in other works, are happy to help. As mentioned above, we also offer alternative license to integrate Nmap into proprietary applications and appliances. These contracts have been sold to dozens of software vendors, and generally include a perpetual license as well as providing for priority support and updates. They also fund the continued development of Nmap. Please email sales@nmap.com for further information. If you have received a written license agreement or contract for Covered Software stating terms other than these, you may choose to use and redistribute Covered Software under those terms instead of these. This Nmap Reference Guide is (C) 2005-2012 Insecure. Com LLC. It is hereby placed under version 3.0 of the m[blue]Creative Commons Attribution Licensem[][19]. This allows you redistribute and modify the work as you desire, as long as you credit the original source. Alternatively, you may choose to treat this document as falling under the same license as Nmap itself (discussed previously). Source is provided to this software because we believe users have a right to know exactly what a program is going to do before they run it. This also allows you to audit the software for security holes (none have been found so far). Source code also allows you to port Nmap to new platforms, fix bugs, and add new features. You are highly encouraged to send your changes to dev@nmap.org for possible incorporation into the main distribution. By sending these changes to Fyodor or one of the Insecure. Org development mailing lists, it is assumed that you are offering the Nmap Project (Insecure. Com LLC) the unlimited, non-exclusive right to reuse, modify, and relicense the code. Nmap will always be available open source,.but this is important because the inability to relicense code has caused devastating problems for other Free Software projects (such as KDE and NASM). We also occasionally relicense the code to third parties as discussed above. If you wish to specify special license conditions of your contributions, just say so when you send them. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License v2.0 for more details at m[blue]http://www.gnu.org/licenses/gpl-2.0.htmlm[], or in the COPYING file included with Nmap. It should also be noted that Nmap has occasionally been known to crash poorly written applications, TCP/IP stacks, and even operating systems.. While this is extremely rare, it is important to keep in mind. Nmap should never be run against mission critical systems unless you are prepared to suffer downtime. We acknowledge here that Nmap may crash your systems or networks and we disclaim all liability for any damage or problems Nmap could cause. Because of the slight risk of crashes and because a few black hats like to use Nmap for reconnaissance prior to attacking systems, there are administrators who become upset and may complain when their system is scanned. Thus, it is often advisable to request permission before doing even a light scan of a network. Nmap should never be installed with special privileges (e.g. suid root).. That would open up a major security vulnerability as other users on the system (or attackers) could use it for privilege escalation. This product includes software developed by the m[blue]Apache Software Foundationm[][20]. A modified version of the m[blue]Libpcap portable packet capture librarym[][21].is distributed along with Nmap. The Windows version of Nmap utilized the Libpcap-derived m[blue]WinPcap librarym[][22].instead. Regular expression support is provided by the m[blue]PCRE librarym[][23],.which is open-source software, written by Philip Hazel.. Certain raw networking functions use the m[blue]Libdnetm[][24].networking library, which was written by Dug Song.. A modified version is distributed with Nmap. Nmap can optionally link with the m[blue]OpenSSL cryptography toolkitm[][25].for SSL version detection support. The Nmap Scripting Engine uses an embedded version of the m[blue]Lua programming languagem[][26].. The m[blue]Liblinear linear classification librarym[][27] is used for our m[blue]IPv6 OS detection machine learning techniquesm[][28]. All of the third-party software described in this paragraph is freely redistributable under BSD-style software licenses. Binary packages for Windows and Mac OS X include support libraries necessary to run Zenmap and Ndiff with Python and PyGTK. (Unix platforms commonly make these libraries easy to install, so they are not part of the packages.) A listing of these support libraries and their licenses is included in the LICENSES files. This software was supported in part through the m[blue]Google Summer of Codem[][29] and the m[blue]DARPA CINDER programm[][30] (DARPA-BAA-10-84). Nmap only uses encryption when compiled with the optional OpenSSL support and linked with OpenSSL. When compiled without OpenSSL support, Insecure. Com LLC believes that Nmap is not subject to U.S. m[blue]Export Administration Regulations (EAR)m[][31] export control. As such, there is no applicable ECCN (export control classification number) and exportation does not require any special license, permit, or other governmental authorization. When compiled with OpenSSL support or distributed as source code, Insecure. Com LLC believes that Nmap falls under U.S. ECCN m[blue]5D002m[][32] (lqInformation Security Softwarerq). We distribute Nmap under the TSU exception for publicly available encryption software defined in m[blue]EAR 740.13(e)m[][33].
1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 2.1 3.1 3.2 4.1 4.2 5.1 5.2 5.3 6.1 6.2 7.1 7.2 7.3 7.4 7.5 8.1 8.2 8.3 9.1 9.2 9.3 9.4 10.1 10.2 11.1 11.2 11.3 11.4 11.5 12.1 12.2 12.3 12.4 12.5 12.6 12.7 13.1 13.2 14.1 14.2 15.1 16.1 17.1 18.1 19.1 20.1 20.2 20.3 20.4 20.5 21.1 21.2 21.3 21.4 21.5 21.6 21.7 21.8 22.1 22.2 22.3 22.4 22.5 23.1 23.2 23.3 24.1 25.1 26.1 26.2 27.1 28.1 28.2 28.3 28.4 29.1 29.2 29.3 29.4 29.5 29.6 30.1 31.1 32.1 32.2 32.3 32.4 32.5 33.1 33.2 34.1 34.2 34.3 34.4 34.5 34.6 35.1 36.1 36.2 36.3 37.1 37.2 37.3 37.4 37.5 37.6 37.7 38.1 38.2 38.3 38.4 38.5 39.1 40.1 40.2 40.3 40.4 40.5 40.6 40.7 40.8 41.1 41.2 41.3 42.1 43.1 43.2 43.3 43.4 43.5 43.6 43.7 43.8 43.9 44.1 45.1 45.2 45.3 45.4 46.1 47.1 48.1 49.1 50.1 50.2 50.3 51.1 51.2 52.1 53.1 54.1 55.1 56.1 57.1 58.1 59.1 59.2 59.3 59.4 59.5 59.6 59.7 60.1 60.2 60.3 60.4 60.5 60.6 60.7 60.8 60.9 61.1 61.2 61.3 61.4 61.5 62.1 62.2 62.3 62.4 62.5 62.6 63.1 64.1 64.2 64.3 64.4 64.5 65.1 66.1 66.2 66.3 66.4 66.5 66.6 66.7 66.8 67.1 68.1 68.2 69.1 69.2 69.3 69.4 69.5 69.6 70.1 70.2 70.3 70.4 70.5 70.6 70.7 70.8 71.1 71.2 71.3 72.1 73.1 73.2 73.3 74.1 75.1 76.1 77.1 77.2 77.3 78.1 78.2 78.3 78.4 78.5 78.6 78.7 78.8 79.1 80.1 80.2 80.3 80.4 81.1 82.1 82.2 82.3 82.4 82.5 83.1 84.1 85.1 85.2 85.3 85.4 85.5 86.1 86.2 86.3 86.4 86.5 87.1 88.1 88.2 88.3 89.1 89.2 90.1 91.1 91.2 91.3 91.4 92.1 92.2 92.3 92.4 92.5 92.6 92.7 92.8 92.9 92.10 93.1 94.1 94.2 94.3 94.4 94.5 94.6 95.1 95.2 96.1 97.1 97.2 97.3 97.4 97.5 97.6 98.1 99.1 100.1 100.2 100.3 101.1 101.2 101.3 101.4 101.5 102.1 102.2 102.3 102.4 102.5 102.6 102.7 102.8 102.9 102.10 102.11 102.12 103.1 103.2 103.3 104.1 105.1 106.1 107.1 108.1 109.1 110.1 111.1 112.1 112.2 112.3 112.4 112.5 112.6 113.1 113.2 114.1 114.2 114.3 114.4 114.5 114.6 114.7 114.8 114.9 114.10 114.11 114.12 115.1 116.1 117.1 118.1 119.1 120.1 120.2 120.3 120.4 120.5 120.6 121.1 121.2 121.3 121.4 122.1 123.1 123.2 123.3 123.4 124.1 124.2 124.3 124.4 125.1 125.2 125.3 125.4 126.1 127.1 127.2 127.3 127.4 128.1 129.1 130.1 130.2 130.3 130.4 131.1 131.2 131.3 131.4 131.5 132.1 132.2 133.1 134.1 134.2 134.3 134.4 134.5 135.1 136.1 137.1 137.2 137.3 138.1 139.1 140.1 140.2 140.3 140.4 140.5 140.6 140.7 141.1 141.2 141.3 141.4 141.5 142.1 142.2 143.1 143.2 143.3 143.4 144.1 144.2 144.3 144.4 144.5 144.6 145.1 145.2 145.3 145.4 145.5 145.6 146.1 146.2 146.3 146.4 146.5 146.6 147.1 147.2 147.3 147.4 148.1 148.2 148.3 149.1 150.1 151.1 151.2 151.3 152.1 152.2 152.3 153.1 153.2 153.3 154.1 154.2 155.1 156.1 156.2 156.3 157.1 158.1 159.1 159.2 159.3 159.4 159.5 160.1 160.2 160.3 160.4 160.5 161.1 161.2 161.3 161.4 162.1 163.1 164.1 165.1 166.1 167.1 167.2 167.3 168.1 168.2 168.3 169.1 169.2 169.3 170.1 171.1 172.1 172.2 172.3 172.4 172.5 172.6 172.7 173.1 173.2 173.3 173.4 173.5 174.1 174.2 175.1 175.2 176.1 177.1 178.1 179.1 179.2 179.3 179.4 179.5 180.1 180.2 180.3 180.4 181.1 182.1 183.1 183.2 183.3 183.4 184.1 184.2 184.3 185.1 185.2 185.3 185.4 186.1 187.1 188.1 189.1 190.1 190.2 190.3 190.4 191.1 192.1 192.2 192.3 192.4 192.5 193.1 194.1 195.1 196.1 197.1 198.1 199.1 200.1 201.1 202.1 203.1 203.2 203.3 203.4 203.5 204.1 205.1 206.1 207.1 208.1 209.1 210.1 211.1 212.1 213.1 214.1 214.2 214.3 214.4 214.5 215.1 216.1 217.1 218.1 219.1 220.1 221.1 221.2 221.3 221.4 221.5 222.1 222.2 222.3 222.4 222.5 223.1 224.1 224.2 225.1 226.1 226.2 226.3 228.1 228.2 228.3 229.1 230.1 230.2 231.1 232.1 233.1 233.2 233.3 233.4 233.5 233.6 233.7 233.8 234.1 234.2 234.3 235.1 236.1 236.2 237.1 237.2 237.3 237.4 237.5 237.6 238.1 238.2 239.1 239.2 239.3 239.4 239.5 240.1 240.2 240.3 241.1 241.2 241.3 241.4 242.1 242.2 242.3 243.1 244.1 244.2 244.3 244.4 245.1 245.2 246.1 246.2 246.3 246.4 246.5 246.6 247.1 247.2 248.1 248.2 248.3 248.4 249.1 249.2 250.1 251.1 251.2 251.3 251.4 251.5 251.6 251.7 251.8 251.9 252.1 252.2 252.3 252.4
Rezultat Nmap pretraživanja je popis skeniranih meta s dodatnim informacijama o svakoj od njih ovisno o korištenim parametrima. Ključna informacija je lq tabela zanimljivih portovarq. U tabeli se nalati broj porta i protokol, naziv servisa i stanje.Stanje je ili: otvoreno, filtrirano, zatvoreno ili nefiltrirano. Otvoreno znači da na ciljanom računalu postoji aplikacija koja sluša na tom portu i čeka na konekciju/pakete. Filtrirano znači da između nas i ciljanog računala postoji vatrozid, paket filter ili neki drugi mrežni uređaj koji blokira port, pa Nmap ne može reći da li je port otvoren ili zatvoren. Zatvoreni portovi trenutno nemaju aplikacije koje slušaju na njima. Portovi su klasificirani kao nefiltrirani u situacijama kada odgovaraju na Nmap-ove upite, ali Nmap nije u mogućnosti ustanoviti da li su otvoreni ili zatvoreni. Nmap vraća sljedeće kombinacije u izvještajima: otvoren|filtriran i zatvoren|filtriran kad ne može ustanoviti koje od dva stanja točnije opisuje port. Port tabela može također sadržavati i informacije o verziji softvera, kada je ta opcija upaljena kod skeniranja. Kad je zatraženo skeniranje IP protokola (-sO), Nmap vraća informacije o podržanim IP protokolima, a ne o portovima. Uz navedenu tabelu portova, Nmap može dati i dodatne informacije o ciljanom računalu, uključujući reverse DNS imena, pretopstavku o tome koji operativni sustav je s druge strane, tipove uređaja i MAC adrese. Prikaz tipičnom Nmap skena je prikazan u: Example 1, lqOvako izgleda primjer Nmap skenarq. Jedan od Nmap argumenata korišten u navedenom primjeru je -A, opcija za otkrivanje OS-a i njegove verzije, zatim-T4 za brže skeniranje, te nakon toga dva hosta koje želimo skenirati. Example 1. Ovako izgleda primjer Nmap skena # nmap -A -T4 scanme.nmap.org playground Starting nmap ( http://www.insecure.org/nmap/ ) Interesting ports on scanme.nmap.org (205.217.153.62): (The 1663 ports scanned but not shown below are in state: filtered) PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 3.9p1 (protocol 1.99) 53/tcp open domain 70/tcp closed gopher 80/tcp open http Apache httpd 2.0.52 ((Fedora)) 113/tcp closed auth Device type: general purpose Running: Linux 2.4.X|2.5.X|2.6.X OS details: Linux 2.4.7 - 2.6.11, Linux 2.6.0 - 2.6.11 Uptime 33.908 days (since Thu Jul 21 03:38:03 2005) Interesting ports on playground.nmap.org (192.168.0.40): (The 1659 ports scanned but not shown below are in state: closed) PORT STATE SERVICE VERSION 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn 389/tcp open ldap? 445/tcp open microsoft-ds Microsoft Windows XP microsoft-ds 1002/tcp open windows-icfw? 1025/tcp open msrpc Microsoft Windows RPC 1720/tcp open H.323/Q.931 CompTek AquaGateKeeper 5800/tcp open vnc-http RealVNC 4.0 (Resolution 400x250; VNC TCP port: 5900) 5900/tcp open vnc VNC (protocol 3.8) MAC Address: 00:A0:CC:63:85:4B (Lite-on Communications) Device type: general purpose Running: Microsoft Windows NT/2K/XP OS details: Microsoft Windows XP Pro RC1+ through final release Service Info: OSs: Windows, Windows XP Nmap finished: 2 IP addresses (2 hosts up) scanned in 88.392 seconds Najnoviju verziju Nmap-a možete downloadati sa sljedećeg linka: m[blue]m[][1]. Najnovija verzija man stranica (uputa) dostupna je na sljedećem linku: m[blue]http://www.insecure.org/nmap/man/m[]. Hrvatsku verziju Nmap vodiča je preveo Robert Petrunić s m[blue]originalne Engleske verijem[][2] 2991. Iako se nadam da će prijevod učiniti Nmap dostupniji ljudima Hrvatskog govornog područja, ne mogu garantirati da je prijevod kompletan i up to date kao i originalna Engleska verzija. Projevod možete modificirati i redistribuirati pod uvjetima m[blue]Creative Commons Attribution Licencem[][3]. Ovo je prva verzija i najvjerovatnije ima dosta nekonzistentnih prijevoda (riječi koje su na različitim mjestima prevedene drugačije), ali smisao prijevoda je i dalje ostao isti. Nadam se da ću u idućim verzijama napisati više "književni" točan prijevod Sljedeći pregled opcija je ispisan kad pokrenete Nmap bez ikakvih parametara, a posljednja verzija je uvijek dostupna na: m[blue]http://www.insecure.org/nmap/data/nmap.usage.txtm[]. Pomaže ljudima zapamtiti najčešće opcije, ali nije zamjena za detaljne upute koje se nalaze u ovom manualu. Neke manje korištene opcije čak se ni ne nalaze u pregledu opcija. Upotreba: nmap [Tip(ovi) skeniranja] [Opcije] {ciljano računalo} CILJANO RAČUNALO: Možete upisati hostname (naziv računala), IP adrese, mreže (subnete) isl. Primjer: scanme.nmap.org, microsoft.com/24, 192.168.0.1; 10.0.0-255.1-254 -iL  : Naziv datoteke u kojoj se nalazi popis hostova/mreža -iR  : Odaberi nasumične hostove --exclude  : Ne skeniraj navedene hostove/mreže --excludefile  : Ne skeniraj navedene hostove/mreže koji se nalaze u navedenoj datoteci OTKRIVANJE HOSTOVA: -sL: List Scan - samo navedi mete koje skeniraš -sP: Ping Scan - samo ustanovi da li je host online i ne radi ništa više -P0: Smatraj sve hostove online -- ne pokušavaj ustanoviti da li postoje. -PS/PA/PU [lista_portova]: koristi TCP SYN/ACK ili UDP za otkrivanje hostova -PE/PP/PM: ICMP echo, timestamp i netmask pokušaji skeniranja -n/-R: Ne pokušavaj raditi DNS rezoluciju/uvijek koristi DNS rezoluciju [default: ponekad] TEHNIKE SKENIRANJA: -sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon skenovi -sN/sF/sX: TCP Null, FIN, and Xmas skenovi --scanflags  : Navedi TCP flagove pomoću kojih želiš skenirati -sI  : Idlescan -sO: IP protocol scan -b  : FTP bounce scan SPECIFIKACIJA PORTOVA I REDOSLJED SKENIRANJA: -p  : Skeniraj samo navedene portove Primjer: -p22; -p1-65535; -p U:53,111,137,T:21-25,80,139,8080 -F: Brzo - Skeniraj samo portove navedene u nmap-services fileu -r: Skeniraj portove po redu - ne randomiziraj OTKRIVANJE SERVISA/VERZIJA: -sV: Pokušaj na osnovu otvorenih portova saznati informacije o servisu/verziji --version_light: Koristi najvjerovatnije skenove zbog ubrzane detekcije verzije --version_all: Isprobaj sve vrste skenova za saznavanje verzije --version_trace: Pokaži detaljnu aktivnost skeniranja verzije (za debugging) DETEKCIJA OS-a: -O: Uključi OS detekciju --osscan_limit: Ograniči OS detekciju samo na one ciljeve koji obećavaju --osscan_guess: Pogađaj OS malo agresivnije TIMING I PERFORMANSE: -T[0-6]: Podesi predložak za timing (veći broj je brže) --min_hostgroup/max_hostgroup  : Paralelno skeniraj hostove / veličina sken grupe --min_parallelism/max_parallelism  : Paraleliziraj sonde --min_rtt_timeout/max_rtt_timeout/initial_rtt_timeout  : Navedi vrijeme potrebno za povratak (engl. round trip time) sonde. --host_timeout  : Odustani od skeniranja ciljanog računala nakon navedenog vremena u milisekundama --scan_delay/--max_scan_delay  : Podesi pauzu između slanja upita OBILAŽENJE FIREWALL-a/IDS-a I SPOOFING: -f; --mtu  : fragmentiraj pakete (opcionalno sa zadanim MTU-om) -D  : Sakrij skan korištenjem mamaca -S  : Spoofaj ishodišnu (source) adresu -e  : Koristi navedeni interface (mrežni adapter) -g/--source_port  : Koristi navedeni broj ishodišnog (source) porta --data_length  : Dodaj random podatke u poslane pakete --ttl  : Podesi IP time-to-live polje --spoof_mac  : Spoofaj svoju MAC adresu ISPIS: -oN/-oX/-oS/-oG  : Ispiši scan normalno, kao XML, s| : Ispis u tri glavna formata istovremeno -v: Povećaj verbose nivo (ako želite postići veći efekt, stavite opciju -vv) -d[nivo]: Podesi ili povećaj debuging nivo (Ima smisla do brojke 9, više od toga ne) --packet_trace: Pokaži sve poslane i primljene pakete --iflist: Ispiši host interface i rute (za debuging) --append_output: Dodaj ispis u postojeće datoteke - nemoj ih prepisati --resume  : Nastavi prekinuti scan --stylesheet  : XSL stylesheet za transformiranje XML generiranog dokumenta u HTML --no_stylesheet: Spriječi povezivanje XSL stylesheet-a s XML ispisom RAZNO: -6: Omogući skeniranje IPv6 protokola -A: Omogući prepoznavanje OS-a i verzije OS-a --datadir  : Navedi customizirani Nmap data file --send_eth/--send_ip: šalji sirove (RAW) ethernet frame-ove ili IP pakete --privileged: Pretpostavka da je korisnik koji je pokrenuo Nmap u potpunosti privilegiran (ima admin ovlasti) -V: Ispiši verziju Nmap-a -h: Ispiši ovaj help ekran PRIMJERI: nmap -v -A scanme.nmap.org nmap -v -sP 192.168.0.0/16 10.0.0.0/8 nmap -v -iR 10000 -P0 -p 80 Sve što unesete u komandnu liniju Nmap-a, a nije opcija ili argument opcije (dakle nije parametar samog programa), tretira se kao ciljano računalo. Najjednostavniji slučaj je da unesete IP adrese ili naziv ciljanog hosta. Ponekad želite skenirati čitavu mrežu hostova. Za tu namjenu Nmap podržava CIDR adresiranje. Dakle, nakon IP adrese ili naziva računala, možete dodati /numbits (broj bitova) koji se koriste kao mrežni ID. Ako smo pak odabrali scanme.nmap.org, a recimo da je IP adresa tog hosta 205.217.153.62, scanme.nmap.org/16 bi skeniralo 65,536 IP adresa između 205.217.0.0 i 205.217.255.255. Najmanja dozvoljena vrijednost je 1 (što bi skeniralo gotovo cijeli internet), dok je najveća dozvoljena vrijednost 32, što skenira samo jednog hosta. CIDR notacija je kratka, ali nije uvijek dovoljno fleksibilna. Npr. želite skenirati 192.168.0.0/16, ali želite izbjeći sve IP adrese koje završavaju s .0 ili .255, jer su to mrežni ID i broadcast IP adresa u klasful adresiranju. Nmap za tu situaciju podržava adresiranje na nivou okteta. Umjesto da navedete normalnu IP adresu, možete navesti listu brojeva odvojenih zarezom (1,2,3) ili područja za svaki oktet (1-254). Npr. 192.168.0-255.1-254 će preskočiti sve adrese u navedenom području koje završavaju na .0 i .255, tj. skenirat će sve IP adrese od 192.168.0.1 do 192.168.255.254, preskačući one IP adrese koje u zadnjem oktetu imaju 0 ili 255. Područja nisu limitirana na zadnji oktet, recimo, 0-255.0-255.13.37 će skenirati SVE IP adrese koje završavaju na 13.37. Ovaj način skeniranja može biti koristan za razna istraživanja i ispitivanja. IPv6 adrese mogu biti specificirane isključivo u potpunosti definirane (fully qualified) kao IP adrese ili naziv hosta. CIDR i oktet područja nisu podržani za IPv6 jer se rijetko koriste. Nmap prihvaća navođenje više hostova u komandnoj liniji, a hostovi ne moraju biti istog tipa. Naredba nmap scanme.nmap.org 192.168.0.0/8 10.0.0,1,3-7.0-255 će učiniti upravo ono što očekujete od nje. Ciljevi skeniranja su obično navedeni u samoj komandnoj liniji, ali podržane su i sljedeće opcije: -iL   (Iščitaj parametre iz liste) -iR   (Nasumično odaberi ciljano računalo) --exclude   (isključi iz skeniranja hostove/mreže) --excludefile   (Isključi iz skeniranja koristeći ulazni file) Jedan od prvih koraka kad je u pitanju sakupljanje informacija o mreži je smanjivanje (ponekad velike) količine IP adresnih područja u popis aktivnih i zanimljivih hostova. Skeniranje svih portova za svaku adresu je sporo i najčešće nepotrebno. Naravno, ono što nekog hosta čini zanimljivim uvelike ovisi o razlogu samog skena. Mrežni administratori će možda biti zainteresirani samo za hostove koji imaju pokrenut određeni servis, dok će sigurnosni auditori biti zainteresirani za svaki uređaj s IP adresom. Administratoru će možda biti dovoljno korištenje ICMP pinga kako bi pronašao hostove na mreži, dok će vanjski penetration tester koristiti široki spektar alata i nebrojene sonde u pokušaju da obiđe zabrane postavljene na vatrozidu. Budući da su potrebe korisnika kod pronalaženja hostova tako različite, Nmap nudi široki spektar opcija za prilagođavanje korištenim tehnikama. Pronalaženje hostova (engl host discovery) se ponekad naziva Ping scan, ali ide daleko dalje od običnog ICMP echo paketa povezanog sa sveprisutnim ping alatom. Korisnici mogu preskočiti dio pinganja s list skenom (-sL) ili isključivanjem pinganja (-P0) ili da pristupe mreži s kombinacijama multi port TCP SYN/ACK, UDP i ICMP sondi. Namjena tih sondi je iznuđivanje odgovora koji dokazuje da je IP adresa u stvari aktivna (korištena je od strane hosta ili mrežnog uređaja). Na većini mreža je samo jedan mali postotak IP adresa aktivan. To je pogotovo točno za mreže blagoslovljene RFC1918 dokumentom (privatni adresni prostor poput 10.0.0.0/8). Navedena mreža ima 16 miliona IP adresa, ali imao sam prilike vidjeti da je koriste firme s manje od tisuću mašina. Postupak pronalaženja hostova može pronaći koja su to računala u tom moru neaktivnih IP adresa. Ukoliko ne navedete nikakvu opciju Postupku pronalaženja hostova, Nmap šalje TCP ACK paket namjenjen portu 80 i ICMP echo zahtijev na ciljano računalo. Izuzetak od ovog pravila je taj da je ARP sken korišten za ciljana računala na lokalnoj ethernet mreži. Za neprivilegirane UNIX shell korisnike, Nmap šalje SYN paket umjesto ACK-a korištenjem connect() sistemskog poziva. To je jednako opcijama -PA -PE. Takav način pronalaženja hostova je obično dostatan kad su u pitanju lokalne mreže, ali preporučen je malo potpuniji set sondi za istraživanje kod sigurnosnog auditinga. Opcija -P* (koja odabire ping tipove) može biti kombinirana. Možete povećati šanse provaljivanja vatrozida slanjem mnogo sondi koje koriste različite TCP portove/zastavice (engl. flags) i ICMP kodove. Također imajte na umu da se po defaultu na lokalnoj mreži za otkrivanje hostova koristi ARP discovery (-PR) čak i kad navedete druge -P* opcije zbog toga jer je gotovo uvijek brži i efikasniji. Sljedeće opcije upravljaju postupkom otkrivanja hostova. -sL (List Sken) Kako je ideja samo ispisati popis ciljanih hostova, ne možete kombinirati opcije za funkcionalnosti višeg nivoa, poput skeniranja portova, detekcije OS-a, ping skeniranja isl. Ukoliko želite isključiti ping skeniranje, a ipak koristiti funkcionalnosti višeg nivoa, pročitajte opis -P0 opcije. -sP (Ping Sken) Sistemski administratori također nalaze ovu opciju poprilično korisnom. Može se koristiti za pronalaženje dostupnih računala na mreži ili koristiti kao alat za nadgledanje dostupnosti servera. Taj način primjene se naziva ping sweep i mnogo je pouzdaniji od pinganja broadcast adrese zato jer mnogi hostovi ne odgovaraju na broadcast upite. (Konkretno windows mašine ne odgovaraju na broadcast ping, ali odgovaraju na druge tipove broadcast paketa). Po defaultu -sP opcija šalje ICMP echo i TCP paket na port 80. Kad je pokrenuta od strane neprivilegiranog korisnika (korisnika koji nije lokalni administrator), poslan je SYN paket na port 80 (korištenjem API poziva connect() ). Kad privilegirani korisnik pokušava skenirati hostve na lokalnoj mreži, koriste se ARP zahtjevi (-PR) osim ako nije specificirana opcija --send_ip. Opciju -sP možete kombinirati s bilo kojim tipom otkrivajućih (discovery) tipova skeniranja (sve -P* opcije osim -P0 opcije) kako bi postigli veću fleksibilnost. Ukoliko se koristi bilo koji od tih tipova skeniranja i port broj, automatski su defaultne postavke skeniranja premošćene (ACK i echo zahtjevi). Ukoliko su između hosta na kojem je pokrenut Nmap i ciljanog hosta nalaze vatrozidi, preporuka je koristiti upravo te tehnike kako vatrozid ne bi filtrirao upite ili odgovore na njih. -P0 (Bez pinganja) -PS [lista_portova] (TCP SYN Ping) SYN flag u paketu kaže ciljanom hostu da se želite spojiti na navedeni port/portove. Ukoliko je port zatvoren, odgovor koji će Nmap dobiti od ciljanog hosta je RST (reset). Ukoliko je port otvoren, ciljano računalo će poslati SYN/ACK paket, što je drugi korak u trostrukom rukovanju TCP protokola. Računalo na kojem je pokrenut Nmap u tom trenutku prekida konekciju na način da pošalje RST paket (umjesto ACK paketa koji bi završio trostruko rukovanje i uspostavio konekciju sa ciljanim hostom). RST paket je poslao kernel računala na kojem je pokrenut Nmap, jer je dobio SYN/ACK paket koji nije očekivao. Nmap ne zanima da li je port otvoren ili zatvoren, RST ili SYN/ACK odgovor koji je dobio dovoljan su odgovor da je računalo "živo". Bez obzira na to RST odgovor znači da je računalo tu i da je "živo", dok SYN/ACK odgovor uz to znači i da računalo "sluša" na navedenom portu. Na UNIX mašinama samo privilegirani korisnik root može slati i primati sirove (RAW) TCP pakete. Za neprivilegirane korisnike napravljen je obilazni put u kojem Nmap automatski poziva connect() API na svaki navedeni port. To je postiglo efekt slanja SYN paketa na coljani host i iniciran je poušaj ostvarivanja konekcije. Ukoliko connect() API vrati brzi odgovor uspješnog spajanja ili ECONNREFUSED grešku, TCP stack na OS-u je dobio SYN/ACK ili RST od ciljanog hosta i host je označen kao dostupan. Ukoliko konekcija "visi" dok ne istekne timeout, ciljani host je označen kao nedostupan (ugašen). Navedeni obilazni put se koristi i kod IPv6 konekcija, je Nmap još nema implementiranu izradu sirovih (RAW) paketa za IPv6 protokol. -PA [lista_portova] (TCP ACK Ping) -PA opcija koristi isti defaultni port kao i SYN scan (port 80) i isto kao i SYN scan može primiti listu portova u istom formatu. Ukoliko neprivilegirani korisnik pokuša pokrenuti Nmap s ovom opcijom ili je u pitanju IPv6 TCP konekcija, koristi se obilazni put opisan u TCP SYN pingu. Ova opcija nije savršena, jer connect() u stvari šalje SYN pakete umjesto ACK paketa Razlog zašto koristiti i SYN i ACK sonde je radi povećavanja šansi za obilaženje vatrozida. Mnogi administratori konfiguriraju rutere i ostale jednostavne vatrozide na način da zaustavljaju dolazeće SYN pakete osim ako nisu namijenjeni nekim javnim servisima, poput weba ili mail servera. Takav način podešavanja uređaja sprječava nedozovljene konekcije prema računalima tvrtke, ali omogućava neograničen izlazni promet prema internetu. Ovakav pristup konekcija bez stanja (engl. stateless) oduzima malo resursa na vatrozidima/ruterima i podržan je na gotovo svim hardverskim i softverskim filterima. Netfilter/ iptables, poznati vatrozid na Linux operativnom sustavu nudi opciju --syn kako bi mogli implementirati ovakav pristup konekcija bez stanja (engl. stateless). Kod tako konfiguriranih vatrozida, sonde SYN ping (-PS) će najvjerovatnije biti blokirane kad ih pošaljete na zatvorene portove. No međutim, ACK sonde će bez problema prolaziti kroz njih. Drugi tip vatrozida podržava konekcije sa stanjem (engl. stateful) koji odbacuju sve neočekivane pakete. Ova opcija se u početku koristila samo kod naprednijih vatrozid rješenja, ali je vremenom postala rasprostranjenija. Linux vatrozid Netfilter/iptables podržava ovu opciju korištenjem opcije --state, koja kategorizira pakete vezano uz stanje konekcije. Skeniranjem takvih sustava veća je vjerovatnost da ćemo od SYN sonde dobiti nekakvu informaciju, nego od ACK, jer se ACK sonde koje nemaju uspostavljenu konekciju tretiraju kao lažne i odbačeni su bez ikakvog odgovora. U slučaju dvojbe, najbolje je poslati i SYN i ACK sonde naviođenjem opcija -PS i -PA. -PU [lista_portova] (UDP Ping) Nakon što je ciljano računalo dobilo paket na zatvoreni port, trebalo bi odgovoriti ICMP paketom " nedostupan port" (engl. port unreachable). Na osnovu toga Nmap može zaključiti da je ciljani host "živ". Drugi tipovi ICMP grešaka, poput nedostupan host/mreža ili premašen TTL (engl. TTL exceeded) nagovještavaju da je host ugašen ili nedostupan. Ukoliko nema nikakvog odgovora, Nmap također zaključi da je host ugašen/ nedostupan. Ukoliko je paket stigao na otvoreni UDP port, većina servisa će jednostavno ignorirati prazan UDP paket i Nmap neće dobiti nikakav odgovor. Zbog toga je defaultni port 32338, jer je mala mogućnost da će neki servis koristiti taj port. Postoje i neki servisi, poput chargen-a, koji će odgovoriti na prazan UDP paket i na taj način otkriti Nmapu da je host "živ". Glavna prednost ovog tipa skeniranja je da obilazi vatrozide i paket filtere koji skeniraju samo TCP promet. Npr. Linksys BEFW11S4 bežični (wireless) ruter na vanjskom mrežnom adapteru filtrira samo TCP portove, a na UDP skenove odgovara s ICMP port nedostupan. -PE; -PP; -PM (ICMP tipovi pinganja) Bez obzira na to što je echo zahtijev standardni ICMP ping upit, Nmap se nije zaustavio na tome. Ako pogledate ICMP standard (m[blue]RFC 792m[][5]) vidjet ćete da je u njemu naveden i timestamp zahtijev, information zahtijev i zahtijev za adresnom maskom i to pod kodovima 13,15 i 17. Iako je namjena tih upita saznati informacije poput adresne maske i trenutnog vremena, vrlo ih je lako iskoristiti za otkrivanje hostova. Host koji odgovori je "živ". Nmap u trenutnoj verziji ne podržava information zahtijev, jer se ne koristi često. RFC 1122 inzistira na tome da lqhost NE BI TREBAO implementirati taj ICMP tip porukarq. Upite za timestamp i adresnu masku možete poslati s -PP i -PM opcijama. Timestamp odgovor (ICMP kod 14) ili odgovor adresne maske (kod 18) otkrivaju da je ciljani host "živ". Ta dva upita su korisni u slučajevima kad administratori blokiraju echo zahtijev pakete, ali zaborave blokirati ostale ICMP pakete. -PR (ARP Ping) ARP sken zadužuje Nmap i njegove optimizirane algoritme za ARP zahtjeve i ukoliko Nmap dobije odgovor ne mora uopće pokretati IP bazirani ping, jer već zna da je računalo dostupno. Ovo čini ARP scan mnogo bržim i pouzdanijim od IP baziranog skena, pa se defaultno koristi kod skeniranje hostova na ethernetu za koje Nmap zaključi da su na lokalnoj mreži. Čak ako ste i naveli neke druge tipove pinga, (poput -PE ili -PS), Nmap će koristiti ARP sken za sve hostove koji su na istoj mreži. Ukoliko ne želite koristiti ARP sken, navedite opciju --send-ip. -n (Bez DNS rezolucije) -R (DNS rezolucija za sva ciljana računala) --system_dns (Koristi sistemski DNS rezolver) --dns_servers   (Serveri koji će se koristiti za obrnute DNS upite) Bez obzira na to što je vremenom Nmap porastao gledano s funkcionalne strane, počeo je kao efikasan port skener, te mu to i dalje ostaje osnovna namjena. Jednostavna naredba nmap ciljani host skenira više od 1660 TCP portova na navedenom računalu. Iako je većina port skenera grupirala portove u otvorene ili zatvorene, Nmap ima granularniji pristup, te dijeli portove na: otvorene, zatvorene, filtrirane, nefiltriran, otvorene|filtrirane i zatvorene|filtrirane. Gore navedena stanja ne potiču od stvarnih stanja portova, već su opis onoga što Nmap u stvari vidi. Npr., ukoliko Nmap-om skenirate neku mrežu, dok ste fizički spojeni na nju, Nmap bi mogao reći da je port 135 otvoren, dok bi isti taj sken u slučaju da tu istu mrežu skenirate s interneta, najvjerovatnije rekao da je port filtriran (nalazi se iza vatrozida ili paket filtera). Šest stanja portova kako ih Nmap prepoznaje otvoren zatvoren filtriran nefiltriran otvoren|filtriran zatvoren|filtriran Kako nisam previše vičan popravcima na automobilu, mogu potrošiti sate i sate samo da nađem odgovarajući alat (poput čekića, ljpljive trake, ključa isl.). Nakon što odustanem od smješnih pokušaja da nešto popravim i odvezem auto kod stvarnog mehaničara, začuđen sam kako jednostavno i nadasve uspješno izvadi iz velike kutije s alatatom baš onaj koji je potreban za uspješan popravak. Umjestnost skeniranja portova je slična. Stručnjak razumije mnoštvo tehnika skeniranja i odabere baš onu (ili kombinaciju više tehnika) koja je odgovarajuća za određeni posao. Neiskusni korisnisi i script kiddies (osobe koje koriste skripte koje je napisao netko drugi ne razumijevajući što i kako te skripte rade), pokušavaju sve riješiti defaultnim SYN skanom. Kako je Nmap besplatan program, jedina prepreka između Vas i masteriranja port skeninga je znanje. To je definitivno suprotno od automehaničarskog posla, u kojem recimo mož ete znati da Vam treba zračni kompresor, ali to ne umanjuje činjenicu da ga trebate i kupiti. Većina tipova skeniranja koje nmap podržava dostupni su privilegiranim korisnicima (morate biti ulogirani kao administrator). To je zbog toga jer šalju sirove (RAW) pakete koji zahtjevaju root pristup u UNIX svijetu. Korištenje administratorskog korisničkog accounta je preporučeno na windows operativnim sustavima, mada Nmap ponekad radi i s neprivilegiranim korisnicima, ako je WinPCap prethodno instaliran na sustav i aktivan. Zahtjev za root privilegijama je bila ozbiljna prepreka kad je Nmap prvi put pušten u javnost 1997. godine, jer je većina korisnika imala pristup dijeljenim shell accountima. Sada je svijet drugačiji. Kompjutori su jeftiniji, veći broj ljudi ima stalni pristup internetu, a desktop UNIX sustavi su dominantni (uključujući linux i MAC OS X). Windows verzija Nmap-a je također dostupna, te je samim tim i Nmap dostupniji većem broju korisnika. Zbog svih tih razloga, sve je manja potreba korisnika da pokreću Nmap logirani sa dijeljenim shell accountima. To je naravno super stvarm jer je Nmap pokrenut pod accountom privilegiranog korisnika mnogo moćniji i fleksibilniji. Iako Nmap pokušava reproducirati ispravan rezultat svojih skenova, imajte na umu da su sve unutrašnje komponente Nmap-a bazirane na paketima vraćenim od ciljanih računala (ili firewall uređaja ispred njih). Neki hostovi mogu biti nepouzdani i podešeni na način da vrate pakete koji će zavarati Nmap i dati krivi rezultat. Još češći su hostovi koji ne podržavaju RFC standard, te ne odgovaraju onako kako Nmap očekuje od njih. FIN, Null i Xmas skenovi su pogotovo podložni tim problemima. Problemi poput gore navedenih su specifični za pojedine tipove skeniranja i o tome se raspravlja u svakoj od tih tehnika skeniranja. Ovo poglavlje dokumentira hrpu tehnika skeniranja portova koje podržava Nmap. Samo jedna od spomenutih metoda može biti korištena u jednom trenutku, osim UDP skena (-sU) koji može biti kombiniran s bilo kojom od TCP sken matoda. Radi lakšeg pamćenja, opcije skeniranja portova su u obliku -sC, gdje je C vidljiv iz samog naziva sken tipa i obično je to prvo slovo. Jedini izuzetak je FTP bounce scan (-b). Defaultno, Nmap radi SYN scan iako će ga zamijeniti s Connect() skenom, ako korisnik nema odgovarajuće ovlasti slanja raw paketa (root pristup na UNIX sustavima) ili ako je specificirana IPv6 kao ciljana IP adresa. Od svih navedenih tipova skenova u ovom poglavlju, neprivilegirani korisnik može pokrenuti samo Connect() i FTP bounce scan. -sS (TCP SYN scan) Tehnika SYN scana se najčešće naziva poluotvoreno skeniranje, jer nikad ne uspostavite potpunu TCP konekciju. Naime, pošaljete SYN paket, kao što bi ga poslali u slučaju da želite uspostaviti stvarnu TCP konekciju i čekate na odgovor. Ako kao odgovor dobijete SYN/ACK, znači da postoji aplikacija koja sluša na tom portu (port je otvoren), dok RST (reset) znači da ne postoji aplikacija koja sluša na tom portu (port je zatvoren). Ukoliko i nakon nekoliko ponovnih slanja upita nema nikakvog odgovorar, port je okarakteriziran kao filtriran. Port je također označen kao filtriran ako kao odgovor dođe ICMP unreachable error (ICMP nedostupan - tip 3, kodovi 1, 2, 3, 9, 10 ili 13). -sT (TCP connect() scan) Ukoliko je SYN scan dostupan, obično je i bolji odabir. Naime, Nmap ima puno manje kontrole nad connect() API pozivom, nego nad raw paketima, te je samim tim Nap manje efikasan. Sistemski poziv napravi potpunu konekciju na otvorene portove ciljanog računala umjesto da napravi reset kao što je slučaj kod SYN skena. Tim postupkom ne samo da gubimo više vremena kako bi saznali da li su portovi otvoreni ili ne, nego postoji i veća vjerovatnost dsa će host zapisati u log pokušaj spajanja. Činjenica je da će svaki IDS sustav logirati i SYN i Connect scan, ali isto tako je činjenica da većina računala nema IDS sustav. Većina servisa na UNIX-oidima će dodati zapis u syslog i (ponekad) kriptičnu poruku o grešci, kad se Nmap spoji i odmah odspoji bez slanja podataka. Jadno napisani servisi se skrše kad se to dogodi, mada je to stvarno rijetkost. Administrator koji vidi hrpu pokušaja spajanja u logovima koji su svi inicirani s jednog hosta, odmah će znati da je netko skenirao portove Connect() metodom. -sU (UDP skenovi) UDP scan aktivirate naredbom -sU. Može biti kombinirana s TCP skenom poput SYN skena ( -sS), kako bi oba protokola bili provjereni "jednim udarcem". UDP scan radi na način da pošalje prazan UDP header (bez podataka) na svaki ciljani port. Ukoliko je vraćen ICMP port unreachable (ICMP nedostupan port) i to tip 3 kod 3, onda je port zatvoren. Druge ICMP greške (tip 3, kodovi 1, 2, 9, 10 ili 13) označavaju port kao filtriran.Povremeno će servis odgovriti s UDP paketom, dokazujući da je port otvoren. Ukoliko nakon nekoliko retransmisija nema nikakvog odgovora, port je okarakteriziran kao otvoren|filtriran. To znači da bi port mogao biti otvoren ili možda paket filteri blokiraju promet prema njemu. Version scan (-sV) može pomoći da se ustanovi koji portovi su stvarno otvoreni, a koji su filtrirani. Veliki izaziv kod skeniranja UDP portova je napraviti ti brzo. Otvoreni i filtrirani portovi rijetko pošalju ikakav odgovor, ostavljajući Nmap da napravi time out, te nakon toga ponovno pošalje paket u slučaju da je prethodni iz bilo kojeg razloga bio izgubljen. Zatvoreni portovi su često još veći problem. Oni najčešće pošalju kao odgovor ICMP port unreacheble grešku. No, za razliku od RST paketa koje pošalju zatvoreni portovi na TCP protokolu kao odgovr na SYN ili Connect() scan, mnogi hostovi ograničavaju ICMP port urnreachable poruku po defaultu. Linnux i Solaris su jako striktni vezano za to. Tako npr. Linux 2.4.20 kernel ograničava destination unreachable poruku na jednu po sekundi (u net/ipv4/icmp.c biblioteci).. Nmap pokušava ustanoviti da li je to slučaj i smanjuje brzinu skeniranja veano uz to, kako bi spriječio zaguš ivanje nekorisnim paketima koje će ciljano računalo tako i tako tiho odbaciti. Nažalost, spomenuti limit koji je postavljen kod linuxa, znači da će skeniranje svih 65536 portova trajati više od 18 sati. Ideja ubrzavanja UDP skena je da se paralelno skenira više hostova, na način da se najprije skleniraju najpopularniji portovi na brz način, skenirajući iza firewall-a i koristeći --host-timeout kako bi se izbjegli spori hostovi. -sN; -sF; -sX (TCP Null, FIN i Xmas skenovi) Kod skeniranja sistema koji su kompatibilni s tim RFC tekstom, svaki paket koji u sebi ima upaljene bitove SYN, RST ili ACK rezzultirat će vraćenim RST paketom ako je port zatvoren, a neće dati nikakav odgovor, ako je port otvoren. Dok god nije upaljen niti jedan od tih bitova, bilo koja kombinacija druga tri bita (FIN, PSH i URG) je u redu. Nmap to iskorištava s tri dolje navedena tipa skeniranja: Null scan (-sN) FIN scan (-sF) Xmas scan (-sX) Sva tri tipa skeniranja su potpuno ista što se ponašanja tiče, samo što su im upaljene različite TCP oznake u paketima. Ukoliko je kao odgovor dobiven RST paket, port se smatra zatvorenim, dok situacija u kojoj nema odgovora, smatra da je port otvoren|filtriran. Port je označen kao filtriran, ako je odgovor na scan ICMP unreachable greška (tip 3, kodovi 1, 2, 3, 9, 10 ili 13). Glavna prednost ovih tipova skeniranja je ta da mogu "proviriti" kroz neke ne stateful firewall uređaje i paket filtering rutere. Druga prednost im je ta da su još više nevidljivi od SYN skena. No, nemojte se u to pouzdavati, jer većina modernih IDS sustava može biti konfigurirana da ih prepozna. Veliki nedostatak je da ne podržavaju svi sistemi RFC 793 do zadnjeg slova, pa tako većina sustava odgovara RST paketom bez obzira na to da li je port otvoren ili nije. Kod takvih sustava su svi portovi koje Nmap skenira okarakterizirani kao zatvoreni. Većina operativnih sustava koji se tako ponašaju su Microsoft Windows, većina Cisco uređaja, BSDI i IBM OS/400. No, ovaj tip skeniranja radi na većini UNIX sustava. Dodatan nedostatak ovih tipova skenova je taj što ne mogu razlikovati otvorene portove od nekih filtriranih, te kao odgovor dobijete otvoren|filtriran, pa si vi mislite... -sA (TCP ACK scan) Kad je u pitanju ACK scan, onda je upaljena samo ACK zastavica (flag) (osim ako koristite --scanflags ). Kad skenirate nefiltrirane hostove, otvoreni i zatvoreni portovi će vratiti RST paket. Nmap ih u tom slučaju označi kao nefiltrirane, što znači da su dostupni ACK paketima, ali nije definirano da li su otvoreni ili zatvoreni. Portovi koji ne odgovaraju na upite ili pošalju određene ICMP greške (tip 3, kod 1, 2, 3, 9, 10 ili 13) su označeni kao filtrirani. -sW (TCP Window scan) Ovaj način skeniranja se pouzdaje u implementacijske detalje nekih operativnih sustava, tako da mu ne morate uvijek vjerovati. Sistemi koji su "otporni" na ovaj način skeniranja obično će vratiti sve portove kao zatvorene. Naravno isto tako je moguće da računal stvarno nema otovrenih portova. Ukoliko je većina portova zatvorena, ali ima onih koji su označeni kao filtrirani, (npr. češće korišteni portovi poput 22, 25, 53) , sustav je podložan ovom načinu skeniranja i rezultat je najvjerovatnije ispravan. Ukoliko pokrenete sken koji vam vrati 1000 zatvorenih portova i 3 otvorena ili filtrirana porta, najvjerovatnije su ta 3 porta uistinu i otvorena. -sM (TCP Maimon scan) --scanflags (Custom TCP scan) --scanflags argument može biti brojčana vrijednost poput 9 (PSH i FIN), ali korištenje simboličnih imena je jednostavnije. Jednostavno izmješajte zajedno bilo koju kombinaciju zastavica (flagova) URG, ACK, PSH, RST, SYN i FIN. Npr. --scanflags URGACKPSHRSTSYNFIN postavlja sve zastavice, ali nije pretjerano koristan za skeniranje. Redosljed navođenja zastavica je nebitan. Uz navođenje željenih zastavica, možete navesti i bazni TCP tip skeniranja (poput -sA ili -sF), što će objasniti Nmap-u kako da interpretira odgovore. Npr. SYN scan tretira paket na koji nije dobio odgovor kao filtriran port, dok ga FIN scan tretira kao otvoren|filtriran. Nmap će se ponašati isto kao što se ponaša kod specificiranog baznog skena, osim što će koristiti zastavice koje ste naveli. Ukoliko ne navedete bazni tip skeniranja, koristit će se SYN scan. -sI   (Idlescan) Osim što je nevjerovatno nevidljiv (zbog načina na koji radi) ovaj tip skeniranja omogućava mapiranje IP baziranih pravila između računala. Ispis portova pokazuje otvorene portove kako ih vidi zombi računalo. Dakle, možete koristiti više zombie računala za skeniranje ciljanog računala. Možete staviti dvotočku i broj porta iza nje, kako bi na tom portu provjerili da li su IPID promjene predvidljive. Ukoliko to ne navedete, Nmap će koristiti standardni port za TCP pinganje (80). -sO (IP protocol scan) Osim što je koristan sam po sebi, protokol scan pokazuje i snagu open source softvera. Iako je temeljna metoda vrlo jednostavna, nisam je mislio uključiti u Nmap, niti sam dobio zahtjev za tom funkcionalnošću, sve dok u ljeto 2000, Gerhard Rieger nije razvio ideju, napisao izvanredan patch koji to implementira u Nmap i posalo na nmap-hakers listu. Uključio sam taj patch u Nmap i pustio novu verziju već drugi dan. Jako malo komercijalnog softvera ima korisnike koji su toliki entuzijasti da bi razvili vlastita poboljšanja za pojedine produkte! Protokol scan radi vrlo slično kao i UDP scan. Umjesto da prolazi kroz brojeve portova UDP paketa, šalje IP pakete i prolazi kroz 8 bitnio polje samog IP protokola. Headeri (zaglavlja) su obično prazni i ne sadrže nikakve podatke, pa čak niti ispravni header za određeni protokol. Izuzeci od tog pravila su TCP, UDP i ICMP protokol. Za te protokole je uključen ispravan protokol header (zaglavlje), jer neki sustavi u suprotonom ne žele poslati paket, tako da Nmap već ima funkcije za kreiranje ispravnih headera. Umjesto da čeka ICMP unreachable poruku, protokol scan traži ICMP protoKol unreachable poruku. Ukoliko Nmap dobije bilo kakav odgovor u bilo kojem protokolu od ciljanog računala, Nmap označi taj protokol kao oOtvoren. ICMP protocol unreachable greška (tip 3, kod 2) označi protokol kao Zatvoren. Sve ostale ICMP poruke (tip 3, kod 1, 3, 9, 10 i 13) označe protokol kao filtriran (iako je to istovremeno dokaz da je ICMP protokol otvoren). Ukoliko ne dođe nikakav odgovor nakon ponovnih pokušaja slanja, protokol je označen kao otvoren|filtriran. -b   (FTP bounce scan) 1997., kad je Nmap lansiran, ova ranjivost je bila široko rasprostranjena, ali do sad je uglavnom "pokrpana" na većini računala. Ipak, još uvijek postoji ranjivi serveri, pa nije loše pokušati i ovu opciju kad sve oostale zataje. Ukoliko je obilaženje vatrozida vaš cilj, skenirajte ciljanu mrežu za otvorenim portom 21 (ili bilo koji ftp servis, ako skenirate sve portove s otkrivanjem verzije programa - version detection), te nakon toga pokušajte ftp bounce scan. Nmap će vam reći da li je host ranjiv ili nije. Ukoliko samo pokušavate sakriti tragove, ne biste trebali (u stvari ne biste smjeli) skenirati samo hostove na ciljanoj mreži. No, prije nego nasumično počnete skenirati za ranjivim ftp serverima na internetu, imajte na umu da većina sysadmina neće cijeniti što im "iskorištavate" servere na taj način Uz sve do sad nabrojane metode skeniranja, Nmap nudi opcije pomoću kojih možete specificirati koje portove želite skenirati, da li će skeniranje portova biti nasumično ili sekvencionalno. Defaultno Nmap skenira sve portove od 0 do 1024 (uključujući i njih) kao i sve portove iznad 1024 koji su navedeni u nmap-services datoteci. -p   (Skeniraj samo navedene portove) Kad skenirate i TCP i UDP portove zajedno, možete navesti identifikator protokola na način da prije brojeva portova stavite identifikator T: za TCP porove ili U: za UDP portove. Parametar vrijedi sve dok ne navedete neki drugi. Na taj bi način skenirali UDP portove 53, 111 i 137, kao i TCP portove 21-25, 80, 139 i 8080. Imajte na umu da morate navesti parametar -sU i bar jedan TCP tip skeniranja (kao npr. -sS, -sF ili -sT) kako bi mogli istovremeno skenirati i TCP i UDP portove. Ukoliko niste naveli identifikator protokola, navedeni portovi će biti skenirani i po TCP i po UDP protokolu. -F (brzi scan (s ograničenim portovima)) -r (Ne miješaj portove) Skenirajte neko računalo pomoću Nmap-a i mogao bi vam reći da su portovi 25/tcp, 80/tcp i 53/tcp otvoreni. Koristeći nmap-services bazu podataka u kojoj se nalazi preko 2200 poznatih servisa, Nmap će vam reći da su na navedenim portzovima najvjerovatnije mail server (SMTP), web server (HTTP) i name server (DNS). To je u većini slučajeva ispravno, većina servera koji slušaju na portu 25 su uistinu mail serveri, ali nemojte biti 100% sigurni u to, jer postoje ljudi koji pokreću servise na "čudnim" portovima. Ako je Nmap ipak u pravu i server o kojem je riječ ima pokrenut SMTP, HTTP i DNS server, to ipak nije pretjerano mnogo informacija. Ukoiko radite pregled ranjivosti (vulnerability assessment) ili samo jednostavan inventar mrež nih servisa na računalima u firmi, činjenica je da trebate mnogo više informacija od gore navedenih. Želite znati koje verzije mail, HTTP i DNS servera su pokrenute na tom računalu. Kad imate "pri ruci" ispravnu verziju serverske komponente nije teško ustanoviti koje ranjivosti dotični server ima. Otkrivanje verzije vam pomaže u dobivanju tih informacija. Nakon što ste otkrili koji TCP i/ili UDP portovi su otvoreni korištenjem neke od do sad opisanih tehnika, otkrivanje verzije ispituje te portove ne bi li otkrilo što je u stvari na tim portovima, tj. koja aplikacija je otvorila dotičpne portove. nmap-service-probes baza podataka sadži upite za ispitivanje raznih servisa i prepoznavanje na osnovu odgovora koje dobije. Nmap pokušava ustanoviti protokol na kojem radi servis (npr. ftp, ssh, telnet, http), naziv aplikacije (npr. ISC Bind, Apache, httpd, Solaris telnetd) , verziju, naziv hosta, tip uređaja (npr. printer, ruter), porodicu iz koje dolazi OS (npr. Windows, Linux) i ponekad neke detalje poput toga da li je otvoren X server, verziju protokola koju koristi SSH ili KaZaA korisničko ime. Naravno, većina servisa ne daje sve te informacije. Ukoliko je Nmap kompajliran s podrškom za OpenSSL protokol, spojit će se na SSL servere kako bi ustanovio servise koji se nalaze iznad enkripcijskog sloja. Ako su otkriveni RPC servisi, Nmap RCP istraživač (-sR) je automatski uključen kako bi otkrio koji program se nalazi iz RPC-a i koja mu je verzija. Neki UDP portovi su označeni s otvoren|filtriran, ako UDP scan nije mogao odrediti da li je port otvoren ili filtriran. Otkrivanje verzije će pokušati dobiti odgovor s tih portova (isto kao što to radi i kod otvorenih portova), te će promijeniti njihovo stanje u otvoren ako uspije dobiti odgovor. TCP portovi koji su okarakterizirani kao otvoreni|filtrirani, tretirani su na isti način. Imajte na umu da opcija -A omogućije otkrivanje verzije uz ostale stvari koje podržava. Dokument koji objašnjava rad, korištenje i mijenjanje ovog dijela programa je dostupan na linku: m[blue]http://www.insecure.org/nmap/vscan/m[]. Kad Nmap dobije odgovr od servisa, a ne može ga usporediti s ni jednim zapisom u svojoj bazi podataka, ispisat će scepijalni "fingerprint" i URL linka na koji ga možete poslati ukoliko ste sigurni u to što se nalazi na tom portu. Molim vas da odvojite nekoliko minuta svog vremena kako bi poslali te informacije, jer će kasnije nekom drugom biti od velike koristi. Zahvaljujući upravo takvom načinu prikupljanaj informacija, Nmap ima preko 3000 zapisa koji odgovaraju (prepoznavaju) preko 350 protokola, poput smtp-a, ftp-a, http-a, itd.. Otkrivanje verzije se uključuje i njime se upravlja korištenjem sljedećih opcija: -sV (Otkrivanje verzije) --allports (koristi sve portove u otkrivanju verzije servisa) --version-intensity   (podesite intenzitet otkrivanja verzije servisa) --version-light (omogući "lagani" mod) --version-all (isprobaj sve upite) --version-trace (prati sve što se događa tijekom skena) -sR (RPC scan) Jedna od najpoznatijih odlika Nmapa je otkrivanje OS-a na ciljanom računalu korištenjem TCP/IP stack otiska (engl. fingerprint). Nmap šalje mnoštvo TCP i UDP paketa na udaljeno računalo i istražuje svaki bit vraćenih paketa. Nakon što je učinio hrpu testova poput TCP ISN sampling, podrška i redosljed TCP opcija, IPID sampling i provjeru veličine inicijalnog TCP prozora, Nmap uspoređuje rezultate s nmap-os-fingerprints bazom podataka s više od 1500 poznatih OS otisaka (engl fingerprint), te ispiše detalje o OS-u ukoliko ga je uspio "pogoditi". Svaki otisak sadrži neformatirani tekstualni opis OS-a i klasifikaciju u koju ulazi naziv izdavača (npr. Sun), OS (npr. Solaris), generacija OS-a (npr. 10) i tip uređaja (općenite namjene, ruter, switch, igraća konzola isl.). Ukoliko Nmap nije u stanju odrediti koji OS je pokrenut na ciljanom računalu, a uvjeti su dobri (npr. postoji barem jedan otvoreni port na računalu), Nmap će vam ponuditi URL link preko kojeg možete poslati otisak ukoliko ste sigurni u to koji OS se nalazi na tom računalu. Na taj način pomažete u nastojanjima da Nmap nauči raspoznati što je moguće više sistema i samim tim postane precizniji u pogađanju. Otkrivanje OS-a omogućava još neke dodatne testove koji koriste informacije prikupljene tijekom procesa pogađanja. Jedan od tih dodatnih testova je i vrijeme od kad je upaljeno računalo (uptime), koji koristi TCP timestamp opciju (RFC 1323) kako bi pogodio kad je računalo zadnji put resetirano.To je prikazano samo za ona računala koja daju tu informaciju. Drugi test je predvidljivost TCP sekvenci. Taj test mjeri koliko je teško uspostaviti lažiranu TCP vezu s udaljenim računalom. To je korisno ukoliko želite iskoristiti povjerenje bazirano na ishodišnoj IP adresi (recimo kod rlogin-a, vatrozida, filtera itd.) ili u situacijama kada želite sakriti svoje tragove. Ovaj način prikrivanja se danas rijetko koristi, no još uvijek postoji velika količina računala koja su ranjiva. Stvarni broj "težine" je baziran na statističkom skupljanju podataka i varira. Obično je bolje koristiti klasifikaciju poput lqpopriličan izazovrq i lqtoliko jednostavno da je smiješnorq . Ovakakv način izvještavanja dobit ćete u normalnom ispisu kad uključite verbose opciju (-v). Kad je verbose opcija uključena zajedno s -O, onda kao rezultat dobijete i izvještaj generiranja IPID sekvence. Većina računala je u tzv. lqinkrementalnojrq klasi, što znači da sa svakim poslanim paketom uvećaju ID polje IP zaglavlja. To ih čini ranjivima na nekoliko naprednih načina sakupljanja informacija i napade zavaravanja (engl. spoofing). Dokument u kojem je opisano kako radi, kako se koristi i kako se može prilagoditi otkrivanje verzije, dostupan je u podosta jezika na linku: m[blue]http://www.insecure.org/nmap/osdetect/m[]. Otkrivanje OS-a se uključuje i upravlja sa sljedećim opcijama -O (Uključi otkrivanje OS-a) --osscan-limit (ograniči otkrivanje OS-a samo na ciljeve koji obećavaju) --osscan-guess; --fuzzy (probaj pogoditi OS na osnovu rezultata) Jedan od najviših prioriteta tijekom razvijanja Nmap-a su performase. Defaultni scan (nmaphostname) nekog računala na lokalnoj mreži traje petinu sekunde. To je manje od vremena koje vam je potrebno za treptaj oka, ali naravno kad skenirate 10 ili 100 tisuća hostova postane osjetno. Uz to, neki tipovi skenova, poput UDP skeniranja i otkrivanja verzijemogu to vrijeme poprilično produžiti. Isto tako skeniranje mogu usporiti i neke konfiguracije vatrozida, pogptovo limitiranje količine odgovora u jedinici vremena.Iako Nmap koristi paralalno izvršavanje skenova kako bi ih dodatno ubrzao, sam korisnik ima potpunu kontrolu nad time. Napredni korisnici pažljivo kombiniraju Nmap naredbe kako bi dobili samo informacije koje im trebaju poštivajući vremenske termine koje su si zadali. Tehnike za ubrzavanje skeniranja sastoje se od toga da izbacite nepotrebne testove i naravno da nadogradite Nmap na posljednju verziju (poboljšanja performansi se konstantno rade). Optimiziranje vremena odziva (engl. Timing) takođem može utjecati na brzinu skeniranja. Opcije slijede: --min-hostgroup  ; --max-hostgroup   (Podešava veličinu grupe paralelnih skenova) Defaultno Nmap radi kompromis. Počinje s grupom od 5 hostova, tako da se prvi rezultati brzo pojave na ekranu, a nakon toga poveća veličinu grupe na 1024. Točan broj ovisi o uključenim opcijama. Zbog povećane efikasnosti Nmap koristi veće grupe za UDP skenove, a manje za TCP skenove. Kad definirate maksimalnu veličinu grupe pomoću opcije --max-hostgroup, Nmap je neće nikad premašiti. Ukoliko pak specificirate minimalnu veličinu grupe s --min-hostgroup, Nmap će pokušati zadržati veličinu grupe iznad tog nivoa. Naravno, ukoliko broj hostova koji su ostali za skeniranje bude manji od minimalne grupa Nmap će normalno odraditi svoj posao. Obje opcije možete koristiti istovremeno kako bi veličinu grupe zadržali u željenim okvirima, ali to je rijetko potrebno. Primarna upotrenba ovih opcija je navođenje što veće minimalne veličine grupe kako bi skenovi brže odradili svoj posao. Najčeđći odabir je 256, kako bi skeniranje mreže išlo u odsječcima C klase. Za skenove u kojima se skenira mnogo portova, povećanje tog broja iznad 256 će rijetko pomoći. Ukoliko pak skenirate samo nekoliko portova, veličina grupe od 2048 ili više, može biti od pomoći. --min-parallelism  ; --max-parallelism   (Podesi paralelizam) Najčešći način upotrebe je da se podesi --min-parallelism na broj veći od 1 kako bi se ubrzalo skeniranje sporijih hostova i mreža. To je ujedno i riskantna opcija, jer ako podesite prevelik broj, utjecat ćete na točnost skena. Isto tako, ukolik opodesite ovu opciju, sprječavate Nmap da dinamički upravlja paralelizmom vezano uz stvarne uvjete na mreži. Broj 10 ima smisla, ali osobno podešavam tu vrijednost kad nemam ništa drugo na rapolaganju. Opcija --max-parallelism stavite na 1 ukoliko želite spriječiti Nmap da koristi paralelizam, tj. želite da šalje samo jednu po jednu sondu.To može biti korisno u kombinaciji s opcijom --scan-delay (objasnit ćemo je kasnije), mada ta opcija sama po sebi služi svrsi dovoljno dobro. --min_rtt_timeout  , --max-rtt-timeout  , --initial-rtt-timeout   (Podesi vrijeme trajanja sondi) Ove opcije primaju vrijednost u milisekundama, ali vi možete navesti vrijeme u sekundama, minutama ili satima na način da stavite opciju s, m ili h. Navođenje nižeg --max-rtt-timeout i --initial-rtt-timeout od defaultnog može osjetno skratiti vrijeme potrebno za skeniranje. To je posebno vidljivo kod (-P0) skenova i skenova prema jako filtriranim mrežama. Ipak, nemojte biti preagresivni, jer vam u tom slučaju skeniranje može i dulje potrajati, jer će Nmap ponovno slati sonde, a odgovr na prethodne je možda na putu nazad. Ukoliko su svi hostovi na lokalnoj mreži, 100ms je razumna vrijednost za --max-rtt-timeout _timeout. Ukoliko postoje ruteri između Nmapa i hostova, najprije pingajte hosta s ICMP ping alatom ili s naprednijim alatom poput Hping2 koji ima veće mogućnosti proći kroz vatrozid. Pogledajte koja je srednja vrijednost vremena portebnog da se paket vrati za 10-tak paketa. Tu vrijednost pomnožite s 2 za --initial-rtt-timeout i s 3 ili 4 za --max-rtt-timeout. Osobno ne postavljam maksimalni rtt ispod 100ms, bez obzira na vrijednosti koje dobijem pinganjem, niti stavljam više od 1000ms. --min-rtt-timeout je rijetko korištena opcija koja može biti korisna kod jako nepouzdanih mrež a na kojima su čak i Nmap-ove defaultne postavke preagresivne. Kako Nmap spušta vrijeme isteka na minimum tek kad zaključi da je mreža pouzdana, ovo bi trebalo prijeviti kao bug na nmap-dev mailing listu. --max-retries   (Navedi maksimalni broj ponovnih slanja sondi) Defaultna postavka (bez -T predloška) je 10 ponovnih slanja. Ukoliko se mreža pokaže pouzdanom i ciljani hostovi ne ograničavaju skeniranje, Nmap će napraviti samo jedno ponovno slanje. Gledano iz tog kuta, na većinu ciljanih računala ne utječe ako stavite --max-retries na nizak broj poput 3. To je vrijednost koja može mnogostruko ubrzati skeniranje sporih hostova (onih koji ne dozvoljavaju mnogo port skenova s jedne IP adrese, nego ih jednostavno blokiraju). Istina je da obično izgubite neke informacija ako Nmap prerano odustane od hosta, ali i to je bolje nego ostaviti --host-timeout da istekne i izgibiti sve informacije o ciljanom hostu. --host-timeout   (odustani od skeniranja sporih hostova) --scan-delay  ; --max_scan-delay   (podesi stanke između sondi) Kad Nmap podesi sken shodno tome, dolazi do dramatičnog usporavanja. --max_scan-delay opcija definira najveće kašnjanje koje će Nmap dozvoliti. Ukoliko podesite ovu opciju na premalu vrijednost, doći će do uzaludnog (prečestog) slanja paketa i samim tim promašenih otvorenih portova ako ciljani host ima uključen lq rate limitingrq. Još jedno način korištenja opcije --scan-delay je da se izbjegnu intrusion detection i intrusion prevention (IDS/IPS) sustavi, koji su bazirani na zadanoj vrijednosti (engl. treshold). -T   (Podesite predložak za vremenske postavke) Navedeni predlošci omogućavaju korisnicima da navedu koliko agresivni žele biti, ostavljajući Nmap-u da odabere točne vrijednosti. Predlošci također rade neka manja podešavanja brzine za koja trenutno ne postoje drugi načini. Npr. -T4 sprječava da dinamičko kašnjenje skeniranja prijeđe 10ms za TCP portove, dok -T5 drži tu vrijednost na 5ms. Predlođke možete kombinirati s finijim kontrolama, sve dok je template naveden prvi inače će vrijednosti iz predloška nadjačati one koje ste naveli. Predlažem korisštenje opcije -T4 kod skeniranja modernih i pouzdanih mreža. Ostavite tu opciju na početku komandne linije čak i kad koristite neke finije naredbe kako bi imali koristi od dodatnih optimizacija koje predložak donosi. Ukoliko ste na pristojnoj broadband ili eternet konekciji, predlažem korištenje opcije -T4. Neki ljudi vole -T5, mada je preagresoivan za moj ukus. Isto tako ljudi ponekad stave -T2 misleći da je manja vjerovatnost da će tako srušiti host ili se inače smatraju pristojnima. No oni u stvari ne razumiju koliko je opcije -T pristojno u stvari spora. Ovaj način skeniranja može potrajati i do 10 puta duže nego defaultni.Padovi računala i problemi s bandwithom su rijetki s korištenjem defaultne opcije -T3, pa je normalno preporučam opreznim skenerima.Izbjegavanje otkrivanja verzije je u svakom slučaju efikasnije u pokušaju rješevanja tih problema nego igranje s vremenima odaziva. Iako su opcije -T0 i -T1 korisne u izbjegavanju otkrivanja od strane IDS sustava, skeniranje tisuću portova će trajati jaaaako dugo. Kod takcih skenova je možda bolje direktno navesti vremena odaziva nego se pouzdati u preddefinirane vrijednosti opcija -T0 i -T1. Glavni efekt korištenja opcije T0 je taj da su skenovi serijski (skenira se port po port) i nakon odskeniranog porta čeka 5 minuta prije nego će poslati iduću sondu.T1 i T2 su slični s tim da T1 čeka 15 sekundi između sondi, dok T2 čeka 0.4 sekunde između sondi. T3 je defaultna postavka koja uključuje paralilizam (skenirano je više portova istovremeno). Opcije T3 je isto kao i --max-rtt-timeout 1250 --initial-rtt-timeout 500 --max-retries 6, te podešava maksimalno TCP kašnjenje na 10ms. Opcija T5 je isto kao i --max-rtt-timeout 300 --min_rtt_timeout 50 --initial-rtt-timeout 250 --max-retries 2 --host-timeout 900000 kao i postavljanje maksimalnog TCP sken kaš njenja na 5ms. Mnogo pionira interneta zu zamislili globalnu otvorenu mrežu univerzalnog adresnog prostora u kojoj je dozvoljeno spajanje bilo koja dva čvora. To bi omogućilo hostovima da šalju i primaju informacije jedan od drugog. Ljudi bi mogli pristupiti svim svojim sustavima s posla i mijenjati postavke grijanja i hlađenja, pa čak i otključavati vrata gostima koji su uranili.Ta verzija univerzalne povezanosti je ugušena nedovoljnim adresnim prostorom i ponajviše iz sigurnosnih razloga. U ranim 90-tima, firme su počele uvoditi vatrozide s primarnom namjenom da smanje mogućnosti povezivanja koje su postojale. Ogromne mreže su ofgrađene od nefiltriranog interneta korištenjem aplikacijskih proxy-a, NAT uređajai paket filtera. Otvoreno kolanje informacija predalo je tron kontroliranim komunikacijskim kanalima i sadržajem koji je njima prolazio. Mrežne barijere poput vatrozida mogu otežati mapiranje mreže, a vremenom neće biti ništa lakše, jer ugušiti lagodno istraživanje mreže je primarni cilj većine uređaja. No ipak, Nmap nudi mnogo mogućnosti kako bi nam pomogao u razumijevanju tih kompleksnih mreža i kako bi provjerio da li filteri uistinu rade onako kako smo zamislili. Čak podržava mehanizme za obilaženje loše implementiranih mjera zaštite. Jedna od najboljeh metoda pomoću koje ćete razumjeti postavke svoje mrežne sigurnosti je pokušaj da je obiđete. Pokušajte se postaviti u mentalni sklop napadača i iskoristite tehnike iz ovog poglavlja protiv svojih mreža. Pokrenite FTP bounce sken, idle sken, napad fragmentacijom ili pokušajte tunelirati kroz svoj proxy server. Uz to što brane mrežnu aktivnost, firme sve više nadgledaju promet sa sustavima za otkrivanje upada (engl. intrusion detection system) IDS. Većina poznatijih IDS sustava dolaze s podešenim pravilima koja mogu prepoznati Nmap skenove, jer ponekad je sken u stvari prethodnik napada. Većina tih sustava je nedavno prerasla u sustave za zaštitu od upada (engl. intrusion prevention system) IPS koji aktivno blokiraju promet koji ocjene kao zloćudan. Na štetu mrežnih administratora i proizvođača IDS sustava, pouzdano ustanoviti što je zloćudno, a što nije samo analizom paketa je teško. Napadači koji imaju strpljenja i sposobnosti obično mogu uz pomoć nekin Nmap-ovih opcija proći nezapaženo od IDS sustava. U međuvremenu admnistratori se moraju boriti s velikom količinom lažnih uzbuna, gdje je normalna mrežna aktivnost pogrešno dijagnosticirana i možda čak blokirana od IPS sustava. Ponekad ljudi predlažu da Nmap ne bi trebao nuditi mogućnosti za obilaženjem vatrozida i provlašenja pored IDS-a. Tvrde da će te mogućnosti biti korištene od strane napadača isto kao i od strane administratora. Problem u ovoj logici je taj što će metode tako i tako biti dostupne napadačima koji će koristiti neki fdrugi alat ili sami doprogramirati funkcionalnost u Nmap, dok bi administratori imali puno teži posao u sprješavanju upada na svoje sustave. Postavljanje samo modernih, zakrpanih FTP servera je mnogo učinkovitija obrana od sprječavanja distribucije alata koji mogu napraviti FTP bounce napad. Ne postoji čarobni metak (ili Nmap opcija) za otkrivanje i potkopavanje vatrozida i IDS sustava. Za to je potrebna vještina i iskustvo. Tutorial je nešto što ne spada u ovaj dokument, koji samo navodi opcije i opisuje što one mogu. -f (fragmentiraj pakete); --mtu (koristi navedeni MTU) -D   (sakrij sken pomoću mamaca) Odvojite svaki host mamac sa zarezimaa možete opcionalno navesti i ME (što predstavlja vašu IP adresu), kako bi bila pozicionirana baš na onom mjestu u skeniranju na kojem je želite. Ako postavite ME na 6. mjesto ili kasnije, neki uobičajeni detektori port skenova (poput alata "scanlogd" firme Solar Designer's) uopće neće pokazati Vašu IP adresu. Ukoliko ne kkoristite ME opciju, Nmap će staviti vašu IP adresu na proizvoljno mjesto. Imajte na umu da hostovi koje navodite kao mamce moraju biti upaljeni, jer ćete inače slučajno napasti host koji skenirate Syn flood napadom. Isto tako poprilično je lako ustanoviti tko vas skenira ako samo jedan host od navedenih uistinu postoji na mreži. Možete koristiti IP adrese umjesto imena (kako vas mamci ne bi vidjeli u svojim name server logovima). Mamci se koriste u inicijalnom ping skenu (korištenjem ICMP, SYN, ACK ili bilo kojeg drugog načina) kao i za trajanja stvarnog skena portova. Mamci se također koriste i kod udaljenog otkrivanja operativnog sustava (-O). Mamci NE rade s otkrivanjem verzije ili TCP connect() skena. Činjenica je da će korištenje previše mamaca usporiti skeniranje i potencijalno ga učiniti manje točnim. Isto tako, neki ISP-ovi će filtrirati lažirane pakete, ali većina ih ne zabranjuje. -S   (Lažiraj ishodišnu adresu) Još jedna mogućnost korištenja ove opcije je lažirati sken kako bi ciljano računalo mislilo da ga skenira netko drugi. Zamislite firmu koju konstantno skenira konkurencija! -e opcija j eobično potrebna za ovu namjenu i -P0 je također preporučeno. -e   (koristi navedenu mrežnu karticu) --source-port  ; -g   (Lažiraj broj ishodišnog porta) Postoje sigurna rješenja tih problema, često u obliku proxy-a na aplikacijskom nivou ili modula na vatrozidu koji parsaju protokol. Nažalost postoje i lakša, manje sigurna rješenja. Vidjevši da DNS odgovori dolaze s porta 53 i aktivni FTP s porta 20, mnogi su administratori pali u zamku jednostavno dozvoljavajući ulazni promet s tih portova. Obično pretpostavljaju da napadači neće uočiti i iskoristiti takve rupe u vatrozidu. U nekim slučajevima administratori smatraju to rješenje kao privremenu zakrpu, dok ne implementiraju bolje rješenje, a onda zaborave na to. U te zamke ne padaju samo preopterećeni mrežni administratori. Mnogo uređaja je isporučeno s takvim nesigurnim pravilima. Čak je i Microsoft bio kriv. IPSec filter koji dolazi s Windows 2000 i s WIndows XP OS-om ima implicitno pravilo koje dozvoljava sav TCP i UDP promet s porta 88 (Kerberos). Još jedan dobro poznati primjer je ZOne Alarm osobni vatrozid, koji je do verzije 2.1.25 dozvoljavao bilo koje dolazne UDP pakete sa ishodišnog porta 53 (DNS) i 67 (DHCP). Nmap nudi opcije -g i --source-port (iste su) kako bi iskoristili ovakve slabosti. Jednostavno navedite broj porta i Nmap će ga koristiti kao ishodišni port gdje je to moguće. Nmap mora koristiti različite portove kako bi neki testovi otkrivanja OS-a radili ispravno,a DNS zahtjevi ignoriraju opciju --source-port, jer se kod toga Nmap oslanja na sistemske biblioteke. Većina TCP skenova uključujući i SYN sken podržava ove opcije u potpunosti isto kao i UDP sken. --data-length   (Dodaj proizvoljne podatke na pakete koje šalješ) --ttl   (Podesi polje IP time-to-live) --randomize-hosts (Proizvoljno poredaj hostove koje skeniraš) --spoof-mac   (Lažiraj MAC adresu) --badsum (Šalji pakete s lažnim TCP/UDP checksumom) Svaki sigurnosni alat je koristan onoliko koliko dobar izvještaj ponudi. Kompleksni testovi i algoritmi su od malo koristi ako njihov rezultat nije predstavljen na organiziran i razumljiv način. Obzirom na različite načine korištenja Nmap-a od strane ljudi i drugih programa, jedan format ne može zadovoljiti sve, tako da Nmap nudi više formata izvještaja, uključujući interaktivni mod koji direktno možete pročitati i XML kako bi ga kasnije mogli pregledavati i analizirati drugi automatizirani alati. Uz to što nudi različite formate izvještaja, Nmap nudi opcije za upravljanje količinom prikazanih informacija, kao i poruke za debugiranje. Izvještaji mogu biti standardni (na ekran op prev.) ili spremljeni u datoteke, u koje Nmap može dodavati podatke ili ih prepisati. Datoteke u koje se spremaju rezultati taskođer mogu biti korištene za prekinute skenove koje ste nastavili. Nmap nam nudi izvještaje u 5 različitih formata. Defaultni se zove interaktivni izvješ taj i poslan je na standardni izlaz (sdtout) (zaslon računala, op. prev.). Također postoji i normalni izvještaj koji je sličan interaktivnom s tim da prikazuje manje informacija i upozorenja, jer je predviđen za kasniju analizu, a ne trenutnu.. XML izvještaj je jedan od najbitnijih, jer ga lako možete konvertirati u HTML, može lako biti pregledavan pomoću programa poput Nmap-ovog grafičkog korisničkog sučelja, te može biti importiran u bazu podataka. Dva preostala tipa izvještaja su jednostavni grepabilni izvještaj koji uključuje većinu informacija o hostu u jednoj liniji i sCRiPt KiDDi3 Izvj3št4j za korisnike koji se smatraju |<-r4d. Dok je interaktivni izvještaj defaultni i nema komandnolinijskih opcija, preostale 4 opcije koriste istu sintaksu. Mogu preuzeti jedan parametar, a to je naziv datoteke u koji će biti pohranjeni rezultati. Možete navesti više različitih formata, ali svaki od njih smijete navesesti samo jednom. Npr. želite gledati normalni izvještaj za sebe, dok istovremeno želite razultate pohraniti i u XML datoteku, za kasniju programsku analizu. To možete postići opcijama -oX myscan.xml -oN myscan.nmap. Iako su u ovom poglavlju korištena imena poput myscan.xml zbog jasnoće, preporučeno je korištenje određenijih i jasnijih imena. Imena koja ćete odabrati ovise o vašim željama i navikama, mada osobno koristim dugačka imena u kojima se nalazi datum skeniranjai nekoliko riječi koje opisuju što je u stvari skenirano, a sve to pohranim u direktorij nazvan imenom tvrtke koju skeniram. Iako navedene opcije spremaju rezultat u datoteke, Nmap i dalje ispisuje interaktivni izvještaj na zaslon računala. Npr. naredba nmap -oX myscan.xml target sprema rezultate skena u XML datoteku imenom myscan.xml i također ispisuje na zaslon računala ono što bi ispisao da opcija -oX nije bila navedena. Ovo možete promijeniti dodajući znak "-" (minus op. prev.) kao parametar jednom od tipova izvještaja, što će prisiliti Nmap da deaktivira interaktivni izvještaj i umjesto njega na stdout pošalje format koji ste naveli. Tako će naredba nmap -oX - target posalti samo XML na stdout. Ozbiljne greške će i dalje biti ispisane na normalni tok grešaka - stderr. Za razliku od nekih Nmap-ovih opcija, razmak između opcije za naziv log datoteke (poput -oX) i naziva datoteke ili znamka minus je obavezan. Ukoliko ga izostavite, npr. napišete -oG- ili -oXscan.xml, Nmap će napraviti datoteke normalnog formata imenom G- i Xscan.xml. Nmap također nudi i opcije za upravljanje količinom prikazanih informacija i opcije da doda podatke u postojeću datoteku , a ne da je prepiše. Sve navedene opcije opisane su u daljnjem tekstu: Formati Nmap-ovih izvještaja -oN   (Normalni izvještaj) -oX   (XML izvještaj) XML nudi stabilan format koji je lako čitljiv od strane programa. Besplatni XML parseri su dostupni za većinu kompjutorskih jezika, uključujući C/C++, Perl, Python i Java-u. Čak postoje i poveznice za većinu tih jezika koje omogućuju direktno interpretiranje Nmap-ovih izvještaja. Primjeri su: m[blue]Nmap::Scannerm[][9] i m[blue]Nmap::Parserm[][10] u Perlu i CPAN-u. U većini slučajeva kad neka ozbiljnija aplikacija komunicira s Nmap-om, XML je željeni format. XML izvještaj se poziva na XSL stilove, koji mogu biti korišteni za formatiranje rezultata u HTML. Najjednostavniji način je da jednostavno učitate XML izvještaj u web preglednik poput firefox-a ili IE-a. Defaultno će to raditi samo na računalu nakojem ste pokrenuli nmap (ili na računalu koje je slično konfigurirano), jer je nmap.xsl hardkodiran. Koristite opciju --webxml ili --stylesheet kako bi kreirali prenosive XML datoteke koje prikazuju podatke u HTML-u na bilo kojem računalu spojenom na web. -oS   (ScRipT KIdd|3 izvještaj) -oG   (Grepabilni izvještaj) No ipak, grepabilni izvještaj je poprilično popularan. To je jednostavni format koji prikazuje svakog hosta na jednoj liniji i može ga se lako pretraživati standardnim UNIX alatima, poput grep-a, awk-a, cut-a, sed-a, diff-a i Perl-a. Čak ga i ja koristim za jednokratne testove iz komandne linije. Pronaći sve hostove koji imaju otvoren ssh port ili se na njima vrti Solaris je vrlo lako pomoću grep naredbe, a to pak može biti poslano awk ili cut naredbi da bi se prikazala željena polja. Grepabilni izvještaj sastoji se od komentara (linija koje počinju s pound znakom (#)) i ciljanih linija. Ciljana linija sadrži kombinaciju od 6 imenovanih polja, odvojenih tabovima i iza njih dolazi dvotočka. Polja su: Host, Ports, Protocols, Ignored State, OS, Seq Index, IPID, and Status. Najvažnije od tih polja je obično Ports, koje daje datalje o svakom zanimljivom portu. To je zarezom odvojena lista portova. Svaki zapis o portu predstavlja jedan zanimljivi port i ima oblik sedam podpolja odvojenih slash znakom (/). Podpolja su: Port number, State, Protocol, Owner, Service, SunRPC info, and Version info. Kao i kod XML formata, više informacija možete naći na sljedećem linku: m[blue]http://www.unspecific.com/nmap-oG-outputm[]. -oA   (Izvještaj u svim formatima) Opcije za prikaz količine informacija i debugiranje -v (povećaj količinu prikazanih informacija) Većina promjena koje se dobiju korištenjem ove opcije utječu na normalni i script kiddie izvještaj. Ostali izvještaji su namijenjeni za automatiziranu obradu, pa Nmap u njima može navesti dodatne informacije bez suvišnog opterećivanja korisnika. Ipak, postoji nekoliko promjena u ostalim modovima gdje veličinu izvještaja možete osjetno smanjiti ne navodeći neke detalje. Npr. komentirana linija u gerepabilnom formatu, koja daje listu svih skeniranih portova isprintana je samo u verose modu, jer može biti poprilično velika. -d [level] (povećaj ili podesi nivo debugiranja) Debuging izvještaj je koristan kad sumnjate da u Nmap-u postoji greška ili ako ste jednostavno zbunjeni oko toga što Nmap radi i zašto. Kako je ova opcija najviše namjenjena developerima, debug linije nisu uvijek samoobjaš njavajuće. Možete dobiti nešto poput: Timeout vals: Timeout vals: srtt: -1 rttvar: -1 to: 1000000 delta 14987 ==> srtt: 14987 rttvar: 14987 to: 100000. Ukoliko ne razumijete liniju, jedini smjer kojim možete nastaviti je da je ignorirate, potražite u izvornom kodu programa ili zatražite pomoć na razvojnoj listi (nmap-dev). Neke linije su samoobjašnjavajuće, ali poruke postaju sve čudnije što je nivo debugiranja veći. --packet-trace (Prati pakete i podatke koji su poslani/primljeni) --iflist (Izlista mrežne adaptere i rute) Ostale opcije izvještaja --append-output (Dodaj rezultate u postojeći file umjesto da ih prepišeš) --resume   (Nastavi prekinut sken) --stylesheet   (Podesi XSL stil za transformiranje XML izvještaja) --webxml (Učitaj stil sa stranice Insecure.Org) --no_stylesheet (Izbaci deklaraciju stila iz XML-a) Ovo poglavlje opisuje neke važne (i neke ne toliko važne) opcije koje jednostavno ne spadaju nigdje drugdje. -6 (Uključi skeniranje IPv6 protokola) Iako IPv6 nije pregazila svijet ipak se poprilično koristi u nekim zemljama (osobito Azijskim), a i većina modernih OS-ova ima ugrađenu podršku. Da bi mogli koristiti Nmap s IPv6 protokolom i ciljano računalo i vaše računalo moraju biti podešeni za korištenje IPv6. Ukoliko vaš ISP (poput većine drugih) ne dodjeljuje IPv6 IP adrese, postoje oni koji nude besplatno IPv6 tuneliranje, što poprilično dobro radi s Nmap-om. Jedan od boljih davatelja takvih usluga je BT Exact. Također sam koristio i usluge tvrtke Hurricane Electric m[blue]http://ipv6tb.he.net/m[]. 6to4 tuneli su još jedan popularan besplatan pristup. -A (opcija agresivnog skeniranja) --datadir   (Navedi korisnički definiranu lokaciju Nmap-ovih datoteka) --send-eth (koristi sirove (raw) pakete za slanje preko etherneta) --send-ip (Šalji na sirovom (raw) IP sloju) --privileged (Pretpostavka da je korisnik u potpunosti privilegiran (op. prev. administrator sustava)) --interactive (Startaj u interaktivnom modu) --noninteractive (Za pokretanje Nmap-a iz nekog drugog programa) -V; --version (Ispiši broj verzije) -h; --help (Ispiši sumarnu help stranicu) Ova opcija je za sad nedostupna na Windows OS-u Tijekom izvršavanja Nmap-a sve tipke koje pritisnete su uhvaćene. To omogućvava interakciju s programom bez da ga zaustavljate u radu. Određene specijalne tipke će mijenjati opcije, dok će druge ispisati statusne poruke koje vas obavještavaju o tekućem skenu. Konvencija je takva da mala slova povećavaju količinu ispisa, dok velika slova smanjuju količinu ispisa. Ova funkcionalnost može biti isključena navođenjem --noninteractive opcije. v / V d / D p / P Bilo što drugo Stats: 0:00:08 elapsed; 111 hosts completed (5 up), 5 undergoing Service Scan Service scan Timing: About 28.00% done; ETC: 16:18 (0:00:15 remaining) Ovdje su neki primjeri korištenja Nmap-a i to od jednostavnih i rutinskih do malo manje kompleksnih i ezoteričnih. Korištene su neke stvarne IP adrese i domene kako bi stvar bila malo konkretnija. Umjesto njih trebali bi staviti adrese/domene iz svoje mreže.. Iako osobno ne smatram da je skeniranje tuđih mreža iligelano i da bi trebalo biti, neki mrežni administratori ne vole nedozvoljeno skeniranje njihovih mreža i mogli bi se žaliti. Dobiti dozvolu prije samog čina je u svakom slučaju ispravan postupak. Za testiranje imate dozvolu skenirati host scanme.nmap.org. Dozvola vrijedi samo za skeniranje korištenjem Nmap-a i ne vrijedi za testiranje exploita i DOS (denial of Service) napada. Kako ne bi preopteretili mrežu, molim Vas da ne skenirate više od 12-tak portova dnevno. Ukoliko će ovaj host biti napadan na bilo koji način, uklonit ću ga s NET-a i Nmap će javiti grešku Failed to resolve given hostname/IP: scanme.nmap.org. Ova dozvola vrijedi i za hostove scanme2.nmap.org, scanme3.nmap.org itd., iako navedeni hostovi za sad ne postoje. nmap -v scanme.nmap.org Ova naredba skenira sve rezervirane TCP portove na računalu scanme.nmap.org. Opcija -v uključuje verbose mod.. nmap -sS -O scanme.nmap.org/24 Pokreće skriveni (engl. stealth) SYN scan prema svakom računalu koje je upaljeno od njih 255 mogućih na mreži lqclass Crq na kojoj se nalazi scanme host. Također pokuša ustanoviti koji OS je pokrenut na svakom od otkrivnih (upaljenih) hostova. Ovo zahtijeva root prava zbog SYN scan-a i OS detekcije. Pokreće enumeraciju hostova i TCP scan na prvoj polovici svakog od 255 mogućih 8 bitnih subneta u mrežnog ID-a 192.168 klase B adresnog prostora. Scan provjerava da li je na ciljanim računalima pokrenut sshd, DNS, pop3d, imapd i/ili port 4564. Za svaki od navedenih portova koji su otvoreni, pokrenuto je i otkrivanje verzije, kak obi se ustanovilo koja aplikacija je otvorila taj port. nmap -v -iR 100000 -P0 -p 80 Ova naredba zatraži Nmap da nasumično odabere 100 000 hostova i skenira ih u potrazi za web serverom (port 80). Enumeracija hostova je isključena opcijom -P0, jer slanje nekoliko sondi kako bi se ustanovilo da li je host upaljen ili ne kad se skenira samo jedan port je ionako nepotrebno. nmap -P0 -p80 -oX logs/pb-port80scan.xml -oG logs/pb-port80scan.gnmap 216.163.128.20/20 Skenira 4096 IP adresa za web serverom (bez prethodnog pinganja) i sprema izvještaj u grepabilnom iXML formatu. Poput svog autora niti Nmap nije savršen, no Vi možete pomoći slanjem prijava o greškama, pa čak i pišući patcheve. Ukoliko se Nmap ne ponaša onako kako očekujete od njega, najprije ga nadogradite na najnoviju verziju dostupnu na m[blue]http://www.insecure.org/nmap/m[]. Ukoliko je problem i dalje tu, istražite da li je već otkriven i prijavljen. Pokušajte "zaguglati" poruku o grešci ili otiđite na Nmap-dev arhive na m[blue]http://seclists.org/m[]. Također pročitajte i kompletan manual. Ukoliko ništa od toga ne pomogne, pošaljite izvještaj o grešci na  . Molim Vas napišite sve što ste do tad otkrili o problemu, te koju verziju Nmap- imate i koju verziju OS-a imate. Izvještaji o prijavljenim problemima i upiti o korištenju Nmap-a koji su poslani na dev@nmap.org imaju više šansi da budu odgovoreni nego oni poslani direktno Fyodor-u. Patchevi za otklanjanje bugova su još i bolji od samih prijava. Osnovne upute za kreiranje patch datoteka s promjenama su dostupne na m[blue]http://www.insecure.org/nmap/data/HACKINGm[]. Patchevi mogu biti poslani na nmap-dev (što je preporučeno) ili direktno Fyodoru. Fyodor   (m[blue]http://www.insecure.orgm[]) Stotine ljudi su doprinjeli u stvaranju Nmap-a tijekom godina. To je navedeno u CHANGELOG datoteci koja je distribuirana s Nmap-om, a dostupna je i na sljedećem linku: m[blue]http://www.insecure.org/nmap/changelog.htmlm[]. Nmap sigurnosni skener je (C) 1996-2005 Insecure.Com LLC. Nmap je također reigistered trademark Insecure.Com LLC. Program je besplatan;možete ga redistribuirati a/ili modificirati pod uvjetima GNU General Public License kako je objavljeno od strane Free Software Fondacije;Verzija 2. To vam garantira pravo korištenja, modificiranja i redistribuiranja ovog softvera pod određenim uvjetima. Ukoliko želite inkorporirati Nmap tehnologiju u svoj softver, možda ćemo vam prodati dodatne licence (kontaktirajte  ). Mnogi proizvođači sigurnosnih skenera već imaju licencu Nmap tehnologije poput otkrivanja hostova, skeniranja portova, OS detekcije i otkrivanja servisa/verzije. Imajte na umu da GPL postavlja važna ograničenja na lqderivirana djelarq, ali ne daje detaljne definicije istih. Kako bi se izbjegli nesporazumi, za potrebe ove licence, mi smatramo da aplikacija sadrži lq derivirano djelorq, ako čini bilo što od navedenog: Naziv lqNmaprq je također uključen u to. Ova lista nije eksluzivna, ali je navedena kako bi pojasnila našu interpretaciju deriviranih djela s najčešćim primjerima. Zabrane se primjenjuju samo u slučaju da uistinu redistribuirate i Nmap. Npr. mišta vas ne sprječava da napišete i prodate front-end za Nmap. Distribuirajte front end i usmjerite ljude na m[blue]http://www.insecure.org/nmap/m[] kako bi preuzeli Nmap. Ne smatramo da su to dodatne zabrane povrh GPL-a, nego samo pojašnjenja toga kako mi interpretiramo lq derivirano djelorq jer se primjenjuje na naš produkt pod GPL licencom. To je slično načinu na koji je Linus Torvalds objavio svoju interpretaciju lqderiviranog djelarq i kako se to odnosi na module linux kernela. Naša interpretacija se odnosi samo na Nmap - ne govorimo o nijednom drugom produktu licenciranom po GPL-u. Ukoliko imate bilo kakvo pitanje o GPL licenciranju i restrikcijama kod korištenja Nmap-a u ne GPL djelima, rado ćemo Vam pomoći. Kao što je gore navedeno, također nudimo i alternativne licence za integriranje Nmapa u neke druge aplikacije i uređaje. Takvi ugovori su prodani mnogim sigurnosnim izdavačima i generalno sadrže stalnu licencu kao i uslugu prioritetne podrške, a uz to financijski pomažu kontinuirani razvoj Nmap tehnologije. Molimo Vas da poš aljete mail na   za daljne informacije. Kao posebno izuzeće od GPL uvjeta, Insecure.Com LLC daje dozvolu za povezivanje koda ovog programa s bilo kojom verzijom OpenSSL biblioteke koja je distribuirana pod sličnom licencom kao i s licencom koja se nalazi u datoteci Copying.OpenSSL i distribuirati povezanu kombinaciju oba programa. Morate poštivati GNU GPL na svim područjima za bilo koji kod koji nije OpenSSL. Ukoliko modificirate navedenu datoteku možete proširiti to izuzeće i na svoju verziju programa, ali niste obavezni to napraviti. Ukoliko dobijete navedene datoteke s pismenom licencom ili ugovorom koji navodi drukčije uvjete od navedenih gore, onda je ta alternativna licenca jača i preuzima primat. Nmap referentne upute su (C) 2005 Insecure.Com LLC. Time su stavljene pod verziju 2.5 m[blue]Creative Commons Attribution Licensem[][3]. To Vam omogućuje da redistribuirate, modificirate tekst po želji, dok god navodite druge izvore koji su radili na njemu. Osim toga, možete tretirati ovaj dokument kao da spada pod istu licencu kao i Nmap (obajšnjeno prije). Izvorni kod je dostupan s programom zato jer vjerujemo da korisnik ima pravo znati što uistinu program radi prije nego će ga pokrenuti. To Vam isto tako omogućava provjeru softvera na sigurnosne rupe (do sad nije pronađena niti jedna). Izvorni Vam kod isto tako omogućava prijenos Nmap-a na nove platforme, popravljanje grešaka i dodavanje novih mogućnosti. Potaknuti ste da promjene pošaljete na   kako bi eventualno bile inkorporirane u buduće verzije glavne distribucije. Slanjem promjena Fyodoru ili nekom na Insecure.Org mailing listi developera, podrazumijeva se da Fyodoru i Insecure.Org-u dajete puna prava na korištenje, modificiranje i relicenciranje koda. Nmap će uvijek biti dostupan kao open source, ali to je bitno jer je nemogućnost relicenciranja koda stvorila ogromne probleme nekim drugim besplatnim softverskim projektima (poput KDE-a i NASM-a). Također povremeno relicenciramo kod drugim tvrtkama kako je navedeno gore. Ukoliko želite definirati posebne licenčne uvjete za svoj doprinos, navedite to odmah kad ih pošaljete. Program je distribuiran u nadi da će bit koristan, ali BEZ IKAKVE GARANCIJE; čak i bez pretopstavljene garancije na PRIHVATLJIVU KVALITETU ili SPOSOBNOST ZA ODREĐENE ZADAĆE. Pogledajte GNU General Public License za više detalja na m[blue]http://www.gnu.org/copyleft/gpl.htmlm[] ili u COPYING datoteci uključenoj s Nmap distribucijom. Treba uzeti u obzir da je Nmap povremeno srušio loše napisane aplikacije, TCP/IP stackove, pa čak i operativne sustave. Iako je to ekstremno rijetko, važno je za znati. Nmap nikad ne bi trebalo pokrenuti na kritičnim sustavima osim ako ste spremni prihvatiti da sustav neko vrijeme ne radi. Ovdje potvrđujemo da Nmap može srušiti vaš sustav ili mrežu i ograđujemo se od bilo kakve odgovornosti za bilo kakvu štetu ili problem prouzročen od Nmap-a. Zbog male mogućnosti pada sustava i zbog toga što neki crno šeširaši vole koristiti Nmap za prikupljanje informacija, postoje administratori koji se uznemire i mogu se žaliti kad primjete da im je mreža skenirana. Stoga je uvijek preporučeno zatražiti dozvolu prije nego započnete i lagani scan mreže. Nmap nikad ne bi trebao biti instaliran sa specijalnim privilegijama (npr. suid root) iz sigurnosnih razloga. Ovaj produkt sadrži softver razvijen od m[blue]Apache Software Fondacijem[][11]. Modificirana verzija m[blue]Libpcap prijenosne paket capture bibliotekem[][12] je distribuirana zajedno s Nmap-om. Windows verzija Nmap-a koristi obradu libpcap-a - m[blue]WinPcapm[][13]. Podrška za regularne izraze je dana od m[blue]PCRE bibliotekem[][14] koja je open source softver. Napisao ga je Philip Hazel. Neke funkcije sirovog netvorkinga koriste m[blue]Libdnetm[][15] mrežnu biblioteku koju je napisao Dug Song. Modificirana verzija je distribuirana s Nmap-om. Nmap se opcionalno može povezati s m[blue]OpenSSL kriptografskim alatimam[][16] za podršku detekcije SSL verzije. Sav gore navedeni softver se slobodno redistribuira pod softverskom licencom po BSD-u. Klasifikacija kontrole izvoza u US-u: Insecure.Com LLC vjeruje da Nmap spada pod US ECCN (export control clasification number - klasifikacijski broj kontrole izvoza) 5D992. Ta se kategorija zove lqSoftver informacijske sigurnosti koji nije kontroliran ECCN-om 5D002rq. Jedina zabrana te klasifikacije je AT (anti terorizam), koja se primjenjuje na gotovo svu robu i zabranjuje izvoz hrpi lažljivih zemalja, poput Iran-a i Sjeverne Koreje (op. prev. iliti onih s kojima Ameri nisu dobri). Tako da Nmap ne zahtijeva nikakvu posebnu licencu, dozvolu ili bilo kakvu drugu autorizaciju američke vlade.