Nmap Development mailing list archives
Re: [NSE] Script Arguments with Environment Variables
From: Patrick Donnelly <batrick () batbytes com>
Date: Tue, 8 Jun 2010 13:44:51 -0400
On Thu, Jun 3, 2010 at 8:57 AM, Patrick Donnelly <batrick () batbytes com> wrote:
Hi nmap-dev, From a conversation in #nmap (on Freenode), a user decided to manually change the user agent in the NSE http library so he wouldn't have to add a script argument for every nmap invocation. I was thinking it would be useful to have an environment variable (maybe NMAP_SCRIPTARGS) that the user could set in their startup scripts so changing the libraries/scripts is no longer necessary. What do you all think?
Here's a simple diff that implements this:
<patch>
batrick@batbytes:~/nmap/svn/nmap$ svn diff
Index: nse_main.lua
===================================================================
--- nse_main.lua (revision 17916)
+++ nse_main.lua (working copy)
@@ -69,6 +69,8 @@
local max = math.max;
+local getenv = os.getenv;
+
local byte = string.byte;
local find = string.find;
local format = string.format;
@@ -759,7 +761,8 @@
end
end
end
- nmap.registry.args = parse_table("{"..args.."}", 1);
+ nmap.registry.args = setmetatable(parse_table("{"..args.."}", 1),
+ {__index = parse_table("{"..getenv("NMAP_SCRIPTARGS").."}", 1)});
end
-- Load all user chosen scripts
</patch>
Arguments given on the command line are given precedence over the
arguments given in the NMAP_SCRIPTARGS environment variable.
--
- 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] Script Arguments with Environment Variables Patrick Donnelly (Jun 03)
- Re: [NSE] Script Arguments with Environment Variables Patrick Donnelly (Jun 08)
- Re: [NSE] Script Arguments with Environment Variables Fyodor (Jun 11)
- Re: [NSE] Script Arguments with Environment Variables Fyodor (Jun 11)
