1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-10 09:49:05 +00:00

Change VSNNUM parsing to account for versions greater than 15

Fixes #2331, closes #2471
This commit is contained in:
nnposter
2022-05-06 02:49:25 +00:00
parent a5d57b3280
commit 4671f5da12
2 changed files with 17 additions and 7 deletions

View File

@@ -1,5 +1,8 @@
#Nmap Changelog ($Id$); -*-text-*- #Nmap Changelog ($Id$); -*-text-*-
o [GH#2331][GH#2471] Script oracle-tns-version was not reporting the version
correctly for Oracle 19c or newer [linholmes]
o [GH#2296][GH#2342] Script redis-info was crashing or producing inaccurate o [GH#2296][GH#2342] Script redis-info was crashing or producing inaccurate
information about client connections. [nnposter] information about client connections. [nnposter]

View File

@@ -36,15 +36,22 @@ local ERR_CODES = {
["12514"] = "unknown service name", ["12514"] = "unknown service name",
} }
-- test data:
-- 135290880: 8.1.6.0.0
-- 153092352: 9.2.0.1.0
-- 169869568: 10.2.0.1.0
-- 185599488: 11.1.0.6.0
-- 202375680: 13.1.0.2.0
-- 318767104: 19.0.0.0.0
local function decode_vsnnum (vsnnum) local function decode_vsnnum (vsnnum)
local hex = stdnse.tohex(tonumber(vsnnum)) vsnnum = tonumber(vsnnum)
local maj, min, a, b, c = string.unpack("c1 c1 c2 c1 c2", hex)
return string.format("%d.%d.%d.%d.%d", return string.format("%d.%d.%d.%d.%d",
tonumber(maj, 16), vsnnum >> 24,
tonumber(min, 16), vsnnum >> 20 & 0xF,
tonumber(a, 16), vsnnum >> 12 & 0xFF,
tonumber(b, 16), vsnnum >> 8 & 0xF,
tonumber(c, 16) vsnnum & 0xFF
) )
end end