Nmap Development mailing list archives
NSE argument table syntax
From: Joao Correa <joao () livewire com br>
Date: Mon, 22 Jun 2009 19:04:27 -0300
Hello Everyone, On my last meeting with Fyodor, David and Patrick we discussed about a new syntax to use script argument tables. This new syntax would be much simpler to use since, nmap ... --script-args=httpproxy={url=scanme.nmap.org,pattern=xxx} would became: nmap ... --script-args=httpproxy.url=scanme.nmap.org,httpproxy.pattern=xxx This new syntax is already supported by NSE, the only problem is that doing the old way you would have one extra indirection, the table httpproxy would be a table inside nmap.registry.args. Using the new syntax this indirection does not exist, and httpproxy.url (for example) is the index inside the table nmap.registry.args. This turns out to be a problem when trying to keep backwards compatibility, because it would be correct for scripts to accept both syntaxes. Scripts must have a way to deal with both and it can make them more complex. I've written a function and appended to stdnse lib. This function transforms arguments with the new syntax in arguments with the old one. The problem is that this function must be called explicitly inside the scripts, since it relies on knowing the table and argument names. I'm not sure that it is the best way to do so, perhaps we could do something similar every time a script is executed, avoiding the explicit call. Any suggestions? Using the function is simple, you just need to set a table with arguments names and call: args = {"url","pattern"} parse_table_args{"proxy",args} Follows the patch. Thanks! Joao
Attachment:
parse_table_args.diff
Description:
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- NSE argument table syntax Joao Correa (Jun 22)
- Re: NSE argument table syntax David Fifield (Jun 22)
- Re: NSE argument table syntax Joao Correa (Jun 22)
- Re: NSE argument table syntax Kris Katterjohn (Jun 22)
- Re: NSE argument table syntax David Fifield (Jun 22)
- Re: NSE argument table syntax Joao Correa (Jun 23)
- Re: NSE argument table syntax Joao Correa (Jun 22)
- Re: NSE argument table syntax David Fifield (Jun 22)