Przeglądaj źródła

[Minor] Check visual confusing in phishing module

tags/1.5.0
Vsevolod Stakhov 7 lat temu
rodzic
commit
9969a6acd3
1 zmienionych plików z 18 dodań i 11 usunięć
  1. 18
    11
      src/plugins/lua/phishing.lua

+ 18
- 11
src/plugins/lua/phishing.lua Wyświetl plik

@@ -146,18 +146,25 @@ local function phishing_cb(task)
end

local weight = 1.0
local dist = util.levenshtein_distance(tld, ptld, 2)
dist = 2 * dist / (#tld + #ptld)

if dist > 0.3 and dist <= 1.0 then
-- Use distance to penalize the total weight
weight = util.tanh(3 * (1 - dist + 0.1))
elseif dist > 1 then
-- We have totally different strings in tld, so penalize it significantly
if dist > 2 then dist = 2 end
weight = util.tanh((2 - dist) * 0.5)
local spoofed,why = util.is_utf_spoofed(tld, ptld)
if spoofed then
rspamd_logger.debugm(N, task, "confusable: %1 -> %2: %3", tld, ptld, why)
weight = 1.0
else
local dist = util.levenshtein_distance(tld, ptld, 2)
dist = 2 * dist / (#tld + #ptld)

if dist > 0.3 and dist <= 1.0 then
-- Use distance to penalize the total weight
weight = util.tanh(3 * (1 - dist + 0.1))
elseif dist > 1 then
-- We have totally different strings in tld, so penalize it significantly
if dist > 2 then dist = 2 end
weight = util.tanh((2 - dist) * 0.5)
end

rspamd_logger.debugm(N, task, "distance: %1 -> %2: %3", tld, ptld, dist)
end
rspamd_logger.debugm(N, task, "distance: %1 -> %2: %3", tld, ptld, dist)

local function found_in_map(map)
if #map > 0 then

Ładowanie…
Anuluj
Zapisz