mirror of
https://github.com/nmap/nmap.git
synced 2026-08-29 04:53:24 +00:00
Print number of threads per script if <5 scripts. See #701
This commit is contained in:
parent
48641e3a14
commit
d80a4e4e59
1 changed files with 35 additions and 0 deletions
35
nse_main.lua
35
nse_main.lua
|
|
@ -991,6 +991,41 @@ local function run (threads_iter, hosts)
|
|||
thread:d("Waiting: %THREAD_AGAINST\n\t%s",
|
||||
(gsub(traceback(co), "\n", "\n\t")));
|
||||
end
|
||||
elseif debugging() >= 1 then
|
||||
local display = {}
|
||||
local limit = 0
|
||||
for co, thread in pairs(running) do
|
||||
local this = display[thread.short_basename]
|
||||
if not this then
|
||||
this = {}
|
||||
limit = limit + 1
|
||||
if limit > 5 then
|
||||
-- Only print stats if 5 or fewer scripts remaining
|
||||
break
|
||||
end
|
||||
end
|
||||
this[1] = (this[1] or 0) + 1
|
||||
display[thread.short_basename] = this
|
||||
end
|
||||
for co, thread in pairs(waiting) do
|
||||
local this = display[thread.short_basename]
|
||||
if not this then
|
||||
this = {}
|
||||
limit = limit + 1
|
||||
if limit > 5 then
|
||||
-- Only print stats if 5 or fewer scripts remaining
|
||||
break
|
||||
end
|
||||
end
|
||||
this[2] = (this[2] or 0) + 1
|
||||
display[thread.short_basename] = this
|
||||
end
|
||||
if limit <= 5 then
|
||||
for name, stats in pairs(display) do
|
||||
print_debug(1, "Script %s: %d threads running, %d threads waiting",
|
||||
name, stats[1] or 0, stats[2] or 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif total > 0 and progress "mayBePrinted" then
|
||||
if verbosity() > 1 or debugging() > 0 then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue