1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 13:11:28 +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

@@ -102,16 +102,6 @@ dependencies = {"ms-sql-brute", "ms-sql-empty-password"}
hostrule = mssql.Helper.GetHostrule_Standard()
portrule = mssql.Helper.GetPortrule_Standard()
local function table_contains( tbl, val )
for k,v in pairs(tbl) do
if ( v == val ) then
return true
end
end
return false
end
local function process_instance( instance )
local status, result, dbs, tables
@@ -188,7 +178,7 @@ local function process_instance( instance )
end
for k, v in pairs(dbs.rows) do
if ( not( table_contains( done_dbs, v[1] ) ) ) then
if ( not( stdnse.contains( done_dbs, v[1] ) ) ) then
local query = [[ SELECT so.name 'table', sc.name 'column', st.name 'type', sc.length
FROM %s..syscolumns sc, %s..sysobjects so, %s..systypes st
WHERE so.id = sc.id AND sc.xtype=st.xtype AND