1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-15 20:29:03 +00:00

Remove many ERROR outputs from non-debug NSE output

This commit is contained in:
dmiller
2015-08-27 20:43:55 +00:00
parent fb5c947453
commit 7852fa3c18
137 changed files with 334 additions and 380 deletions

View File

@@ -126,6 +126,8 @@ local function parseDatabases(data)
return tab.dump(result)
end
local function fail (err) return stdnse.format_output(false, err) end
action = function(host, port)
-- this could really be more elegant, but it has to do for now
local handshake = "5a000000035b000001000000ffffffff000004005a000000000242000409000000400000d03f00000040000070000000000500000004000000020000000300000749343231360004501c2a035201037201097064626d73727600"
@@ -139,17 +141,17 @@ action = function(host, port)
status, data = exchPacket(socket, bin.pack("H", handshake))
if ( not(status) ) then
return "\n ERROR: Failed to perform handshake with MaxDB server"
return fail("Failed to perform handshake with MaxDB server")
end
status, data = exchPacket(socket, bin.pack("H", dbm_version))
if ( not(status) ) then
return "\n ERROR: Failed to request version information from server"
return fail("Failed to request version information from server")
end
local version_info = parseVersion(data)
if ( not(version_info) ) then
return "\n ERROR: Failed to parse version information from server"
return fail("Failed to parse version information from server")
end
local result, filter = {}, {"Version", "Build", "OS", "Instroot", "Sysname"}
@@ -160,7 +162,7 @@ action = function(host, port)
status, data = exchCommand(socket, bin.pack("H", db_enum))
socket:close()
if ( not(status) ) then
return "\n ERROR: Failed to request version information from server"
return fail("Failed to request version information from server")
end
local dbs = parseDatabases(data)
table.insert(result, { name = "Databases", dbs } )