mirror of
https://github.com/nmap/nmap.git
synced 2025-12-12 18:59:03 +00:00
Add xmloutput to vnc-info.nse
This commit is contained in:
@@ -79,8 +79,8 @@ VNC = {
|
|||||||
[22]= "Colin Dean xvp",
|
[22]= "Colin Dean xvp",
|
||||||
|
|
||||||
-- Mac OS X screen sharing uses 30 and 35
|
-- Mac OS X screen sharing uses 30 and 35
|
||||||
[30]= "Mac OS X security type (30)",
|
[30]= "Mac OS X security type",
|
||||||
[35]= "Mac OS X security type (35)",
|
[35]= "Mac OS X security type",
|
||||||
},
|
},
|
||||||
|
|
||||||
new = function(self, host, port)
|
new = function(self, host, port)
|
||||||
@@ -256,13 +256,20 @@ VNC = {
|
|||||||
return true, ""
|
return true, ""
|
||||||
end,
|
end,
|
||||||
|
|
||||||
--- Returns all supported security types as a table of strings
|
--- Returns all supported security types as a table
|
||||||
--
|
--
|
||||||
-- @return table containing a string entry for each security type
|
-- @return table containing a entry for each security type
|
||||||
getSecTypesAsStringTable = function( self )
|
getSecTypesAsTable = function( self )
|
||||||
local tmp = {}
|
local tmp = {}
|
||||||
|
local typemt = {
|
||||||
|
__tostring = function(me)
|
||||||
|
return ("%s (%s)"):format(me.name, me.type)
|
||||||
|
end
|
||||||
|
}
|
||||||
for i=1, self.vncsec.count do
|
for i=1, self.vncsec.count do
|
||||||
table.insert( tmp, VNC.sectypes_str[self.vncsec.types[i]] or ("Unknown security type (%d)"):format(self.vncsec.types[i]) )
|
local t = {name=VNC.sectypes_str[self.vncsec.types[i]] or "Unknown security type", type=self.vncsec.types[i]}
|
||||||
|
setmetatable(t, typemt)
|
||||||
|
table.insert( tmp, t )
|
||||||
end
|
end
|
||||||
return true, tmp
|
return true, tmp
|
||||||
end,
|
end,
|
||||||
|
|||||||
@@ -21,6 +21,18 @@ categories = {"default", "discovery", "safe"}
|
|||||||
-- | Mac OS X security type (30)
|
-- | Mac OS X security type (30)
|
||||||
-- |_ Mac OS X security type (35)
|
-- |_ Mac OS X security type (35)
|
||||||
--
|
--
|
||||||
|
-- @xmloutput
|
||||||
|
-- <elem key="Protocol version">3.8</elem>
|
||||||
|
-- <table key="Security types">
|
||||||
|
-- <table>
|
||||||
|
-- <elem key="name">Ultra</elem>
|
||||||
|
-- <elem key="type">17</elem>
|
||||||
|
-- </table>
|
||||||
|
-- <table>
|
||||||
|
-- <elem key="name">VNC Authentication</elem>
|
||||||
|
-- <elem key="type">2</elem>
|
||||||
|
-- </table>
|
||||||
|
-- </table>
|
||||||
|
|
||||||
-- Version 0.2
|
-- Version 0.2
|
||||||
|
|
||||||
@@ -34,7 +46,7 @@ action = function(host, port)
|
|||||||
|
|
||||||
local vnc = vnc.VNC:new( host.ip, port.number )
|
local vnc = vnc.VNC:new( host.ip, port.number )
|
||||||
local status, data
|
local status, data
|
||||||
local result = {}
|
local result = stdnse.output_table()
|
||||||
|
|
||||||
status, data = vnc:connect()
|
status, data = vnc:connect()
|
||||||
if ( not(status) ) then return " \n ERROR: " .. data end
|
if ( not(status) ) then return " \n ERROR: " .. data end
|
||||||
@@ -42,19 +54,18 @@ action = function(host, port)
|
|||||||
status, data = vnc:handshake()
|
status, data = vnc:handshake()
|
||||||
if ( not(status) ) then return " \n ERROR: " .. data end
|
if ( not(status) ) then return " \n ERROR: " .. data end
|
||||||
|
|
||||||
status, data = vnc:getSecTypesAsStringTable()
|
status, data = vnc:getSecTypesAsTable()
|
||||||
if ( not(status) ) then return " \n ERROR: " .. data end
|
if ( not(status) ) then return " \n ERROR: " .. data end
|
||||||
|
|
||||||
table.insert(result, ("Protocol version: %s"):format(vnc:getProtocolVersion()) )
|
result["Protocol version"] = vnc:getProtocolVersion()
|
||||||
|
|
||||||
if ( data and #data ~= 0 ) then
|
if ( data and #data ~= 0 ) then
|
||||||
data.name = "Security types:"
|
result["Security types"] = data
|
||||||
table.insert( result, data )
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if ( vnc:supportsSecType(vnc.sectypes.NONE) ) then
|
if ( vnc:supportsSecType(vnc.sectypes.NONE) ) then
|
||||||
table.insert(result, "WARNING: Server does not require authentication")
|
result["WARNING"] = "Server does not require authentication"
|
||||||
end
|
end
|
||||||
|
|
||||||
return stdnse.format_output(status, result)
|
return result
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user