Browse Source

[Rules] OMOGRAPH_URL: Avoid extra calls for repeated urls

tags/1.9.0
Vsevolod Stakhov 5 years ago
parent
commit
fb2c14b1e1
1 changed files with 9 additions and 4 deletions
  1. 9
    4
      rules/misc.lua

+ 9
- 4
rules/misc.lua View File

local bad_omographs = 0 local bad_omographs = 0
local single_bad_omograps = 0 local single_bad_omograps = 0
local bad_urls = {} local bad_urls = {}
local seen = {}


fun.each(function(u) fun.each(function(u)
if u:is_phished() then if u:is_phished() then

local h1 = u:get_host() local h1 = u:get_host()
local h2 = u:get_phished():get_host() local h2 = u:get_phished():get_host()
if h1 and h2 then if h1 and h2 then
if util.is_utf_spoofed(h1, h2) then
table.insert(bad_urls, string.format('%s->%s', h1, h2))
local selt = string.format('%s->%s', h1, h2)
if not seen[selt] and util.is_utf_spoofed(h1, h2) then
bad_urls[#bad_urls + 1] = selt
bad_omographs = bad_omographs + 1 bad_omographs = bad_omographs + 1
end end
seen[selt] = true
end end
end end
if not u:is_html_displayed() then if not u:is_html_displayed() then
local h = u:get_tld() local h = u:get_tld()


if h then if h then
if util.is_utf_spoofed(h) then
table.insert(bad_urls, string.format('%s', h))
if not seen[h] and util.is_utf_spoofed(h) then
bad_urls[#bad_urls + 1] = h
single_bad_omograps = single_bad_omograps + 1 single_bad_omograps = single_bad_omograps + 1
end end
seen[h] = true
end end
end end
end, urls) end, urls)

Loading…
Cancel
Save