commit 6d97c8f: [Project] Lua_magic: Add more types

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Sep 9 12:14:15 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-09-09 13:07:50 +0100
URL: https://github.com/rspamd/rspamd/commit/6d97c8f9bfe5ddf16b53c9b8f8d11258c0af8f36 (HEAD -> master)

[Project] Lua_magic: Add more types

---
 lualib/lua_magic/heuristics.lua | 3 +++
 lualib/lua_magic/patterns.lua   | 9 +++++++++
 lualib/lua_magic/types.lua      | 8 ++++++++
 3 files changed, 20 insertions(+)

diff --git a/lualib/lua_magic/heuristics.lua b/lualib/lua_magic/heuristics.lua
index 60ff57224..8469fa9f8 100644
--- a/lualib/lua_magic/heuristics.lua
+++ b/lualib/lua_magic/heuristics.lua
@@ -51,6 +51,7 @@ local zip_patterns = {
          [[mimetypeapplication/vnd\.oasis\.opendocument.formula]],
          [[mimetypeapplication/vnd\.oasis\.opendocument\.chart]]},
   odp = {[[mimetypeapplication/vnd\.oasis\.opendocument\.presentation]]},
+  epub = {[[epub\+zip]]}
 }
 
 -- Used to match pattern index and extension
@@ -236,6 +237,8 @@ local function detect_archive_flaw(part, arch, log_obj)
         res.docx = res.docx + 30
       elseif file:sub(1, 4) == 'ppt/' then
         res.pptx = res.pptx + 30
+      elseif file == 'META-INF/MANIFEST.MF' then
+        res.jar = res.jar + 40
       end
     end
 
diff --git a/lualib/lua_magic/patterns.lua b/lualib/lua_magic/patterns.lua
index 87ed3c0e9..630f287ce 100644
--- a/lualib/lua_magic/patterns.lua
+++ b/lualib/lua_magic/patterns.lua
@@ -224,6 +224,15 @@ local patterns = {
       },
     }
   },
+  xar = {
+    matches = {
+      {
+        string = [[xar!]],
+        relative_position = 0,
+        weight = 60,
+      },
+    }
+  },
   iso = {
     matches = {
       {
diff --git a/lualib/lua_magic/types.lua b/lualib/lua_magic/types.lua
index e8e4e45e2..3ecd0575a 100644
--- a/lualib/lua_magic/types.lua
+++ b/lualib/lua_magic/types.lua
@@ -105,6 +105,14 @@ local types = {
     ct = 'application/x-zoo',
     type = 'archive',
   },
+  xar = {
+    ct = 'application/x-xar',
+    type = 'archive',
+  },
+  epub = {
+    ct = 'application/x-epub',
+    type = 'archive'
+  },
   szdd = { -- in fact, their MSDOS extension is like FOO.TX_ or FOO.TX$
     ct = 'application/x-compressed',
     type = 'archive',


More information about the Commits mailing list