magic 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. # Magic data for mod_mime_magic Apache module (originally for file(1) command)
  2. # The module is described in /manual/mod/mod_mime_magic.html
  3. #
  4. # The format is 4-5 columns:
  5. # Column #1: byte number to begin checking from, ">" indicates continuation
  6. # Column #2: type of data to match
  7. # Column #3: contents of data to match
  8. # Column #4: MIME type of result
  9. # Column #5: MIME encoding of result (optional)
  10. #------------------------------------------------------------------------------
  11. # Localstuff: file(1) magic for locally observed files
  12. # Add any locally observed files here.
  13. #------------------------------------------------------------------------------
  14. # end local stuff
  15. #------------------------------------------------------------------------------
  16. #------------------------------------------------------------------------------
  17. # Java
  18. 0 short 0xcafe
  19. >2 short 0xbabe application/java
  20. #------------------------------------------------------------------------------
  21. # audio: file(1) magic for sound formats
  22. #
  23. # from Jan Nicolai Langfeldt <janl@ifi.uio.no>,
  24. #
  25. # Sun/NeXT audio data
  26. 0 string .snd
  27. >12 belong 1 audio/basic
  28. >12 belong 2 audio/basic
  29. >12 belong 3 audio/basic
  30. >12 belong 4 audio/basic
  31. >12 belong 5 audio/basic
  32. >12 belong 6 audio/basic
  33. >12 belong 7 audio/basic
  34. >12 belong 23 audio/x-adpcm
  35. # DEC systems (e.g. DECstation 5000) use a variant of the Sun/NeXT format
  36. # that uses little-endian encoding and has a different magic number
  37. # (0x0064732E in little-endian encoding).
  38. 0 lelong 0x0064732E
  39. >12 lelong 1 audio/x-dec-basic
  40. >12 lelong 2 audio/x-dec-basic
  41. >12 lelong 3 audio/x-dec-basic
  42. >12 lelong 4 audio/x-dec-basic
  43. >12 lelong 5 audio/x-dec-basic
  44. >12 lelong 6 audio/x-dec-basic
  45. >12 lelong 7 audio/x-dec-basic
  46. # compressed (G.721 ADPCM)
  47. >12 lelong 23 audio/x-dec-adpcm
  48. # Bytes 0-3 of AIFF, AIFF-C, & 8SVX audio files are "FORM"
  49. # AIFF audio data
  50. 8 string AIFF audio/x-aiff
  51. # AIFF-C audio data
  52. 8 string AIFC audio/x-aiff
  53. # IFF/8SVX audio data
  54. 8 string 8SVX audio/x-aiff
  55. # Creative Labs AUDIO stuff
  56. # Standard MIDI data
  57. 0 string MThd audio/unknown
  58. #>9 byte >0 (format %d)
  59. #>11 byte >1 using %d channels
  60. # Creative Music (CMF) data
  61. 0 string CTMF audio/unknown
  62. # SoundBlaster instrument data
  63. 0 string SBI audio/unknown
  64. # Creative Labs voice data
  65. 0 string Creative\ Voice\ File audio/unknown
  66. ## is this next line right? it came this way...
  67. #>19 byte 0x1A
  68. #>23 byte >0 - version %d
  69. #>22 byte >0 \b.%d
  70. # [GRR 950115: is this also Creative Labs? Guessing that first line
  71. # should be string instead of unknown-endian long...]
  72. #0 long 0x4e54524b MultiTrack sound data
  73. #0 string NTRK MultiTrack sound data
  74. #>4 long x - version %ld
  75. # Microsoft WAVE format (*.wav)
  76. # [GRR 950115: probably all of the shorts and longs should be leshort/lelong]
  77. # Microsoft RIFF
  78. 0 string RIFF
  79. # - WAVE format
  80. >8 string WAVE audio/x-wav
  81. # MPEG audio.
  82. 0 beshort&0xfff0 0xfff0 audio/mpeg
  83. # C64 SID Music files, from Linus Walleij <triad@df.lth.se>
  84. 0 string PSID audio/prs.sid
  85. #------------------------------------------------------------------------------
  86. # c-lang: file(1) magic for C programs or various scripts
  87. #
  88. # XPM icons (Greg Roelofs, newt@uchicago.edu)
  89. # ideally should go into "images", but entries below would tag XPM as C source
  90. 0 string /*\ XPM image/x-xbm 7bit
  91. # this first will upset you if you're a PL/1 shop... (are there any left?)
  92. # in which case rm it; ascmagic will catch real C programs
  93. # C or REXX program text
  94. 0 string /* text/plain
  95. # C++ program text
  96. 0 string // text/plain
  97. #------------------------------------------------------------------------------
  98. # compress: file(1) magic for pure-compression formats (no archives)
  99. #
  100. # compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, whap, etc.
  101. #
  102. # Formats for various forms of compressed data
  103. # Formats for "compress" proper have been moved into "compress.c",
  104. # because it tries to uncompress it to figure out what's inside.
  105. # standard unix compress
  106. 0 string \037\235 application/octet-stream x-compress
  107. # gzip (GNU zip, not to be confused with [Info-ZIP/PKWARE] zip archiver)
  108. 0 string \037\213 application/octet-stream x-gzip
  109. # According to gzip.h, this is the correct byte order for packed data.
  110. 0 string \037\036 application/octet-stream
  111. #
  112. # This magic number is byte-order-independent.
  113. #
  114. 0 short 017437 application/octet-stream
  115. # XXX - why *two* entries for "compacted data", one of which is
  116. # byte-order independent, and one of which is byte-order dependent?
  117. #
  118. # compacted data
  119. 0 short 0x1fff application/octet-stream
  120. 0 string \377\037 application/octet-stream
  121. # huf output
  122. 0 short 0145405 application/octet-stream
  123. # Squeeze and Crunch...
  124. # These numbers were gleaned from the Unix versions of the programs to
  125. # handle these formats. Note that I can only uncrunch, not crunch, and
  126. # I didn't have a crunched file handy, so the crunch number is untested.
  127. # Keith Waclena <keith@cerberus.uchicago.edu>
  128. #0 leshort 0x76FF squeezed data (CP/M, DOS)
  129. #0 leshort 0x76FE crunched data (CP/M, DOS)
  130. # Freeze
  131. #0 string \037\237 Frozen file 2.1
  132. #0 string \037\236 Frozen file 1.0 (or gzip 0.5)
  133. # lzh?
  134. #0 string \037\240 LZH compressed data
  135. #------------------------------------------------------------------------------
  136. # frame: file(1) magic for FrameMaker files
  137. #
  138. # This stuff came on a FrameMaker demo tape, most of which is
  139. # copyright, but this file is "published" as witness the following:
  140. #
  141. 0 string \<MakerFile application/x-frame
  142. 0 string \<MIFFile application/x-frame
  143. 0 string \<MakerDictionary application/x-frame
  144. 0 string \<MakerScreenFon application/x-frame
  145. 0 string \<MML application/x-frame
  146. 0 string \<Book application/x-frame
  147. 0 string \<Maker application/x-frame
  148. #------------------------------------------------------------------------------
  149. # html: file(1) magic for HTML (HyperText Markup Language) docs
  150. #
  151. # from Daniel Quinlan <quinlan@yggdrasil.com>
  152. # and Anna Shergold <anna@inext.co.uk>
  153. #
  154. 0 string \<!DOCTYPE\ HTML text/html
  155. 0 string \<!doctype\ html text/html
  156. 0 string \<HEAD text/html
  157. 0 string \<head text/html
  158. 0 string \<TITLE text/html
  159. 0 string \<title text/html
  160. 0 string \<html text/html
  161. 0 string \<HTML text/html
  162. 0 string \<!-- text/html
  163. 0 string \<h1 text/html
  164. 0 string \<H1 text/html
  165. # XML eXtensible Markup Language, from Linus Walleij <triad@df.lth.se>
  166. 0 string \<?xml text/xml
  167. #------------------------------------------------------------------------------
  168. # images: file(1) magic for image formats (see also "c-lang" for XPM bitmaps)
  169. #
  170. # originally from jef@helios.ee.lbl.gov (Jef Poskanzer),
  171. # additions by janl@ifi.uio.no as well as others. Jan also suggested
  172. # merging several one- and two-line files into here.
  173. #
  174. # XXX - byte order for GIF and TIFF fields?
  175. # [GRR: TIFF allows both byte orders; GIF is probably little-endian]
  176. #
  177. # [GRR: what the hell is this doing in here?]
  178. #0 string xbtoa btoa'd file
  179. # PBMPLUS
  180. # PBM file
  181. 0 string P1 image/x-portable-bitmap 7bit
  182. # PGM file
  183. 0 string P2 image/x-portable-greymap 7bit
  184. # PPM file
  185. 0 string P3 image/x-portable-pixmap 7bit
  186. # PBM "rawbits" file
  187. 0 string P4 image/x-portable-bitmap
  188. # PGM "rawbits" file
  189. 0 string P5 image/x-portable-greymap
  190. # PPM "rawbits" file
  191. 0 string P6 image/x-portable-pixmap
  192. # NIFF (Navy Interchange File Format, a modification of TIFF)
  193. # [GRR: this *must* go before TIFF]
  194. 0 string IIN1 image/x-niff
  195. # TIFF and friends
  196. # TIFF file, big-endian
  197. 0 string MM image/tiff
  198. # TIFF file, little-endian
  199. 0 string II image/tiff
  200. # possible GIF replacements; none yet released!
  201. # (Greg Roelofs, newt@uchicago.edu)
  202. #
  203. # GRR 950115: this was mine ("Zip GIF"):
  204. # ZIF image (GIF+deflate alpha)
  205. 0 string GIF94z image/unknown
  206. #
  207. # GRR 950115: this is Jeremy Wohl's Free Graphics Format (better):
  208. # FGF image (GIF+deflate beta)
  209. 0 string FGF95a image/unknown
  210. #
  211. # GRR 950115: this is Thomas Boutell's Portable Bitmap Format proposal
  212. # (best; not yet implemented):
  213. # PBF image (deflate compression)
  214. 0 string PBF image/unknown
  215. # GIF
  216. 0 string GIF image/gif
  217. # JPEG images
  218. 0 beshort 0xffd8 image/jpeg
  219. # PC bitmaps (OS/2, Windoze BMP files) (Greg Roelofs, newt@uchicago.edu)
  220. 0 string BM image/bmp
  221. #>14 byte 12 (OS/2 1.x format)
  222. #>14 byte 64 (OS/2 2.x format)
  223. #>14 byte 40 (Windows 3.x format)
  224. #0 string IC icon
  225. #0 string PI pointer
  226. #0 string CI color icon
  227. #0 string CP color pointer
  228. #0 string BA bitmap array
  229. 0 string \x89PNG image/png
  230. 0 string FWS application/x-shockwave-flash
  231. 0 string CWS application/x-shockwave-flash
  232. #------------------------------------------------------------------------------
  233. # lisp: file(1) magic for lisp programs
  234. #
  235. # various lisp types, from Daniel Quinlan (quinlan@yggdrasil.com)
  236. 0 string ;; text/plain 8bit
  237. # Emacs 18 - this is always correct, but not very magical.
  238. 0 string \012( application/x-elc
  239. # Emacs 19
  240. 0 string ;ELC\023\000\000\000 application/x-elc
  241. #------------------------------------------------------------------------------
  242. # mail.news: file(1) magic for mail and news
  243. #
  244. # There are tests to ascmagic.c to cope with mail and news.
  245. 0 string Relay-Version: message/rfc822 7bit
  246. 0 string #!\ rnews message/rfc822 7bit
  247. 0 string N#!\ rnews message/rfc822 7bit
  248. 0 string Forward\ to message/rfc822 7bit
  249. 0 string Pipe\ to message/rfc822 7bit
  250. 0 string Return-Path: message/rfc822 7bit
  251. 0 string Path: message/news 8bit
  252. 0 string Xref: message/news 8bit
  253. 0 string From: message/rfc822 7bit
  254. 0 string Article message/news 8bit
  255. #------------------------------------------------------------------------------
  256. # msword: file(1) magic for MS Word files
  257. #
  258. # Contributor claims:
  259. # Reversed-engineered MS Word magic numbers
  260. #
  261. 0 string \376\067\0\043 application/msword
  262. 0 string \333\245-\0\0\0 application/msword
  263. # disable this one because it applies also to other
  264. # Office/OLE documents for which msword is not correct. See PR#2608.
  265. #0 string \320\317\021\340\241\261 application/msword
  266. #------------------------------------------------------------------------------
  267. # printer: file(1) magic for printer-formatted files
  268. #
  269. # PostScript
  270. 0 string %! application/postscript
  271. 0 string \004%! application/postscript
  272. # Acrobat
  273. # (due to clamen@cs.cmu.edu)
  274. 0 string %PDF- application/pdf
  275. #------------------------------------------------------------------------------
  276. # sc: file(1) magic for "sc" spreadsheet
  277. #
  278. 38 string Spreadsheet application/x-sc
  279. #------------------------------------------------------------------------------
  280. # tex: file(1) magic for TeX files
  281. #
  282. # XXX - needs byte-endian stuff (big-endian and little-endian DVI?)
  283. #
  284. # From <conklin@talisman.kaleida.com>
  285. # Although we may know the offset of certain text fields in TeX DVI
  286. # and font files, we can't use them reliably because they are not
  287. # zero terminated. [but we do anyway, christos]
  288. 0 string \367\002 application/x-dvi
  289. #0 string \367\203 TeX generic font data
  290. #0 string \367\131 TeX packed font data
  291. #0 string \367\312 TeX virtual font data
  292. #0 string This\ is\ TeX, TeX transcript text
  293. #0 string This\ is\ METAFONT, METAFONT transcript text
  294. # There is no way to detect TeX Font Metric (*.tfm) files without
  295. # breaking them apart and reading the data. The following patterns
  296. # match most *.tfm files generated by METAFONT or afm2tfm.
  297. #2 string \000\021 TeX font metric data
  298. #2 string \000\022 TeX font metric data
  299. #>34 string >\0 (%s)
  300. # Texinfo and GNU Info, from Daniel Quinlan (quinlan@yggdrasil.com)
  301. #0 string \\input\ texinfo Texinfo source text
  302. #0 string This\ is\ Info\ file GNU Info text
  303. # correct TeX magic for Linux (and maybe more)
  304. # from Peter Tobias (tobias@server.et-inf.fho-emden.de)
  305. #
  306. 0 leshort 0x02f7 application/x-dvi
  307. # RTF - Rich Text Format
  308. 0 string {\\rtf application/rtf
  309. #------------------------------------------------------------------------------
  310. # animation: file(1) magic for animation/movie formats
  311. #
  312. # animation formats, originally from vax@ccwf.cc.utexas.edu (VaX#n8)
  313. # MPEG file
  314. 0 string \000\000\001\263 video/mpeg
  315. #
  316. # The contributor claims:
  317. # I couldn't find a real magic number for these, however, this
  318. # -appears- to work. Note that it might catch other files, too,
  319. # so BE CAREFUL!
  320. #
  321. # Note that title and author appear in the two 20-byte chunks
  322. # at decimal offsets 2 and 22, respectively, but they are XOR'ed with
  323. # 255 (hex FF)! DL format SUCKS BIG ROCKS.
  324. #
  325. # DL file version 1 , medium format (160x100, 4 images/screen)
  326. 0 byte 1 video/unknown
  327. 0 byte 2 video/unknown
  328. # Quicktime video, from Linus Walleij <triad@df.lth.se>
  329. # from Apple quicktime file format documentation.
  330. 4 string moov video/quicktime
  331. 4 string mdat video/quicktime