Nmap Development mailing list archives
Re: [NSE] Adding mkdir support
From: Patrick Donnelly <batrick () batbytes com>
Date: Fri, 30 Mar 2012 16:57:49 -0400
On Fri, Mar 30, 2012 at 2:30 PM, Patrik Karlsson <patrik () cqure net> wrote:
On Fri, Mar 30, 2012 at 12:26 AM, Patrick Donnelly <batrick () batbytes com> wrote:On Thu, Mar 29, 2012 at 6:10 PM, Patrik Karlsson <patrik () cqure net> wrote:I think adding lfs to NSE is a good solution. We can move the NSE specific stuff to the private cnse library in nse_main.cc or maybe in nse_nmaplib.cc.Sounds like a good idea. How much work would it involve do you think? Is it a matter of simply copying the code over or does it require a lot other changes?Very little work. It would involve moving the nse_fetch* functions in nse_fs.cc to nse_main.cc. Correct the references in nse_main.cc and nse_main.lua which I believe are cnse.fs.* to cnse.*. The rest is just copying lfs.[ch] and adding code in nse_main.cc to load the library into the global namespace. You can look at nse_bit.(cc|h) as a simple example. -- - Patrick DonnellyI'm attaching a patch that adds lfs to nse_fs.cc and the fs namespace and moves the functions you mentioned to nse_main.cc. As this is not one of my usual script/library additions I would appreciate all help/suggestions I can get.
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 _______________________________________________ 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] Adding mkdir support Patrik Karlsson (Mar 29)
- Re: [NSE] Adding mkdir support Patrick Donnelly (Mar 29)
- Re: [NSE] Adding mkdir support Patrik Karlsson (Mar 29)
- Re: [NSE] Adding mkdir support Patrick Donnelly (Mar 29)
- Re: [NSE] Adding mkdir support Patrik Karlsson (Mar 29)
- Re: [NSE] Adding mkdir support Patrick Donnelly (Mar 29)
- Re: [NSE] Adding mkdir support Patrik Karlsson (Mar 30)
- Re: [NSE] Adding mkdir support Patrick Donnelly (Mar 30)
- Re: [NSE] Adding mkdir support Djalal Harouni (Mar 30)
- Re: [NSE] Adding mkdir support Patrik Karlsson (Mar 31)
- Re: [NSE] Adding mkdir support Patrik Karlsson (Mar 31)
- Re: [NSE] Adding mkdir support Patrik Karlsson (Mar 29)
- Re: [NSE] Adding mkdir support Patrick Donnelly (Mar 29)