Created
August 26, 2013 01:51
-
-
Save d33tah/6337489 to your computer and use it in GitHub Desktop.
A quick-and-dirty patch that forces Nmap to keep printing the current progress, displaying it in a single line.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/scan_engine.cc b/scan_engine.cc | |
index c712d72..e31df95 100644 | |
--- a/scan_engine.cc | |
+++ b/scan_engine.cc | |
@@ -5738,7 +5738,7 @@ void ultra_scan(std::vector<Target *> &Targets, struct scan_lists *ports, | |
// printf("TRACE: Finished waitForResponses() at %.4fs\n", o.TimeSinceStartMS(&USI.now) / 1000.0); | |
processData(&USI); | |
- if (keyWasPressed()) { | |
+ if (true) { | |
// This prints something like | |
// SYN Stealth Scan Timing: About 1.14% done; ETC: 15:01 (0:43:23 remaining); | |
USI.SPM->printStats(USI.getCompletionFraction(), NULL); | |
diff --git a/timing.cc b/timing.cc | |
index 25b37eb..556ae0b 100644 | |
--- a/timing.cc | |
+++ b/timing.cc | |
@@ -659,7 +659,7 @@ bool ScanProgressMeter::printStats(double perc_done, | |
// data for decent timing estimates. Also with perc_done == 0 | |
// these elements will be nonsensical. | |
if (perc_done < 0.01) { | |
- log_write(LOG_STDOUT, "%s Timing: About %.2f%% done\n", | |
+ log_write(LOG_STDOUT, "\r%s Timing: About %.2f%% done", | |
scantypestr, perc_done * 100); | |
log_flush(LOG_STDOUT); | |
return true; | |
@@ -676,7 +676,7 @@ bool ScanProgressMeter::printStats(double perc_done, | |
ltime = localtime(&timet); | |
assert(ltime); | |
- log_write(LOG_STDOUT, "%s Timing: About %.2f%% done; ETC: %02d:%02d (%.f:%02.f:%02.f remaining)\n", | |
+ log_write(LOG_STDOUT, "\r%s Timing: About %.2f%% done; ETC: %02d:%02d (%.f:%02.f:%02.f remaining)", | |
scantypestr, perc_done * 100, ltime->tm_hour, ltime->tm_min, | |
floor(time_left_s / 60.0 / 60.0), | |
floor(fmod(time_left_s / 60.0, 60.0)), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment