1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-01 20:39:02 +00:00

NSE enhanced output patch

This commit is contained in:
devin
2014-05-29 03:22:59 +00:00
parent 415e2671ab
commit 5e6c9d5f78
3 changed files with 148 additions and 23 deletions

View File

@@ -443,7 +443,7 @@ do
co = co,
env = env,
identifier = tostring(co),
info = format("'%s' (%s)", self.short_basename, tostring(co));
info = format("'%s' M:%s", self.id, match(tostring(co), "0x(.*)") , -1);
parent = nil, -- placeholder
script = self,
type = script_type,
@@ -466,7 +466,7 @@ do
args = {n = select("#", ...), ...},
close_handlers = {},
co = co,
info = format("'%s' worker (%s)", self.short_basename, tostring(co));
info = format("'%s' W:%s", self.id, match(tostring(co), "0x(.*)") , -1);
parent = self,
worker = true,
};
@@ -905,6 +905,20 @@ local function run (threads_iter, hosts)
rawset(stdnse, "base", function ()
return current and current.co;
end);
rawset(stdnse, "gettid", function ()
return current and current.identifier;
end);
rawset(stdnse, "getid", function ()
return current and current.id;
end);
rawset(stdnse, "gethostport", function ()
if current then
return current.host, current.port;
end
end);
rawset(stdnse, "isworker", function ()
return current and current.worker;
end);
while threads_iter and num_threads < CONCURRENCY_LIMIT do
local thread = threads_iter()
@@ -1344,6 +1358,10 @@ local function main (hosts, scantype)
-- These functions do not exist until we are executing action functions.
rawset(stdnse, "new_thread", nil)
rawset(stdnse, "base", nil)
rawset(stdnse, "gettid", nil)
rawset(stdnse, "getid", nil)
rawset(stdnse, "gethostport", nil)
rawset(stdnse, "isworker", nil)
for runlevel, scripts in ipairs(runlevels) do
-- This iterator is passed to the run function. It returns one new script