Nmap Development mailing list archives

Re: [NSE] new function to parse arguments


From: Ron <ron () skullsecurity net>
Date: Sat, 14 Aug 2010 21:20:15 -0500

Nice, I've been meaning to write something like that. The whole unsafe=1 thing was pretty ugly. 

On Sat, 14 Aug 2010 18:57:06 +0100 Djalal Harouni <tixxdz () gmail com>
wrote:
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


-- 
Ron Bowes
http://www.skullsecurity.org
http://www.twitter.com/iagox86

Attachment: _bin
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: