mirror of
https://github.com/nmap/nmap.git
synced 2026-10-21 03:11:48 +00:00
Fix some output formatting and a crash
This commit is contained in:
parent
0f99596555
commit
566120ca58
1 changed files with 8 additions and 6 deletions
|
|
@ -104,19 +104,21 @@ end
|
|||
local function format_output(results)
|
||||
local output = tab.new()
|
||||
local xmlout = {}
|
||||
local ips = stdnse.keys(results)
|
||||
table.sort(ips)
|
||||
|
||||
for i, record in ipairs(table.sort(stdnse.keys(results))) do
|
||||
for i, ip in ipairs(ips) do
|
||||
record = results[ip]
|
||||
xmlout[i] = record
|
||||
tab.addrow(output, "IP: " .. record.address, "MAC: " .. record.mac, "IFACE: " .. record.iface)
|
||||
tab.addrow(output, " IP: " .. record.address, "MAC: " .. record.mac, "IFACE: " .. record.iface)
|
||||
end
|
||||
|
||||
if ( #output > 0 ) then
|
||||
output = { tab.dump(output) }
|
||||
output = {"", tab.dump(output) }
|
||||
if not target.ALLOW_NEW_TARGETS then
|
||||
table.insert(output, "")
|
||||
table.insert(output, "Use --script-args=newtargets to add the results as targets")
|
||||
table.insert(output, " Use --script-args=newtargets to add the results as targets")
|
||||
end
|
||||
return xmlout, table.concat(output, "\n ")
|
||||
return xmlout, table.concat(output, "\n")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue