By Bryan Burns, Jennifer Stisa Granick, Steve Manzuik, Paul Guersch, Dave Killion, Nicolas Beauchesne, Eric Moret, Julien Sobrier, Michael Lynn, Eric Markham, Chris Iezzoni, Philippe Biondi
Book Price: $59.99 USD
£37.50 GBP
PDF Price: $48.99
Cover | Table of Contents | Colophon
(1) Derives independent economic value, actual or potential, from not being generally known to the public or to other persons who can obtain economic value from its disclosure or use; and (2) Is the subject of efforts that are reasonable under the circumstances to maintain its secrecy.
(1) reading about the program;(2) observing the program in operation by using it on a computer;(3) performing a static examination of the individual computer instructions contained within the program; and(4) performing a dynamic examination of the individual computer instructions as the program is being run on a computer.
imap 143/tcp # Internet Message Access Protocol
-sP option to perform a host scan. By default, Nmap sends both an ICMP echo request (also known as ping) packet as well as a TCP SYN packet to port 80 (the default web server port) to determine whether a computer is listening on a given IP address. If the IP addresses being scanned are on the same subnet as the scanner, ARP packets are used instead; it is a faster and more reliable way to see which IP addresses are in use. Here's an example of Nmap scanning the first 20 hosts of a subnet:
[bryan@nereid bryan] sudo nmap -n -sP 10.150.9.1-20
Host 10.150.9.15 appears to be up.
MAC Address: 00:0C:F1:D2:29:4C (Intel)
Host 10.150.9.16 appears to be up.
MAC Address: 00:0B:DB:27:40:47 (Dell ESG Pcba Test)
Nmap finished: 20 IP addresses (2 hosts up) scanned in 0.646 seconds
-n flag instructs nmap to not do name lookups on the IP addresses it scans. This often makes the scan faster as reverse DNS lookups can take a long time to complete. The DNS requests can be somewhat noisy as well, so if you're trying to be subtle with your scan, -n is usually a good idea.bryan@firemaw:˜$ sudo nmap 10.150.9.46 Interesting ports on 10.150.9.46: (The 1667 ports scanned but not shown below are in state: filtered) PORT STATE SERVICE 21/tcp open ftp 22/tcp open ssh 80/tcp open http 427/tcp closed svrloc 443/tcp closed https 3689/tcp open rendezvous 8080/tcp open http-proxy bryan@firemaw:˜$ unicornscan 10.150.9.46 Open ftp[ 21] From 10.150.9.46 ttl 64 Open ssh[ 22] From 10.150.9.46 ttl 64 Open http[ 80] From 10.150.9.46 ttl 64 Open http-alt[ 8080] From 10.150.9.46 ttl 64 bryan@firemaw:˜$ sudo scanrand 10.150.9.46 bryan@firemaw:˜$
-b flag (), results are produced.-p ports option. The ports argument is a comma-separated list of ports or port ranges. For example:sudo nmap -p 21-25,80,100-150 target
-F flag, which instructs Nmap to perform a "fast" scan by only looking for ports specified in the nmap-services file. This file comes with Nmap and contains around 1200 ports, which is a small decrease from the 1,600+ ports that Nmap scans by default.T: in front of the TCP ports and U: in front of the UDP ports. For example, to scan TCP ports 21 through 25 and 80 and UDP ports 5000 through 6000, you would type:sudo nmap -pT:21-25,80,U:5000-6000 target
-p-100 is equivalent to -p1-100, and -p100- is equivalent to -p100-65535.-p-, which is equivalent to -p1-65535.:) character. As with Nmap, the ports specification can be a comma-separated list of individual ports or a range of ports. For example:unicornscan target:21-25,80,100-150
q (for "quick") in place of a port list.1.2.3.4 or www.somedomain.com.10.0.0.1/24. Class B (65535 addresses) networks are represented by /16, class A (16 million addresses) by /8, and so on./0 denotes all possible IP addresses (there are over four billion of them). Unicornscan happily accepts 0/0 as a valid scan target and will commence to scan the entire Internet. You really shouldn't do this as it won't finish in your lifetime, and you'll likely annoy lots of people in the process. Nmap is polite enough to not accept /0 as a valid input, but it does accept /1, which, at two billion addresses, is nearly as bad.10.0.0.1-254. This is roughly equivalent to the CIDR notation /24, but is slightly superior since 10.0.0.0 and 10.0.0.255 aren't valid IP addresses to scan, yet are included in the CIDR notation. The IP range notation allows you to express complex target lists that are impossible with CIDR notation, such as:10.1,3,5,7,9.50-100,150-200.1-5,250-254
-sU flag. For example:sudo nmap -sU target
-mU flag, such as:sudo unicornscan -mU target
-sV) functionality mentioned in Here's an example of Nmap performing a UDP scan with protocol data:sudo nmap -sU -sV target
-T5 option.) Another complication is that many firewall and IPS devices respond to a flood of SYN packets by enabling SYN cookies, which makes every port appear to be open.-sV option instructs Nmap to test for application type and version for all ports found to be open. The following example shows Nmap fingerprinting the open ports on my OS X host:
bryan@firemaw:˜$ sudo nmap -n -sV 10.150.9.46
Interesting ports on 10.150.9.46:
(The 1667 ports scanned but not shown below are in state: filtered)
PORT STATE SERVICE VERSION
21/tcp open ftp tnftpd 20040810
22/tcp open ssh OpenSSH 3.8.1p1 (protocol 1.99)
80/tcp open http Apache httpd 1.3.33 ((Darwin) PHP/4.4.1)
427/tcp closed svrloc
443/tcp closed https
3689/tcp open rendezvous Apple iTunes 6.0.4 (on Mac OS X)
8080/tcp open http-proxy?
-allports and -version-all options.-O flag to the scan command line. The following flags can be used in conjunction with OS detection to augment the results:-v-O, Nmap performs a TCP Initial Sequence Number (ISN) and IP ID analysis. These metrics can be used to determine how susceptible the target is to various forms of traffic spoofing. Targets that are reported as having incremental IP ID sequence generation are good candidates for idle scans (see ).osscan-limitfuzzy or —osscan-guess-otype filename option, where the type is N, G, X, or S. An additional option, -oA basename, is supported to simultaneously write the scan output in the Normal, Grepable, and XML formats. With this option, the files are named basename.nmap, basename.gnmap, and basename.xml. Multiple output formats can be specified using -o flags as well. For example, to write the output of a scan in normal and XML formats simultaneously, you would type:sudo nmap -oN normal_output -oX xml_output target
resume option. When resuming from a file, no command-line options are supported other than the file from which to resume (the original scan options are saved in the output file and are reused when the scan is resumed).bryan@firemaw:˜$ sudo nmap -oG grepable_output -n 10.150.9.15,143 Interesting ports on 10.150.9.15: (The 1671 ports scanned but not shown below are in state: closed) PORT STATE SERVICE 22/tcp open ssh 111/tcp open rpcbind 955/tcp open unknown ^C caught SIGINT signal, cleaning up bryan@firemaw:˜$ sudo nmap —resume grepable_output Interesting ports on 10.150.9.143: (The 1672 ports scanned but not shown below are in state: filtered) PORT STATE SERVICE 139/tcp open netbios-ssn 445/tcp open microsoft-ds
-sI zombie:port option. The zombie argument needs to be the address of a host with predictable IP IDs, and the port needs to be an open TCP port on that host (if no port is specified, Nmap tries port 80 by default).-P0 (see ) with an idle scan so no packets are seen originating from your host. If you don't use this option, your host will send some initial host discovery packets prior to the spoofed scan, which could be used to trace the scan back to you.
bryan@firemaw:˜$ sudo nmap -P0 -sI 10.150.10.253:3389 10.150.9.46
Idlescan using zombie 10.150.10.253 (10.150.10.253:3389); Class: Incremental
Interesting ports on 10.150.9.46:
(The 1669 ports scanned but not shown below are in state: closed|filtered)
PORT STATE SERVICE
21/tcp open ftp
22/tcp open ssh
80/tcp open http
3689/tcp open rendezvous
8080/tcp open http-proxy