Nmap Development mailing list archives
Re: [NSE] Patch to get_args for deprecation
From: Kris Katterjohn <katterjohn () gmail com>
Date: Thu, 23 Sep 2010 21:29:27 -0500
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 09/23/2010 09:08 PM, Ron wrote:
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?
I haven't tested this yet, but here are my initial thoughts: I think the warning message should be somehow configurable on a per-call or per-script basis. For example, using your patch I think I can update my scripts which have args like probeport and ipidseq.probeport; however, as discussed in previous threads I feel that neither is more preferred than the other and so I don't want a warning printed if a user (like me) uses probeport. There's obviously a difference between my arg names and yours: my scripts let the script name part be optional (e.g. dropping ipidseq) while your update changes the whole name (smbuser -> smb.user), so it's understandable why yours may be marked deprecated. I'm a bit busy right now so I haven't thought about how to support this as an option (if that's desirable), but I wanted to throw this out there in case a discussion takes off.
Ron
Cheers, Kris Katterjohn -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJMnA0GAAoJEEQxgFs5kUfu5YAQAK/Yge+AEAtSDeLXlvk31QhL ftfQsQSQroR+Za1aMOZtij6D562Pd5kZAWNYKE2VzeCp6zunYSSxH0oLrCaJs/7D J/ywPvNYH6sxtfzK9B7lsfh9aYG+cyyonTNDFrFpk8GhAprz0lLPDDXPlmWsBqS+ uNnkR8tGgWuHeaqd9FebbQBAbXhqM6vG5Ar2QiBafhjGIwEAdA/2ojRlY265ppL9 j95cdQzDIWGR9qm6vzb3+cI3PCL7qj1yQhM//5a4LfxQ8xLuWnXgdWvB86vQK4Zm XVlPXWGdI1Flm6FEeRMj6rivsxKgbhXdimf8FlNP6kzvqjaf/xYxN4fnqBZYH3Nj v/IliAjeIEwhkRKH2tYZ+jSYOoHpkxd5h2SLhD5EXToFqob46KPChdnZisIWm0yN P7qLWRgx9eUfSflOM5V4M0Adl3akyPPROl2W5JU+1QLHkvpW4nskd/h3lnpC4c8d SMqnTU2R99dVdU13Ln8IgrYt/lTIgLOsaxr5saBPZkpKQNI8BWTgxvV3xTDhbRq5 6uGlz/mei4da6Rd/3k8UtLaq9a5SljcJi/ZxeCmeBNEZzzHBAmAGW6R4Q5Rb7UQ2 rU9aOzTai57WLDFWGNGLZyXwwwcYqG1ZW5P0td9iZx0br9TUijMfSquqxtNnzNQD MzibGkb7cQPaGFKD6HRd =2bpC -----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:
- [NSE] Patch to get_args for deprecation Ron (Sep 23)
- Re: [NSE] Patch to get_args for deprecation Kris Katterjohn (Sep 23)
- Re: [NSE] Patch to get_args for deprecation David Fifield (Sep 23)
- Re: [NSE] Patch to get_args for deprecation Ron (Sep 23)
- Re: [NSE] Patch to get_args for deprecation David Fifield (Sep 23)
- Re: [NSE] Patch to get_args for deprecation Ron (Sep 24)
- Re: [NSE] Patch to get_args for deprecation David Fifield (Sep 24)
- Re: [NSE] Patch to get_args for deprecation Ron (Sep 25)
- Re: [NSE] Patch to get_args for deprecation David Fifield (Sep 23)
- Re: [NSE] Patch to get_args for deprecation Kris Katterjohn (Sep 23)
- Re: [NSE] Patch to get_args for deprecation Fyodor (Sep 24)
- Re: [NSE] Patch to get_args for deprecation Kris Katterjohn (Sep 23)