ソースを参照

Improve pyzor with min and halfscore threshold settings

pull/4948/head
mykeenu 1ヶ月前
コミット
94b74c48e4
コミッターのメールアドレスに関連付けられたアカウントが存在しません
1個のファイルの変更11行の追加2行の削除
  1. 11
    2
      lualib/lua_scanners/pyzor.lua

+ 11
- 2
lualib/lua_scanners/pyzor.lua ファイルの表示

@@ -43,6 +43,8 @@ local function pyzor_config(opts)
message = '${SCANNER}: Pyzor bulk message found: "${VIRUS}"',
default_score = 1.5,
action = false,
min_threshold = 0, -- zero score if whitelist+report count smaller than this
halfscore_threshold = 0, -- half score if whitelist+report count smaller than this
}

pyzor_conf = lua_util.override_defaults(pyzor_conf, opts)
@@ -149,8 +151,15 @@ local function pyzor_check(task, content, digest, rule)
rule.default_score: 1
Weight: 0
]]
local weight = tonumber(string.format("%.2f",
rule.default_score * (reported - whitelisted) / (reported + whitelisted)))
local weight = 0
local total = reported + whitelisted
if total > rule.min_threshold and total > 0 then
weight = tonumber(string.format("%.2f",
rule.default_score * (reported - whitelisted) / total))
if total < rule.halfscore_threshold then
weight = tonumber(string.format("%.2f", weight / 2))
end
end
local info = string.format("count=%d wl=%d", reported, whitelisted)
local threat_string = string.format("bl_%d_wl_%d",
reported, whitelisted)

読み込み中…
キャンセル
保存