summaryrefslogtreecommitdiffstats
path: root/rules/misc.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-02-24 10:45:30 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-02-24 10:45:55 +0000
commit3bc602c96ca66dc8b1a958bf2cc767c099346ed4 (patch)
tree67769ad5e64c7a32b0402f391f73d79961d68533 /rules/misc.lua
parent5fca00b1f15cc38361879baa78aced1f9d34f53c (diff)
downloadrspamd-3bc602c96ca66dc8b1a958bf2cc767c099346ed4.tar.gz
rspamd-3bc602c96ca66dc8b1a958bf2cc767c099346ed4.zip
[Fix] Adopt OMOGRAPH_URL rule
Diffstat (limited to 'rules/misc.lua')
-rw-r--r--rules/misc.lua24
1 files changed, 7 insertions, 17 deletions
diff --git a/rules/misc.lua b/rules/misc.lua
index e7dca4b04..8cfd71619 100644
--- a/rules/misc.lua
+++ b/rules/misc.lua
@@ -799,25 +799,15 @@ rspamd_config.OMOGRAPH_URL = {
local bad_urls = {}
fun.each(function(u)
- local h = u:get_host()
- if h then
- local parts = rspamd_str_split(h, '.')
- local found = false
-
- for _,p in ipairs(parts) do
- local cnlat,ctot = util.count_non_ascii(p)
-
- if cnlat > 0 and cnlat ~= ctot then
- bad_omographs = bad_omographs + 1.0 / cnlat
- found = true
- end
- end
-
- if found then
- table.insert(bad_urls, h)
+ local h1 = u:get_host()
+ local h2 = u:get_phished():get_host()
+ if h1 and h2 then
+ if util.is_utf_spoofed(h1, h2) then
+ table.insert(bad_urls, string.format('%s->%s', h1, h2))
+ bad_omographs = bad_omographs + 1
end
end
- end, fun.filter(function(u) return not u:is_html_displayed() end, urls))
+ end, fun.filter(function(u) return u:is_phished() end, urls))
if bad_omographs > 0 then
if bad_omographs > 1 then bad_omographs = 1.0 end