1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-29 19:09:01 +00:00

Sort duplicates output in ssh-hostkey.nse.

This commit is contained in:
david
2011-12-30 04:05:36 +00:00
parent 52e617630a
commit acaade017b

View File

@@ -54,6 +54,7 @@ author = "Sven Klemm"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"safe","default","discovery"}
require("ipOps")
require("shortport")
require("stdnse")
stdnse.silent_require("openssl")
@@ -151,6 +152,7 @@ local function postaction()
-- look for hosts using the same hostkey
for key, hosts in pairs(hostkeys) do
if #hostkeys[key] > 1 then
table.sort(hostkeys[key], function(a, b) return ipOps.compare_ip(a, "lt", b) end)
local str = 'Key ' .. key .. ' used by:'
for _, host in ipairs(hostkeys[key]) do
str = str .. '\n ' .. host