Nmap Development mailing list archives

Re: NSE Script Arguments (Was: Script selection - Gsoc)


From: Kris Katterjohn <katterjohn () gmail com>
Date: Sun, 04 Apr 2010 23:37:15 -0500

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/04/2010 11:14 PM, Patrick Donnelly wrote:
Another option is to make the args globally available via an 'arg'
table for each script (each script has its own args).

That's a cool idea.

I'm undecided on whether we should strip some "identifier" for script
arguments in the above code snippet. Something like this:

arg["ldap-brute.username"] = arg["ldap-brute.username"] or "foo"

versus

arg["username"] = arg["username"] or "foo" -- the ldap-brute prefix is
inferred by nse_main.lua

I think I prefer the former because many scripts "share" the same argument.


I don't like the former, since it's uglier than the latter and seems redundant
to have the script name prefix in the argument name given to that script.

I say just have the arguments with the script id in the name take precedence
over the same argument without the explicit prefix.  This is what I thought it
was used for anyway, and to allow (as you said) for scripts to share args.

The showing below assumes a user runs a script "script" and the evaluations
take place in the context of "script".

If a user specifies "script.user=kris" then

arg["user"] => "kris"

and if a user specifies "user=kris" then

arg["user"] => "kris"

but if a user specifies "script.user=patrick,user=kris" then

arg["user"] => "patrick"

since the prefixed argument takes precedence over the other when used in the
context of the script "script".  So the use of the explicit script prefix is
transparent to the script, and I don't see a problem with this aspect.

Thoughts?

Cheers,
Kris Katterjohn

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIcBAEBAgAGBQJLuWj6AAoJEEQxgFs5kUfubbsP/0uuL65ZcteYs6kqBFh8C1xN
+5u0Fg1zRNy2mM9Gahp90UjcMLfaPf4OQ7sBKd8qiimO8pUHDznwcP3HmfHrA2Nn
4GLz2wq54xDAZ204EOo8BCFLSBr8LAIIQa3fRc7smbpqnB2WUqSEJ+Jrl2CVw0wu
5LOBOo/jClgls3UAf/msL8QFnoorqc9pFaigNPrWvSOjO9MSsCNcW1enCYPG2dR4
yrHqDfBi9J18rR29nxqfytMulhVmgqywzaVTpSYRwto+DvKuSkvA0U9WmoU6O4bm
taqbiJR1WDlurMkUSK99fYPrc9B97UiEFhaCGXaukNrlNzGLiwcxbfgWGVcZsY+z
bsgI9MTZ9rm3n6npdGQbDhXRjKPVFRRZbVK4CsaUoSji4CbbvkxnnpNNl1uqKElS
Rzv3LpXWjuXmBxZomdonVd6sjGPl1JmDmXRawf0fJrxksSaHV0rtb4OThx7wKp04
nAr6Feh7Bj0tKu0EFxUo/LgPdyS5ECai5Qg/wtCAPRlhqvI4U6YARTg+eqSw7seo
/Si48oAm+LYM7YsURWZ55xM6jDvFbfBXAGI9K8ttZ8UtSbfw0Mf/ZRIOXIC/5KaN
ganRGy+F0u2xqM3okUc6bGL4aNDYplferSBBWl3K3xVm2C54QPq7/I/S8F8K+Djy
pfiKllbicQ6eejOrzK29
=3EGS
-----END PGP SIGNATURE-----
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: