mirror of
https://github.com/nmap/nmap.git
synced 2026-02-11 16:06:33 +00:00
Simplifies implementation of function arg_value(). Closes #617
This commit is contained in:
@@ -834,14 +834,11 @@ end
|
||||
local function arg_value(argname)
|
||||
if nmap.registry.args[argname] then
|
||||
return nmap.registry.args[argname]
|
||||
else
|
||||
-- if scriptname.arg is not there, check "arg"
|
||||
local argument_frags = strsplit("%.", argname)
|
||||
if #argument_frags > 0 then
|
||||
if nmap.registry.args[argument_frags[2]] then
|
||||
return nmap.registry.args[argument_frags[2]]
|
||||
end
|
||||
end
|
||||
end
|
||||
-- if scriptname.arg is not there, check "arg"
|
||||
local argument_frags = strsplit("%.", argname)
|
||||
if nmap.registry.args[argument_frags[2]] then
|
||||
return nmap.registry.args[argument_frags[2]]
|
||||
end
|
||||
|
||||
for _, v in ipairs(nmap.registry.args) do
|
||||
@@ -849,6 +846,7 @@ local function arg_value(argname)
|
||||
return 1
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Parses the script arguments passed to the --script-args option.
|
||||
|
||||
Reference in New Issue
Block a user