From 9632670762292c95e874648e9f32ddf839f6bd0d Mon Sep 17 00:00:00 2001 From: david Date: Wed, 17 Feb 2010 19:12:15 +0000 Subject: [PATCH] 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. --- CHANGELOG | 7 +++++++ docs/refguide.xml | 16 +++++++++++----- nmap.cc | 31 ++++++++++++++++++++++++------- 3 files changed, 42 insertions(+), 12 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2e719a54d..4f158d2fa 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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. diff --git a/docs/refguide.xml b/docs/refguide.xml index 255e7a8a6..6767ac65a 100644 --- a/docs/refguide.xml +++ b/docs/refguide.xml @@ -3602,6 +3602,9 @@ format is available verbosity + + (Set verbosity level) + 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: , or give a verbosity level + directly, for example . giving more than once @@ -3629,10 +3633,13 @@ format is available - (Increase or set debugging level) + (Increase debugging level) debugging + + (Set debugging level) + @@ -3641,9 +3648,8 @@ debugging is available to flood you with much more! As with the verbosity option (), debugging is enabled with a command-line flag () and the debug level can be increased by specifying it -multiple times.giving more than once -Alternatively, you can set -a debug level by giving an argument to . For +multiple times,giving more than once +as in , or by setting a level directly. For example, 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. diff --git a/nmap.cc b/nmap.cc index cb061925b..21d593086 100644 --- a/nmap.cc +++ b/nmap.cc @@ -287,8 +287,8 @@ printf("%s %s ( %s )\n" " -oN/-oX/-oS/-oG : Output scan in normal, XML, s|: 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; } }