Nmap Development mailing list archives

Re: [NSE] Reflection facilities for better verbose/debug output


From: David Fifield <david () bamsoftware com>
Date: Sun, 23 Sep 2012 21:40:33 -0700

On Sun, Sep 23, 2012 at 06:12:28PM -0400, Patrick Donnelly wrote:
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.

This is a good idea. Let us not simply alias print_debug and
print_verbose to the new functions, because of the double script id
problem you mentioned. Rather let's keep the behavior of those functions
the same and deprecate them, and then change scripts to use the new
names, pruning script ids when needed. This way we have an incentive to
migrate scripts so that they serve as examples of the new style.

NSE: ['http-default-accounts' (thread: 0x3231610)] HTTP: Host returns proper 404 result.

Could this be more concise? Like

NSE: [http-default-accounts 0x3231610] HTTP: Host returns proper 404 result.

Even that is quite long; maybe the thread id should only be there for
-d2 or higher.

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


Current thread: