mirror of
https://github.com/nmap/nmap.git
synced 2025-12-10 17:59:04 +00:00
Simplify the chunk calculation.
This commit is contained in:
@@ -120,6 +120,11 @@ license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
|
|||||||
categories = {"discovery", "intrusive"}
|
categories = {"discovery", "intrusive"}
|
||||||
|
|
||||||
|
|
||||||
|
-- Test this many ciphersuites at a time.
|
||||||
|
-- http://seclists.org/nmap-dev/2012/q3/156
|
||||||
|
-- http://seclists.org/nmap-dev/2010/q1/859
|
||||||
|
local CHUNK_SIZE = 64
|
||||||
|
|
||||||
-- Most of the values in the tables below are from:
|
-- Most of the values in the tables below are from:
|
||||||
-- http://www.iana.org/assignments/tls-parameters/
|
-- http://www.iana.org/assignments/tls-parameters/
|
||||||
PROTOCOLS = {
|
PROTOCOLS = {
|
||||||
@@ -823,18 +828,14 @@ local function keys(t)
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
local function keys_in_chunks(t)
|
local function in_chunks(t, size)
|
||||||
local ret = {{}}
|
local ret = {}
|
||||||
local c = 0
|
for i = 1, #t, size do
|
||||||
local b = 1
|
local chunk = {}
|
||||||
for k, _ in pairs(t) do
|
for j = i, i + size do
|
||||||
c = c+1
|
chunk[#chunk+1] = t[j]
|
||||||
ret[b][c] = k
|
|
||||||
if c >= 64 then
|
|
||||||
c = 0
|
|
||||||
b = b + 1
|
|
||||||
ret[b] = {}
|
|
||||||
end
|
end
|
||||||
|
ret[#ret+1] = chunk
|
||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
@@ -851,7 +852,7 @@ end
|
|||||||
|
|
||||||
local function find_ciphers(host, port, protocol)
|
local function find_ciphers(host, port, protocol)
|
||||||
local name, protocol_worked, record, results, t,cipherstr
|
local name, protocol_worked, record, results, t,cipherstr
|
||||||
local ciphers = keys_in_chunks(CIPHERS)
|
local ciphers = in_chunks(keys(CIPHERS), CHUNK_SIZE)
|
||||||
|
|
||||||
results = {}
|
results = {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user