From 434255a2a71e508d1e1de2bda368572d62be7e3e Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 26 Dec 2018 14:59:14 +0000 Subject: [Rework] Lua_scanners: Further library split --- lualib/lua_scanners/init.lua | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'lualib/lua_scanners/init.lua') diff --git a/lualib/lua_scanners/init.lua b/lualib/lua_scanners/init.lua index 9937fd73f..149402874 100644 --- a/lualib/lua_scanners/init.lua +++ b/lualib/lua_scanners/init.lua @@ -19,8 +19,37 @@ limitations under the License. -- This module contains external scanners functions --]] +local fun = require "fun" + local exports = { - antivirus = require "lua_scanners/lua_antivirus", } +local function require_scanner(name) + local sc = require ("lua_scanners/" .. name) + + exports[sc.name or name] = sc +end + +require_scanner('clamav') +require_scanner('fprot') +require_scanner('kaspersky_av') +require_scanner('savapi') +require_scanner('sophos') + +exports.add_scanner = function(name, t, conf_func, check_func) + assert(type(conf_func) == 'function' and type(check_func) == 'function', + 'bad arguments') + exports[name] = { + type = t, + configure = conf_func, + check = check_func, + } +end + +exports.filter = function(t) + return fun.tomap(fun.filter(function(_, elt) + return type(elt) == 'table' and elt.type and elt.type == t + end, exports)) +end + return exports \ No newline at end of file -- cgit v1.2.3