1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-07 06:59:03 +00:00

Re-indent some more scripts. Whitespace-only commit

https://secwiki.org/w/Nmap/Code_Standards
This commit is contained in:
dmiller
2014-02-02 15:33:29 +00:00
parent c7d4f2ec96
commit d309fecd12
50 changed files with 6076 additions and 6076 deletions

View File

@@ -155,20 +155,20 @@ portrule = shortport.port_or_service({1098, 1099, 1090, 8901, 8902, 8903}, {"jav
-- Some lazy shortcuts
local function dbg(str,...)
stdnse.print_debug(3,"RMI-DUMPREG:"..str, ...)
stdnse.print_debug(3,"RMI-DUMPREG:"..str, ...)
end
local function dbg_err(str, ... )
stdnse.print_debug("RMI-DUMPREG-ERR:"..str, ...)
stdnse.print_debug("RMI-DUMPREG-ERR:"..str, ...)
end
-- Function to split a string
local function split(str, sep)
local sep, fields = sep or "; ", {}
local pattern = string.format("([^%s]+)", sep)
str:gsub(pattern, function(c) fields[#fields+1] = c end)
return fields
end
local sep, fields = sep or "; ", {}
local pattern = string.format("([^%s]+)", sep)
str:gsub(pattern, function(c) fields[#fields+1] = c end)
return fields
end
--This is a customData formatter. In some cases, the RMI library finds 'custom data' which belongs to an object.
@@ -180,57 +180,57 @@ local function split(str, sep)
-- of the returned RMI object.
-- @return title, data
function customDataFormatter(className, customData)
if customData == nil then return nil end
if #customData ==0 then return nil end
if customData == nil then return nil end
if #customData ==0 then return nil end
local retData = {}
for k,v in ipairs(customData) do
if v:find("file:/") == 1 then
-- This is a classpath
local cp = split(v, "; ") -- Splits into table
table.insert(retData, "Classpath")
table.insert(retData, cp)
else
table.insert(retData[v])
end
end
local retData = {}
for k,v in ipairs(customData) do
if v:find("file:/") == 1 then
-- This is a classpath
local cp = split(v, "; ") -- Splits into table
table.insert(retData, "Classpath")
table.insert(retData, cp)
else
table.insert(retData[v])
end
end
return "Custom data", retData
return "Custom data", retData
end
function action(host,port, args)
local registry= rmi.Registry:new( host.ip, port.number)
local registry= rmi.Registry:new( host.ip, port.number)
local status, j_array = registry:list()
local output = {}
if not status then
return false, ("Registry listing failed (%s)"):format(tostring(j_array))
end
-- It's definitely RMI!
port.version.name ='java-rmi'
port.version.product='Java RMI Registry'
nmap.set_port_version(host,port)
local status, j_array = registry:list()
local output = {}
if not status then
return false, ("Registry listing failed (%s)"):format(tostring(j_array))
end
-- It's definitely RMI!
port.version.name ='java-rmi'
port.version.product='Java RMI Registry'
nmap.set_port_version(host,port)
-- Monkey patch the java-class in rmi, to set our own custom data formatter
-- for classpaths
rmi.JavaClass.customDataFormatter = customDataFormatter
-- Monkey patch the java-class in rmi, to set our own custom data formatter
-- for classpaths
rmi.JavaClass.customDataFormatter = customDataFormatter
-- We expect an array of strings to be the return data
local data = j_array:getValues()
for i,name in ipairs( data ) do
--print(data)
table.insert(output, name)
dbg("Querying object %s", name)
local status, j_object= registry:lookup(name)
-- We expect an array of strings to be the return data
local data = j_array:getValues()
for i,name in ipairs( data ) do
--print(data)
table.insert(output, name)
dbg("Querying object %s", name)
local status, j_object= registry:lookup(name)
if status then
table.insert(output, j_object:toTable())
end
if status then
table.insert(output, j_object:toTable())
end
end
return stdnse.format_output(true, output)
end
return stdnse.format_output(true, output)
end