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:
@@ -6,7 +6,8 @@ local string = require "string"
|
||||
local table = require "table"
|
||||
|
||||
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
|
||||
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
|
||||
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)
|
||||
|
||||
local registry = rmi.Registry:new( host, port )
|
||||
|
||||
|
||||
local status, j_array = registry:list()
|
||||
local output = {}
|
||||
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
|
||||
-- It's definitely RMI!
|
||||
port.version.name = 'java-rmi'
|
||||
@@ -229,8 +230,7 @@ function action(host,port, args)
|
||||
if status then
|
||||
table.insert(output, j_object:toTable())
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
return stdnse.format_output(true, output)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user