diff --git a/scripts/ssh2-enum-algos.nse b/scripts/ssh2-enum-algos.nse
index 36051d6b7..121fd18e8 100644
--- a/scripts/ssh2-enum-algos.nse
+++ b/scripts/ssh2-enum-algos.nse
@@ -56,6 +56,43 @@ type.
-- | compression_algorithms (2)
-- | none
-- |_ zlib@openssh.com
+--
+-- @xmloutput
+--
+-- ecdh-sha2-nistp256
+-- ecdh-sha2-nistp384
+-- ecdh-sha2-nistp521
+-- diffie-hellman-group-exchange-sha256
+-- diffie-hellman-group-exchange-sha1
+-- diffie-hellman-group14-sha1
+-- diffie-hellman-group1-sha1
+--
+--
+-- ssh-rsa
+-- ecdsa-sha2-nistp256
+--
+--
+-- aes128-ctr
+-- aes192-ctr
+-- aes256-ctr
+-- aes128-cbc
+-- 3des-cbc
+-- blowfish-cbc
+-- cast128-cbc
+-- aes192-cbc
+-- aes256-cbc
+--
+--
+-- hmac-sha1
+-- umac-64@openssh.com
+-- hmac-ripemd160
+-- hmac-sha2-256
+-- hmac-sha2-512
+--
+--
+-- none
+-- zlib@openssh.com
+--
author = "Kris Katterjohn"
@@ -94,22 +131,28 @@ end
-- Build and return the output table
local output = function(parsed, lists)
- local out = {}
+ local out = stdnse.output_table()
for _, l in ipairs(lists) do
local v = parsed[l]
local a = v:len() > 0 and stdnse.strsplit(",", v) or {}
- local e
if nmap.verbosity() > 0 then
- e = { ["name"] = l .. " (" .. #a .. ")" }
- table.insert(e, a)
- else
- e = l .. " (" .. #a .. ")"
+ setmetatable(a, {
+ __tostring = function(t)
+ return string.format("(%d)\n %s", #t, table.concat(t, "\n "))
+ end
+ })
+ else
+ setmetatable(a, {
+ __tostring = function(t)
+ return string.format("(%d)", #t)
+ end
+ })
end
- table.insert(out, e)
+ out[l] = a
end
- return stdnse.format_output(true, out)
+ return out
end
action = function(host, port)