Home page logo

nmap-dev logo 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"}

Follows the patch.


Attachment: parse_table_args.diff

Sent through the nmap-dev mailing list
Archived at http://SecLists.Org

  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]