mirror of
https://github.com/nmap/nmap.git
synced 2025-12-09 14:11:29 +00:00
Fix script matching patterns that start with category names
The keyword patterns like "categories" or K "true" were consuming the first part of patterns like --script 'broadcast-*' resulting in the error "'broadcast-*' did not match a category, filename, or directory" Changed to add a lookahead match for space, parentheses, or end-of-line before considering a keyword to have matched.
This commit is contained in:
@@ -278,7 +278,7 @@ end
|
|||||||
-- Return a pattern which matches a "keyword" literal, case insensitive.
|
-- Return a pattern which matches a "keyword" literal, case insensitive.
|
||||||
local function K (a)
|
local function K (a)
|
||||||
local insensitize = Cf((P(1) / function (a) return S(lower(a)..upper(a)) end)^1, function (a, b) return a * b end);
|
local insensitize = Cf((P(1) / function (a) return S(lower(a)..upper(a)) end)^1, function (a, b) return a * b end);
|
||||||
return assert(insensitize:match(a)) * -(locale().alnum + P "_"); -- "keyword" token
|
return assert(insensitize:match(a)) * #(V "space" + S"()," + P(-1)); -- "keyword" token
|
||||||
end
|
end
|
||||||
|
|
||||||
local REQUIRE_ERROR = {};
|
local REQUIRE_ERROR = {};
|
||||||
|
|||||||
Reference in New Issue
Block a user