commit 1ae43b6: [Minor] Mime_types: Insert MIME_OBFUSCATED_ARCHIVE symbol

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Jan 13 20:56:05 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-01-13 20:44:57 +0000
URL: https://github.com/rspamd/rspamd/commit/1ae43b63ba3196c80ee64821b686c5f12ed9d46a

[Minor] Mime_types: Insert MIME_OBFUSCATED_ARCHIVE symbol

---
 src/plugins/lua/mime_types.lua | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/plugins/lua/mime_types.lua b/src/plugins/lua/mime_types.lua
index fd1c7e2d5..a2e570ef8 100644
--- a/src/plugins/lua/mime_types.lua
+++ b/src/plugins/lua/mime_types.lua
@@ -35,6 +35,7 @@ local settings = {
   symbol_good = 'MIME_GOOD',
   symbol_attachment = 'MIME_BAD_ATTACHMENT',
   symbol_encrypted_archive = 'MIME_ENCRYPTED_ARCHIVE',
+  symbol_obfuscated_archive = 'MIME_OBFUSCATED_ARCHIVE',
   symbol_exe_in_gen_split_rar = 'MIME_EXE_IN_GEN_SPLIT_RAR',
   symbol_archive_in_archive = 'MIME_ARCHIVE_IN_ARCHIVE',
   symbol_double_extension = 'MIME_DOUBLE_BAD_EXTENSION',
@@ -429,6 +430,7 @@ local function check_mime_type(task)
           end
           local arch = p:get_archive()
 
+          -- TODO: migrate to flags once C part is ready
           if arch:is_encrypted() then
             task:insert_result(settings.symbol_encrypted_archive, 1.0, filename)
             task:insert_result('MIME_TRACE', 0.0,
@@ -440,6 +442,13 @@ local function check_mime_type(task)
             })
             task:insert_result('MIME_TRACE', 0.0,
                 string.format("%s:%s", p:get_id(), '-'))
+          elseif arch:is_obfuscated() then
+            task:insert_result(settings.symbol_obfuscated_archive, 1.0, {
+              'obfuscated archive',
+              filename,
+            })
+            task:insert_result('MIME_TRACE', 0.0,
+                string.format("%s:%s", p:get_id(), '-'))
           end
 
           if check then
@@ -628,6 +637,12 @@ if opts then
       parent = id,
       group = 'mime_types',
     })
+    rspamd_config:register_symbol({
+      type = 'virtual',
+      name = settings['symbol_obfuscated_archive'],
+      parent = id,
+      group = 'mime_types',
+    })
     rspamd_config:register_symbol({
       type = 'virtual',
       name = settings['symbol_exe_in_gen_split_rar'],


More information about the Commits mailing list