Change the warning message for time specifications that look off by a

factor of 1000. I realized there is a bad ambiguity in

The default unit for --host-timeout is seconds (since April 2010),
so your time of "10000" is 2.8 hours.

It could be interpreted as "seconds since April 2010" which is a strange
way to specify a length of time and would be confusing if you took it
that way. I have changed it to

Since April 2010, the default unit for --host-timeout is seconds,
so your time of "10000" is 2.8 hours.
This commit is contained in:
david 2010-07-13 17:22:58 +00:00
parent 3f124b9bcc
commit 16232ff34c
2 changed files with 7 additions and 7 deletions

View file

@ -117,7 +117,7 @@ o [Nmap, Ncat, Nping] The default unit for time specifications is now
Some sanity checks have been added to catch what looks like an
attempt to use the old millisecond defaults. For example,
--host-timeout 10000 yields
The default unit for --host-timeout is seconds (since April 2010),
Since April 2010, the default unit for --host-timeout is seconds,
so your time of "10000" is 2.8 hours. If this is what you want,
use "10000s".
QUITTING!

12
nmap.cc
View file

@ -654,7 +654,7 @@ int nmap_main(int argc, char *argv[]) {
if (l < 5)
fatal("Bogus --max-rtt-timeout argument specified, must be at least 5ms");
if (l >= 50 * 1000 && tval_unit(optarg) == NULL)
fatal("The default unit for --max-rtt-timeout is seconds (since April 2010), so your time of \"%s\" is %g seconds. Use \"%sms\" for %g milliseconds.", optarg, l / 1000.0, optarg, l / 1000.0);
fatal("Since April 2010, the default unit for --max-rtt-timeout is seconds, so your time of \"%s\" is %g seconds. Use \"%sms\" for %g milliseconds.", optarg, l / 1000.0, optarg, l / 1000.0);
if (l < 20)
error("WARNING: You specified a round-trip time timeout (%ld ms) that is EXTRAORDINARILY SMALL. Accuracy may suffer.", l);
pre_max_rtt_timeout = l;
@ -663,14 +663,14 @@ int nmap_main(int argc, char *argv[]) {
if (l < 0)
fatal("Bogus --min-rtt-timeout argument specified");
if (l >= 50 * 1000 && tval_unit(optarg) == NULL)
fatal("The default unit for --min-rtt-timeout is seconds (since April 2010), so your time of \"%s\" is %g seconds. Use \"%sms\" for %g milliseconds.", optarg, l / 1000.0, optarg, l / 1000.0);
fatal("Since April 2010, the default unit for --min-rtt-timeout is seconds, so your time of \"%s\" is %g seconds. Use \"%sms\" for %g milliseconds.", optarg, l / 1000.0, optarg, l / 1000.0);
pre_min_rtt_timeout = l;
} else if (optcmp(long_options[option_index].name, "initial-rtt-timeout") == 0) {
l = tval2msecs(optarg);
if (l <= 0)
fatal("Bogus --initial-rtt-timeout argument specified. Must be positive");
if (l >= 50 * 1000 && tval_unit(optarg) == NULL)
fatal("The default unit for --initial-rtt-timeout is seconds (since April 2010), so your time of \"%s\" is %g seconds. Use \"%sms\" for %g milliseconds.", optarg, l / 1000.0, optarg, l / 1000.0);
fatal("Since April 2010, the default unit for --initial-rtt-timeout is seconds, so your time of \"%s\" is %g seconds. Use \"%sms\" for %g milliseconds.", optarg, l / 1000.0, optarg, l / 1000.0);
pre_init_rtt_timeout = l;
} else if (strcmp(long_options[option_index].name, "excludefile") == 0) {
if (exclude_spec)
@ -713,7 +713,7 @@ int nmap_main(int argc, char *argv[]) {
if (l <= 0)
fatal("Bogus --host-timeout argument specified");
if (l >= 10000 * 1000 && tval_unit(optarg) == NULL)
fatal("The default unit for --host-timeout is seconds (since April 2010), so your time of \"%s\" is %.1f hours. If this is what you want, use \"%ss\".", optarg, l / 1000.0 / 60 / 60, optarg);
fatal("Since April 2010, the default unit for --host-timeout is seconds, so your time of \"%s\" is %.1f hours. If this is what you want, use \"%ss\".", optarg, l / 1000.0 / 60 / 60, optarg);
pre_host_timeout = l;
} else if (strcmp(long_options[option_index].name, "ttl") == 0) {
o.ttl = atoi(optarg);
@ -750,7 +750,7 @@ int nmap_main(int argc, char *argv[]) {
if (l < 0)
fatal("Bogus --scan-delay argument specified.");
if (l >= 100 * 1000)
fatal("The default unit for --scan-delay is seconds (since April 2010), so your time of \"%s\" is %.1f minutes. Use \"%sms\" for %g milliseconds.", optarg, l / 1000.0 / 60, optarg, l / 1000.0);
fatal("Since April 2010, the default unit for --scan-delay is seconds, so your time of \"%s\" is %.1f minutes. Use \"%sms\" for %g milliseconds.", optarg, l / 1000.0 / 60, optarg, l / 1000.0);
pre_scan_delay = l;
} else if (optcmp(long_options[option_index].name, "defeat-rst-ratelimit") == 0) {
o.defeat_rst_ratelimit = 1;
@ -759,7 +759,7 @@ int nmap_main(int argc, char *argv[]) {
if (l < 0)
fatal("Bogus --max-scan-delay argument specified.");
if (l >= 100 * 1000)
fatal("The default unit for --max-scan-delay is seconds (since April 2010), so your time of \"%s\" is %.1f minutes. If this is what you want, use \"%ss\".", optarg, l / 1000.0 / 60, optarg);
fatal("Since April 2010, the default unit for --max-scan-delay is seconds, so your time of \"%s\" is %.1f minutes. If this is what you want, use \"%ss\".", optarg, l / 1000.0 / 60, optarg);
pre_max_scan_delay = l;
} else if (optcmp(long_options[option_index].name, "max-retries") == 0) {
pre_max_retries = atoi(optarg);