Nmap Development mailing list archives
Re: [NSE] Patch to get_args for deprecation
From: Ron <ron () skullsecurity net>
Date: Thu, 23 Sep 2010 21:57:00 -0500
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thu, 23 Sep 2010 19:42:34 -0700 David Fifield <david () bamsoftware com> wrote:
Yes, that's a great idea. I think the default behavior (for scripts)
should also be to automatically add the script prefix, so
stdnse.get_script_args("path")
in http-whatever.nse would accept either of the arguments "path" or
"http-whatever.path". This matches the convention that Kris uses in
his scripts. And then scripts would automatically support the naming
convention instead of manually doing it.
I can see one issue that may actually not be an issue. The smbbasic argument (which turns on 'basic' authentication as opposed to extended) is in smb.lua, but smbuser and smbpass are both defined in smbauth.lua. It'd be best if those were all in the 'smb.' namespace, even though the others are technically defined in smbauth.lua. Now, an immediate argument against that is that, by enforcing the filename prefix, it makes it far easier for users (and applications) to find documentation, among many other benefits. As a workaround, I could read smbuser and smbpass in smb.lua and pass them to the smbauth.lua function as an argument. That might be the best anyways.
I agree that it would be nice to have some other way to mark
deprecation than its position in the list. One idea I had is to use
some reserved character that we don't use in script argument names,
like
stdnse.get_script_args({'smb.user', '!smbuser'}, {'smb.pass',
'!smbpass'}, 'domain')
But that's not really so important, and if it's easy to keep
supporting the old names then there's no real reason to deprecate
them.
The only real reason is to prevent confusion, really. But I'd have no intention of ever removing the originals, they're documented as the originals in too many places already. But I do like the idea of the '!' prefix. That'd nicely support both me and Kris's goals while keeping the code clean.
Ron, go ahead and commit your change to allow arrays, and we can discuss the deprecation question further.
Done. Thanks for the quick feedback!
David Fifield
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkycE3wACgkQ2t2zxlt4g/TtygCeK2g7unz3MEr1Xa5/tH5tY7wr QuwAn2HQR4Ed06J+G4i7pxD9Qta0kzxc =zK1l -----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)
