mirror of
https://github.com/nmap/nmap.git
synced 2026-08-03 22:29:06 +00:00
Removed escape_magic function in favor of a simple substitution.
This commit is contained in:
parent
55ded906f2
commit
4209947f9b
1 changed files with 1 additions and 5 deletions
|
|
@ -296,10 +296,6 @@ local function get_chosen_scripts (rules)
|
|||
return 'm("'..str..'")';
|
||||
end
|
||||
end
|
||||
-- Escape a magic character by prepending the '%' escape character
|
||||
local function escape_magic (str)
|
||||
return "%"..str;
|
||||
end
|
||||
|
||||
for i, rule in ipairs(rules) do
|
||||
rule = match(rule, "^%s*(.-)%s*$"); -- strip surrounding whitespace
|
||||
|
|
@ -342,7 +338,7 @@ local function get_chosen_scripts (rules)
|
|||
if r_categories[lower(pattern)] then return true end
|
||||
-- Check filename with wildcards
|
||||
pattern = gsub(pattern, "%.nse$", ""); -- remove optional extension
|
||||
pattern = gsub(pattern, "[%^%$%(%)%%%.%[%]%+%-%?]", escape_magic);
|
||||
pattern = gsub(pattern, "[%^%$%(%)%%%.%[%]%+%-%?]", "%%%1"); -- esc magic
|
||||
pattern = gsub(pattern, "%*", ".*"); -- change to Lua wildcard
|
||||
pattern = "^"..pattern.."$"; -- anchor to beginning and end
|
||||
return not not find(escaped_basename, pattern);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue