diff --git a/scripts/netbus-info.nse b/scripts/netbus-info.nse index a38bb8618..e339384e8 100644 --- a/scripts/netbus-info.nse +++ b/scripts/netbus-info.nse @@ -50,6 +50,32 @@ and an smtp-server used for notification delivery. -- | Wave: 0 -- | Synth: 0 -- |_ Cd: 0 +-- @xmloutput +-- +-- 127.0.0.1 +--
+-- +-- PuTTY Configuration +--
+-- +-- Z:\home\joeuser\Desktop\Patch.exe +-- Yes +-- joeuser +-- 1 +--
+-- +-- 12345 +-- 1 +-- password123 +-- admin@example.com +-- spoofed@example.org +-- smtp.example.net +--
+-- +-- 0 +-- 0 +-- 0 +--
-- -- @args netbus-info.password The password used for authentication @@ -64,68 +90,63 @@ portrule = shortport.port_or_service (12345, "netbus", {"tcp"}) local function format_acl(acl) if acl == nil then - return {} + return nil end local payload = string.sub(acl, 9) --skip header local fields = stdnse.strsplit("|", payload) table.remove(fields, (# fields)) - fields["name"] = "ACL" return fields end local function format_apps(apps) if apps == nil then - return {} + return nil end local payload = string.sub(apps, 10) --skip header local fields = stdnse.strsplit("|", payload) table.remove(fields, (# fields)) - fields["name"] = "APPLICATIONS" return fields end local function format_info(info) if info == nil then - return {} + return nil end local payload = string.sub(info, 6) --skip header local fields = stdnse.strsplit("|", payload) - fields["name"] = "INFO" return fields end local function format_setup(setup) - local formatted = {} if setup == nil then - return formatted + return nil end local fields = stdnse.strsplit(";", setup) if # fields < 7 then - return formatted + return nil end - formatted["name"] = "SETUP" - table.insert(formatted, string.format("TCP-port: %s", fields[2])) - table.insert(formatted, string.format("Log traffic: %s", fields[3])) - table.insert(formatted, string.format("Password: %s", fields[4])) - table.insert(formatted, string.format("Notify to: %s", fields[5])) - table.insert(formatted, string.format("Notify from: %s", fields[6])) - table.insert(formatted, string.format("SMTP-server: %s", fields[7])) + local formatted = stdnse.output_table() + formatted["TCP-port"] = fields[2] + formatted["Log traffic"] = fields[3] + formatted["Password"] = fields[4] + formatted["Notify to"] = fields[5] + formatted["Notify from"] = fields[6] + formatted["SMTP-server"] = fields[7] return formatted end local function format_volume(volume) - local formatted = {} if volume == nil then - return formatted + return nil end local fields = stdnse.strsplit(";", volume) if # fields < 4 then - return formatted + return nil end - formatted["name"] = "VOLUME" - table.insert(formatted, string.format("Wave: %s", fields[2])) - table.insert(formatted, string.format("Synth: %s", fields[3])) - table.insert(formatted, string.format("Cd: %s", fields[4])) + local formatted = stdnse.output_table() + formatted["Wave"] = fields[2] + formatted["Synth"] = fields[3] + formatted["Cd"] = fields[4] return formatted end @@ -161,14 +182,14 @@ action = function( host, port ) local volume = buffer() socket:close() - local response = {} - table.insert(response, format_acl(acl)) - table.insert(response, format_apps(apps)) - table.insert(response, format_info(info)) - table.insert(response, format_setup(setup)) - table.insert(response, format_volume(volume)) + local response = stdnse.output_table() + response["ACL"] = format_acl(acl) + response["APPLICATIONS"] = format_apps(apps) + response["INFO"] = format_info(info) + response["SETUP"] = format_setup(setup) + response["VOLUME"] = format_volume(volume) - return stdnse.format_output(true, response) + return response end