Nmap Development mailing list archives
Re: [NSE] new function to parse arguments
From: Patrick Donnelly <batrick () batbytes com>
Date: Sat, 14 Aug 2010 22:49:32 -0400
On Sat, Aug 14, 2010 at 1:57 PM, 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.
I would suggest returning multiple script-arguments instead of a table. That way the script writer can do instead: local arg1, arg2, argn = stdnse.get_script_args("arg1", "arg2", "argn"); -- - Patrick Donnelly _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- [NSE] new function to parse arguments Djalal Harouni (Aug 14)
- Re: [NSE] new function to parse arguments Ron (Aug 14)
- Re: [NSE] new function to parse arguments Fyodor (Aug 16)
- Re: [NSE] new function to parse arguments Ron (Aug 16)
- Re: [NSE] new function to parse arguments Djalal Harouni (Aug 16)
- Re: [NSE] new function to parse arguments David Fifield (Aug 16)
- Re: [NSE] new function to parse arguments Djalal Harouni (Aug 16)
- Re: [NSE] new function to parse arguments Fyodor (Aug 16)
- Re: [NSE] new function to parse arguments Ron (Aug 14)