Nmap Development mailing list archives

Re: [NSE] Adding mkdir support


From: Patrik Karlsson <patrik () cqure net>
Date: Sat, 31 Mar 2012 21:56:17 +0200



It looks very good. Just a two small changes I think:

o fetchfile_absolute and fetchscript should be static functions.
Remove the declarations in nse_main.h, make the functions static, and
relocate them higher in the file so they are visible to:

  static const luaL_Reg nse[] = {
    {"fetchfile_absolute", fetchfile_absolute},
    {"fetchscript", fetchscript},


o Add a 'local fs = require "fs"' for nse_main.lua. As a rule, that
code avoids all globals (except at the very beginning).

--
- Patrick Donnelly


Thanks! I fixed both changes you mentioned.
In addition, I ended up creating the luadoc in nselib/fs.luadoc as well as
some minor code adjustments as a result of that.
I essentially made sure that all functions returned false instead of nil as
there first return value and added a status return value for one or two
functions that needed it.

The new patch with these changes, including the luadoc is attached. I have
done some testing using a test script and have finished implementing the
http-mirror script which makes use of the mkdir function.

Cheers,
Patrik

-- 
Patrik Karlsson
http://www.cqure.net
http://twitter.com/nevdull77

Attachment: nmap-lfs.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: