1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-21 06:59:01 +00:00

Fix to make SCRIPT_NAME not have a filename extension in certain situations.

See [1].

[1] http://seclists.org/nmap-dev/2011/q3/304
This commit is contained in:
batrick
2011-07-21 18:26:11 +00:00
parent 9d7ce06a96
commit 4d27d83f62

View File

@@ -386,10 +386,9 @@ do
"Warning: Loading '%s' -- the recommended file extension is '.nse'.",
filename);
end
local basename = match(filename, "[/\\]([^/\\]-)$") or filename;
local short_basename = match(filename, "[/\\]([^/\\]-)%.nse$") or
match(filename, "[/\\]([^/\\]-)%.[^.]*$") or
filename;
local basename = match(filename, "([^/\\]+)$") or filename;
local short_basename = match(filename, "([^/\\]+)%.nse$") or
match(filename, "([^/\\]+)%.[^.]*$") or filename;
local file_closure = assert(loadfile(filename));
-- Give the closure its own environment, with global access
local env = {