mirror of
https://github.com/nmap/nmap.git
synced 2026-09-01 16:02: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:
parent
197f28265f
commit
726b259b20
9 changed files with 28 additions and 109 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue