mirror of
https://github.com/nmap/nmap.git
synced 2025-12-21 06:59:01 +00:00
Use tab instead of manually counting spaces.
This commit is contained in:
@@ -51,6 +51,7 @@ require "stdnse"
|
||||
require "packet"
|
||||
require "openssl"
|
||||
require "bin"
|
||||
require "tab"
|
||||
require "target"
|
||||
|
||||
prerule = function()
|
||||
@@ -256,16 +257,18 @@ action = function()
|
||||
until next(threads) == nil
|
||||
|
||||
-- generate output
|
||||
local output = {}
|
||||
local output = tab.new()
|
||||
for ip_addr, mac_addr in pairs(icmp_responders) do
|
||||
if target.ALLOW_NEW_TARGETS then
|
||||
target.add(ip_addr)
|
||||
end
|
||||
table.insert(output,"IP: "..ip_addr..string.rep(" ",15-#ip_addr).." MAC: "..mac_addr)
|
||||
tab.addrow(output, "IP: " .. ip_addr, "MAC: " .. mac_addr)
|
||||
end
|
||||
if #output > 0 and not target.ALLOW_NEW_TARGETS then
|
||||
table.insert(output,"Use the newtargets script-arg to add the results as targets")
|
||||
if #output > 0 then
|
||||
output = { tab.dump(output) }
|
||||
if not target.ALLOW_NEW_TARGETS then
|
||||
output[#output + 1] = "Use the newtargets script-arg to add the results as targets"
|
||||
end
|
||||
return stdnse.format_output(true, output)
|
||||
end
|
||||
|
||||
return stdnse.format_output( (#output>0), output )
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user