commit 415bcce: [Minor] Lua_magic: Add bat files detection

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Sep 24 15:07:07 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-09-24 15:59:58 +0100
URL: https://github.com/rspamd/rspamd/commit/415bcce9f46adc023de100c535ac53981ce8851f (HEAD -> master)

[Minor] Lua_magic: Add bat files detection

---
 lualib/lua_magic/patterns.lua | 9 +++++++++
 lualib/lua_magic/types.lua    | 4 ++++
 2 files changed, 13 insertions(+)

diff --git a/lualib/lua_magic/patterns.lua b/lualib/lua_magic/patterns.lua
index 8d90a45ef..47026478b 100644
--- a/lualib/lua_magic/patterns.lua
+++ b/lualib/lua_magic/patterns.lua
@@ -129,6 +129,15 @@ local patterns = {
       },
     }
   },
+  bat = {
+    matches = {
+      {
+        string = [[(?i)@\s*ECHO\s+OFF]],
+        position = {'>=', 0},
+        weight = 60,
+      },
+    }
+  },
   class = {
     -- Technically, this also matches MachO files, but I don't care about
     -- Apple and their mental health problems here: just consider Java files,
diff --git a/lualib/lua_magic/types.lua b/lualib/lua_magic/types.lua
index 5626b3445..4ed378ecd 100644
--- a/lualib/lua_magic/types.lua
+++ b/lualib/lua_magic/types.lua
@@ -47,6 +47,10 @@ local types = {
     ct = 'application/vnd.android.package-archive',
     type = 'archive',
   },
+  bat = {
+    ct = 'application/x-bat',
+    type = 'executable',
+  },
   -- text
   rtf = {
     ct = "application/rtf",


More information about the Commits mailing list