Nmap Development mailing list archives

[PATCH] printf() -> log_write() and --script-trace changes


From: Kris Katterjohn <katterjohn () gmail com>
Date: Wed, 04 Jul 2007 18:11:47 -0500

Hey everyone!

r5085 in the soc07 branch changes bare printf()s to
log_write(LOG_PLAIN,)s because otherwise they are *always* printed even
if XML or greppable output is sent to stdout (e.g. -oX -).  I noticed it
with the "Timing report" (lists hostgroups, rtt-timeouts, etc) and knew
something was wrong :)

o.scripttrace enables the printing of packets sent/received in the
scripts, but nsock tracing was done regardless.  I made a new
o.scriptTrace() to handle it like o.packetTrace() and o.versionTrace()
(so that debug levels and --packet-trace are factors as well), and nsock
tracing is only done if this is enabled.  Other occurrences of
o.scripttrace in nse_nsock.cc were also changed to o.scriptTrace().

NmapOps.h:

#ifndef NOLUA
bool scriptTrace() { return packetTrace()? true : scripttrace; }
#endif

nse_nsock.cc:

if (o.scriptTrace())
        nsp_settrace(nsp, 5, o.getStartTime());

nsp_settrace() was what was always done, and set the tracing level to
o.debugging. But I changed it to 5 to be like DNS and version detection
(so they should all act the same, for consistency).

At higher debug levels (usually 3, depending on which trace options are
used), the nsock tracing is still done even when the different output
types are sent to stdout, but that shouldn't happen very often.


Please let me know if you have any problems!

Thanks,
Kris Katterjohn

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: