archive 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918
  1. #------------------------------------------------------------------------------
  2. # $File: archive,v 1.73 2012/11/09 22:59:30 christos Exp $
  3. # archive: file(1) magic for archive formats (see also "msdos" for self-
  4. # extracting compressed archives)
  5. #
  6. # cpio, ar, arc, arj, hpack, lha/lharc, rar, squish, uc2, zip, zoo, etc.
  7. # pre-POSIX "tar" archives are handled in the C code.
  8. # POSIX tar archives
  9. 257 string ustar\0 POSIX tar archive
  10. !:mime application/x-tar # encoding: posix
  11. 257 string ustar\040\040\0 GNU tar archive
  12. !:mime application/x-tar # encoding: gnu
  13. # Incremental snapshot gnu-tar format from:
  14. # http://www.gnu.org/software/tar/manual/html_node/Snapshot-Files.html
  15. 0 string GNU\ tar- GNU tar incremental snapshot data
  16. >&0 regex [0-9]\.[0-9]+-[0-9]+ version %s
  17. # cpio archives
  18. #
  19. # Yes, the top two "cpio archive" formats *are* supposed to just be "short".
  20. # The idea is to indicate archives produced on machines with the same
  21. # byte order as the machine running "file" with "cpio archive", and
  22. # to indicate archives produced on machines with the opposite byte order
  23. # from the machine running "file" with "byte-swapped cpio archive".
  24. #
  25. # The SVR4 "cpio(4)" hints that there are additional formats, but they
  26. # are defined as "short"s; I think all the new formats are
  27. # character-header formats and thus are strings, not numbers.
  28. 0 short 070707 cpio archive
  29. !:mime application/x-cpio
  30. 0 short 0143561 byte-swapped cpio archive
  31. !:mime application/x-cpio # encoding: swapped
  32. 0 string 070707 ASCII cpio archive (pre-SVR4 or odc)
  33. 0 string 070701 ASCII cpio archive (SVR4 with no CRC)
  34. 0 string 070702 ASCII cpio archive (SVR4 with CRC)
  35. # Debian package (needs to go before regular portable archives)
  36. #
  37. 0 string =!<arch>\ndebian
  38. !:mime application/x-debian-package
  39. >8 string debian-split part of multipart Debian package
  40. >8 string debian-binary Debian binary package
  41. >8 string !debian
  42. >68 string >\0 (format %s)
  43. # These next two lines do not work, because a bzip2 Debian archive
  44. # still uses gzip for the control.tar (first in the archive). Only
  45. # data.tar varies, and the location of its filename varies too.
  46. # file/libmagic does not current have support for ascii-string based
  47. # (offsets) as of 2005-09-15.
  48. #>81 string bz2 \b, uses bzip2 compression
  49. #>84 string gz \b, uses gzip compression
  50. #>136 ledate x created: %s
  51. 0 string =!<thin>\n thin archive with
  52. >68 belong 0 no symbol entries
  53. >68 belong 1 %d symbol entry
  54. >68 belong >1 %d symbol entries
  55. # other archives
  56. 0 long 0177555 very old archive
  57. 0 short 0177555 very old PDP-11 archive
  58. 0 long 0177545 old archive
  59. 0 short 0177545 old PDP-11 archive
  60. 0 long 0100554 apl workspace
  61. 0 string =<ar> archive
  62. !:mime application/x-archive
  63. # MIPS archive (needs to go before regular portable archives)
  64. #
  65. 0 string =!<arch>\n__________E MIPS archive
  66. >20 string U with MIPS Ucode members
  67. >21 string L with MIPSEL members
  68. >21 string B with MIPSEB members
  69. >19 string L and an EL hash table
  70. >19 string B and an EB hash table
  71. >22 string X -- out of date
  72. 0 search/1 -h- Software Tools format archive text
  73. #
  74. # XXX - why are there multiple <ar> thingies? Note that 0x213c6172 is
  75. # "!<ar", so, for new-style (4.xBSD/SVR2andup) archives, we have:
  76. #
  77. # 0 string =!<arch> current ar archive
  78. # 0 long 0x213c6172 archive file
  79. #
  80. # and for SVR1 archives, we have:
  81. #
  82. # 0 string \<ar> System V Release 1 ar archive
  83. # 0 string =<ar> archive
  84. #
  85. # XXX - did Aegis really store shared libraries, breakpointed modules,
  86. # and absolute code program modules in the same format as new-style
  87. # "ar" archives?
  88. #
  89. 0 string =!<arch> current ar archive
  90. !:mime application/x-archive
  91. >8 string __.SYMDEF random library
  92. >0 belong =65538 - pre SR9.5
  93. >0 belong =65539 - post SR9.5
  94. >0 beshort 2 - object archive
  95. >0 beshort 3 - shared library module
  96. >0 beshort 4 - debug break-pointed module
  97. >0 beshort 5 - absolute code program module
  98. 0 string \<ar> System V Release 1 ar archive
  99. 0 string =<ar> archive
  100. #
  101. # XXX - from "vax", which appears to collect a bunch of byte-swapped
  102. # thingies, to help you recognize VAX files on big-endian machines;
  103. # with "leshort", "lelong", and "string", that's no longer necessary....
  104. #
  105. 0 belong 0x65ff0000 VAX 3.0 archive
  106. 0 belong 0x3c61723e VAX 5.0 archive
  107. #
  108. 0 long 0x213c6172 archive file
  109. 0 lelong 0177555 very old VAX archive
  110. 0 leshort 0177555 very old PDP-11 archive
  111. #
  112. # XXX - "pdp" claims that 0177545 can have an __.SYMDEF member and thus
  113. # be a random library (it said 0xff65 rather than 0177545).
  114. #
  115. 0 lelong 0177545 old VAX archive
  116. >8 string __.SYMDEF random library
  117. 0 leshort 0177545 old PDP-11 archive
  118. >8 string __.SYMDEF random library
  119. #
  120. # From "pdp" (but why a 4-byte quantity?)
  121. #
  122. 0 lelong 0x39bed PDP-11 old archive
  123. 0 lelong 0x39bee PDP-11 4.0 archive
  124. # ARC archiver, from Daniel Quinlan (quinlan@yggdrasil.com)
  125. #
  126. # The first byte is the magic (0x1a), byte 2 is the compression type for
  127. # the first file (0x01 through 0x09), and bytes 3 to 15 are the MS-DOS
  128. # filename of the first file (null terminated). Since some types collide
  129. # we only test some types on basis of frequency: 0x08 (83%), 0x09 (5%),
  130. # 0x02 (5%), 0x03 (3%), 0x04 (2%), 0x06 (2%). 0x01 collides with terminfo.
  131. 0 lelong&0x8080ffff 0x0000081a ARC archive data, dynamic LZW
  132. !:mime application/x-arc
  133. 0 lelong&0x8080ffff 0x0000091a ARC archive data, squashed
  134. !:mime application/x-arc
  135. 0 lelong&0x8080ffff 0x0000021a ARC archive data, uncompressed
  136. !:mime application/x-arc
  137. 0 lelong&0x8080ffff 0x0000031a ARC archive data, packed
  138. !:mime application/x-arc
  139. 0 lelong&0x8080ffff 0x0000041a ARC archive data, squeezed
  140. !:mime application/x-arc
  141. 0 lelong&0x8080ffff 0x0000061a ARC archive data, crunched
  142. !:mime application/x-arc
  143. # [JW] stuff taken from idarc, obviously ARC successors:
  144. 0 lelong&0x8080ffff 0x00000a1a PAK archive data
  145. !:mime application/x-arc
  146. 0 lelong&0x8080ffff 0x0000141a ARC+ archive data
  147. !:mime application/x-arc
  148. 0 lelong&0x8080ffff 0x0000481a HYP archive data
  149. !:mime application/x-arc
  150. # Acorn archive formats (Disaster prone simpleton, m91dps@ecs.ox.ac.uk)
  151. # I can't create either SPARK or ArcFS archives so I have not tested this stuff
  152. # [GRR: the original entries collide with ARC, above; replaced with combined
  153. # version (not tested)]
  154. #0 byte 0x1a RISC OS archive (spark format)
  155. 0 string \032archive RISC OS archive (ArcFS format)
  156. 0 string Archive\000 RISC OS archive (ArcFS format)
  157. # All these were taken from idarc, many could not be verified. Unfortunately,
  158. # there were many low-quality sigs, i.e. easy to trigger false positives.
  159. # Please notify me of any real-world fishy/ambiguous signatures and I'll try
  160. # to get my hands on the actual archiver and see if I find something better. [JW]
  161. # probably many can be enhanced by finding some 0-byte or control char near the start
  162. # idarc calls this Crush/Uncompressed... *shrug*
  163. 0 string CRUSH Crush archive data
  164. # Squeeze It (.sqz)
  165. 0 string HLSQZ Squeeze It archive data
  166. # SQWEZ
  167. 0 string SQWEZ SQWEZ archive data
  168. # HPack (.hpk)
  169. 0 string HPAK HPack archive data
  170. # HAP
  171. 0 string \x91\x33HF HAP archive data
  172. # MD/MDCD
  173. 0 string MDmd MDCD archive data
  174. # LIM
  175. 0 string LIM\x1a LIM archive data
  176. # SAR
  177. 3 string LH5 SAR archive data
  178. # BSArc/BS2
  179. 0 string \212\3SB \0 BSArc/BS2 archive data
  180. # MAR
  181. 2 string =-ah MAR archive data
  182. # ACB
  183. #0 belong&0x00f800ff 0x00800000 ACB archive data
  184. # CPZ
  185. # TODO, this is what idarc says: 0 string \0\0\0 CPZ archive data
  186. # JRC
  187. 0 string JRchive JRC archive data
  188. # Quantum
  189. 0 string DS\0 Quantum archive data
  190. # ReSOF
  191. 0 string PK\3\6 ReSOF archive data
  192. # QuArk
  193. 0 string 7\4 QuArk archive data
  194. # YAC
  195. 14 string YC YAC archive data
  196. # X1
  197. 0 string X1 X1 archive data
  198. 0 string XhDr X1 archive data
  199. # CDC Codec (.dqt)
  200. 0 belong&0xffffe000 0x76ff2000 CDC Codec archive data
  201. # AMGC
  202. 0 string \xad6" AMGC archive data
  203. # NuLIB
  204. 0 string NõFélå NuLIB archive data
  205. # PakLeo
  206. 0 string LEOLZW PAKLeo archive data
  207. # ChArc
  208. 0 string SChF ChArc archive data
  209. # PSA
  210. 0 string PSA PSA archive data
  211. # CrossePAC
  212. 0 string DSIGDCC CrossePAC archive data
  213. # Freeze
  214. 0 string \x1f\x9f\x4a\x10\x0a Freeze archive data
  215. # KBoom
  216. 0 string ¨MP¨ KBoom archive data
  217. # NSQ, must go after CDC Codec
  218. 0 string \x76\xff NSQ archive data
  219. # DPA
  220. 0 string Dirk\ Paehl DPA archive data
  221. # BA
  222. # TODO: idarc says "bytes 0-2 == bytes 3-5"
  223. # TTComp
  224. 0 string \0\6 TTComp archive data
  225. # ESP, could this conflict with Easy Software Products' (e.g.ESP ghostscript) documentation?
  226. 0 string ESP ESP archive data
  227. # ZPack
  228. 0 string \1ZPK\1 ZPack archive data
  229. # Sky
  230. 0 string \xbc\x40 Sky archive data
  231. # UFA
  232. 0 string UFA UFA archive data
  233. # Dry
  234. 0 string =-H2O DRY archive data
  235. # FoxSQZ
  236. 0 string FOXSQZ FoxSQZ archive data
  237. # AR7
  238. 0 string ,AR7 AR7 archive data
  239. # PPMZ
  240. 0 string PPMZ PPMZ archive data
  241. # MS Compress
  242. 4 string \x88\xf0\x27 MS Compress archive data
  243. # updated by Joerg Jenderek
  244. >9 string \0
  245. >>0 string KWAJ
  246. >>>7 string \321\003 MS Compress archive data
  247. >>>>14 ulong >0 \b, original size: %ld bytes
  248. >>>>18 ubyte >0x65
  249. >>>>>18 string x \b, was %.8s
  250. >>>>>(10.b-4) string x \b.%.3s
  251. # MP3 (archiver, not lossy audio compression)
  252. 0 string MP3\x1a MP3-Archiver archive data
  253. # ZET
  254. 0 string OZÝ ZET archive data
  255. # TSComp
  256. 0 string \x65\x5d\x13\x8c\x08\x01\x03\x00 TSComp archive data
  257. # ARQ
  258. 0 string gW\4\1 ARQ archive data
  259. # Squash
  260. 3 string OctSqu Squash archive data
  261. # Terse
  262. 0 string \5\1\1\0 Terse archive data
  263. # PUCrunch
  264. 0 string \x01\x08\x0b\x08\xef\x00\x9e\x32\x30\x36\x31 PUCrunch archive data
  265. # UHarc
  266. 0 string UHA UHarc archive data
  267. # ABComp
  268. 0 string \2AB ABComp archive data
  269. 0 string \3AB2 ABComp archive data
  270. # CMP
  271. 0 string CO\0 CMP archive data
  272. # Splint
  273. 0 string \x93\xb9\x06 Splint archive data
  274. # InstallShield
  275. 0 string \x13\x5d\x65\x8c InstallShield Z archive Data
  276. # Gather
  277. 1 string GTH Gather archive data
  278. # BOA
  279. 0 string BOA BOA archive data
  280. # RAX
  281. 0 string ULEB\xa RAX archive data
  282. # Xtreme
  283. 0 string ULEB\0 Xtreme archive data
  284. # Pack Magic
  285. 0 string @â\1\0 Pack Magic archive data
  286. # BTS
  287. 0 belong&0xfeffffff 0x1a034465 BTS archive data
  288. # ELI 5750
  289. 0 string Ora\ ELI 5750 archive data
  290. # QFC
  291. 0 string \x1aFC\x1a QFC archive data
  292. 0 string \x1aQF\x1a QFC archive data
  293. # PRO-PACK
  294. 0 string RNC PRO-PACK archive data
  295. # 777
  296. 0 string 777 777 archive data
  297. # LZS221
  298. 0 string sTaC LZS221 archive data
  299. # HPA
  300. 0 string HPA HPA archive data
  301. # Arhangel
  302. 0 string LG Arhangel archive data
  303. # EXP1, uses bzip2
  304. 0 string 0123456789012345BZh EXP1 archive data
  305. # IMP
  306. 0 string IMP\xa IMP archive data
  307. # NRV
  308. 0 string \x00\x9E\x6E\x72\x76\xFF NRV archive data
  309. # Squish
  310. 0 string \x73\xb2\x90\xf4 Squish archive data
  311. # Par
  312. 0 string PHILIPP Par archive data
  313. 0 string PAR Par archive data
  314. # HIT
  315. 0 string UB HIT archive data
  316. # SBX
  317. 0 belong&0xfffff000 0x53423000 SBX archive data
  318. # NaShrink
  319. 0 string NSK NaShrink archive data
  320. # SAPCAR
  321. 0 string #\ CAR\ archive\ header SAPCAR archive data
  322. 0 string CAR\ 2.00RG SAPCAR archive data
  323. # Disintegrator
  324. 0 string DST Disintegrator archive data
  325. # ASD
  326. 0 string ASD ASD archive data
  327. # InstallShield CAB
  328. 0 string ISc( InstallShield CAB
  329. # TOP4
  330. 0 string T4\x1a TOP4 archive data
  331. # BatComp left out: sig looks like COM executable
  332. # so TODO: get real 4dos batcomp file and find sig
  333. # BlakHole
  334. 0 string BH\5\7 BlakHole archive data
  335. # BIX
  336. 0 string BIX0 BIX archive data
  337. # ChiefLZA
  338. 0 string ChfLZ ChiefLZA archive data
  339. # Blink
  340. 0 string Blink Blink archive data
  341. # Logitech Compress
  342. 0 string \xda\xfa Logitech Compress archive data
  343. # ARS-Sfx (FIXME: really a SFX? then goto COM/EXE)
  344. 1 string (C)\ STEPANYUK ARS-Sfx archive data
  345. # AKT/AKT32
  346. 0 string AKT32 AKT32 archive data
  347. 0 string AKT AKT archive data
  348. # NPack
  349. 0 string MSTSM NPack archive data
  350. # PFT
  351. 0 string \0\x50\0\x14 PFT archive data
  352. # SemOne
  353. 0 string SEM SemOne archive data
  354. # PPMD
  355. 0 string \x8f\xaf\xac\x84 PPMD archive data
  356. # FIZ
  357. 0 string FIZ FIZ archive data
  358. # MSXiE
  359. 0 belong&0xfffff0f0 0x4d530000 MSXiE archive data
  360. # DeepFreezer
  361. 0 belong&0xfffffff0 0x797a3030 DeepFreezer archive data
  362. # DC
  363. 0 string =<DC- DC archive data
  364. # TPac
  365. 0 string \4TPAC\3 TPac archive data
  366. # Ai
  367. 0 string Ai\1\1\0 Ai archive data
  368. 0 string Ai\1\0\0 Ai archive data
  369. # Ai32
  370. 0 string Ai\2\0 Ai32 archive data
  371. 0 string Ai\2\1 Ai32 archive data
  372. # SBC
  373. 0 string SBC SBC archive data
  374. # Ybs
  375. 0 string YBS Ybs archive data
  376. # DitPack
  377. 0 string \x9e\0\0 DitPack archive data
  378. # DMS
  379. 0 string DMS! DMS archive data
  380. # EPC
  381. 0 string \x8f\xaf\xac\x8c EPC archive data
  382. # VSARC
  383. 0 string VS\x1a VSARC archive data
  384. # PDZ
  385. 0 string PDZ PDZ archive data
  386. # ReDuq
  387. 0 string rdqx ReDuq archive data
  388. # GCA
  389. 0 string GCAX GCA archive data
  390. # PPMN
  391. 0 string pN PPMN archive data
  392. # WinImage
  393. 3 string WINIMAGE WinImage archive data
  394. # Compressia
  395. 0 string CMP0CMP Compressia archive data
  396. # UHBC
  397. 0 string UHB UHBC archive data
  398. # WinHKI
  399. 0 string \x61\x5C\x04\x05 WinHKI archive data
  400. # WWPack data file
  401. 0 string WWP WWPack archive data
  402. # BSN (BSA, PTS-DOS)
  403. 0 string \xffBSG BSN archive data
  404. 1 string \xffBSG BSN archive data
  405. 3 string \xffBSG BSN archive data
  406. 1 string \0\xae\2 BSN archive data
  407. 1 string \0\xae\3 BSN archive data
  408. 1 string \0\xae\7 BSN archive data
  409. # AIN
  410. 0 string \x33\x18 AIN archive data
  411. 0 string \x33\x17 AIN archive data
  412. # XPA32
  413. 0 string xpa\0\1 XPA32 archive data
  414. # SZip (TODO: doesn't catch all versions)
  415. 0 string SZ\x0a\4 SZip archive data
  416. # XPack DiskImage
  417. 0 string jm XPack DiskImage archive data
  418. # XPack Data
  419. 0 string xpa XPack archive data
  420. # XPack Single Data
  421. 0 string Í\ jm XPack single archive data
  422. # TODO: missing due to unknown magic/magic at end of file:
  423. #DWC
  424. #ARG
  425. #ZAR
  426. #PC/3270
  427. #InstallIt
  428. #RKive
  429. #RK
  430. #XPack Diskimage
  431. # These were inspired by idarc, but actually verified
  432. # Dzip archiver (.dz)
  433. 0 string DZ Dzip archive data
  434. >2 byte x \b, version %i
  435. >3 byte x \b.%i
  436. # ZZip archiver (.zz)
  437. 0 string ZZ\ \0\0 ZZip archive data
  438. 0 string ZZ0 ZZip archive data
  439. # PAQ archiver (.paq)
  440. 0 string \xaa\x40\x5f\x77\x1f\xe5\x82\x0d PAQ archive data
  441. 0 string PAQ PAQ archive data
  442. >3 byte&0xf0 0x30
  443. >>3 byte x (v%c)
  444. # JAR archiver (.j), this is the successor to ARJ, not Java's JAR (which is essentially ZIP)
  445. 0xe string \x1aJar\x1b JAR (ARJ Software, Inc.) archive data
  446. 0 string JARCS JAR (ARJ Software, Inc.) archive data
  447. # ARJ archiver (jason@jarthur.Claremont.EDU)
  448. 0 leshort 0xea60 ARJ archive data
  449. !:mime application/x-arj
  450. >5 byte x \b, v%d,
  451. >8 byte &0x04 multi-volume,
  452. >8 byte &0x10 slash-switched,
  453. >8 byte &0x20 backup,
  454. >34 string x original name: %s,
  455. >7 byte 0 os: MS-DOS
  456. >7 byte 1 os: PRIMOS
  457. >7 byte 2 os: Unix
  458. >7 byte 3 os: Amiga
  459. >7 byte 4 os: Macintosh
  460. >7 byte 5 os: OS/2
  461. >7 byte 6 os: Apple ][ GS
  462. >7 byte 7 os: Atari ST
  463. >7 byte 8 os: NeXT
  464. >7 byte 9 os: VAX/VMS
  465. >3 byte >0 %d]
  466. # [JW] idarc says this is also possible
  467. 2 leshort 0xea60 ARJ archive data
  468. # HA archiver (Greg Roelofs, newt@uchicago.edu)
  469. # This is a really bad format. A file containing HAWAII will match this...
  470. #0 string HA HA archive data,
  471. #>2 leshort =1 1 file,
  472. #>2 leshort >1 %u files,
  473. #>4 byte&0x0f =0 first is type CPY
  474. #>4 byte&0x0f =1 first is type ASC
  475. #>4 byte&0x0f =2 first is type HSC
  476. #>4 byte&0x0f =0x0e first is type DIR
  477. #>4 byte&0x0f =0x0f first is type SPECIAL
  478. # suggestion: at least identify small archives (<1024 files)
  479. 0 belong&0xffff00fc 0x48410000 HA archive data
  480. >2 leshort =1 1 file,
  481. >2 leshort >1 %u files,
  482. >4 byte&0x0f =0 first is type CPY
  483. >4 byte&0x0f =1 first is type ASC
  484. >4 byte&0x0f =2 first is type HSC
  485. >4 byte&0x0f =0x0e first is type DIR
  486. >4 byte&0x0f =0x0f first is type SPECIAL
  487. # HPACK archiver (Peter Gutmann, pgut1@cs.aukuni.ac.nz)
  488. 0 string HPAK HPACK archive data
  489. # JAM Archive volume format, by Dmitry.Kohmanyuk@UA.net
  490. 0 string \351,\001JAM\ JAM archive,
  491. >7 string >\0 version %.4s
  492. >0x26 byte =0x27 -
  493. >>0x2b string >\0 label %.11s,
  494. >>0x27 lelong x serial %08x,
  495. >>0x36 string >\0 fstype %.8s
  496. # LHARC/LHA archiver (Greg Roelofs, newt@uchicago.edu)
  497. 2 string -lh0- LHarc 1.x/ARX archive data [lh0]
  498. !:mime application/x-lharc
  499. 2 string -lh1- LHarc 1.x/ARX archive data [lh1]
  500. !:mime application/x-lharc
  501. 2 string -lz4- LHarc 1.x archive data [lz4]
  502. !:mime application/x-lharc
  503. 2 string -lz5- LHarc 1.x archive data [lz5]
  504. !:mime application/x-lharc
  505. # [never seen any but the last; -lh4- reported in comp.compression:]
  506. 2 string -lzs- LHa/LZS archive data [lzs]
  507. !:mime application/x-lha
  508. 2 string -lh\40- LHa 2.x? archive data [lh ]
  509. !:mime application/x-lha
  510. 2 string -lhd- LHa 2.x? archive data [lhd]
  511. !:mime application/x-lha
  512. 2 string -lh2- LHa 2.x? archive data [lh2]
  513. !:mime application/x-lha
  514. 2 string -lh3- LHa 2.x? archive data [lh3]
  515. !:mime application/x-lha
  516. 2 string -lh4- LHa (2.x) archive data [lh4]
  517. !:mime application/x-lha
  518. 2 string -lh5- LHa (2.x) archive data [lh5]
  519. !:mime application/x-lha
  520. 2 string -lh6- LHa (2.x) archive data [lh6]
  521. !:mime application/x-lha
  522. 2 string -lh7- LHa (2.x)/LHark archive data [lh7]
  523. !:mime application/x-lha
  524. >20 byte x - header level %d
  525. # taken from idarc [JW]
  526. 2 string -lZ PUT archive data
  527. 2 string -lz LZS archive data
  528. 2 string -sw1- Swag archive data
  529. # RAR archiver (Greg Roelofs, newt@uchicago.edu)
  530. 0 string Rar! RAR archive data,
  531. !:mime application/x-rar
  532. >44 byte x v%0x,
  533. >10 byte >0 flags:
  534. >>10 byte &0x01 Archive volume,
  535. >>10 byte &0x02 Commented,
  536. >>10 byte &0x04 Locked,
  537. >>10 byte &0x08 Solid,
  538. >>10 byte &0x20 Authenticated,
  539. >35 byte 0 os: MS-DOS
  540. >35 byte 1 os: OS/2
  541. >35 byte 2 os: Win32
  542. >35 byte 3 os: Unix
  543. # some old version? idarc says:
  544. 0 string RE\x7e\x5e RAR archive data
  545. # SQUISH archiver (Greg Roelofs, newt@uchicago.edu)
  546. 0 string SQSH squished archive data (Acorn RISCOS)
  547. # UC2 archiver (Greg Roelofs, newt@uchicago.edu)
  548. # [JW] see exe section for self-extracting version
  549. 0 string UC2\x1a UC2 archive data
  550. # PKZIP multi-volume archive
  551. 0 string PK\x07\x08PK\x03\x04 Zip multi-volume archive data, at least PKZIP v2.50 to extract
  552. !:mime application/zip
  553. # Zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
  554. 0 string PK\005\006 Zip archive data (empty)
  555. 0 string PK\003\004
  556. # Specialised zip formats which start with a member named 'mimetype'
  557. # (stored uncompressed, with no 'extra field') containing the file's MIME type.
  558. # Check for have 8-byte name, 0-byte extra field, name "mimetype", and
  559. # contents starting with "application/":
  560. >26 string \x8\0\0\0mimetypeapplication/
  561. # KOffice / OpenOffice & StarOffice / OpenDocument formats
  562. # From: Abel Cheung <abel@oaka.org>
  563. # KOffice (1.2 or above) formats
  564. # (mimetype contains "application/vnd.kde.<SUBTYPE>")
  565. >>50 string vnd.kde. KOffice (>=1.2)
  566. >>>58 string karbon Karbon document
  567. >>>58 string kchart KChart document
  568. >>>58 string kformula KFormula document
  569. >>>58 string kivio Kivio document
  570. >>>58 string kontour Kontour document
  571. >>>58 string kpresenter KPresenter document
  572. >>>58 string kspread KSpread document
  573. >>>58 string kword KWord document
  574. # OpenOffice formats (for OpenOffice 1.x / StarOffice 6/7)
  575. # (mimetype contains "application/vnd.sun.xml.<SUBTYPE>")
  576. >>50 string vnd.sun.xml. OpenOffice.org 1.x
  577. >>>62 string writer Writer
  578. >>>>68 byte !0x2e document
  579. >>>>68 string .template template
  580. >>>>68 string .global global document
  581. >>>62 string calc Calc
  582. >>>>66 byte !0x2e spreadsheet
  583. >>>>66 string .template template
  584. >>>62 string draw Draw
  585. >>>>66 byte !0x2e document
  586. >>>>66 string .template template
  587. >>>62 string impress Impress
  588. >>>>69 byte !0x2e presentation
  589. >>>>69 string .template template
  590. >>>62 string math Math document
  591. >>>62 string base Database file
  592. # OpenDocument formats (for OpenOffice 2.x / StarOffice >= 8)
  593. # http://lists.oasis-open.org/archives/office/200505/msg00006.html
  594. # (mimetype contains "application/vnd.oasis.opendocument.<SUBTYPE>")
  595. >>50 string vnd.oasis.opendocument. OpenDocument
  596. >>>73 string text
  597. >>>>77 byte !0x2d Text
  598. !:mime application/vnd.oasis.opendocument.text
  599. >>>>77 string -template Text Template
  600. !:mime application/vnd.oasis.opendocument.text-template
  601. >>>>77 string -web HTML Document Template
  602. !:mime application/vnd.oasis.opendocument.text-web
  603. >>>>77 string -master Master Document
  604. !:mime application/vnd.oasis.opendocument.text-master
  605. >>>73 string graphics
  606. >>>>81 byte !0x2d Drawing
  607. !:mime application/vnd.oasis.opendocument.graphics
  608. >>>>81 string -template Template
  609. !:mime application/vnd.oasis.opendocument.graphics-template
  610. >>>73 string presentation
  611. >>>>85 byte !0x2d Presentation
  612. !:mime application/vnd.oasis.opendocument.presentation
  613. >>>>85 string -template Template
  614. !:mime application/vnd.oasis.opendocument.presentation-template
  615. >>>73 string spreadsheet
  616. >>>>84 byte !0x2d Spreadsheet
  617. !:mime application/vnd.oasis.opendocument.spreadsheet
  618. >>>>84 string -template Template
  619. !:mime application/vnd.oasis.opendocument.spreadsheet-template
  620. >>>73 string chart
  621. >>>>78 byte !0x2d Chart
  622. !:mime application/vnd.oasis.opendocument.chart
  623. >>>>78 string -template Template
  624. !:mime application/vnd.oasis.opendocument.chart-template
  625. >>>73 string formula
  626. >>>>80 byte !0x2d Formula
  627. !:mime application/vnd.oasis.opendocument.formula
  628. >>>>80 string -template Template
  629. !:mime application/vnd.oasis.opendocument.formula-template
  630. >>>73 string database Database
  631. !:mime application/vnd.oasis.opendocument.database
  632. >>>73 string image
  633. >>>>78 byte !0x2d Image
  634. !:mime application/vnd.oasis.opendocument.image
  635. >>>>78 string -template Template
  636. !:mime application/vnd.oasis.opendocument.image-template
  637. # EPUB (OEBPS) books using OCF (OEBPS Container Format)
  638. # From: Adam Buchbinder <adam.buchbinder@gmail.com>
  639. # http://www.idpf.org/ocf/ocf1.0/download/ocf10.htm, section 4.
  640. # (mimetype contains "application/epub+zip")
  641. >>50 string epub+zip EPUB ebook data
  642. !:mime application/epub+zip
  643. # Catch other ZIP-with-mimetype formats
  644. # In a ZIP file, the bytes immediately after a member's contents are
  645. # always "PK". The 2 regex rules here print the "mimetype" member's
  646. # contents up to the first 'P'. Luckily, most MIME types don't contain
  647. # any capital 'P's. This is a kludge.
  648. # (mimetype contains "application/<OTHER>")
  649. >>50 string !epub+zip
  650. >>>50 string !vnd.oasis.opendocument.
  651. >>>>50 string !vnd.sun.xml.
  652. >>>>>50 string !vnd.kde.
  653. >>>>>>38 regex [!-OQ-~]+ Zip data (MIME type "%s"?)
  654. !:mime application/zip
  655. # (mimetype contents other than "application/*")
  656. >26 string \x8\0\0\0mimetype
  657. >>38 string !application/
  658. >>>38 regex [!-OQ-~]+ Zip data (MIME type "%s"?)
  659. !:mime application/zip
  660. # Java Jar files
  661. >(26.s+30) leshort 0xcafe Java Jar file data (zip)
  662. !:mime application/jar
  663. # Generic zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
  664. # Next line excludes specialized formats:
  665. >(26.s+30) leshort !0xcafe
  666. >>26 string !\x8\0\0\0mimetype Zip archive data
  667. !:mime application/zip
  668. >>>4 byte 0x09 \b, at least v0.9 to extract
  669. >>>4 byte 0x0a \b, at least v1.0 to extract
  670. >>>4 byte 0x0b \b, at least v1.1 to extract
  671. >>>4 byte 0x14 \b, at least v2.0 to extract
  672. >>>4 byte 0x2d \b, at least v3.0 to extract
  673. >>>0x161 string WINZIP \b, WinZIP self-extracting
  674. # StarView Metafile
  675. # From Pierre Ducroquet <pinaraf@pinaraf.info>
  676. 0 string VCLMTF StarView MetaFile
  677. >6 beshort x \b, version %d
  678. >8 belong x \b, size %d
  679. # Zoo archiver
  680. 20 lelong 0xfdc4a7dc Zoo archive data
  681. !:mime application/x-zoo
  682. >4 byte >48 \b, v%c.
  683. >>6 byte >47 \b%c
  684. >>>7 byte >47 \b%c
  685. >32 byte >0 \b, modify: v%d
  686. >>33 byte x \b.%d+
  687. >42 lelong 0xfdc4a7dc \b,
  688. >>70 byte >0 extract: v%d
  689. >>>71 byte x \b.%d+
  690. # Shell archives
  691. 10 string #\ This\ is\ a\ shell\ archive shell archive text
  692. !:mime application/octet-stream
  693. #
  694. # LBR. NB: May conflict with the questionable
  695. # "binary Computer Graphics Metafile" format.
  696. #
  697. 0 string \0\ \ \ \ \ \ \ \ \ \ \ \0\0 LBR archive data
  698. #
  699. # PMA (CP/M derivative of LHA)
  700. #
  701. 2 string -pm0- PMarc archive data [pm0]
  702. 2 string -pm1- PMarc archive data [pm1]
  703. 2 string -pm2- PMarc archive data [pm2]
  704. 2 string -pms- PMarc SFX archive (CP/M, DOS)
  705. 5 string -pc1- PopCom compressed executable (CP/M)
  706. # From Rafael Laboissiere <rafael@laboissiere.net>
  707. # The Project Revision Control System (see
  708. # http://prcs.sourceforge.net) generates a packaged project
  709. # file which is recognized by the following entry:
  710. 0 leshort 0xeb81 PRCS packaged project
  711. # Microsoft cabinets
  712. # by David Necas (Yeti) <yeti@physics.muni.cz>
  713. #0 string MSCF\0\0\0\0 Microsoft cabinet file data,
  714. #>25 byte x v%d
  715. #>24 byte x \b.%d
  716. # MPi: All CABs have version 1.3, so this is pointless.
  717. # Better magic in debian-additions.
  718. # GTKtalog catalogs
  719. # by David Necas (Yeti) <yeti@physics.muni.cz>
  720. 4 string gtktalog\ GTKtalog catalog data,
  721. >13 string 3 version 3
  722. >>14 beshort 0x677a (gzipped)
  723. >>14 beshort !0x677a (not gzipped)
  724. >13 string >3 version %s
  725. ############################################################################
  726. # Parity archive reconstruction file, the 'par' file format now used on Usenet.
  727. 0 string PAR\0 PARity archive data
  728. >48 leshort =0 - Index file
  729. >48 leshort >0 - file number %d
  730. # Felix von Leitner <felix-file@fefe.de>
  731. 0 string d8:announce BitTorrent file
  732. !:mime application/x-bittorrent
  733. # Atari MSA archive - Teemu Hukkanen <tjhukkan@iki.fi>
  734. 0 beshort 0x0e0f Atari MSA archive data
  735. >2 beshort x \b, %d sectors per track
  736. >4 beshort 0 \b, 1 sided
  737. >4 beshort 1 \b, 2 sided
  738. >6 beshort x \b, starting track: %d
  739. >8 beshort x \b, ending track: %d
  740. # Alternate ZIP string (amc@arwen.cs.berkeley.edu)
  741. 0 string PK00PK\003\004 Zip archive data
  742. # ACE archive (from http://www.wotsit.org/download.asp?f=ace)
  743. # by Stefan `Sec` Zehl <sec@42.org>
  744. 7 string **ACE** ACE archive data
  745. >15 byte >0 version %d
  746. >16 byte =0x00 \b, from MS-DOS
  747. >16 byte =0x01 \b, from OS/2
  748. >16 byte =0x02 \b, from Win/32
  749. >16 byte =0x03 \b, from Unix
  750. >16 byte =0x04 \b, from MacOS
  751. >16 byte =0x05 \b, from WinNT
  752. >16 byte =0x06 \b, from Primos
  753. >16 byte =0x07 \b, from AppleGS
  754. >16 byte =0x08 \b, from Atari
  755. >16 byte =0x09 \b, from Vax/VMS
  756. >16 byte =0x0A \b, from Amiga
  757. >16 byte =0x0B \b, from Next
  758. >14 byte x \b, version %d to extract
  759. >5 leshort &0x0080 \b, multiple volumes,
  760. >>17 byte x \b (part %d),
  761. >5 leshort &0x0002 \b, contains comment
  762. >5 leshort &0x0200 \b, sfx
  763. >5 leshort &0x0400 \b, small dictionary
  764. >5 leshort &0x0800 \b, multi-volume
  765. >5 leshort &0x1000 \b, contains AV-String
  766. >>30 string \x16*UNREGISTERED\x20VERSION* (unregistered)
  767. >5 leshort &0x2000 \b, with recovery record
  768. >5 leshort &0x4000 \b, locked
  769. >5 leshort &0x8000 \b, solid
  770. # Date in MS-DOS format (whatever that is)
  771. #>18 lelong x Created on
  772. # sfArk : compression program for Soundfonts (sf2) by Dirk Jagdmann
  773. # <doj@cubic.org>
  774. 0x1A string sfArk sfArk compressed Soundfont
  775. >0x15 string 2
  776. >>0x1 string >\0 Version %s
  777. >>0x2A string >\0 : %s
  778. # DR-DOS 7.03 Packed File *.??_
  779. 0 string Packed\ File\ Personal NetWare Packed File
  780. >12 string x \b, was "%.12s"
  781. # EET archive
  782. # From: Tilman Sauerbeck <tilman@code-monkey.de>
  783. 0 belong 0x1ee7ff00 EET archive
  784. !:mime application/x-eet
  785. # rzip archives
  786. 0 string RZIP rzip compressed data
  787. >4 byte x - version %d
  788. >5 byte x \b.%d
  789. >6 belong x (%d bytes)
  790. # From: "Robert Dale" <robdale@gmail.com>
  791. 0 belong 123 dar archive,
  792. >4 belong x label "%.8x
  793. >>8 belong x %.8x
  794. >>>12 beshort x %.4x"
  795. >14 byte 0x54 end slice
  796. >14 beshort 0x4e4e multi-part
  797. >14 beshort 0x4e53 multi-part, with -S
  798. # Symbian installation files
  799. # http://www.thouky.co.uk/software/psifs/sis.html
  800. # http://developer.symbian.com/main/downloads/papers/SymbianOSv91/softwareinstallsis.pdf
  801. 8 lelong 0x10000419 Symbian installation file
  802. !:mime application/vnd.symbian.install
  803. >4 lelong 0x1000006D (EPOC release 3/4/5)
  804. >4 lelong 0x10003A12 (EPOC release 6)
  805. 0 lelong 0x10201A7A Symbian installation file (Symbian OS 9.x)
  806. !:mime x-epoc/x-sisx-app
  807. # From "Nelson A. de Oliveira" <naoliv@gmail.com>
  808. 0 string MPQ\032 MoPaQ (MPQ) archive
  809. # From: Dirk Jagdmann <doj@cubic.org>
  810. # xar archive format: http://code.google.com/p/xar/
  811. 0 string xar! xar archive
  812. >6 beshort x - version %ld
  813. # From: "Nelson A. de Oliveira" <naoliv@gmail.com>
  814. # .kgb
  815. 0 string KGB_arch KGB Archiver file
  816. >10 string x with compression level %.1s
  817. # xar (eXtensible ARchiver) archive
  818. # From: "David Remahl" <dremahl@apple.com>
  819. 0 string xar! xar archive
  820. #>4 beshort x header size %d
  821. >6 beshort x version %d,
  822. #>8 quad x compressed TOC: %d,
  823. #>16 quad x uncompressed TOC: %d,
  824. >24 belong 0 no checksum
  825. >24 belong 1 SHA-1 checksum
  826. >24 belong 2 MD5 checksum
  827. # Type: Parity Archive
  828. # From: Daniel van Eeden <daniel_e@dds.nl>
  829. 0 string PAR2 Parity Archive Volume Set
  830. # Bacula volume format. (Volumes always start with a block header.)
  831. # URL: http://bacula.org/3.0.x-manuals/en/developers/developers/Block_Header.html
  832. # From: Adam Buchbinder <adam.buchbinder@gmail.com>
  833. 12 string BB02 Bacula volume
  834. >20 bedate x \b, started %s
  835. # ePub is XHTML + XML inside a ZIP archive. The first member of the
  836. # archive must be an uncompressed file called 'mimetype' with contents
  837. # 'application/epub+zip'
  838. # start by checking that this is a ZIP archive, then check for the
  839. # proper mimetype file
  840. # From: Ralf Brown <ralf.brown@gmail.com>
  841. 0 string PK\003\004
  842. >0x1E string mimetypeapplication/epub+zip EPUB document
  843. !:mime application/epub+zip
  844. # From: "Michał Górny" <mgorny@gentoo.org>
  845. # ZPAQ: http://mattmahoney.net/dc/zpaq.html
  846. 0 string zPQ ZPAQ stream
  847. >3 byte x \b, level %d
  848. # BBeB ebook, unencrypted (LRF format)
  849. # URL: http://www.sven.de/librie/Librie/LrfFormat
  850. # From: Adam Buchbinder <adam.buchbinder@gmail.com>
  851. 0 string L\0R\0F\0\0\0 BBeB ebook data, unencrypted
  852. >8 beshort x \b, version %d
  853. >36 byte 1 \b, front-to-back
  854. >36 byte 16 \b, back-to-front
  855. >42 beshort x \b, (%dx,
  856. >44 beshort x %d)