-p port ranges (Only scan specified ports) .
This option specifies which ports you want to scan and overrides the default. Individual port numbers
are OK, as are ranges separated by a hyphen (e.g. 1-1023). The beginning and/or end values of a
range may be omitted, causing Nmap to use 1 and 65535, respectively. So you can specify -p- to scan
ports from 1 through 65535. Scanning port zero. is allowed if you specify it explicitly. For IP
protocol scanning (-sO), this option specifies the protocol numbers you wish to scan for (0–255).
When scanning both TCP and UDP ports, you can specify a particular protocol by preceding the port
numbers by T: or U:. 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 “http”, 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.
|
-v (Increase verbosity level) .
Increases the verbosity level, causing Nmap to print more information about the scan in progress.
Open ports are shown as they are found and completion time estimates are provided when Nmap thinks a
scan will take more than a few minutes. Use it twice or more for even greater verbosity.
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.
|
-oX filespec (XML output) .
Requests that XML output be directed to the given filename. Nmap includes a document type definition
(DTD) which allows XML parsers to validate Nmap XML output. While it is primarily intended for
programmatic use, it can also help humans interpret Nmap XML output. The DTD defines the legal
elements of the format, and often enumerates the attributes and values they can take on. The latest
version is always available from http://nmap.org/data/nmap.dtd.
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
Nmap::Scanner[15] and Nmap::Parser[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.
|