diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-08-20 16:39:34 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-08-20 16:39:55 +0100 |
commit | 1238bf915ec6b35225181e32649065784b36bb6c (patch) | |
tree | cee08b20af5cc68da83d5998ba2b6a0d5240c782 /src/plugins/lua | |
parent | 2f2907f9bac3a7bb82e39b4d8f7f1ac5606095df (diff) | |
download | rspamd-1238bf915ec6b35225181e32649065784b36bb6c.tar.gz rspamd-1238bf915ec6b35225181e32649065784b36bb6c.zip |
[Feature] Show the exact value matched for multima symbols
Diffstat (limited to 'src/plugins/lua')
-rw-r--r-- | src/plugins/lua/multimap.lua | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua index 99576a511..d913f7619 100644 --- a/src/plugins/lua/multimap.lua +++ b/src/plugins/lua/multimap.lua @@ -28,6 +28,48 @@ require "fun" () local urls = {} +local value_types = { + ip = { + get_value = function(ip) return ip:to_string() end, + }, + from = { + get_value = function(val) return val end, + }, + header = { + get_value = function(val) return val end, + }, + rcpt = { + get_value = function(val) return val end, + }, + user = { + get_value = function(val) return val end, + }, + url = { + get_value = function(url) return url:get_tld() end, + }, + dnsbl = { + get_value = function(ip) return ip:to_string() end, + }, + filename = { + get_value = function(val) return val end, + }, + content = { + get_value = function(val) return nil end, + }, + hostname = { + get_value = function(val) return val end, + }, + asn = { + get_value = function(val) return val end, + }, + country = { + get_value = function(val) return val end, + }, + mempool = { + get_value = function(val) return val end, + }, +} + local function ip_to_rbl(ip, rbl) return table.concat(ip:inversed_str_octets(), ".") .. '.' .. rbl end @@ -386,7 +428,13 @@ local function multimap_callback(task, rule) else symbol = r['symbol'] end - task:insert_result(symbol, score) + + local opt = value_types[r['type']].get_value(value) + if opt then + task:insert_result(symbol, score, opt) + else + task:insert_result(symbol, score) + end if pre_filter then task:set_pre_result(r['action'], 'Matched map: ' .. r['symbol']) |