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:
@@ -36,8 +36,8 @@ is 0. The payload is consisted of random bytes.
|
|||||||
--
|
--
|
||||||
-- @output
|
-- @output
|
||||||
-- | broadcast-ping:
|
-- | broadcast-ping:
|
||||||
-- | IP: 192.168.1.1 MAC: 00:23:69:2a:b1:25
|
-- | IP: 192.168.1.1 MAC: 00:23:69:2a:b1:25
|
||||||
-- | IP: 192.168.1.106 MAC: 1c:65:9d:88:d8:36
|
-- | IP: 192.168.1.106 MAC: 1c:65:9d:88:d8:36
|
||||||
-- |_ Use the newtargets script-arg to add the results as targets
|
-- |_ Use the newtargets script-arg to add the results as targets
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
@@ -51,6 +51,7 @@ require "stdnse"
|
|||||||
require "packet"
|
require "packet"
|
||||||
require "openssl"
|
require "openssl"
|
||||||
require "bin"
|
require "bin"
|
||||||
|
require "tab"
|
||||||
require "target"
|
require "target"
|
||||||
|
|
||||||
prerule = function()
|
prerule = function()
|
||||||
@@ -256,16 +257,18 @@ action = function()
|
|||||||
until next(threads) == nil
|
until next(threads) == nil
|
||||||
|
|
||||||
-- generate output
|
-- generate output
|
||||||
local output = {}
|
local output = tab.new()
|
||||||
for ip_addr, mac_addr in pairs(icmp_responders) do
|
for ip_addr, mac_addr in pairs(icmp_responders) do
|
||||||
if target.ALLOW_NEW_TARGETS then
|
if target.ALLOW_NEW_TARGETS then
|
||||||
target.add(ip_addr)
|
target.add(ip_addr)
|
||||||
end
|
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
|
end
|
||||||
if #output > 0 and not target.ALLOW_NEW_TARGETS then
|
if #output > 0 then
|
||||||
table.insert(output,"Use the newtargets script-arg to add the results as targets")
|
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
|
end
|
||||||
|
|
||||||
return stdnse.format_output( (#output>0), output )
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user