diff -urNb nmap-4.76/nmap.cc nmap-4.76-auto-stats/nmap.cc --- nmap-4.76/nmap.cc 2008-09-10 20:32:35.000000000 +0200 +++ nmap-4.76-auto-stats/nmap.cc 2009-01-06 19:55:37.824815494 +0100 @@ -313,6 +313,7 @@ " --send-eth/--send-ip: Send using raw ethernet frames or IP packets\n" " --privileged: Assume that the user is fully privileged\n" " --unprivileged: Assume the user lacks raw socket privileges\n" + " --auto-stats : Print stats automatically every seconds. Not very accurate\n" " -V: Print version number\n" " -h: Print this help summary page.\n" "EXAMPLES:\n" @@ -679,6 +680,7 @@ {"min-rate", required_argument, 0, 0}, {"max_rate", required_argument, 0, 0}, {"max-rate", required_argument, 0, 0}, + {"auto-stats", required_argument, 0, 0}, {0, 0, 0, 0} }; @@ -942,6 +944,9 @@ } else if(optcmp(long_options[option_index].name, "max-rate") == 0) { if (sscanf(optarg, "%f", &o.max_packet_send_rate) != 1 || o.max_packet_send_rate <= 0.0) fatal("Argument to --max-rate must be a positive floating-point number"); + } else if(strcmp(long_options[option_index].name, "auto-stats") == 0){ + o.auto_stats=true; + o.autostats_seconds=abs(atoi(optarg)); } else { fatal("Unknown long option (%s) given@#!$#$", long_options[option_index].name); } diff -urNb nmap-4.76/NmapOps.cc nmap-4.76-auto-stats/NmapOps.cc --- nmap-4.76/NmapOps.cc 2008-08-05 21:28:51.000000000 +0200 +++ nmap-4.76-auto-stats/NmapOps.cc 2009-01-06 19:55:15.450816048 +0100 @@ -267,6 +267,8 @@ ipopt_lasthop = 0; release_memory = false; topportlevel = -1; + auto_stats = false; + seconds = 0; #ifndef NOLUA script = 0; scriptversion = 0; diff -urNb nmap-4.76/NmapOps.h nmap-4.76-auto-stats/NmapOps.h --- nmap-4.76/NmapOps.h 2008-07-30 02:15:57.000000000 +0200 +++ nmap-4.76-auto-stats/NmapOps.h 2009-01-06 19:55:20.517824661 +0100 @@ -319,6 +319,9 @@ bool log_errors; bool traceroute; bool reason; + bool auto_stats; + int autostats_seconds; + time_t seconds; #ifndef NOLUA int script; diff -urNb nmap-4.76/nmap_tty.cc nmap-4.76-auto-stats/nmap_tty.cc --- nmap-4.76/nmap_tty.cc 2008-05-22 22:45:32.000000000 +0200 +++ nmap-4.76-auto-stats/nmap_tty.cc 2009-01-06 19:55:28.704816004 +0100 @@ -240,6 +240,18 @@ print a status message */ bool keyWasPressed() { + if (o.auto_stats) { + if (o.seconds == 0) + o.seconds = time(NULL); + + time_t seconds_temp = time(NULL); + if ((seconds_temp-o.seconds) > o.autostats_seconds) { + o.seconds = seconds_temp; + printStatusMessage(); + return true; + } + } + int c; if (o.noninteractive)