From 3bc602c96ca66dc8b1a958bf2cc767c099346ed4 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 24 Feb 2017 10:45:30 +0000 Subject: [PATCH] [Fix] Adopt OMOGRAPH_URL rule --- rules/misc.lua | 24 +++++++----------------- 1 file 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 -- 2.39.5