o The -v and -d options are now handled in the same way. The three

forms are equivalent:
    -v -v -v    -vvv    -v3
    -d -d -d    -ddd    -d3
  Formerly, the -ddd and -v3 forms didn't work. Mak Kolybabi submitted
  a patch.
This commit is contained in:
david 2010-02-17 19:12:15 +00:00
parent d14f12d2f1
commit 9632670762
3 changed files with 42 additions and 12 deletions

View file

@ -2,6 +2,13 @@
[NOT YET RELEASED]
o The -v and -d options are now handled in the same way. The three
forms are equivalent:
-v -v -v -vvv -v3
-d -d -d -ddd -d3
Formerly, the -ddd and -v3 forms didn't work. Mak Kolybabi submitted
a patch.
o Nping, the packet generation program by Luis MartinGarcia, is now
included in the Nmap distribution.

View file

@ -3602,6 +3602,9 @@ format is available
<indexterm><primary><option>-v</option></primary></indexterm>
<indexterm><primary>verbosity</primary></indexterm>
</term>
<term>
<option>-v<replaceable>level</replaceable></option> (Set verbosity level)
</term>
<listitem>
<para>Increases the verbosity level, causing Nmap to
@ -3609,7 +3612,8 @@ format is available
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.
verbosity: <option>-vv</option>, or give a verbosity level
directly, for example <option>-v3</option>.
<indexterm><primary><option>-v</option></primary><secondary>giving more than once</secondary></indexterm>
</para>
@ -3629,10 +3633,13 @@ format is available
<varlistentry>
<term>
<option>-d [level]</option> (Increase or set debugging level)
<option>-d</option> (Increase debugging level)
<indexterm><primary><option>-d</option></primary></indexterm>
<indexterm><primary>debugging</primary></indexterm>
</term>
<term>
<option>-d<replaceable>level</replaceable></option> (Set debugging level)
</term>
<listitem>
@ -3641,9 +3648,8 @@ debugging is available to flood you with much more! As with the
verbosity option (<option>-v</option>), debugging is enabled with a
command-line flag (<option>-d</option>) and the debug level can be
increased by specifying it
multiple times.<indexterm><primary><option>-d</option></primary><secondary>giving more than once</secondary></indexterm>
Alternatively, you can set
a debug level by giving an argument to <option>-d</option>. For
multiple times,<indexterm><primary><option>-d</option></primary><secondary>giving more than once</secondary></indexterm>
as in <option>-dd</option>, or by setting a level directly. For
example, <option>-d9</option> sets level nine. That is the highest
effective level and will produce thousands of lines unless you run a
very simple scan with very few ports and targets.</para>

31
nmap.cc
View file

@ -287,8 +287,8 @@ printf("%s %s ( %s )\n"
" -oN/-oX/-oS/-oG <file>: Output scan in normal, XML, s|<rIpt kIddi3,\n"
" and Grepable format, respectively, to the given filename.\n"
" -oA <basename>: Output in the three major formats at once\n"
" -v: Increase verbosity level (use twice or more for greater effect)\n"
" -d[level]: Set or increase debugging level (Up to 9 is meaningful)\n"
" -v: Increase verbosity level (use -vv or more for greater effect)\n"
" -d: Increase debugging level (use -dd or more for greater effect)\n"
" --reason: Display the reason a port is in a particular state\n"
" --open: Only show open (or possibly open) ports\n"
" --packet-trace: Show all packets sent and received\n"
@ -740,7 +740,7 @@ int nmap_main(int argc, char *argv[]) {
/* OK, lets parse these args! */
optind = 1; /* so it can be called multiple times */
while((arg = getopt_long_only(argc,fakeargv,"6Ab:D:d::e:Ffg:hIi:M:m:nO::o:P:p:qRrS:s:T:Vv", long_options, &option_index)) != EOF) {
while((arg = getopt_long_only(argc,fakeargv,"6Ab:D:d::e:Ffg:hIi:M:m:nO::o:P:p:qRrS:s:T:Vv::", long_options, &option_index)) != EOF) {
switch(arg) {
case 0:
#ifndef NOLUA
@ -1057,10 +1057,18 @@ int nmap_main(int argc, char *argv[]) {
} while(q);
break;
case 'd':
if (optarg)
if (optarg && isdigit(optarg[0])) {
o.debugging = o.verbose = atoi(optarg);
else {
o.debugging++; o.verbose++;
} else {
const char *p;
o.debugging++;
o.verbose++;
for (p = optarg != NULL ? optarg : ""; *p == 'd'; p++) {
o.debugging++;
o.verbose++;
}
if (*p != '\0')
fatal("Invalid argument to -d: \"%s\".", optarg);
}
o.reason = true;
break;
@ -1304,7 +1312,16 @@ int nmap_main(int argc, char *argv[]) {
exit(0);
break;
case 'v':
o.verbose++;
if (optarg && isdigit(optarg[0])) {
o.verbose = atoi(optarg);
} else {
const char *p;
o.verbose++;
for (p = optarg != NULL ? optarg : ""; *p == 'v'; p++)
o.verbose++;
if (*p != '\0')
fatal("Invalid argument to -v: \"%s\".", optarg);
}
break;
}
}