mirror of
https://github.com/nmap/nmap.git
synced 2025-12-19 14:09:02 +00:00
Rewrite some duplicated loops.
This commit is contained in:
@@ -257,19 +257,15 @@ action = function()
|
|||||||
|
|
||||||
-- generate output
|
-- generate output
|
||||||
local output = {}
|
local output = {}
|
||||||
|
for ip_addr, mac_addr in pairs(icmp_responders) do
|
||||||
if target.ALLOW_NEW_TARGETS then
|
if target.ALLOW_NEW_TARGETS then
|
||||||
for ip_addr, mac_addr in pairs(icmp_responders) do
|
|
||||||
target.add(ip_addr)
|
target.add(ip_addr)
|
||||||
|
end
|
||||||
table.insert(output,"IP: "..ip_addr..string.rep(" ",15-#ip_addr).." MAC: "..mac_addr)
|
table.insert(output,"IP: "..ip_addr..string.rep(" ",15-#ip_addr).." MAC: "..mac_addr)
|
||||||
end
|
end
|
||||||
else
|
if #output > 0 and not target.ALLOW_NEW_TARGETS then
|
||||||
for ip_addr, mac_addr in pairs(icmp_responders) do
|
|
||||||
table.insert(output,"IP: "..ip_addr..string.rep(" ",15-#ip_addr).." MAC: "..mac_addr)
|
|
||||||
end
|
|
||||||
if #output>0 then
|
|
||||||
table.insert(output,"Use the newtargets script-arg to add the results as targets")
|
table.insert(output,"Use the newtargets script-arg to add the results as targets")
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
return stdnse.format_output( (#output>0), output )
|
return stdnse.format_output( (#output>0), output )
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user