commit 0b5f43d: [Minor] Lua_magic: Add types for .jar and for .apk

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Sep 24 12:00:06 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-09-24 12:57:33 +0100
URL: https://github.com/rspamd/rspamd/commit/0b5f43d31ee401931d65e4627e0bcebab571be7c (HEAD -> master)

[Minor] Lua_magic: Add types for .jar and for .apk

---
 lualib/lua_magic/heuristics.lua | 5 ++++-
 lualib/lua_magic/types.lua      | 8 ++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/lualib/lua_magic/heuristics.lua b/lualib/lua_magic/heuristics.lua
index 8fb83bb0d..700932051 100644
--- a/lualib/lua_magic/heuristics.lua
+++ b/lualib/lua_magic/heuristics.lua
@@ -244,7 +244,8 @@ local function detect_archive_flaw(part, arch, log_obj)
     jar = 0,
     odt = 0,
     odp = 0,
-    ods = 0
+    ods = 0,
+    apk = 0,
   } -- ext + confidence pairs
 
   -- General msoffice patterns
@@ -268,6 +269,8 @@ local function detect_archive_flaw(part, arch, log_obj)
         res.pptx = res.pptx + 30
       elseif file == 'META-INF/MANIFEST.MF' then
         res.jar = res.jar + 40
+      elseif file == 'AndroidManifest.xml' then
+        res.apk = res.apk + 60
       end
     end
 
diff --git a/lualib/lua_magic/types.lua b/lualib/lua_magic/types.lua
index 2b2545d87..5626b3445 100644
--- a/lualib/lua_magic/types.lua
+++ b/lualib/lua_magic/types.lua
@@ -39,6 +39,14 @@ local types = {
     ct = 'application/x-java-applet',
     type = 'executable',
   },
+  jar = {
+    ct = 'application/java-archive',
+    type = 'archive',
+  },
+  apk = {
+    ct = 'application/vnd.android.package-archive',
+    type = 'archive',
+  },
   -- text
   rtf = {
     ct = "application/rtf",


More information about the Commits mailing list