mailing list archives
Re: [RFC] Username/Password NSE library
From: Kris Katterjohn <katterjohn () gmail com>
Date: Wed, 25 Jun 2008 11:23:30 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Patrick Donnelly wrote:
On Wed, Jun 25, 2008 at 12:25 AM, Kris Katterjohn <katterjohn () gmail com> wrote:
My initial reactions:
* I mentioned the functionality of returning a table of usernames and
passwords, and the option of returning a table of only a certain size,
Like I said, you can modify usernames and passwords to return smaller
tables based on a parameter (e.g. unpwdb.usernames("short")).
Alternatively, you can modify the design to operate on an array (and
use ipairs()). The user could then break on the number he wants e.g.:
for i, user in unpwdb.usernames() do
if i > 20 then break; end
-- do stuff
I understand this, I was merely pointing out that the closure was the method
of choice. I mentioned it initially, and nobody seemed to think that
returning a table was better.
But, like I said, if returning a table is now the desired functionality, then
your changes seem fine.
* The third return value from the functions, which tells the caller whether
we're using a user-defined list or not, is always nil in yours.
This is simply necessary for Lua's generic for loop and the next
function. I suggest alternate functions that return information about
it being a user-defined list and what not.
If returning the table is decided upon, then this makes sense (unless there is
a simpler way).
Aside from these, your changes seem to work fine after I modified my test
script to handle them.
Good to hear it.
I have run into one problem which I didn't test last night: giving the library
a non-existent filename. Rather than returning false and giving the caller an
error message like mine did, or returning the error message like I assume
yours is supposed to do, I get this rather nasty looking error message:
SCRIPT ENGINE: error while initializing script rules:
./nselib/unpwdb.lua:29: bad argument #1 to 'lines' (none: No such file or
[C]: in function 'lines'
./nselib/unpwdb.lua:29: in main chunk
[C]: in function 'require'
./scripts/unpwdbtest.nse:7: in main chunk
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
Sent through the nmap-dev mailing list
Archived at http://SecLists.Org
Re: [RFC] Username/Password NSE library Kris Katterjohn (Jun 24)