1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 13:11:28 +00:00

o [NSE] Applied patch to add additional version information to Mongodb scripts

[Martin Swende]
This commit is contained in:
patrik
2011-12-20 18:54:03 +00:00
parent 1350b11331
commit 5d0db9c7fc
3 changed files with 17 additions and 1 deletions

View File

@@ -1,5 +1,8 @@
# Nmap Changelog ($Id$); -*-text-*- # Nmap Changelog ($Id$); -*-text-*-
o [NSE] Applied patch to add additional version information to Mongodb scripts
[Martin Swende]
o [NSE] Added path argument to the http-auth script and changed so that script o [NSE] Added path argument to the http-auth script and changed so that script
output was returned using stdnse.format_output [Duarte Silva, Patrik] output was returned using stdnse.format_output [Duarte Silva, Patrik]

View File

@@ -65,6 +65,10 @@ function action(host,port)
status, result = mongodb.query(socket, packet) status, result = mongodb.query(socket, packet)
if not status then return result end-- Error message if not status then return result end-- Error message
port.version.name ='mongodb'
port.version.product='MongoDB'
nmap.set_port_version(host,port,'hardmatched')
local output = mongodb.queryResultToTable(result) local output = mongodb.queryResultToTable(result)
if err ~= nil then if err ~= nil then
stdnse.log_error(err) stdnse.log_error(err)

View File

@@ -75,8 +75,13 @@ function action(host,port)
status,statQResult = mongodb.query(socket, packet) status,statQResult = mongodb.query(socket, packet)
if not status then return statResult end if not status then return statQResult end
port.version.name ='mongodb'
port.version.product='MongoDB'
port.version.name_confidence = 100
nmap.set_port_version(host,port,'hardmatched')
status, packet = mongodb.buildInfoQuery() status, packet = mongodb.buildInfoQuery()
if not status then return packet end if not status then return packet end
@@ -87,6 +92,10 @@ function action(host,port)
return buildQResult return buildQResult
end end
local versionNumber = buildQResult['version']
port.version.product='MongoDB '..versionNumber
nmap.set_port_version(host,port,'hardmatched')
local stat_out = mongodb.queryResultToTable(statQResult) local stat_out = mongodb.queryResultToTable(statQResult)
local build_out = mongodb.queryResultToTable(buildQResult) local build_out = mongodb.queryResultToTable(buildQResult)
local output = {"MongoDB Build info",build_out,"Server status",stat_out} local output = {"MongoDB Build info",build_out,"Server status",stat_out}