1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-10 09:49:05 +00:00

Fix bad output when rmi.Registry.list fails. Closes #262

This commit is contained in:
dmiller
2015-12-19 18:01:11 +00:00
parent 5243f4f049
commit 82b765f6fe

View File

@@ -6,7 +6,8 @@ local string = require "string"
local table = require "table" local table = require "table"
description = [[ description = [[
Connects to a remote RMI registry and attempts to dump all of its objects. Connects to a remote RMI registry and attempts to dump all of its
objects.
First it tries to determine the names of all objects bound in the First it tries to determine the names of all objects bound in the
registry, and then it tries to determine information about the registry, and then it tries to determine information about the
@@ -19,7 +20,8 @@ on it.
It also gives information about where the objects are located, (marked It also gives information about where the objects are located, (marked
with @<ip>:port in the output). with @<ip>:port in the output).
Some apps give away the classpath, which this scripts catches in so-called "Custom data". Some apps give away the classpath, which this scripts catches in
so-called "Custom data".
]] ]]
--- ---
@@ -200,14 +202,13 @@ end
function action(host,port, args) function action(host,port, args)
local registry = rmi.Registry:new( host, port ) local registry = rmi.Registry:new( host, port )
local status, j_array = registry:list() local status, j_array = registry:list()
local output = {} local output = {}
if not status then if not status then
return false, ("Registry listing failed (%s)"):format(tostring(j_array)) table.insert(output, ("Registry listing failed (%s)"):format(tostring(j_array)))
return stdnse.format_output(false, output)
end end
-- It's definitely RMI! -- It's definitely RMI!
port.version.name = 'java-rmi' port.version.name = 'java-rmi'
@@ -229,8 +230,7 @@ function action(host,port, args)
if status then if status then
table.insert(output, j_object:toTable()) table.insert(output, j_object:toTable())
end end
end end
return stdnse.format_output(true, output) return stdnse.format_output(true, output)
end end