Nmap Development mailing list archives

Re: Bugfixes for smb-psexec


From: Ron <ron () skullsecurity net>
Date: Tue, 6 Jul 2010 14:33:58 -0500

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. 
-- 
Ron Bowes
http://www.skullsecurity.org
http://www.twitter.com/iagox86

Attachment: psexec-updates-2.diff
Description:

Attachment: _bin
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: