1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-30 11:29:01 +00:00

Consolidate "contains" functions into stdnse.contains

These implementations were all functionally identical. The replacement
has an extra feature of returning the index where the value was found,
currently unused.
This commit is contained in:
dmiller
2014-01-16 22:57:33 +00:00
parent 197f28265f
commit 726b259b20
9 changed files with 28 additions and 109 deletions

View File

@@ -39,7 +39,7 @@ function parse_robtex_response (data)
local result = {}
for domain in string.gmatch(data, "<span id=\"dns[0-9]+\"><a href=\"//[a-z]+.robtex.com/([^\"]-)%.html\"") do
if not table.contains(result, domain) then
if not stdnse.contains(result, domain) then
table.insert(result, domain)
end
end
@@ -60,12 +60,3 @@ action = function (host)
end
return output_tab
end
function table.contains (table, element)
for _, value in pairs(table) do
if value == element then
return true
end
end
return false
end