1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31: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:
dmiller
2015-08-12 14:29:20 +00:00
parent 2fa36ec97f
commit 69345854ee

View File

@@ -278,7 +278,7 @@ end
-- Return a pattern which matches a "keyword" literal, case insensitive.
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);
return assert(insensitize:match(a)) * -(locale().alnum + P "_"); -- "keyword" token
return assert(insensitize:match(a)) * #(V "space" + S"()," + P(-1)); -- "keyword" token
end
local REQUIRE_ERROR = {};