diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-09-06 14:06:14 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-09-06 14:06:14 +0100 |
commit | 8dffba8ba0717f1f8a4ba9e006ca1f5942decfc2 (patch) | |
tree | dbbe5488aefd184f2dcd717f59596beb9b3b40c0 /lualib/lua_magic/patterns.lua | |
parent | 055640c105492d4aaa8a75f973ce208ffd8cc045 (diff) | |
download | rspamd-8dffba8ba0717f1f8a4ba9e006ca1f5942decfc2.tar.gz rspamd-8dffba8ba0717f1f8a4ba9e006ca1f5942decfc2.zip |
[Project] Lua_magic: Add more file types
Diffstat (limited to 'lualib/lua_magic/patterns.lua')
-rw-r--r-- | lualib/lua_magic/patterns.lua | 144 |
1 files changed, 140 insertions, 4 deletions
diff --git a/lualib/lua_magic/patterns.lua b/lualib/lua_magic/patterns.lua index 354f8ec61..a52baa790 100644 --- a/lualib/lua_magic/patterns.lua +++ b/lualib/lua_magic/patterns.lua @@ -20,14 +20,12 @@ limitations under the License. --]] local patterns = { - { - -- MSDOS extension to match types table - ext = 'pdf', + pdf = { -- These are alternatives matches = { { string = [[%PDF-\d]], - position = 6, -- must be end of the match, as that's how hyperscan works + position = 6, -- must be end of the match, as that's how hyperscan works (or use relative_position) weight = 60, }, { @@ -41,6 +39,144 @@ local patterns = { weight = 60, }, }, + }, + ps = { + matches = { + { + string = [[%!PS-Adobe]], + relative_position = 0, + weight = 60, + }, + }, + }, + -- RTF document + rtf = { + matches = { + { + string = [[{\\rtf\d]], + position = 6, + weight = 60, + } + } + }, + chm = { + matches = { + { + string = [[ITSF]], + relative_position = 0, + weight = 60, + } + } + }, + djvu = { + matches = { + { + string = [[AT&TFORM]], + relative_position = 0, + weight = 60, + }, + { + string = [[DJVM]], + relative_position = 0x0c, + weight = 60, + } + } + }, + -- MS Exe file + exe = { + matches = { + { + string = [[MZ]], + relative_position = 0, + weight = 10, + }, + -- PE part + { + string = [[PE\x{00}\x{00}]], + position = {'>=', 0x3c + 4}, + weight = 40, + } + } + }, + -- Archives + arj = { + matches = { + { + hex = '60EA', + relative_position = 0, + weight = 60, + }, + } + }, + ace = { + matches = { + { + string = [[\*\*ACE\*\*]], + position = 14, + weight = 60, + }, + } + }, + cab = { + matches = { + { + string = [[MSCF]], + relative_position = 0, + weight = 60, + }, + } + }, + -- Images + psd = { + matches = { + { + string = [[8BPS]], + relative_position = 0, + weight = 60, + }, + } + }, + ico = { + matches = { + { + hex = [[00000100]], + relative_position = 0, + weight = 60, + }, + } + }, + pcx = { + matches = { + { + hex = [[0A050108]], + relative_position = 0, + weight = 60, + }, + } + }, + pic = { + matches = { + { + hex = [[FF80C9C71A00]], + relative_position = 0, + weight = 60, + }, + } + }, + -- Other + pgp = { + matches = { + { + hex = [[A803504750]], + relative_position = 0, + weight = 60, + }, + { + hex = [[2D424547494E20504750204D4553534147452D]], + relative_position = 0, + weight = 60, + }, + } } } |