diff --git a/nselib/comm.lua b/nselib/comm.lua index 64a121638..10d8d12be 100644 --- a/nselib/comm.lua +++ b/nselib/comm.lua @@ -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 diff --git a/nselib/tab.lua b/nselib/tab.lua index 1cbc5171d..b0a0bf3dc 100644 --- a/nselib/tab.lua +++ b/nselib/tab.lua @@ -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.