From 33a8bc11c42a76dca52cf768a29cac0a705265fc Mon Sep 17 00:00:00 2001 From: dmiller Date: Fri, 18 Oct 2013 18:34:55 +0000 Subject: [PATCH] Add xmloutput to socks-auth-info.nse --- scripts/socks-auth-info.nse | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/scripts/socks-auth-info.nse b/scripts/socks-auth-info.nse index 488d1c067..6092d7862 100644 --- a/scripts/socks-auth-info.nse +++ b/scripts/socks-auth-info.nse @@ -24,7 +24,15 @@ types: -- | No authentication -- |_ Username and password -- - +-- @xmloutput +-- +-- 0 +-- No authentication +--
+-- +-- 2 +-- Username and password +--
author = "Patrik Karlsson" license = "Same as Nmap--See http://nmap.org/book/man-legal.html" @@ -39,14 +47,20 @@ action = function(host, port) -- iterate over all authentication methods as the server only responds with -- a single supported one if we send a list. + local mt = { __tostring = function(t) return t.name end } for _, method in pairs(socks.AuthMethod) do local status, response = helper:connect( method ) if ( status ) then - table.insert(auth_methods, helper:authNameByNumber(response.method)) + local out = { + method = response.method, + name = helper:authNameByNumber(response.method) + } + setmetatable(out, mt) + table.insert(auth_methods, out) end end helper:close() if ( 0 == #auth_methods ) then return end - return stdnse.format_output(true, auth_methods) + return auth_methods end