1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-30 01:59:02 +00:00

canonicalize more code

This commit is contained in:
batrick
2011-05-11 14:50:38 +00:00
parent dc909f7d77
commit e700497f6c
2 changed files with 19 additions and 12 deletions

View File

@@ -137,14 +137,21 @@ end
-- @param port_number The number of the port to check
-- @return bool True if port is usually ssl, otherwise false
local function is_ssl(port_number)
local common_ssl_ports = {443, 465, 989, 990, 992, 993, 994, 995, 587, 6697, 6679, 8443}
local table_size = table.maxn(common_ssl_ports)
local i = 0
while i < table_size do
if port_number == common_ssl_ports[i] then return true end
i = i + 1
end
return false
local common_ssl_ports = {
[443] = true,
[465] = true,
[989] = true,
[990] = true,
[992] = true,
[993] = true,
[994] = true,
[995] = true,
[587] = true,
[6697] = true,
[6679] = true,
[8443] = true,
}
return not not common_ssl_ports[port_number]
end
--- This function returns best protocol order for trying to open a

View File

@@ -31,11 +31,11 @@ require('strbuf')
--- Create and return a new table.
-- @return A new table.
function new()
local table = {}
local t = {}
table.current_row = 1
setmetatable(table, {__tostring=dump})
return table
t.current_row = 1
setmetatable(t, {__tostring=dump})
return t
end
--- Add a new string item to a table at a given column position.