
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
OS Hardening Principles
|
95
If you state a port range using the -p flag, you can combine commas and dashes to
create a very specific group of ports to be scanned. For example, typing
-p 20-
23,80,53,600-1024
tells nmap to scan ports 20 through 23, 80, 53, and 600 through
1024. Don’t use any spaces in your port range, however. Alternatively, you can use
the
-F flag (short for “fast scan”), which tells nmap to scan only those ports listed in
the file /usr/share/nmap/nmap-services; these are ports Fyodor has found to fre-
quently yield interesting results.
The “target’’ expression can be a hostname, a host IP address, a network IP address,
or a range of IP addresses. Wildcards may be used. For example,
192.168.17.*
expands to all 255 IP addresses in the network 192.168.17.0/24 (in fact, you could
use
192.168.17.0/24 instead); 10.13.[1,2,4].* expands to 10.13.1.0/24, 10.13.2.0/
24, and 10.13.4.0/24. As you can see, nmap is very flexible in the types of target
expressions it understands.
Figure 3-7. Sample nmapfe session