From 566120ca581ad3762ab84b8763d617481e6a684d Mon Sep 17 00:00:00 2001 From: dmiller Date: Fri, 18 Dec 2015 21:48:44 +0000 Subject: [PATCH] Fix some output formatting and a crash --- scripts/targets-ipv6-multicast-mld.nse | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/targets-ipv6-multicast-mld.nse b/scripts/targets-ipv6-multicast-mld.nse index a8db511b5..ffae9901e 100644 --- a/scripts/targets-ipv6-multicast-mld.nse +++ b/scripts/targets-ipv6-multicast-mld.nse @@ -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