mirror of
https://github.com/nmap/nmap.git
synced 2026-08-03 22:29:06 +00:00
Get rid of redundant/useless tonumber()s in script arg processing
This commit is contained in:
parent
47d31171b0
commit
1d5da8bccb
8 changed files with 14 additions and 17 deletions
|
|
@ -56,8 +56,7 @@ action = function(host, port)
|
|||
if not timeout or timeout < 0 then timeout = 10 end
|
||||
|
||||
-- Set bytes
|
||||
local bytes = tonumber(nmap.registry.args[SCRIPT_NAME .. '.bytes'])
|
||||
if not bytes then bytes = 512 else tonumber(bytes) end
|
||||
local bytes = tonumber(nmap.registry.args[SCRIPT_NAME .. '.bytes']) or 512
|
||||
|
||||
-- Connect and retrieve acarsd info in XML format over TCP
|
||||
stdnse.debug1("Connecting to %s:%s [Timeout: %ss]", host.targetname or host.ip, port.number, timeout)
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ action = function(host)
|
|||
|
||||
nmap.registry.bruteddomains[domainname] = true
|
||||
stdnse.debug1("Starting dns-brute at: "..domainname)
|
||||
local max_threads = stdnse.get_script_args('dns-brute.threads') and tonumber( stdnse.get_script_args('dns-brute.threads') ) or 5
|
||||
local max_threads = tonumber( stdnse.get_script_args('dns-brute.threads') ) or 5
|
||||
local dosrv = stdnse.get_script_args("dns-brute.srv") or false
|
||||
stdnse.debug1("THREADS: "..max_threads)
|
||||
-- First look for dns-brute.hostlist
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ action = function( host, port )
|
|||
local usernames, passwords, creds
|
||||
local database = stdnse.get_script_args('drda-brute.dbname') or "SAMPLE"
|
||||
local condvar = nmap.condvar( valid_accounts )
|
||||
local max_threads = stdnse.get_script_args('drda-brute.threads') and tonumber( stdnse.get_script_args('drda-brute.threads') ) or 10
|
||||
local max_threads = tonumber( stdnse.get_script_args('drda-brute.threads') ) or 10
|
||||
|
||||
-- Check if the DB specified is valid
|
||||
if( not(isValidDb(host, port, database)) ) then
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ action = function(host, port)
|
|||
local creds, pos, pager
|
||||
local links, result, hashes,legacyHashes, id_files = {}, {}, {}, {},{}
|
||||
local chunk_size = 30
|
||||
local max_fetch = stdnse.get_script_args('domino-enum-passwords.count') and tonumber(stdnse.get_script_args('domino-enum-passwords.count')) or 10
|
||||
local max_fetch = tonumber(stdnse.get_script_args('domino-enum-passwords.count')) or 10
|
||||
local http_response
|
||||
|
||||
if ( nmap.registry['credentials'] and nmap.registry['credentials']['http'] ) then
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ action = function(host, port)
|
|||
-- irc servers seem to be restrictive about too many connection attempts
|
||||
-- in a short time thus we need to limit the number of threads
|
||||
local threads = stdnse.get_script_args(("%s.threads"):format(SCRIPT_NAME))
|
||||
threads = tonumber(threads) and tonumber(threads) or 2
|
||||
threads = tonumber(threads) or 2
|
||||
engine:setMaxThreads(threads)
|
||||
local status, accounts = engine:start()
|
||||
return accounts
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ function action(host,port)
|
|||
local saveFile = stdnse.get_script_args('ldap.savesearch')
|
||||
local accounts
|
||||
local objCount = 0
|
||||
local maxObjects = stdnse.get_script_args('ldap.maxobjects') and tonumber(stdnse.get_script_args('ldap.maxobjects')) or 20
|
||||
local maxObjects = tonumber(stdnse.get_script_args('ldap.maxobjects')) or 20
|
||||
|
||||
-- In order to discover what protocol to use (SSL/TCP) we need to send a few bytes to the server
|
||||
-- An anonymous bind should do it
|
||||
|
|
|
|||
|
|
@ -87,8 +87,7 @@ local function process_instance( instance )
|
|||
local output = {}
|
||||
local exclude_dbs = { "'master'", "'tempdb'", "'model'", "'msdb'" }
|
||||
|
||||
local RS_LIMIT = stdnse.get_script_args( {'mssql-hasdbaccess.limit', 'ms-sql-hasdbaccess.limit' } )
|
||||
and tonumber(stdnse.get_script_args( {'mssql-hasdbaccess.limit', 'ms-sql-hasdbaccess.limit' } )) or 5
|
||||
local RS_LIMIT = tonumber(stdnse.get_script_args( {'mssql-hasdbaccess.limit', 'ms-sql-hasdbaccess.limit' } )) or 5
|
||||
|
||||
if ( RS_LIMIT <= 0 ) then
|
||||
limit = ""
|
||||
|
|
|
|||
|
|
@ -112,10 +112,8 @@ local function process_instance( instance )
|
|||
local done_dbs = {}
|
||||
local db_limit, tbl_limit
|
||||
|
||||
local DB_COUNT = stdnse.get_script_args( {'ms-sql-tables.maxdb', 'mssql-tables.maxdb'} )
|
||||
and tonumber( stdnse.get_script_args( {'ms-sql-tables.maxdb', 'mssql-tables.maxdb'} ) ) or 5
|
||||
local TABLE_COUNT = stdnse.get_script_args( {'ms-sql-tables.maxtables', 'mssql-tables.maxtables' } )
|
||||
and tonumber( stdnse.get_script_args( {'ms-sql-tables.maxtables', 'mssql-tables.maxtables' } ) ) or 2
|
||||
local DB_COUNT = tonumber( stdnse.get_script_args( {'ms-sql-tables.maxdb', 'mssql-tables.maxdb'} ) ) or 5
|
||||
local TABLE_COUNT = tonumber( stdnse.get_script_args( {'ms-sql-tables.maxtables', 'mssql-tables.maxtables' } ) ) or 2
|
||||
local keywords_filter = ""
|
||||
|
||||
if ( DB_COUNT <= 0 ) then
|
||||
|
|
@ -129,9 +127,10 @@ local function process_instance( instance )
|
|||
tbl_limit = string.format( "TOP %d", TABLE_COUNT )
|
||||
end
|
||||
|
||||
local keywords_arg = stdnse.get_script_args( {'ms-sql-tables.keywords', 'mssql-tables.keywords' } )
|
||||
-- Build the keyword filter
|
||||
if ( stdnse.get_script_args( {'ms-sql-tables.keywords', 'mssql-tables.keywords' } ) ) then
|
||||
local keywords = stdnse.get_script_args( {'ms-sql-tables.keywords', 'mssql-tables.keywords' } )
|
||||
if keywords_arg then
|
||||
local keywords = keywords_arg
|
||||
local tmp_tbl = {}
|
||||
|
||||
if( type(keywords) == 'string' ) then
|
||||
|
|
@ -207,8 +206,8 @@ local function process_instance( instance )
|
|||
local pos = 1
|
||||
local restrict_tbl = {}
|
||||
|
||||
if ( stdnse.get_script_args( {'ms-sql-tables.keywords', 'mssql-tables.keywords' } ) ) then
|
||||
local tmp = stdnse.get_script_args( {'ms-sql-tables.keywords', 'mssql-tables.keywords' } )
|
||||
if keywords_arg then
|
||||
local tmp = keywords_arg
|
||||
if ( type(tmp) == 'table' ) then
|
||||
tmp = stdnse.strjoin(',', tmp)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue