1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-28 18:39:03 +00:00

o [NSE] Added a Versant object database library and the scripts

broadcast-versant-locate and versant-info. The first discovers Versant
  databases on the LAN and the second queries them for information. [Patrik]
This commit is contained in:
patrik
2012-03-08 17:51:48 +00:00
parent 03dde2cc9a
commit cde380ea2c
5 changed files with 430 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
description = [[
Discovers Versant object databases using the srvloc protocol
]]
---
-- @usage
-- nmap --script broadcast-versant-locate
--
-- @output
-- Pre-scan script results:
-- | broadcast-versant-locate:
-- |_ vod://192.168.200.222:5019
--
author = "Patrik Karlsson"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"broadcast", "safe"}
require 'srvloc'
prerule = function() return true end
action = function()
local helper = srvloc.Helper:new()
local status, result = helper:ServiceRequest("service:odbms.versant:vod", "default")
helper:close()
if ( not(status) ) then return end
local output = {}
for _, v in ipairs(result) do
table.insert(output, v:match("^service:odbms.versant:vod://(.*)$"))
end
return stdnse.format_output(true, output)
end

View File

@@ -35,6 +35,7 @@ Entry { filename = "broadcast-rip-discover.nse", categories = { "broadcast", "sa
Entry { filename = "broadcast-ripng-discover.nse", categories = { "broadcast", "safe", } }
Entry { filename = "broadcast-sybase-asa-discover.nse", categories = { "broadcast", "safe", } }
Entry { filename = "broadcast-upnp-info.nse", categories = { "broadcast", "safe", } }
Entry { filename = "broadcast-versant-locate.nse", categories = { "broadcast", "safe", } }
Entry { filename = "broadcast-wake-on-lan.nse", categories = { "broadcast", "safe", } }
Entry { filename = "broadcast-wpad-discover.nse", categories = { "broadcast", "safe", } }
Entry { filename = "broadcast-wsdd-discover.nse", categories = { "broadcast", "safe", } }
@@ -322,6 +323,7 @@ Entry { filename = "tftp-enum.nse", categories = { "discovery", "intrusive", } }
Entry { filename = "unusual-port.nse", categories = { "safe", } }
Entry { filename = "upnp-info.nse", categories = { "default", "discovery", "safe", } }
Entry { filename = "url-snarf.nse", categories = { "safe", } }
Entry { filename = "versant-info.nse", categories = { "discovery", "safe", } }
Entry { filename = "vmauthd-brute.nse", categories = { "brute", "intrusive", } }
Entry { filename = "vnc-brute.nse", categories = { "brute", "intrusive", } }
Entry { filename = "vnc-info.nse", categories = { "default", "discovery", "safe", } }

110
scripts/versant-info.nse Normal file
View File

@@ -0,0 +1,110 @@
description = [[
Extracts information, including file paths, version and database names from
a Versant object database.
]]
---
-- @usage
-- nmap -p 5019 <ip> --script versant-info
--
-- @output
-- PORT STATE SERVICE REASON
-- 5019/tcp open versant syn-ack
-- | versant-info:
-- | Hostname: WIN-S6HA7RJFAAR
-- | Root path: C:\Versant\8
-- | Database path: C:\Versant\db
-- | Library path: C:\Versant\8
-- | Version: 8.0.2
-- | Databases
-- | FirstDB@WIN-S6HA7RJFAAR:5019
-- | Created: Sat Mar 03 12:00:02 2012
-- | Owner: Administrator
-- | Version: 8.0.2
-- | SecondDB@WIN-S6HA7RJFAAR:5019
-- | Created: Sat Mar 03 03:44:10 2012
-- | Owner: Administrator
-- | Version: 8.0.2
-- | ThirdDB@WIN-S6HA7RJFAAR:5019
-- | Created: Sun Mar 04 02:20:21 2012
-- | Owner: Administrator
-- |_ Version: 8.0.2
--
require 'shortport'
require 'versant'
author = "Patrik Karlsson"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"discovery", "safe"}
portrule = shortport.port_or_service(5019, "versant", "tcp")
local function fail(err) return ("\n ERROR: %s"):format(err or "") end
action = function(host, port)
local v = versant.Versant:new(host, port)
local status = v:connect()
if ( not(status) ) then
return fail("Failed to connect to server")
end
local status, newport = v:getObePort()
if ( not(status) ) then
return fail("Failed to retrieve OBE port")
end
v:close()
v = versant.Versant.OBE:new(host, newport)
status = v:connect()
if ( not(status) ) then
return fail("Failed to connect to server")
end
status, result = v:getVODInfo()
if ( not(status) ) then
return fail("Failed to get VOD information")
end
v:close()
local output = {}
table.insert(output, ("Hostname: %s"):format(result.hostname))
table.insert(output, ("Root path: %s"):format(result.root_path))
table.insert(output, ("Database path: %s"):format(result.db_path))
table.insert(output, ("Library path: %s"):format(result.lib_path))
table.insert(output, ("Version: %s"):format(result.version))
port.version.product = "Versant Database"
port.version.name = "versant"
nmap.set_port_version(host, port, "hardmatched")
-- the script may fail after this part, but we want to report at least
-- the above information if that's the case.
v = versant.Versant:new(host, port)
status = v:connect()
if ( not(status) ) then
return stdnse.format_output(true, output)
end
status, result = v:getNodeInfo()
if ( not(status) ) then
return stdnse.format_output(true, output)
end
v:close()
local databases = { name = "Databases" }
for _, db in ipairs(result) do
local db_tbl = { name = db.name }
table.insert(db_tbl, ("Created: %s"):format(db.created))
table.insert(db_tbl, ("Owner: %s"):format(db.owner))
table.insert(db_tbl, ("Version: %s"):format(db.version))
table.insert(databases, db_tbl)
end
table.insert(output, databases)
return stdnse.format_output(true, output)
end