Nmap Development mailing list archives

[NSE] Patch to get_args for deprecation


From: Ron <ron () skullsecurity net>
Date: Thu, 23 Sep 2010 21:08:15 -0500

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

I was getting ready to convert my smb_* stuff to use stdnse.get_script_args(), but I realized that my script-args don't 
really follow the conventional format of script.name or library.name. I'd like to, for example, change 'smbuser' and 
'smbpass' to 'smb.user' and 'smb.pass'. With the patch attached, you'd be able to do this:

local smbuser, smbpass, domain = stdnse.get_script_args({'smb.user', 'smbuser'}, {'smb.pass', 'smbpass'}, 'domain')

Basically, each argument can, optionally, be an array. If it's an array, the first element is the proper one and all 
remaining are deprecated. They'll still be accepted, but the user will get a warning:
NSE: WARNING: Option 'smbuser' is deprecated; use 'smb.user' instead.
NSE: WARNING: Option 'smbpass' is deprecated; use 'smb.pass' instead.

I tested the attached patch and it looks fine. Any feelings about this?

Ron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkycCA8ACgkQ2t2zxlt4g/Q2bwCg10oHN8JKoRpB0h8pXHXa5pk3
9U0An1fegmg+AVW4ojPOHOqvF+i2tSiM
=S7QB
-----END PGP SIGNATURE-----

Attachment: deprecation.patch
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: