]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Improve phishing plugin
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 4 May 2016 14:22:28 +0000 (15:22 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 4 May 2016 14:22:28 +0000 (15:22 +0100)
- Ignore redirected URLs
- Fix levenshtein distance calculations

src/plugins/lua/phishing.lua

index fcb2e5f7d2fc4a1f5b2cf7385bdbbb9d8be5ad4f..ecf88679fe612c4e30028893bd86789eb9e2f1e5 100644 (file)
@@ -30,7 +30,7 @@ local function phishing_cb(task)
 
   if urls then
     for _,url in ipairs(urls) do
-      if url:is_phished() then
+      if url:is_phished() and not url:is_redirected() then
         local found = false
         local purl = url:get_phished()
         local tld = url:get_tld()
@@ -41,7 +41,7 @@ local function phishing_cb(task)
         end
 
         local weight = 1.0
-        local dist = util.levenshtein_distance(tld, ptld)
+        local dist = util.levenshtein_distance(tld, ptld, 2)
         dist = 2 * dist / (#tld + #ptld)
 
         if dist > 0.3 and dist <= 1.0 then