Nmap Development mailing list archives

Re: Bugfixes for smb-psexec


From: David Fifield <david () bamsoftware com>
Date: Wed, 28 Jul 2010 21:18:29 -0600

On Tue, Jul 06, 2010 at 02:33:58PM -0500, Ron wrote:
On Mon, 5 Jul 2010 18:18:41 -0400 Patrick Donnelly
<batrick () batbytes com> wrote:
Each function can have its own environment, so you don't need to
change the module function in the global environment. Instead you can
assign an environment that has a custom module function:

local f = loadfile(...)
setfenv(f, setmetatable({module = function() end}, {__index = _G}))
f()

-- 
- Patrick Donnelly
Thanks, worked like a charm!

A far cleaner version is attached. The major changes (from the base nmap) are:
o It no longer uses the global environment to store the modules table
o It now uses loadfile() to load the configuration files, which follows best practices better
o The module() line at the top of the configuration files is no longer required, but if it exists all that happens is 
a warning is printed
o Worked around what appears to be a bug in one person's Nmap install where absolute paths didn't resolve properly -- 
I couldn't replicate, but he confirmed it was fixed

Let me know if you see any further issues. If not, I'll commit. 

I think this is fine to commit now.

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


Current thread: