Nmap Development mailing list archives
[Exp PATCH] Fix a "bug" in Traceroute output
From: Kris Katterjohn <katterjohn () gmail com>
Date: Sat, 17 Mar 2007 19:15:21 -0500
The attached patch (/nmap-exp/kris SVN r4583) fixes a "bug" in the output of --traceroute. A ScanProgressMeter (SPM) is made in Traceroute::Traceroute(), causing a "Initiating Traceroute on ..." to be printed on stdout (and <taskbegin task="Traceroute" ...> for XML). SPM->endTask() is never called, so no "Completed Traceroute ..." or "<taskend ...>" is printed. If I did a --traceroute for google.com and kernel.org in the same scan, I would get "Initiating Traceroute ..." once (when it should be twice), with no "Completed ..." message. And the "xxx.xxx.xxx.xxx: guessing hop distance at ..." messages for the different hosts are all together with no separation. This just reorganizes the SPM stuff. It's all now local to Traceroute::trace() instead of a few different places. And now there's a <taskend ..> for the <taskbegin ..>'s, and "Completed Traceroute ..." for the "Initiating ..."'s. The "guessing hop distance" lines are printed inside the correct "Initiating" and "Completed" lines. Whew.. that's a lot of words for a small patch :) It works great for me, so lemme know what you think! Thanks, Kris Katterjohn
Index: traceroute.h
===================================================================
--- traceroute.h (revision 4582)
+++ traceroute.h (revision 4583)
@@ -317,7 +317,6 @@
struct scan_info scaninfo;
- ScanProgressMeter *SPM;
Target **hops;
pcap_t *pd;
eth_t *ethsd;
Index: traceroute.cc
===================================================================
--- traceroute.cc (revision 4582)
+++ traceroute.cc (revision 4583)
@@ -218,7 +218,6 @@
/* rely on each group using the same device */
pd = my_pcap_open_live (device_name, 100, o.spoofsource ? 1 : 0, 2);
- SPM = new ScanProgressMeter ("Traceroute");
scaninfo.initial_proto = IPPROTO_IP;
scaninfo.open_response = 0;
@@ -304,8 +303,6 @@
free(hops);
for (; it != TraceGroups.end (); ++it)
delete (it->second);
- assert(SPM != NULL);
- delete (SPM);
if (ethsd)
ethsd = NULL;
close (fd);
@@ -789,6 +786,7 @@
TraceProbe *tp = NULL;
TraceGroup *tg = NULL;
Target *t = NULL;
+ ScanProgressMeter *SPM;
u16 total_size, total_complete;
if (o.af () == AF_INET6) {
@@ -816,6 +814,8 @@
* legitimate to trace to */
sendTTLProbes (Targets, valid_targets);
+ SPM = new ScanProgressMeter ("Traceroute");
+
while (!readTraceResponses ()) {
for (targ = valid_targets.begin (); targ != valid_targets.end (); ++targ) {
t = *targ;
@@ -861,6 +861,8 @@
swap (total_complete, total_size);
SPM->printStats (MIN ((double) total_complete / total_size, 0.99), NULL);
}
+ SPM->endTask(NULL, NULL);
+ delete (SPM);
}
/* Resolves traceroute hops through nmaps
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- [Exp PATCH] Fix a "bug" in Traceroute output Kris Katterjohn (Mar 17)
- Re: [Exp PATCH] Fix a "bug" in Traceroute output Fyodor (Mar 17)
