diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-11-24 10:38:00 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-24 10:38:00 +0000 |
commit | 318082d040d78fd461acc9dc540ae8353e668f26 (patch) | |
tree | 75042545a65650a492ce81307fa14ccb9717de59 /lualib | |
parent | 08a71f0108cbd92c750924f91d3522364b30e66a (diff) | |
parent | a9f2fb8d1af4ab42d581e1e3924623039470e2b7 (diff) | |
download | rspamd-318082d040d78fd461acc9dc540ae8353e668f26.tar.gz rspamd-318082d040d78fd461acc9dc540ae8353e668f26.zip |
Merge pull request #3558 from fatalbanana/specific_urls_extractor
[Minor] Selectors: fixes for specific URLs
Diffstat (limited to 'lualib')
-rw-r--r-- | lualib/lua_selectors/extractors.lua | 27 | ||||
-rw-r--r-- | lualib/lua_selectors/init.lua | 6 |
2 files changed, 31 insertions, 2 deletions
diff --git a/lualib/lua_selectors/extractors.lua b/lualib/lua_selectors/extractors.lua index 162f01808..770887ff6 100644 --- a/lualib/lua_selectors/extractors.lua +++ b/lualib/lua_selectors/extractors.lua @@ -287,7 +287,34 @@ e.g. `get_tld`]], ['args_schema'] = {ts.shape{ limit = ts.number + ts.string / tonumber, esld_limit = (ts.number + ts.string / tonumber):is_optional(), + flags = ts.array_of(ts.one_of{ + 'content', + 'has_port', + 'has_user', + 'host_encoded', + 'html_displayed', + 'idn', + 'image', + 'missing_slahes', -- sic + 'no_tld', + 'numeric', + 'obscured', + 'path_encoded', + 'query', + 'query_encoded', + 'redirected', + 'schema_encoded', + 'schemaless', + 'subject', + 'text', + 'unnormalised', + 'url_displayed', + 'zw_spaces', + 'phished', + }):is_optional(), + flags_mode = ts.one_of{'explicit'}:is_optional(), prefix = ts.string:is_optional(), + need_content = (ts.boolean + ts.string / lua_util.toboolean):is_optional(), need_emails = (ts.boolean + ts.string / lua_util.toboolean):is_optional(), need_images = (ts.boolean + ts.string / lua_util.toboolean):is_optional(), ignore_redirected = (ts.boolean + ts.string / lua_util.toboolean):is_optional(), diff --git a/lualib/lua_selectors/init.lua b/lualib/lua_selectors/init.lua index 54d42f242..3839cec9e 100644 --- a/lualib/lua_selectors/init.lua +++ b/lualib/lua_selectors/init.lua @@ -236,8 +236,10 @@ local function make_grammar() FUNCTION = l.Ct(atom * spc * (obrace * l.V("ARG_LIST") * ebrace)^0), METHOD = l.Ct(atom / function(e) return '__' .. e end * spc * (obrace * l.V("ARG_LIST") * ebrace)^0), ARG_LIST = l.Ct((l.V("ARG") * comma^0)^0), - ARG = l.Cf(tbl_obrace * l.V("NAMED_ARG") * tbl_ebrace, rawset) + argument, - NAMED_ARG = (l.Ct("") * l.Cg(argument * eqsign * argument * comma^0)^0), + ARG = l.Cf(tbl_obrace * l.V("NAMED_ARG") * tbl_ebrace, rawset) + argument + l.V("LIST_ARGS"), + NAMED_ARG = (l.Ct("") * l.Cg(argument * eqsign * (argument + l.V("LIST_ARGS")) * comma^0)^0), + LIST_ARGS = l.Ct(tbl_obrace * l.V("LIST_ARG") * tbl_ebrace), + LIST_ARG = l.Cg(argument * comma^0)^0, } end |