aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-11-12 19:58:59 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-11-12 19:58:59 +0300
commit3b7bcc355f8b9d934b7478005c408af631e14acd (patch)
tree4667408a06fd83a30dd00cb2166ecc1831d0defe /src/plugins
parentfc5e5ef142c107027a01b90b35b52a8ce944d7ab (diff)
downloadrspamd-3b7bcc355f8b9d934b7478005c408af631e14acd.tar.gz
rspamd-3b7bcc355f8b9d934b7478005c408af631e14acd.zip
* Add ability to obtain phished url from lua
* Add ability to specify check domains for phishing check with 'domains' option
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lua/phishing.lua17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/plugins/lua/phishing.lua b/src/plugins/lua/phishing.lua
index 8021a0069..70bb67a52 100644
--- a/src/plugins/lua/phishing.lua
+++ b/src/plugins/lua/phishing.lua
@@ -2,6 +2,7 @@
--
--
local symbol = 'PHISHED_URL'
+local domains = nil
function phishing_cb (task)
local urls = task:get_urls();
@@ -9,7 +10,18 @@ function phishing_cb (task)
if urls then
for _,url in ipairs(urls) do
if url:is_phished() then
- task:insert_result(symbol, 1, url:get_host())
+ if domains then
+ local _,_,tld = string.find(url:get_phished():get_host(), '([a-zA-Z0-9%-]+\.[a-zA-Z0-9%-]+)$')
+ if tld then
+ if domains:get_key(tld) then
+ if url:is_phished() then
+ task:insert_result(symbol, 1, url:get_host())
+ end
+ end
+ end
+ else
+ task:insert_result(symbol, 1, url:get_phished():get_host())
+ end
end
end
end
@@ -24,5 +36,8 @@ if opts then
-- Register symbol's callback
rspamd_config:register_symbol(symbol, 1.0, 'phishing_cb')
end
+ if opts['domains'] then
+ domains = rspamd_config:add_hash_map (opts['domains'])
+ end
-- If no symbol defined, do not register this module
end