Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. --[[
  2. Copyright (c) 2022, Vsevolod Stakhov <vsevolod@rspamd.com>
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ]]--
  13. --[[[
  14. -- @module lua_scanners
  15. -- This module contains external scanners functions
  16. --]]
  17. local fun = require "fun"
  18. local exports = {
  19. }
  20. local function require_scanner(name)
  21. local sc = require("lua_scanners/" .. name)
  22. exports[sc.name or name] = sc
  23. end
  24. -- Antiviruses
  25. require_scanner('clamav')
  26. require_scanner('fprot')
  27. require_scanner('kaspersky_av')
  28. require_scanner('kaspersky_se')
  29. require_scanner('savapi')
  30. require_scanner('sophos')
  31. require_scanner('virustotal')
  32. require_scanner('avast')
  33. -- Other scanners
  34. require_scanner('dcc')
  35. require_scanner('oletools')
  36. require_scanner('icap')
  37. require_scanner('vadesecure')
  38. require_scanner('spamassassin')
  39. require_scanner('p0f')
  40. require_scanner('razor')
  41. require_scanner('pyzor')
  42. require_scanner('cloudmark')
  43. exports.add_scanner = function(name, t, conf_func, check_func)
  44. assert(type(conf_func) == 'function' and type(check_func) == 'function',
  45. 'bad arguments')
  46. exports[name] = {
  47. type = t,
  48. configure = conf_func,
  49. check = check_func,
  50. }
  51. end
  52. exports.filter = function(t)
  53. return fun.tomap(fun.filter(function(_, elt)
  54. return type(elt) == 'table' and elt.type and (
  55. (type(elt.type) == 'string' and elt.type == t) or
  56. (type(elt.type) == 'table' and fun.any(function(tt)
  57. return tt == t
  58. end, elt.type))
  59. )
  60. end, exports))
  61. end
  62. return exports