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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user