mirror of
https://github.com/nmap/nmap.git
synced 2025-12-09 14:11:29 +00:00
Whitespace in ssl-enum-ciphers.
This commit is contained in:
@@ -630,16 +630,16 @@ local function try_protocol(host, port, protocol)
|
|||||||
|
|
||||||
-- Add cipher to the list of accepted ciphers.
|
-- Add cipher to the list of accepted ciphers.
|
||||||
name = record["body"]["cipher"]
|
name = record["body"]["cipher"]
|
||||||
if rankedciphersfilename and rankedciphers[name] then
|
if rankedciphersfilename and rankedciphers[name] then
|
||||||
cipherstr=rankedciphers[name]
|
cipherstr=rankedciphers[name]
|
||||||
else
|
else
|
||||||
cipherstr="unknown strength"
|
cipherstr="unknown strength"
|
||||||
end
|
end
|
||||||
stdnse.print_debug(2, "Strength of %s rated %d.",cipherstr,cipherstrength[cipherstr])
|
stdnse.print_debug(2, "Strength of %s rated %d.",cipherstr,cipherstrength[cipherstr])
|
||||||
if mincipherstrength>cipherstrength[cipherstr] then
|
if mincipherstrength>cipherstrength[cipherstr] then
|
||||||
stdnse.print_debug(2, "Downgrading min cipher strength to %d.",cipherstrength[cipherstr])
|
stdnse.print_debug(2, "Downgrading min cipher strength to %d.",cipherstrength[cipherstr])
|
||||||
mincipherstrength=cipherstrength[cipherstr]
|
mincipherstrength=cipherstrength[cipherstr]
|
||||||
end
|
end
|
||||||
name=name.." - "..cipherstr
|
name=name.." - "..cipherstr
|
||||||
table.insert(results, name)
|
table.insert(results, name)
|
||||||
end
|
end
|
||||||
@@ -717,37 +717,37 @@ end
|
|||||||
|
|
||||||
-- Shamelessly stolen from nselib/unpwdb.lua and changed a bit. (Gabriel Lawrence)
|
-- Shamelessly stolen from nselib/unpwdb.lua and changed a bit. (Gabriel Lawrence)
|
||||||
local filltable = function(filename,table)
|
local filltable = function(filename,table)
|
||||||
if #table ~= 0 then
|
if #table ~= 0 then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
local file = io.open(filename, "r")
|
local file = io.open(filename, "r")
|
||||||
|
|
||||||
if not file then
|
if not file then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
while true do
|
while true do
|
||||||
local l = file:read()
|
local l = file:read()
|
||||||
|
|
||||||
if not l then
|
if not l then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Comments takes up a whole line
|
-- Comments takes up a whole line
|
||||||
if not l:match("#!comment:") then
|
if not l:match("#!comment:") then
|
||||||
lsplit=stdnse.strsplit("%s+", l)
|
lsplit=stdnse.strsplit("%s+", l)
|
||||||
if cipherstrength[lsplit[2]] then
|
if cipherstrength[lsplit[2]] then
|
||||||
table[lsplit[1]] = lsplit[2]
|
table[lsplit[1]] = lsplit[2]
|
||||||
else
|
else
|
||||||
stdnse.print_debug(1,"Strength not defined, ignoring: %s:%s",lsplit[1],lsplit[2])
|
stdnse.print_debug(1,"Strength not defined, ignoring: %s:%s",lsplit[1],lsplit[2])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
file:close()
|
file:close()
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
portrule = shortport.ssl
|
portrule = shortport.ssl
|
||||||
@@ -755,14 +755,14 @@ portrule = shortport.ssl
|
|||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local name, result, results
|
local name, result, results
|
||||||
|
|
||||||
rankedciphersfilename=stdnse.get_script_args("ssl-enum-ciphers.rankedcipherlist")
|
rankedciphersfilename=stdnse.get_script_args("ssl-enum-ciphers.rankedcipherlist")
|
||||||
if rankedciphersfilename then
|
if rankedciphersfilename then
|
||||||
filltable(rankedciphersfilename,rankedciphers)
|
filltable(rankedciphersfilename,rankedciphers)
|
||||||
else
|
else
|
||||||
rankedciphersfilename = nmap.fetchfile( "nselib/data/ssl-ciphers" )
|
rankedciphersfilename = nmap.fetchfile( "nselib/data/ssl-ciphers" )
|
||||||
stdnse.print_debug(1, "Ranked ciphers filename: %s", rankedciphersfilename)
|
stdnse.print_debug(1, "Ranked ciphers filename: %s", rankedciphersfilename)
|
||||||
filltable(rankedciphersfilename,rankedciphers)
|
filltable(rankedciphersfilename,rankedciphers)
|
||||||
end
|
end
|
||||||
|
|
||||||
results = {}
|
results = {}
|
||||||
|
|
||||||
@@ -778,11 +778,11 @@ action = function(host, port)
|
|||||||
-- Sort protocol results by name.
|
-- Sort protocol results by name.
|
||||||
table.sort(results, function(a, b) return a["name"] < b["name"] end)
|
table.sort(results, function(a, b) return a["name"] < b["name"] end)
|
||||||
if rankedciphersfilename then
|
if rankedciphersfilename then
|
||||||
for k,v in pairs(cipherstrength) do
|
for k, v in pairs(cipherstrength) do
|
||||||
if v==mincipherstrength then
|
if v == mincipherstrength then
|
||||||
table.insert(results, "Least strength = " .. k)
|
table.insert(results, "Least strength = " .. k)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return stdnse.format_output(true, results)
|
return stdnse.format_output(true, results)
|
||||||
|
|||||||
Reference in New Issue
Block a user