aboutsummaryrefslogtreecommitdiffstats
path: root/rules/misc.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-02-04 13:41:21 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-02-04 13:41:38 +0100
commit6c8b19b9422f6fb4b776a59617750d53a48da5f1 (patch)
tree1df2c37cb4027e258ef953bda529de7f473041e6 /rules/misc.lua
parent6670767e3a55bc9313ac5019e36e510c49ef3709 (diff)
downloadrspamd-6c8b19b9422f6fb4b776a59617750d53a48da5f1.tar.gz
rspamd-6c8b19b9422f6fb4b776a59617750d53a48da5f1.zip
[Feature] Detect URLs with suspicious omographs
Diffstat (limited to 'rules/misc.lua')
-rw-r--r--rules/misc.lua26
1 files changed, 25 insertions, 1 deletions
diff --git a/rules/misc.lua b/rules/misc.lua
index 6a1eec4fc..56de79a6b 100644
--- a/rules/misc.lua
+++ b/rules/misc.lua
@@ -756,4 +756,28 @@ local freemail_reply_neq_from_id = rspamd_config:register_symbol({
score = 3.0
})
rspamd_config:register_dependency(freemail_reply_neq_from_id, 'FREEMAIL_REPLYTO')
-rspamd_config:register_dependency(freemail_reply_neq_from_id, 'FREEMAIL_FROM') \ No newline at end of file
+rspamd_config:register_dependency(freemail_reply_neq_from_id, 'FREEMAIL_FROM')
+
+rspamd_config.OMOGRAPH_URL = {
+ callback = function(task)
+ local urls = task:get_urls()
+
+ if urls then
+ for _,u in ipairs(urls) do
+ local h = u:get_host()
+
+ if h then
+ local non_latin,total = util.count_non_ascii(h)
+
+ if non_latin ~= total and non_latin > 0 then
+ return true, 1.0, h
+ end
+ end
+ end
+ end
+
+ return false
+ end,
+ score = 5.0,
+ description = 'Url contains both latin and non-latin characters'
+}