diff --git a/CHANGELOG b/CHANGELOG index 4453275b8..9aa065917 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ #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 information about client connections. [nnposter] diff --git a/scripts/oracle-tns-version.nse b/scripts/oracle-tns-version.nse index 470e2611c..bdf6ddc80 100644 --- a/scripts/oracle-tns-version.nse +++ b/scripts/oracle-tns-version.nse @@ -36,15 +36,22 @@ local ERR_CODES = { ["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 hex = stdnse.tohex(tonumber(vsnnum)) - local maj, min, a, b, c = string.unpack("c1 c1 c2 c1 c2", hex) + vsnnum = tonumber(vsnnum) return string.format("%d.%d.%d.%d.%d", - tonumber(maj, 16), - tonumber(min, 16), - tonumber(a, 16), - tonumber(b, 16), - tonumber(c, 16) + vsnnum >> 24, + vsnnum >> 20 & 0xF, + vsnnum >> 12 & 0xFF, + vsnnum >> 8 & 0xF, + vsnnum & 0xFF ) end