Nmap Development mailing list archives

Re: [NSE] Adding mkdir support


From: Djalal Harouni <tixxdz () opendz org>
Date: Fri, 30 Mar 2012 23:14:43 +0100

Hi,

Just some notes to consider:

On Fri, Mar 30, 2012 at 04:57:49PM -0400, Patrick Donnelly wrote:
On Fri, Mar 30, 2012 at 2:30 PM, Patrik Karlsson <patrik () cqure net> wrote:
I'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).
I don't think that we need to export all the lfs functions (I don't like
the rmdir...), just the ones we need, beside that before we include this
we should probably define how scripts will create dirs/files and where...

Just to avoid the unix tricks and to avoid situations where scripts create
lot of dirs/files according to network input ... (if a script contains a
bug...) and to keep Nmap's spirit about files.

-- 
tixxdz
http://opendz.org
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: