Nmap Development mailing list archives

[NSE] Reflection facilities for better verbose/debug output


From: Patrick Donnelly <batrick () batbytes com>
Date: Sun, 23 Sep 2012 18:12:28 -0400

Hi list,

I wrote up two new stdnse functions to allow libraries (in particular)
to know what script is running. The specific use-case is to improve
debug/verbose output and alleviate the need for a script to pass
SCRIPT_NAME to the debug/verbose functions. As part of this patch,
I've also shortened the print_verbose and print_debug function names
to simply verbose and debug, respectively.

The output is a little larger but maybe more useful. Many scripts
should be changed to no longer pass SCRIPT_NAME to
print_debug/print_verbose functions. Scripts should also be changed to
use the shorter names.

Here's some sample output. Note that some scripts are still passing
SCRIPT_NAME to debug/verbose and so the script id is printed twice.

NSE: ['http-default-accounts' (thread: 0x3231610)] HTTP: Host returns
proper 404 result.
NSE: ['http-default-accounts' (thread: 0x3231610)]
http-default-accounts: Loading fingerprints:
/home/batrick/nmap/svn/nmap-debug/nselib/data/http-default-accounts-fingerprints
.lua
NSE: ['http-default-accounts' (thread: 0x3231610)]
http-default-accounts: 5 fingerprints were loaded
NSE: ['http-default-accounts' (thread: 0x3231610)]
http-default-accounts: Trying known locations under path '' (change
with 'http-default-accounts.basepath' argument)
NSE: ['http-default-accounts' (thread: 0x3231610)] Total number of
pipelined requests: 9
NSE: Finished http-robots.txt against 127.0.0.1:80.
NSE: ['membase-http-info' (thread: 0x3288ab0)] HTTP: Host returns
proper 404 result.
NSE: ['http-frontpage-login' (thread: 0x3238f30)] Frontpage probably
not installed.
NSE: ['http-malware-host' (thread: 0x324b020)] HTTP: Host returns
proper 404 result.
NSE: ['http-cakephp-version' (thread: 0x32299d0)] HTTP: Host returns
proper 404 result.
NSE: ['http-default-accounts' (thread: 0x3231610)] Number of requests
allowed by pipeline: 9
NSE: ['http-favicon' (thread: 0x32366b0)] No favicon found.
NSE: ['http-vuln-cve2010-0738' (thread: 0x326a7a0)] HTTP: Host returns
proper 404 result.
NSE: ['http-default-accounts' (thread: 0x3231610)] Number of received
responses: 9
NSE: ['http-default-accounts' (thread: 0x3231610)] HTTP: Host returns
proper 404 result.
NSE: ['http-default-accounts' (thread: 0x3231610)]
http-default-accounts: Processing Cacti
NSE: ['http-default-accounts' (thread: 0x3231610)]
http-default-accounts: Processing Apache Tomcat
NSE: ['http-default-accounts' (thread: 0x3231610)]
http-default-accounts: Processing Apache Axis2
NSE: ['http-default-accounts' (thread: 0x3231610)]
http-default-accounts: Processing Arris 2307
NSE: ['http-default-accounts' (thread: 0x3231610)]
http-default-accounts: Processing Cisco 2811
NSE: ['dns-blacklist' (worker thread: 0x348a190)] Query function
returned nothing, skipping 'ip-port.exitlist.torproject.org'
NSE: ['http-vuln-cve2011-3192' (thread: 0x326cee0)]
http-vuln-cve2011-3192: Server ignores the range header (200 status
code)
NSE: ['http-headers' (thread: 0x3247b00)] HTTP: Host supports HEAD.

All of the above are debug function calls. A verbose function call
would print something like:

NSE: ['http-default-accounts'] ...

Not many scripts use verbose output so it's hard to give a real example.


Anyway, I'm leaving this here in case someone is interested in integrating it.

-- 
- Patrick Donnelly

Attachment: nse-debug.2.patch
Description:

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

Current thread: