You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

types.lua 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. --[[
  2. Copyright (c) 2019, Vsevolod Stakhov <vsevolod@highsecure.ru>
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ]]--
  13. --[[[
  14. -- @module lua_magic/patterns
  15. -- This module contains types definitions
  16. --]]
  17. -- This table is indexed by msdos extension for convenience
  18. local types = {
  19. -- exe
  20. exe = {
  21. ct = 'application/x-ms-application',
  22. type = 'executable',
  23. },
  24. elf = {
  25. ct = 'application/x-elf-executable',
  26. type = 'executable',
  27. },
  28. lnk = {
  29. ct = 'application/x-ms-application',
  30. type = 'executable',
  31. },
  32. class = {
  33. ct = 'application/x-java-applet',
  34. type = 'executable',
  35. },
  36. jar = {
  37. ct = 'application/java-archive',
  38. type = 'archive',
  39. },
  40. apk = {
  41. ct = 'application/vnd.android.package-archive',
  42. type = 'archive',
  43. },
  44. bat = {
  45. ct = 'application/x-bat',
  46. type = 'executable',
  47. },
  48. -- text
  49. rtf = {
  50. ct = "application/rtf",
  51. type = 'text',
  52. },
  53. pdf = {
  54. ct = 'application/pdf',
  55. type = 'binary',
  56. },
  57. ps = {
  58. ct = 'application/postscript',
  59. type = 'binary',
  60. },
  61. chm = {
  62. ct = 'application/x-chm',
  63. type = 'binary',
  64. },
  65. djvu = {
  66. ct = 'application/x-djvu',
  67. type = 'binary',
  68. },
  69. -- archives
  70. arj = {
  71. ct = 'application/x-arj',
  72. type = 'archive',
  73. },
  74. cab = {
  75. ct = 'application/x-cab',
  76. type = 'archive',
  77. },
  78. ace = {
  79. ct = 'application/x-ace',
  80. type = 'archive',
  81. },
  82. tar = {
  83. ct = 'application/x-tar',
  84. type = 'archive',
  85. },
  86. bz2 = {
  87. ct = 'application/x-bzip',
  88. type = 'archive',
  89. },
  90. xz = {
  91. ct = 'application/x-xz',
  92. type = 'archive',
  93. },
  94. lz4 = {
  95. ct = 'application/x-lz4',
  96. type = 'archive',
  97. },
  98. zst = {
  99. ct = 'application/x-zstandard',
  100. type = 'archive',
  101. },
  102. dmg = {
  103. ct = 'application/x-dmg',
  104. type = 'archive',
  105. },
  106. iso = {
  107. ct = 'application/x-iso',
  108. type = 'archive',
  109. },
  110. zoo = {
  111. ct = 'application/x-zoo',
  112. type = 'archive',
  113. },
  114. egg = {
  115. ct = 'application/x-egg',
  116. type = 'archive',
  117. },
  118. alz = {
  119. ct = 'application/x-alz',
  120. type = 'archive',
  121. },
  122. xar = {
  123. ct = 'application/x-xar',
  124. type = 'archive',
  125. },
  126. epub = {
  127. ct = 'application/x-epub',
  128. type = 'archive'
  129. },
  130. szdd = { -- in fact, their MSDOS extension is like FOO.TX_ or FOO.TX$
  131. ct = 'application/x-compressed',
  132. type = 'archive',
  133. },
  134. -- images
  135. psd = {
  136. ct = 'image/psd',
  137. type = 'image',
  138. av_check = false,
  139. },
  140. pcx = {
  141. ct = 'image/pcx',
  142. type = 'image',
  143. av_check = false,
  144. },
  145. pic = {
  146. ct = 'image/pic',
  147. type = 'image',
  148. av_check = false,
  149. },
  150. tiff = {
  151. ct = 'image/tiff',
  152. type = 'image',
  153. av_check = false,
  154. },
  155. ico = {
  156. ct = 'image/ico',
  157. type = 'image',
  158. av_check = false,
  159. },
  160. swf = {
  161. ct = 'application/x-shockwave-flash',
  162. type = 'image',
  163. },
  164. -- Ole files
  165. ole = {
  166. ct = 'application/octet-stream',
  167. type = 'office'
  168. },
  169. doc = {
  170. ct = 'application/msword',
  171. type = 'office'
  172. },
  173. xls = {
  174. ct = 'application/vnd.ms-excel',
  175. type = 'office'
  176. },
  177. ppt = {
  178. ct = 'application/vnd.ms-powerpoint',
  179. type = 'office'
  180. },
  181. vsd = {
  182. ct = 'application/vnd.visio',
  183. type = 'office'
  184. },
  185. msi = {
  186. ct = 'application/x-msi',
  187. type = 'executable'
  188. },
  189. msg = {
  190. ct = 'application/vnd.ms-outlook',
  191. type = 'office'
  192. },
  193. -- newer office (2007+)
  194. docx = {
  195. ct = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
  196. type = 'office'
  197. },
  198. xlsx = {
  199. ct = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
  200. type = 'office'
  201. },
  202. pptx = {
  203. ct = 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
  204. type = 'office'
  205. },
  206. -- OpenOffice formats
  207. odt = {
  208. ct = 'application/vnd.oasis.opendocument.text',
  209. type = 'office'
  210. },
  211. ods = {
  212. ct = 'application/vnd.oasis.opendocument.spreadsheet',
  213. type = 'office'
  214. },
  215. odp = {
  216. ct = 'application/vnd.oasis.opendocument.presentation',
  217. type = 'office'
  218. },
  219. -- other
  220. pgp = {
  221. ct = 'application/encrypted',
  222. type = 'encrypted'
  223. },
  224. uue = {
  225. ct = 'application/x-uuencoded',
  226. type = 'binary',
  227. },
  228. -- Types that are detected by Rspamd itself
  229. -- Archives
  230. zip = {
  231. ct = 'application/zip',
  232. type = 'archive',
  233. },
  234. rar = {
  235. ct = 'application/x-rar',
  236. type = 'archive',
  237. },
  238. ['7z'] = {
  239. ct = 'x-7z-compressed',
  240. type = 'archive',
  241. },
  242. gz = {
  243. ct = 'application/gzip',
  244. type = 'archive',
  245. },
  246. -- Images
  247. png = {
  248. ct = 'image/png',
  249. type = 'image',
  250. av_check = false,
  251. },
  252. gif = {
  253. ct = 'image/gif',
  254. type = 'image',
  255. av_check = false,
  256. },
  257. jpg = {
  258. ct = 'image/jpeg',
  259. type = 'image',
  260. av_check = false,
  261. },
  262. bmp = {
  263. type = 'image',
  264. ct = 'image/bmp',
  265. av_check = false,
  266. },
  267. dwg = {
  268. type = 'image',
  269. ct = 'image/vnd.dwg',
  270. },
  271. -- Text
  272. txt = {
  273. type = 'text',
  274. ct = 'text/plain',
  275. av_check = false,
  276. },
  277. html = {
  278. type = 'text',
  279. ct = 'text/html',
  280. av_check = false,
  281. },
  282. csv = {
  283. type = 'text',
  284. ct = 'text/csv',
  285. av_check = false,
  286. },
  287. ics = {
  288. type = 'text',
  289. ct = 'text/calendar',
  290. av_check = false,
  291. },
  292. vcf = {
  293. type = 'text',
  294. ct = 'text/vcard',
  295. av_check = false,
  296. },
  297. eml = {
  298. type = 'message',
  299. ct = 'message/rfc822',
  300. av_check = false,
  301. },
  302. }
  303. return types