diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-07-03 18:49:14 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-07-03 18:49:14 +0100 |
commit | 09ec061b6028754b6fe5ca74619780355b30ccfd (patch) | |
tree | 0dfa928f122d3de6db73fd148c9fec070559fba8 /lualib/rspamadm/mime.lua | |
parent | 8a64455c564be18b23da97bd69c7feb2ae0bb710 (diff) | |
download | rspamd-09ec061b6028754b6fe5ca74619780355b30ccfd.tar.gz rspamd-09ec061b6028754b6fe5ca74619780355b30ccfd.zip |
[Minor] Initial implementation of fuzzy hashes extraction tool
Diffstat (limited to 'lualib/rspamadm/mime.lua')
-rw-r--r-- | lualib/rspamadm/mime.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lualib/rspamadm/mime.lua b/lualib/rspamadm/mime.lua index 2cdec1513..f31fe29f1 100644 --- a/lualib/rspamadm/mime.lua +++ b/lualib/rspamadm/mime.lua @@ -317,6 +317,22 @@ local function stat_handler(opts) e.t2 or "", table.concat(fun.totable( fun.map(function(k) return k end, e.flags)), ",")) end + elseif opts.fuzzy then + local parts = task:get_parts() or {} + out_elts[fname] = {} + process_func = function(e) + return string.format('part: %s(%s): %s', e.type, e.file or "", e.digest) + end + for _,part in ipairs(parts) do + if not part:is_multipart() then + table.insert(out_elts[fname], { + digest = part:get_digest(), + file = part:get_filename(), + type = string.format('%s/%s', part:get_type()) + }) + + end + end end task:destroy() -- No automatic dtor |