Nmap Development mailing list archives

[NSE] new function to parse arguments


From: Djalal Harouni <tixxdz () gmail com>
Date: Sat, 14 Aug 2010 18:57:06 +0100

Hi,

I've just added a simple code to check script arguments to the stdnse
library in my branch: nmap-exp/djalal/nmap-add-targets  as r19753,r19755
and the patch is attached. The new function get_script_args() returns a
table of valid argument/value pairs.

This simple function if used by script writers, lets the user to specify
script arguments as:
--script-args="unsafe=1" or --script-args="unsafe"

So the user do not need to *set* the 'unsafe' argument to activate it.
The value of the argument is this situation will be a number '1' instead
of a boolean to avoid some possible comparison errors in scripts.

Adding code to specify/check argument types in the function will simply
add complexity.

Examples are shown in the nsedoc of the patch, pls let me know if you
have suggestions.

-- 
tixxdz

Attachment: get_script_args.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: