archive 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428
  1. #------------------------------------------------------------------------------
  2. # $File: archive,v 1.117 2018/03/17 02:11:04 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 also handled in the C code ../../src/is_tar.c.
  8. # POSIX tar archives
  9. # URL: https://en.wikipedia.org/wiki/Tar_(computing)
  10. # Reference: https://www.freebsd.org/cgi/man.cgi?query=tar&sektion=5&manpath=FreeBSD+8-current
  11. # header mainly padded with nul bytes
  12. 500 quad 0
  13. # filename or extended attribute printable strings in range space null til umlaut ue
  14. >0 ubeshort >0x1F00
  15. >>0 ubeshort <0xFCFD
  16. # last 4 header bytes often null but tar\0 in gtarfail2.tar gtarfail.tar-bad
  17. # at https://sourceforge.net/projects/s-tar/files/testscripts/
  18. >>>508 ubelong&0x8B9E8DFF 0
  19. # nul, space or ascii digit 0-7 at start of mode
  20. >>>>100 ubyte&0xC8 =0
  21. >>>>>101 ubyte&0xC8 =0
  22. # nul, space at end of check sum
  23. >>>>>>155 ubyte&0xDF =0
  24. # space or ascii digit 0 at start of check sum
  25. >>>>>>>148 ubyte&0xEF =0x20
  26. >>>>>>>>0 use tar-file
  27. # minimal check and then display tar archive information which can also be
  28. # embedded inside others like Android Backup, Clam AntiVirus database
  29. 0 name tar-file
  30. >257 string !ustar
  31. # header padded with nuls
  32. >>257 ulong =0
  33. # GNU tar version 1.29 with non pax format option without refusing
  34. # creates misleading V7 header for Long path, Multi-volume, Volume type
  35. >>>156 ubyte 0x4c GNU tar archive
  36. !:mime application/x-gtar
  37. !:ext tar/gtar
  38. >>>156 ubyte 0x4d GNU tar archive
  39. !:mime application/x-gtar
  40. !:ext tar/gtar
  41. >>>156 ubyte 0x56 GNU tar archive
  42. !:mime application/x-gtar
  43. !:ext tar/gtar
  44. >>>156 default x tar archive (V7)
  45. !:mime application/x-tar
  46. !:ext tar
  47. # other stuff in padding
  48. # some implementations add new fields to the blank area at the end of the header record
  49. # created for example by DOS TAR 3.20g 1994 Tim V.Shapore with -j option
  50. >>257 ulong !0 tar archive (old)
  51. !:mime application/x-tar
  52. !:ext tar
  53. # magic in newer, GNU, posix variants
  54. >257 string =ustar
  55. # 2 last char of magic and UStar version because string expression does not work
  56. # 2 space characters followed by a null for GNU variant
  57. >>261 ubelong =0x72202000 POSIX tar archive (GNU)
  58. !:mime application/x-gtar
  59. !:ext tar/gtar
  60. # UStar version with ASCII "00"
  61. >>261 ubelong 0x72003030 POSIX
  62. # gLOBAL and ExTENSION type only found in POSIX.1-2001 format
  63. >>>156 ubyte 0x67 \b.1-2001
  64. >>>156 ubyte 0x78 \b.1-2001
  65. >>>156 ubyte x tar archive
  66. !:mime application/x-ustar
  67. !:ext tar/ustar
  68. # version with 2 binary nuls embedded in Android Backup like com.android.settings.ab
  69. >>261 ubelong 0x72000000 tar archive (ustar)
  70. !:mime application/x-ustar
  71. !:ext tar/ustar
  72. # not seen ustar variant with garbish version
  73. >>261 default x tar archive (unknown ustar)
  74. !:mime application/x-ustar
  75. !:ext tar/ustar
  76. # type flag of 1st tar archive member
  77. #>156 ubyte x \b, %c-type
  78. >156 ubyte x
  79. >>156 ubyte 0 \b, file
  80. >>156 ubyte 0x30 \b, file
  81. >>156 ubyte 0x31 \b, hard link
  82. >>156 ubyte 0x32 \b, symlink
  83. >>156 ubyte 0x33 \b, char device
  84. >>156 ubyte 0x34 \b, block device
  85. >>156 ubyte 0x35 \b, directory
  86. >>156 ubyte 0x36 \b, fifo
  87. >>156 ubyte 0x37 \b, reserved
  88. >>156 ubyte 0x4c \b, long path
  89. >>156 ubyte 0x4d \b, multi volume
  90. >>156 ubyte 0x56 \b, volume
  91. >>156 ubyte 0x67 \b, global
  92. >>156 ubyte 0x78 \b, extension
  93. >>156 default x \b, type
  94. >>>156 ubyte x '%c'
  95. # name[100]
  96. >0 string >\0 %-.60s
  97. # mode mainly stored as an octal number in ASCII null or space terminated
  98. >100 string >\0 \b, mode %-.7s
  99. # user id mainly as octal numbers in ASCII null or space terminated
  100. >108 string >\0 \b, uid %-.7s
  101. # group id mainly as octal numbers in ASCII null or space terminated
  102. >116 string >\0 \b, gid %-.7s
  103. # size mainly as octal number in ASCII
  104. >124 ubyte <0x38
  105. >>124 string >\0 \b, size %-.12s
  106. # coding indicated by setting the high-order bit of the leftmost byte
  107. >124 ubyte >0xEF \b, size 0x
  108. >>124 ubyte !0xff \b%2.2x
  109. >>125 ubyte !0xff \b%2.2x
  110. >>126 ubyte !0xff \b%2.2x
  111. >>127 ubyte !0xff \b%2.2x
  112. >>128 ubyte !0xff \b%2.2x
  113. >>129 ubyte !0xff \b%2.2x
  114. >>130 ubyte !0xff \b%2.2x
  115. >>131 ubyte !0xff \b%2.2x
  116. >>132 ubyte !0xff \b%2.2x
  117. >>133 ubyte !0xff \b%2.2x
  118. >>134 ubyte !0xff \b%2.2x
  119. >>135 ubyte !0xff \b%2.2x
  120. # seconds since 0:0:0 1 jan 1970 UTC as octal number mainly in ASCII null or space terminated
  121. >136 string >\0 \b, seconds %-.11s
  122. # header checksum stored as an octal number in ASCII null or space terminated
  123. #>148 string x \b, cksum %.7s
  124. # linkname[100]
  125. >157 string >\0 \b, linkname %-.40s
  126. # additional fields for ustar
  127. >257 string =ustar
  128. # owner user name null terminated
  129. >>265 string >\0 \b, user %-.32s
  130. # group name null terminated
  131. >>297 string >\0 \b, group %-.32s
  132. # device major minor if not zero
  133. >>329 ubequad&0xCFCFCFCFcFcFcFdf !0
  134. >>>329 string x \b, devmaj %-.7s
  135. >>337 ubequad&0xCFCFCFCFcFcFcFdf !0
  136. >>>337 string x \b, devmin %-.7s
  137. # prefix[155]
  138. >>345 string >\0 \b, prefix %-.155s
  139. # old non ustar/POSIX tar
  140. >257 string !ustar
  141. >>508 string =tar\0
  142. # padding[255] in old star
  143. >>>257 string >\0 \b, padding: %-.40s
  144. >>508 default x
  145. # padding[255] in old tar sometimes comment field
  146. >>>257 string >\0 \b, comment: %-.40s
  147. # Incremental snapshot gnu-tar format from:
  148. # http://www.gnu.org/software/tar/manual/html_node/Snapshot-Files.html
  149. 0 string GNU\ tar- GNU tar incremental snapshot data
  150. >&0 regex [0-9]\.[0-9]+-[0-9]+ version %s
  151. # cpio archives
  152. #
  153. # Yes, the top two "cpio archive" formats *are* supposed to just be "short".
  154. # The idea is to indicate archives produced on machines with the same
  155. # byte order as the machine running "file" with "cpio archive", and
  156. # to indicate archives produced on machines with the opposite byte order
  157. # from the machine running "file" with "byte-swapped cpio archive".
  158. #
  159. # The SVR4 "cpio(4)" hints that there are additional formats, but they
  160. # are defined as "short"s; I think all the new formats are
  161. # character-header formats and thus are strings, not numbers.
  162. 0 short 070707 cpio archive
  163. !:mime application/x-cpio
  164. 0 short 0143561 byte-swapped cpio archive
  165. !:mime application/x-cpio # encoding: swapped
  166. 0 string 070707 ASCII cpio archive (pre-SVR4 or odc)
  167. 0 string 070701 ASCII cpio archive (SVR4 with no CRC)
  168. 0 string 070702 ASCII cpio archive (SVR4 with CRC)
  169. #
  170. # Various archive formats used by various versions of the "ar"
  171. # command.
  172. #
  173. #
  174. # Original UNIX archive formats.
  175. # They were written with binary values in host byte order, and
  176. # the magic number was a host "int", which might have been 16 bits
  177. # or 32 bits. We don't say "PDP-11" or "VAX", as there might have
  178. # been ports to little-endian 16-bit-int or 32-bit-int platforms
  179. # (x86?) using some of those formats; if none existed, feel free
  180. # to use "PDP-11" for little-endian 16-bit and "VAX" for little-endian
  181. # 32-bit. There might have been big-endian ports of that sort as
  182. # well.
  183. #
  184. 0 leshort 0177555 very old 16-bit-int little-endian archive
  185. 0 beshort 0177555 very old 16-bit-int big-endian archive
  186. 0 lelong 0177555 very old 32-bit-int little-endian archive
  187. 0 belong 0177555 very old 32-bit-int big-endian archive
  188. 0 leshort 0177545 old 16-bit-int little-endian archive
  189. >2 string __.SYMDEF random library
  190. 0 beshort 0177545 old 16-bit-int big-endian archive
  191. >2 string __.SYMDEF random library
  192. 0 lelong 0177545 old 32-bit-int little-endian archive
  193. >4 string __.SYMDEF random library
  194. 0 belong 0177545 old 32-bit-int big-endian archive
  195. >4 string __.SYMDEF random library
  196. #
  197. # From "pdp" (but why a 4-byte quantity?)
  198. #
  199. 0 lelong 0x39bed PDP-11 old archive
  200. 0 lelong 0x39bee PDP-11 4.0 archive
  201. #
  202. # XXX - what flavor of APL used this, and was it a variant of
  203. # some ar archive format? It's similar to, but not the same
  204. # as, the APL workspace magic numbers in pdp.
  205. #
  206. 0 long 0100554 apl workspace
  207. #
  208. # System V Release 1 portable(?) archive format.
  209. #
  210. 0 string =<ar> System V Release 1 ar archive
  211. !:mime application/x-archive
  212. #
  213. # Debian package; it's in the portable archive format, and needs to go
  214. # before the entry for regular portable archives, as it's recognized as
  215. # a portable archive whose first member has a name beginning with
  216. # "debian".
  217. #
  218. 0 string =!<arch>\ndebian
  219. >8 string debian-split part of multipart Debian package
  220. !:mime application/vnd.debian.binary-package
  221. >8 string debian-binary Debian binary package
  222. !:mime application/vnd.debian.binary-package
  223. >8 string !debian
  224. >68 string >\0 (format %s)
  225. # These next two lines do not work, because a bzip2 Debian archive
  226. # still uses gzip for the control.tar (first in the archive). Only
  227. # data.tar varies, and the location of its filename varies too.
  228. # file/libmagic does not current have support for ascii-string based
  229. # (offsets) as of 2005-09-15.
  230. #>81 string bz2 \b, uses bzip2 compression
  231. #>84 string gz \b, uses gzip compression
  232. #>136 ledate x created: %s
  233. #
  234. # MIPS archive; they're in the portable archive format, and need to go
  235. # before the entry for regular portable archives, as it's recognized as
  236. # a portable archive whose first member has a name beginning with
  237. # "__________E".
  238. #
  239. 0 string =!<arch>\n__________E MIPS archive
  240. !:mime application/x-archive
  241. >20 string U with MIPS Ucode members
  242. >21 string L with MIPSEL members
  243. >21 string B with MIPSEB members
  244. >19 string L and an EL hash table
  245. >19 string B and an EB hash table
  246. >22 string X -- out of date
  247. 0 search/1 -h- Software Tools format archive text
  248. #
  249. # BSD/SVR2-and-later portable archive formats.
  250. #
  251. 0 string =!<arch> current ar archive
  252. !:mime application/x-archive
  253. >8 string __.SYMDEF random library
  254. >68 string __.SYMDEF\ SORTED random library
  255. #
  256. # "Thin" archive, as can be produced by GNU ar.
  257. #
  258. 0 string =!<thin>\n thin archive with
  259. >68 belong 0 no symbol entries
  260. >68 belong 1 %d symbol entry
  261. >68 belong >1 %d symbol entries
  262. # ARC archiver, from Daniel Quinlan (quinlan@yggdrasil.com)
  263. #
  264. # The first byte is the magic (0x1a), byte 2 is the compression type for
  265. # the first file (0x01 through 0x09), and bytes 3 to 15 are the MS-DOS
  266. # filename of the first file (null terminated). Since some types collide
  267. # we only test some types on basis of frequency: 0x08 (83%), 0x09 (5%),
  268. # 0x02 (5%), 0x03 (3%), 0x04 (2%), 0x06 (2%). 0x01 collides with terminfo.
  269. 0 lelong&0x8080ffff 0x0000081a ARC archive data, dynamic LZW
  270. !:mime application/x-arc
  271. 0 lelong&0x8080ffff 0x0000091a ARC archive data, squashed
  272. !:mime application/x-arc
  273. 0 lelong&0x8080ffff 0x0000021a ARC archive data, uncompressed
  274. !:mime application/x-arc
  275. 0 lelong&0x8080ffff 0x0000031a ARC archive data, packed
  276. !:mime application/x-arc
  277. 0 lelong&0x8080ffff 0x0000041a ARC archive data, squeezed
  278. !:mime application/x-arc
  279. 0 lelong&0x8080ffff 0x0000061a ARC archive data, crunched
  280. !:mime application/x-arc
  281. # [JW] stuff taken from idarc, obviously ARC successors:
  282. 0 lelong&0x8080ffff 0x00000a1a PAK archive data
  283. !:mime application/x-arc
  284. 0 lelong&0x8080ffff 0x0000141a ARC+ archive data
  285. !:mime application/x-arc
  286. 0 lelong&0x8080ffff 0x0000481a HYP archive data
  287. !:mime application/x-arc
  288. # Acorn archive formats (Disaster prone simpleton, m91dps@ecs.ox.ac.uk)
  289. # I can't create either SPARK or ArcFS archives so I have not tested this stuff
  290. # [GRR: the original entries collide with ARC, above; replaced with combined
  291. # version (not tested)]
  292. #0 byte 0x1a RISC OS archive (spark format)
  293. 0 string \032archive RISC OS archive (ArcFS format)
  294. 0 string Archive\000 RISC OS archive (ArcFS format)
  295. # All these were taken from idarc, many could not be verified. Unfortunately,
  296. # there were many low-quality sigs, i.e. easy to trigger false positives.
  297. # Please notify me of any real-world fishy/ambiguous signatures and I'll try
  298. # to get my hands on the actual archiver and see if I find something better. [JW]
  299. # probably many can be enhanced by finding some 0-byte or control char near the start
  300. # idarc calls this Crush/Uncompressed... *shrug*
  301. 0 string CRUSH Crush archive data
  302. # Squeeze It (.sqz)
  303. 0 string HLSQZ Squeeze It archive data
  304. # SQWEZ
  305. 0 string SQWEZ SQWEZ archive data
  306. # HPack (.hpk)
  307. 0 string HPAK HPack archive data
  308. # HAP
  309. 0 string \x91\x33HF HAP archive data
  310. # MD/MDCD
  311. 0 string MDmd MDCD archive data
  312. # LIM
  313. 0 string LIM\x1a LIM archive data
  314. # SAR
  315. 3 string LH5 SAR archive data
  316. # BSArc/BS2
  317. 0 string \212\3SB\020\0 BSArc/BS2 archive data
  318. # Bethesda Softworks Archive (Oblivion)
  319. 0 string BSA\0 BSArc archive data
  320. >4 lelong x version %d
  321. # MAR
  322. 2 string =-ah MAR archive data
  323. # ACB
  324. #0 belong&0x00f800ff 0x00800000 ACB archive data
  325. # CPZ
  326. # TODO, this is what idarc says: 0 string \0\0\0 CPZ archive data
  327. # JRC
  328. 0 string JRchive JRC archive data
  329. # Quantum
  330. 0 string DS\0 Quantum archive data
  331. # ReSOF
  332. 0 string PK\3\6 ReSOF archive data
  333. # QuArk
  334. 0 string 7\4 QuArk archive data
  335. # YAC
  336. 14 string YC YAC archive data
  337. # X1
  338. 0 string X1 X1 archive data
  339. 0 string XhDr X1 archive data
  340. # CDC Codec (.dqt)
  341. 0 belong&0xffffe000 0x76ff2000 CDC Codec archive data
  342. # AMGC
  343. 0 string \xad6" AMGC archive data
  344. # NuLIB
  345. 0 string N\xc3\xb5F\xc3\xa9lx\xc3\xa5 NuLIB archive data
  346. # PakLeo
  347. 0 string LEOLZW PAKLeo archive data
  348. # ChArc
  349. 0 string SChF ChArc archive data
  350. # PSA
  351. 0 string PSA PSA archive data
  352. # CrossePAC
  353. 0 string DSIGDCC CrossePAC archive data
  354. # Freeze
  355. 0 string \x1f\x9f\x4a\x10\x0a Freeze archive data
  356. # KBoom
  357. 0 string \xc2\xa8MP\xc2\xa8 KBoom archive data
  358. # NSQ, must go after CDC Codec
  359. 0 string \x76\xff NSQ archive data
  360. # DPA
  361. 0 string Dirk\ Paehl DPA archive data
  362. # BA
  363. # TODO: idarc says "bytes 0-2 == bytes 3-5"
  364. # TTComp
  365. # URL: http://fileformats.archiveteam.org/wiki/TTComp_archive
  366. # Update: Joerg Jenderek
  367. # GRR: line below is too general as it matches also Panorama database "TCDB 2003-10 demo.pan", others
  368. 0 string \0\6
  369. # look for first keyword of Panorama database *.pan
  370. >12 search/261 DESIGN
  371. # skip keyword with low entropy
  372. >12 default x TTComp archive, binary, 4K dictionary
  373. # (version 5.25) labeled the above entry as "TTComp archive data"
  374. # ESP, could this conflict with Easy Software Products' (e.g.ESP ghostscript) documentation?
  375. 0 string ESP ESP archive data
  376. # ZPack
  377. 0 string \1ZPK\1 ZPack archive data
  378. # Sky
  379. 0 string \xbc\x40 Sky archive data
  380. # UFA
  381. 0 string UFA UFA archive data
  382. # Dry
  383. 0 string =-H2O DRY archive data
  384. # FoxSQZ
  385. 0 string FOXSQZ FoxSQZ archive data
  386. # AR7
  387. 0 string ,AR7 AR7 archive data
  388. # PPMZ
  389. 0 string PPMZ PPMZ archive data
  390. # MS Compress
  391. # Update: Joerg Jenderek
  392. # URL: http://fileformats.archiveteam.org/wiki/MS-DOS_installation_compression
  393. # Reference: https://hwiegman.home.xs4all.nl/fileformats/compress/szdd_kwaj_format.html
  394. # Note: use correct version of extracting tool like EXPAND, UNPACK, DECOMP or 7Z
  395. 4 string \x88\xf0\x27
  396. # KWAJ variant
  397. >0 string KWAJ MS Compress archive data, KWAJ variant
  398. !:mime application/x-ms-compress-kwaj
  399. # extension not working in version 5.32
  400. # magic/Magdir/archive, 284: Warning: EXTENSION type ` ??_' has bad char '?'
  401. # file: line 284: Bad magic entry ' ??_'
  402. !:ext ??_
  403. # compression method (0-4)
  404. >>8 uleshort x \b, %u method
  405. # offset of compressed data
  406. >>10 uleshort x \b, 0x%x offset
  407. #>>(10.s) uleshort x
  408. #>>>&-6 string x \b, TEST extension %-.3s
  409. # header flags to mark header extensions
  410. >>12 uleshort >0 \b, 0x%x flags
  411. # 4 bytes: decompressed length of file
  412. >>12 uleshort &0x01
  413. >>>14 ulelong x \b, original size: %u bytes
  414. # 2 bytes: unknown purpose
  415. # 2 bytes: length of unknown data + mentioned bytes
  416. # 1-9 bytes: null-terminated file name
  417. # 1-4 bytes: null-terminated file extension
  418. >>12 uleshort &0x08
  419. >>>12 uleshort ^0x01
  420. >>>>12 uleshort ^0x02
  421. >>>>>12 uleshort ^0x04
  422. >>>>>>12 uleshort ^0x10
  423. >>>>>>>14 string x \b, %-.8s
  424. >>>>>>12 uleshort &0x10
  425. >>>>>>>14 string x \b, %-.8s
  426. >>>>>>>>&1 string x \b.%-.3s
  427. >>>>>12 uleshort &0x04
  428. >>>>>>12 uleshort ^0x10
  429. >>>>>>>(14.s) uleshort x
  430. >>>>>>>>&14 string x \b, %-.8s
  431. >>>>>>12 uleshort &0x10
  432. >>>>>>>(14.s) uleshort x
  433. >>>>>>>>&14 string x \b, %-.8s
  434. >>>>>>>>>&1 string x \b.%-.3s
  435. >>>>12 uleshort &0x02
  436. >>>>>12 uleshort ^0x04
  437. >>>>>>12 uleshort ^0x10
  438. >>>>>>>16 string x \b, %-.8s
  439. >>>>>>12 uleshort &0x10
  440. >>>>>>>16 string x \b, %-.8s
  441. >>>>>>>>&1 string x \b.%-.3s
  442. >>>>>12 uleshort &0x04
  443. >>>>>>12 uleshort ^0x10
  444. >>>>>>>(16.s) uleshort x
  445. >>>>>>>>&16 string x \b, %-.8s
  446. >>>>>>12 uleshort &0x10
  447. >>>>>>>(16.s) uleshort x
  448. >>>>>>>&16 string x %-.8s
  449. >>>>>>>>&1 string x \b.%-.3s
  450. >>>12 uleshort &0x01
  451. >>>>12 uleshort ^0x02
  452. >>>>>12 uleshort ^0x04
  453. >>>>>>12 uleshort ^0x10
  454. >>>>>>>18 string x \b, %-.8s
  455. >>>>>>12 uleshort &0x10
  456. >>>>>>>18 string x \b, %-.8s
  457. >>>>>>>>&1 string x \b.%-.3s
  458. >>>>>12 uleshort &0x04
  459. >>>>>>12 uleshort ^0x10
  460. >>>>>>>(18.s) uleshort x
  461. >>>>>>>>&18 string x \b, %-.8s
  462. >>>>>>12 uleshort &0x10
  463. >>>>>>>(18.s) uleshort x
  464. >>>>>>>>&18 string x \b, %-.8s
  465. >>>>>>>>>&1 string x \b.%-.3s
  466. >>>>12 uleshort &0x02
  467. >>>>>12 uleshort ^0x04
  468. >>>>>>12 uleshort ^0x10
  469. >>>>>>>20 string x \b, %-.8s
  470. >>>>>>12 uleshort &0x10
  471. >>>>>>>20 string x \b, %-.8s
  472. >>>>>>>>&1 string x \b.%-.3s
  473. >>>>>12 uleshort &0x04
  474. >>>>>>12 uleshort ^0x10
  475. >>>>>>>(20.s) uleshort x
  476. >>>>>>>>&20 string x \b, %-.8s
  477. >>>>>>12 uleshort &0x10
  478. >>>>>>>(20.s) uleshort x
  479. >>>>>>>>&20 string x \b, %-.8s
  480. >>>>>>>>>&1 string x \b.%-.3s
  481. # 2 bytes: length of data + mentioned bytes
  482. #
  483. # SZDD variant Haruhiko Okumura's LZSS or 7z type MsLZ
  484. >0 string SZDD MS Compress archive data, SZDD variant
  485. !:mime application/x-ms-compress-szdd
  486. !:ext ??_
  487. # The character missing from the end of the filename (0=unknown)
  488. >>9 string >\0 \b, %-.1s is last character of original name
  489. # https://www.betaarchive.com/forum/viewtopic.php?t=26161
  490. # Compression mode: "A" (0x41) found but sometimes "B" in Windows 3.1 builds 026 and 034e
  491. >>8 string !A \b, %-.1s method
  492. >>10 ulelong >0 \b, original size: %u bytes
  493. # QBasic SZDD variant
  494. 3 string \x88\xf0\x27
  495. >0 string SZ\x20 MS Compress archive data, QBasic variant
  496. !:mime application/x-ms-compress-sz
  497. !:ext ??$
  498. >>8 ulelong >0 \b, original size: %u bytes
  499. # MP3 (archiver, not lossy audio compression)
  500. 0 string MP3\x1a MP3-Archiver archive data
  501. # ZET
  502. 0 string OZ\xc3\x9d ZET archive data
  503. # TSComp
  504. 0 string \x65\x5d\x13\x8c\x08\x01\x03\x00 TSComp archive data
  505. # ARQ
  506. 0 string gW\4\1 ARQ archive data
  507. # Squash
  508. 3 string OctSqu Squash archive data
  509. # Terse
  510. 0 string \5\1\1\0 Terse archive data
  511. # PUCrunch
  512. 0 string \x01\x08\x0b\x08\xef\x00\x9e\x32\x30\x36\x31 PUCrunch archive data
  513. # UHarc
  514. 0 string UHA UHarc archive data
  515. # ABComp
  516. 0 string \2AB ABComp archive data
  517. 0 string \3AB2 ABComp archive data
  518. # CMP
  519. 0 string CO\0 CMP archive data
  520. # Splint
  521. 0 string \x93\xb9\x06 Splint archive data
  522. # InstallShield
  523. 0 string \x13\x5d\x65\x8c InstallShield Z archive Data
  524. # Gather
  525. 1 string GTH Gather archive data
  526. # BOA
  527. 0 string BOA BOA archive data
  528. # RAX
  529. 0 string ULEB\xa RAX archive data
  530. # Xtreme
  531. 0 string ULEB\0 Xtreme archive data
  532. # Pack Magic
  533. 0 string @\xc3\xa2\1\0 Pack Magic archive data
  534. # BTS
  535. 0 belong&0xfeffffff 0x1a034465 BTS archive data
  536. # ELI 5750
  537. 0 string Ora\ ELI 5750 archive data
  538. # QFC
  539. 0 string \x1aFC\x1a QFC archive data
  540. 0 string \x1aQF\x1a QFC archive data
  541. # PRO-PACK
  542. 0 string RNC PRO-PACK archive data
  543. # 777
  544. 0 string 777 777 archive data
  545. # LZS221
  546. 0 string sTaC LZS221 archive data
  547. # HPA
  548. 0 string HPA HPA archive data
  549. # Arhangel
  550. 0 string LG Arhangel archive data
  551. # EXP1, uses bzip2
  552. 0 string 0123456789012345BZh EXP1 archive data
  553. # IMP
  554. 0 string IMP\xa IMP archive data
  555. # NRV
  556. 0 string \x00\x9E\x6E\x72\x76\xFF NRV archive data
  557. # Squish
  558. 0 string \x73\xb2\x90\xf4 Squish archive data
  559. # Par
  560. 0 string PHILIPP Par archive data
  561. 0 string PAR Par archive data
  562. # HIT
  563. 0 string UB HIT archive data
  564. # SBX
  565. 0 belong&0xfffff000 0x53423000 SBX archive data
  566. # NaShrink
  567. 0 string NSK NaShrink archive data
  568. # SAPCAR
  569. 0 string #\ CAR\ archive\ header SAPCAR archive data
  570. 0 string CAR\ 2.00RG SAPCAR archive data
  571. # Disintegrator
  572. 0 string DST Disintegrator archive data
  573. # ASD
  574. 0 string ASD ASD archive data
  575. # InstallShield CAB
  576. 0 string ISc( InstallShield CAB
  577. # TOP4
  578. 0 string T4\x1a TOP4 archive data
  579. # BatComp left out: sig looks like COM executable
  580. # so TODO: get real 4dos batcomp file and find sig
  581. # BlakHole
  582. 0 string BH\5\7 BlakHole archive data
  583. # BIX
  584. 0 string BIX0 BIX archive data
  585. # ChiefLZA
  586. 0 string ChfLZ ChiefLZA archive data
  587. # Blink
  588. 0 string Blink Blink archive data
  589. # Logitech Compress
  590. 0 string \xda\xfa Logitech Compress archive data
  591. # ARS-Sfx (FIXME: really a SFX? then goto COM/EXE)
  592. 1 string (C)\ STEPANYUK ARS-Sfx archive data
  593. # AKT/AKT32
  594. 0 string AKT32 AKT32 archive data
  595. 0 string AKT AKT archive data
  596. # NPack
  597. 0 string MSTSM NPack archive data
  598. # PFT
  599. 0 string \0\x50\0\x14 PFT archive data
  600. # SemOne
  601. 0 string SEM SemOne archive data
  602. # PPMD
  603. 0 string \x8f\xaf\xac\x84 PPMD archive data
  604. # FIZ
  605. 0 string FIZ FIZ archive data
  606. # MSXiE
  607. 0 belong&0xfffff0f0 0x4d530000 MSXiE archive data
  608. # DeepFreezer
  609. 0 belong&0xfffffff0 0x797a3030 DeepFreezer archive data
  610. # DC
  611. 0 string =<DC- DC archive data
  612. # TPac
  613. 0 string \4TPAC\3 TPac archive data
  614. # Ai
  615. 0 string Ai\1\1\0 Ai archive data
  616. 0 string Ai\1\0\0 Ai archive data
  617. # Ai32
  618. 0 string Ai\2\0 Ai32 archive data
  619. 0 string Ai\2\1 Ai32 archive data
  620. # SBC
  621. 0 string SBC SBC archive data
  622. # Ybs
  623. 0 string YBS Ybs archive data
  624. # DitPack
  625. 0 string \x9e\0\0 DitPack archive data
  626. # DMS
  627. 0 string DMS! DMS archive data
  628. # EPC
  629. 0 string \x8f\xaf\xac\x8c EPC archive data
  630. # VSARC
  631. 0 string VS\x1a VSARC archive data
  632. # PDZ
  633. 0 string PDZ PDZ archive data
  634. # ReDuq
  635. 0 string rdqx ReDuq archive data
  636. # GCA
  637. 0 string GCAX GCA archive data
  638. # PPMN
  639. 0 string pN PPMN archive data
  640. # WinImage
  641. 3 string WINIMAGE WinImage archive data
  642. # Compressia
  643. 0 string CMP0CMP Compressia archive data
  644. # UHBC
  645. 0 string UHB UHBC archive data
  646. # WinHKI
  647. 0 string \x61\x5C\x04\x05 WinHKI archive data
  648. # WWPack data file
  649. 0 string WWP WWPack archive data
  650. # BSN (BSA, PTS-DOS)
  651. 0 string \xffBSG BSN archive data
  652. 1 string \xffBSG BSN archive data
  653. 3 string \xffBSG BSN archive data
  654. 1 string \0\xae\2 BSN archive data
  655. 1 string \0\xae\3 BSN archive data
  656. 1 string \0\xae\7 BSN archive data
  657. # AIN
  658. 0 string \x33\x18 AIN archive data
  659. 0 string \x33\x17 AIN archive data
  660. # XPA32 test moved and merged with XPA by Joerg Jenderek at Sep 2015
  661. # SZip (TODO: doesn't catch all versions)
  662. 0 string SZ\x0a\4 SZip archive data
  663. # XPack DiskImage
  664. # *.XDI updated by Joerg Jenderek Sep 2015
  665. # ftp://ftp.sac.sk/pub/sac/pack/0index.txt
  666. # GRR: this test is still too general as it catches also text files starting with jm
  667. 0 string jm
  668. # only found examples with this additional characteristic 2 bytes
  669. >2 string \x2\x4 Xpack DiskImage archive data
  670. #!:ext xdi
  671. # XPack Data
  672. # *.xpa updated by Joerg Jenderek Sep 2015
  673. # ftp://ftp.elf.stuba.sk/pub/pc/pack/
  674. 0 string xpa XPA
  675. !:ext xpa
  676. # XPA32
  677. # ftp://ftp.elf.stuba.sk/pub/pc/pack/xpa32.zip
  678. # created by XPA32.EXE version 1.0.2 for Windows
  679. >0 string xpa\0\1 \b32 archive data
  680. # created by XPACK.COM version 1.67m or 1.67r with short 0x1800
  681. >3 ubeshort !0x0001 \bck archive data
  682. # XPack Single Data
  683. # changed by Joerg Jenderek Sep 2015 back to like in version 5.12
  684. # letter 'I'+ acute accent is equivalent to \xcd
  685. 0 string \xcd\ jm Xpack single archive data
  686. #!:mime application/x-xpa-compressed
  687. !:ext xpa
  688. # TODO: missing due to unknown magic/magic at end of file:
  689. #DWC
  690. #ARG
  691. #ZAR
  692. #PC/3270
  693. #InstallIt
  694. #RKive
  695. #RK
  696. #XPack Diskimage
  697. # These were inspired by idarc, but actually verified
  698. # Dzip archiver (.dz)
  699. # Update: Joerg Jenderek
  700. # URL: http://speeddemosarchive.com/dzip/
  701. # reference: http://speeddemosarchive.com/dzip/dz29src.zip/main.c
  702. # GRR: line below is too general as it matches also ASCII texts like Doszip commander help dz.txt
  703. 0 string DZ
  704. # latest version is 2.9 dated 7 may 2003
  705. >2 byte <4 Dzip archive data
  706. !:mime application/x-dzip
  707. !:ext dz
  708. >>2 byte x \b, version %i
  709. >>3 byte x \b.%i
  710. >>4 ulelong x \b, offset 0x%x
  711. >>8 ulelong x \b, %u files
  712. # ZZip archiver (.zz)
  713. 0 string ZZ\ \0\0 ZZip archive data
  714. 0 string ZZ0 ZZip archive data
  715. # PAQ archiver (.paq)
  716. 0 string \xaa\x40\x5f\x77\x1f\xe5\x82\x0d PAQ archive data
  717. 0 string PAQ PAQ archive data
  718. >3 byte&0xf0 0x30
  719. >>3 byte x (v%c)
  720. # JAR archiver (.j), this is the successor to ARJ, not Java's JAR (which is essentially ZIP)
  721. 0xe string \x1aJar\x1b JAR (ARJ Software, Inc.) archive data
  722. 0 string JARCS JAR (ARJ Software, Inc.) archive data
  723. # ARJ archiver (jason@jarthur.Claremont.EDU)
  724. 0 leshort 0xea60 ARJ archive data
  725. !:mime application/x-arj
  726. >5 byte x \b, v%d,
  727. >8 byte &0x04 multi-volume,
  728. >8 byte &0x10 slash-switched,
  729. >8 byte &0x20 backup,
  730. >34 string x original name: %s,
  731. >7 byte 0 os: MS-DOS
  732. >7 byte 1 os: PRIMOS
  733. >7 byte 2 os: Unix
  734. >7 byte 3 os: Amiga
  735. >7 byte 4 os: Macintosh
  736. >7 byte 5 os: OS/2
  737. >7 byte 6 os: Apple ][ GS
  738. >7 byte 7 os: Atari ST
  739. >7 byte 8 os: NeXT
  740. >7 byte 9 os: VAX/VMS
  741. >3 byte >0 %d]
  742. # [JW] idarc says this is also possible
  743. 2 leshort 0xea60 ARJ archive data
  744. # HA archiver (Greg Roelofs, newt@uchicago.edu)
  745. # This is a really bad format. A file containing HAWAII will match this...
  746. #0 string HA HA archive data,
  747. #>2 leshort =1 1 file,
  748. #>2 leshort >1 %hu files,
  749. #>4 byte&0x0f =0 first is type CPY
  750. #>4 byte&0x0f =1 first is type ASC
  751. #>4 byte&0x0f =2 first is type HSC
  752. #>4 byte&0x0f =0x0e first is type DIR
  753. #>4 byte&0x0f =0x0f first is type SPECIAL
  754. # suggestion: at least identify small archives (<1024 files)
  755. 0 belong&0xffff00fc 0x48410000 HA archive data
  756. >2 leshort =1 1 file,
  757. >2 leshort >1 %u files,
  758. >4 byte&0x0f =0 first is type CPY
  759. >4 byte&0x0f =1 first is type ASC
  760. >4 byte&0x0f =2 first is type HSC
  761. >4 byte&0x0f =0x0e first is type DIR
  762. >4 byte&0x0f =0x0f first is type SPECIAL
  763. # HPACK archiver (Peter Gutmann, pgut1@cs.aukuni.ac.nz)
  764. 0 string HPAK HPACK archive data
  765. # JAM Archive volume format, by Dmitry.Kohmanyuk@UA.net
  766. 0 string \351,\001JAM\ JAM archive,
  767. >7 string >\0 version %.4s
  768. >0x26 byte =0x27 -
  769. >>0x2b string >\0 label %.11s,
  770. >>0x27 lelong x serial %08x,
  771. >>0x36 string >\0 fstype %.8s
  772. # LHARC/LHA archiver (Greg Roelofs, newt@uchicago.edu)
  773. # Update: Joerg Jenderek
  774. # URL: https://en.wikipedia.org/wiki/LHA_(file_format)
  775. # Reference: http://web.archive.org/web/20021005080911/http://www.osirusoft.com/joejared/lzhformat.html
  776. #
  777. # check and display information of lharc (LHa,PMarc) file
  778. 0 name lharc-file
  779. # check 1st character of method id like -lz4- -lh5- or -pm2-
  780. >2 string -
  781. # check 5th character of method id
  782. >>6 string -
  783. # check header level 0 1 2 3
  784. >>>20 ubyte <4
  785. # check 2nd, 3th and 4th character of method id
  786. >>>>3 regex \^(lh[0-9a-ex]|lz[s2-8]|pm[012]|pc1) \b
  787. !:mime application/x-lzh-compressed
  788. # creator type "LHA "
  789. !:apple ????LHA
  790. # display archive type name like "LHa/LZS archive data" or "LArc archive"
  791. >>>>>2 string -lz \b
  792. !:ext lzs
  793. # already known -lzs- -lz4- -lz5- with old names
  794. >>>>>>2 string -lzs LHa/LZS archive data
  795. >>>>>>3 regex \^lz[45] LHarc 1.x archive data
  796. # missing -lz?- with wikipedia names
  797. >>>>>>3 regex \^lz[2378] LArc archive
  798. # display archive type name like "LHa (2.x) archive data"
  799. >>>>>2 string -lh \b
  800. # already known -lh0- -lh1- -lh2- -lh3- -lh4- -lh5- -lh6- -lh7- -lhd- variants with old names
  801. >>>>>>3 regex \^lh[01] LHarc 1.x/ARX archive data
  802. # LHice archiver use ".ICE" as name extension instead usual one ".lzh"
  803. # FOOBAR archiver use ".foo" as name extension instead usual one
  804. # "Florain Orjanov's and Olga Bachetska's ARchiver" not found at the moment
  805. >>>>>>>2 string -lh1 \b
  806. !:ext lha/lzh/ice
  807. >>>>>>3 regex \^lh[23d] LHa 2.x? archive data
  808. >>>>>>3 regex \^lh[7] LHa (2.x)/LHark archive data
  809. >>>>>>3 regex \^lh[456] LHa (2.x) archive data
  810. >>>>>>>2 string -lh5 \b
  811. # https://en.wikipedia.org/wiki/BIOS
  812. # Some mainboard BIOS like Award use LHa compression. So archives with unusal extension are found like
  813. # bios.rom , kd7_v14.bin, 1010.004, ...
  814. !:ext lha/lzh/rom/bin
  815. # missing -lh?- variants (Joe Jared)
  816. >>>>>>3 regex \^lh[89a-ce] LHa (Joe Jared) archive
  817. # UNLHA32 2.67a
  818. >>>>>>2 string -lhx LHa (UNLHA32) archive
  819. # lha archives with standard file name extensions ".lha" ".lzh"
  820. >>>>>>3 regex !\^(lh1|lh5) \b
  821. !:ext lha/lzh
  822. # this should not happen if all -lh variants are described
  823. >>>>>>2 default x LHa (unknown) archive
  824. #!:ext lha
  825. # PMarc
  826. >>>>>3 regex \^pm[012] PMarc archive data
  827. !:ext pma
  828. # append method id without leading and trailing minus character
  829. >>>>>3 string x [%3.3s]
  830. >>>>>>0 use lharc-header
  831. #
  832. # check and display information of lharc header
  833. 0 name lharc-header
  834. # header size 0x4 , 0x1b-0x61
  835. >0 ubyte x
  836. # compressed data size != compressed file size
  837. #>7 ulelong x \b, data size %d
  838. # attribute: 0x2~?? 0x10~symlink|target 0x20~normal
  839. #>19 ubyte x \b, 19_0x%x
  840. # level identifier 0 1 2 3
  841. #>20 ubyte x \b, level %d
  842. # time stamp
  843. #>15 ubelong x DATE 0x%8.8x
  844. # OS ID for level 1
  845. >20 ubyte 1
  846. # 0x20 types find for *.rom files
  847. >>(21.b+24) ubyte <0x21 \b, 0x%x OS
  848. # ascii type like M for MSDOS
  849. >>(21.b+24) ubyte >0x20 \b, '%c' OS
  850. # OS ID for level 2
  851. >20 ubyte 2
  852. #>>23 ubyte x \b, OS ID 0x%x
  853. >>23 ubyte <0x21 \b, 0x%x OS
  854. >>23 ubyte >0x20 \b, '%c' OS
  855. # filename only for level 0 and 1
  856. >20 ubyte <2
  857. # length of filename
  858. >>21 ubyte >0 \b, with
  859. # filename
  860. >>>21 pstring x "%s"
  861. #
  862. #2 string -lh0- LHarc 1.x/ARX archive data [lh0]
  863. #!:mime application/x-lharc
  864. 2 string -lh0-
  865. >0 use lharc-file
  866. #2 string -lh1- LHarc 1.x/ARX archive data [lh1]
  867. #!:mime application/x-lharc
  868. 2 string -lh1-
  869. >0 use lharc-file
  870. # NEW -lz2- ... -lz8-
  871. 2 string -lz2-
  872. >0 use lharc-file
  873. 2 string -lz3-
  874. >0 use lharc-file
  875. 2 string -lz4-
  876. >0 use lharc-file
  877. 2 string -lz5-
  878. >0 use lharc-file
  879. 2 string -lz7-
  880. >0 use lharc-file
  881. 2 string -lz8-
  882. >0 use lharc-file
  883. # [never seen any but the last; -lh4- reported in comp.compression:]
  884. #2 string -lzs- LHa/LZS archive data [lzs]
  885. 2 string -lzs-
  886. >0 use lharc-file
  887. # According to wikipedia and others such a version does not exist
  888. #2 string -lh\40- LHa 2.x? archive data [lh ]
  889. #2 string -lhd- LHa 2.x? archive data [lhd]
  890. 2 string -lhd-
  891. >0 use lharc-file
  892. #2 string -lh2- LHa 2.x? archive data [lh2]
  893. 2 string -lh2-
  894. >0 use lharc-file
  895. #2 string -lh3- LHa 2.x? archive data [lh3]
  896. 2 string -lh3-
  897. >0 use lharc-file
  898. #2 string -lh4- LHa (2.x) archive data [lh4]
  899. 2 string -lh4-
  900. >0 use lharc-file
  901. #2 string -lh5- LHa (2.x) archive data [lh5]
  902. 2 string -lh5-
  903. >0 use lharc-file
  904. #2 string -lh6- LHa (2.x) archive data [lh6]
  905. 2 string -lh6-
  906. >0 use lharc-file
  907. #2 string -lh7- LHa (2.x)/LHark archive data [lh7]
  908. 2 string -lh7-
  909. # !:mime application/x-lha
  910. # >20 byte x - header level %d
  911. >0 use lharc-file
  912. # NEW -lh8- ... -lhe- , -lhx-
  913. 2 string -lh8-
  914. >0 use lharc-file
  915. 2 string -lh9-
  916. >0 use lharc-file
  917. 2 string -lha-
  918. >0 use lharc-file
  919. 2 string -lhb-
  920. >0 use lharc-file
  921. 2 string -lhc-
  922. >0 use lharc-file
  923. 2 string -lhe-
  924. >0 use lharc-file
  925. 2 string -lhx-
  926. >0 use lharc-file
  927. # taken from idarc [JW]
  928. 2 string -lZ PUT archive data
  929. # already done by LHarc magics
  930. # this should never happen if all sub types of LZS archive are identified
  931. #2 string -lz LZS archive data
  932. 2 string -sw1- Swag archive data
  933. 0 name rar-file-header
  934. >24 byte 15 \b, v1.5
  935. >24 byte 20 \b, v2.0
  936. >24 byte 29 \b, v4
  937. >15 byte 0 \b, os: MS-DOS
  938. >15 byte 1 \b, os: OS/2
  939. >15 byte 2 \b, os: Win32
  940. >15 byte 3 \b, os: Unix
  941. >15 byte 4 \b, os: Mac OS
  942. >15 byte 5 \b, os: BeOS
  943. 0 name rar-archive-header
  944. >3 leshort&0x1ff >0 \b, flags:
  945. >>3 leshort &0x01 ArchiveVolume
  946. >>3 leshort &0x02 Commented
  947. >>3 leshort &0x04 Locked
  948. >>3 leshort &0x10 NewVolumeNaming
  949. >>3 leshort &0x08 Solid
  950. >>3 leshort &0x20 Authenticated
  951. >>3 leshort &0x40 RecoveryRecordPresent
  952. >>3 leshort &0x80 EncryptedBlockHeader
  953. >>3 leshort &0x100 FirstVolume
  954. # RAR (Roshal Archive) archive
  955. 0 string Rar!\x1a\7\0 RAR archive data
  956. !:mime application/x-rar
  957. !:ext rar/cbr
  958. # file header
  959. >(0xc.l+9) byte 0x74
  960. >>(0xc.l+7) use rar-file-header
  961. # subblock seems to share information with file header
  962. >(0xc.l+9) byte 0x7a
  963. >>(0xc.l+7) use rar-file-header
  964. >9 byte 0x73
  965. >>7 use rar-archive-header
  966. 0 string Rar!\x1a\7\1\0 RAR archive data, v5
  967. !:mime application/x-rar
  968. !:ext rar
  969. # Very old RAR archive
  970. # http://jasonblanks.com/wp-includes/images/papers/KnowyourarchiveRAR.pdf
  971. 0 string RE\x7e\x5e RAR archive data (<v1.5)
  972. !:mime application/x-rar
  973. !:ext rar/cbr
  974. # SQUISH archiver (Greg Roelofs, newt@uchicago.edu)
  975. 0 string SQSH squished archive data (Acorn RISCOS)
  976. # UC2 archiver (Greg Roelofs, newt@uchicago.edu)
  977. # [JW] see exe section for self-extracting version
  978. 0 string UC2\x1a UC2 archive data
  979. # PKZIP multi-volume archive
  980. 0 string PK\x07\x08PK\x03\x04 Zip multi-volume archive data, at least PKZIP v2.50 to extract
  981. !:mime application/zip
  982. !:ext zip/cbz
  983. # Zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
  984. 0 string PK\005\006 Zip archive data (empty)
  985. !:mime application/zip
  986. !:ext zip/cbz
  987. 0 string PK\003\004
  988. # Specialised zip formats which start with a member named 'mimetype'
  989. # (stored uncompressed, with no 'extra field') containing the file's MIME type.
  990. # Check for have 8-byte name, 0-byte extra field, name "mimetype", and
  991. # contents starting with "application/":
  992. >26 string \x8\0\0\0mimetypeapplication/
  993. # KOffice / OpenOffice & StarOffice / OpenDocument formats
  994. # From: Abel Cheung <abel@oaka.org>
  995. # KOffice (1.2 or above) formats
  996. # (mimetype contains "application/vnd.kde.<SUBTYPE>")
  997. >>50 string vnd.kde. KOffice (>=1.2)
  998. >>>58 string karbon Karbon document
  999. >>>58 string kchart KChart document
  1000. >>>58 string kformula KFormula document
  1001. >>>58 string kivio Kivio document
  1002. >>>58 string kontour Kontour document
  1003. >>>58 string kpresenter KPresenter document
  1004. >>>58 string kspread KSpread document
  1005. >>>58 string kword KWord document
  1006. # OpenOffice formats (for OpenOffice 1.x / StarOffice 6/7)
  1007. # (mimetype contains "application/vnd.sun.xml.<SUBTYPE>")
  1008. >>50 string vnd.sun.xml. OpenOffice.org 1.x
  1009. >>>62 string writer Writer
  1010. >>>>68 byte !0x2e document
  1011. >>>>68 string .template template
  1012. >>>>68 string .global global document
  1013. >>>62 string calc Calc
  1014. >>>>66 byte !0x2e spreadsheet
  1015. >>>>66 string .template template
  1016. >>>62 string draw Draw
  1017. >>>>66 byte !0x2e document
  1018. >>>>66 string .template template
  1019. >>>62 string impress Impress
  1020. >>>>69 byte !0x2e presentation
  1021. >>>>69 string .template template
  1022. >>>62 string math Math document
  1023. >>>62 string base Database file
  1024. # OpenDocument formats (for OpenOffice 2.x / StarOffice >= 8)
  1025. # http://lists.oasis-open.org/archives/office/200505/msg00006.html
  1026. # (mimetype contains "application/vnd.oasis.opendocument.<SUBTYPE>")
  1027. >>50 string vnd.oasis.opendocument. OpenDocument
  1028. >>>73 string text
  1029. >>>>77 byte !0x2d Text
  1030. !:mime application/vnd.oasis.opendocument.text
  1031. >>>>77 string -template Text Template
  1032. !:mime application/vnd.oasis.opendocument.text-template
  1033. >>>>77 string -web HTML Document Template
  1034. !:mime application/vnd.oasis.opendocument.text-web
  1035. >>>>77 string -master Master Document
  1036. !:mime application/vnd.oasis.opendocument.text-master
  1037. >>>73 string graphics
  1038. >>>>81 byte !0x2d Drawing
  1039. !:mime application/vnd.oasis.opendocument.graphics
  1040. >>>>81 string -template Template
  1041. !:mime application/vnd.oasis.opendocument.graphics-template
  1042. >>>73 string presentation
  1043. >>>>85 byte !0x2d Presentation
  1044. !:mime application/vnd.oasis.opendocument.presentation
  1045. >>>>85 string -template Template
  1046. !:mime application/vnd.oasis.opendocument.presentation-template
  1047. >>>73 string spreadsheet
  1048. >>>>84 byte !0x2d Spreadsheet
  1049. !:mime application/vnd.oasis.opendocument.spreadsheet
  1050. >>>>84 string -template Template
  1051. !:mime application/vnd.oasis.opendocument.spreadsheet-template
  1052. >>>73 string chart
  1053. >>>>78 byte !0x2d Chart
  1054. !:mime application/vnd.oasis.opendocument.chart
  1055. >>>>78 string -template Template
  1056. !:mime application/vnd.oasis.opendocument.chart-template
  1057. >>>73 string formula
  1058. >>>>80 byte !0x2d Formula
  1059. !:mime application/vnd.oasis.opendocument.formula
  1060. >>>>80 string -template Template
  1061. !:mime application/vnd.oasis.opendocument.formula-template
  1062. >>>73 string database Database
  1063. !:mime application/vnd.oasis.opendocument.database
  1064. # Valid for LibreOffice Base 6.0.1.1 at least
  1065. >>>73 string base Database
  1066. !:mime application/vnd.oasis.opendocument.base
  1067. >>>73 string image
  1068. >>>>78 byte !0x2d Image
  1069. !:mime application/vnd.oasis.opendocument.image
  1070. >>>>78 string -template Template
  1071. !:mime application/vnd.oasis.opendocument.image-template
  1072. # EPUB (OEBPS) books using OCF (OEBPS Container Format)
  1073. # http://www.idpf.org/ocf/ocf1.0/download/ocf10.htm, section 4.
  1074. # From: Ralf Brown <ralf.brown@gmail.com>
  1075. >>50 string epub+zip EPUB document
  1076. !:mime application/epub+zip
  1077. # Catch other ZIP-with-mimetype formats
  1078. # In a ZIP file, the bytes immediately after a member's contents are
  1079. # always "PK". The 2 regex rules here print the "mimetype" member's
  1080. # contents up to the first 'P'. Luckily, most MIME types don't contain
  1081. # any capital 'P's. This is a kludge.
  1082. # (mimetype contains "application/<OTHER>")
  1083. >>50 string !epub+zip
  1084. >>>50 string !vnd.oasis.opendocument.
  1085. >>>>50 string !vnd.sun.xml.
  1086. >>>>>50 string !vnd.kde.
  1087. >>>>>>38 regex [!-OQ-~]+ Zip data (MIME type "%s"?)
  1088. !:mime application/zip
  1089. # (mimetype contents other than "application/*")
  1090. >26 string \x8\0\0\0mimetype
  1091. >>38 string !application/
  1092. >>>38 regex [!-OQ-~]+ Zip data (MIME type "%s"?)
  1093. !:mime application/zip
  1094. # Java Jar files
  1095. >(26.s+30) leshort 0xcafe Java archive data (JAR)
  1096. !:mime application/java-archive
  1097. # iOS App
  1098. >(26.s+30) leshort !0xcafe
  1099. >>26 string !\x8\0\0\0mimetype
  1100. >>>30 string Payload/
  1101. >>>>38 search/64 .app/ iOS App
  1102. !:mime application/x-ios-app
  1103. # Generic zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
  1104. # Next line excludes specialized formats:
  1105. >(26.s+30) leshort !0xcafe
  1106. >>26 string !\x8\0\0\0mimetype Zip archive data
  1107. !:mime application/zip
  1108. >>>4 beshort x \b, at least
  1109. >>>4 use zipversion
  1110. >>>4 beshort x to extract
  1111. >>>0x161 string WINZIP \b, WinZIP self-extracting
  1112. # StarView Metafile
  1113. # From Pierre Ducroquet <pinaraf@pinaraf.info>
  1114. 0 string VCLMTF StarView MetaFile
  1115. >6 beshort x \b, version %d
  1116. >8 belong x \b, size %d
  1117. # Zoo archiver
  1118. 20 lelong 0xfdc4a7dc Zoo archive data
  1119. !:mime application/x-zoo
  1120. >4 byte >48 \b, v%c.
  1121. >>6 byte >47 \b%c
  1122. >>>7 byte >47 \b%c
  1123. >32 byte >0 \b, modify: v%d
  1124. >>33 byte x \b.%d+
  1125. >42 lelong 0xfdc4a7dc \b,
  1126. >>70 byte >0 extract: v%d
  1127. >>>71 byte x \b.%d+
  1128. # Shell archives
  1129. 10 string #\ This\ is\ a\ shell\ archive shell archive text
  1130. !:mime application/octet-stream
  1131. #
  1132. # LBR. NB: May conflict with the questionable
  1133. # "binary Computer Graphics Metafile" format.
  1134. #
  1135. 0 string \0\ \ \ \ \ \ \ \ \ \ \ \0\0 LBR archive data
  1136. #
  1137. # PMA (CP/M derivative of LHA)
  1138. # Update: Joerg Jenderek
  1139. # URL: https://en.wikipedia.org/wiki/LHA_(file_format)
  1140. #
  1141. #2 string -pm0- PMarc archive data [pm0]
  1142. 2 string -pm0-
  1143. >0 use lharc-file
  1144. #2 string -pm1- PMarc archive data [pm1]
  1145. 2 string -pm1-
  1146. >0 use lharc-file
  1147. #2 string -pm2- PMarc archive data [pm2]
  1148. 2 string -pm2-
  1149. >0 use lharc-file
  1150. 2 string -pms- PMarc SFX archive (CP/M, DOS)
  1151. #!:mime application/x-foobar-exec
  1152. !:ext com
  1153. 5 string -pc1- PopCom compressed executable (CP/M)
  1154. #!:mime application/x-
  1155. #!:ext com
  1156. # From Rafael Laboissiere <rafael@laboissiere.net>
  1157. # The Project Revision Control System (see
  1158. # http://prcs.sourceforge.net) generates a packaged project
  1159. # file which is recognized by the following entry:
  1160. 0 leshort 0xeb81 PRCS packaged project
  1161. # Microsoft cabinets
  1162. # by David Necas (Yeti) <yeti@physics.muni.cz>
  1163. #0 string MSCF\0\0\0\0 Microsoft cabinet file data,
  1164. #>25 byte x v%d
  1165. #>24 byte x \b.%d
  1166. # MPi: All CABs have version 1.3, so this is pointless.
  1167. # Better magic in debian-additions.
  1168. # GTKtalog catalogs
  1169. # by David Necas (Yeti) <yeti@physics.muni.cz>
  1170. 4 string gtktalog\ GTKtalog catalog data,
  1171. >13 string 3 version 3
  1172. >>14 beshort 0x677a (gzipped)
  1173. >>14 beshort !0x677a (not gzipped)
  1174. >13 string >3 version %s
  1175. ############################################################################
  1176. # Parity archive reconstruction file, the 'par' file format now used on Usenet.
  1177. 0 string PAR\0 PARity archive data
  1178. >48 leshort =0 - Index file
  1179. >48 leshort >0 - file number %d
  1180. # Felix von Leitner <felix-file@fefe.de>
  1181. 0 string d8:announce BitTorrent file
  1182. !:mime application/x-bittorrent
  1183. # Durval Menezes, <jmgthbfile at durval dot com>
  1184. 0 string d13:announce-list BitTorrent file
  1185. !:mime application/x-bittorrent
  1186. # Atari MSA archive - Teemu Hukkanen <tjhukkan@iki.fi>
  1187. 0 beshort 0x0e0f Atari MSA archive data
  1188. >2 beshort x \b, %d sectors per track
  1189. >4 beshort 0 \b, 1 sided
  1190. >4 beshort 1 \b, 2 sided
  1191. >6 beshort x \b, starting track: %d
  1192. >8 beshort x \b, ending track: %d
  1193. # Alternate ZIP string (amc@arwen.cs.berkeley.edu)
  1194. 0 string PK00PK\003\004 Zip archive data
  1195. !:mime application/zip
  1196. !:ext zip/cbz
  1197. # ACE archive (from http://www.wotsit.org/download.asp?f=ace)
  1198. # by Stefan `Sec` Zehl <sec@42.org>
  1199. 7 string **ACE** ACE archive data
  1200. >15 byte >0 version %d
  1201. >16 byte =0x00 \b, from MS-DOS
  1202. >16 byte =0x01 \b, from OS/2
  1203. >16 byte =0x02 \b, from Win/32
  1204. >16 byte =0x03 \b, from Unix
  1205. >16 byte =0x04 \b, from MacOS
  1206. >16 byte =0x05 \b, from WinNT
  1207. >16 byte =0x06 \b, from Primos
  1208. >16 byte =0x07 \b, from AppleGS
  1209. >16 byte =0x08 \b, from Atari
  1210. >16 byte =0x09 \b, from Vax/VMS
  1211. >16 byte =0x0A \b, from Amiga
  1212. >16 byte =0x0B \b, from Next
  1213. >14 byte x \b, version %d to extract
  1214. >5 leshort &0x0080 \b, multiple volumes,
  1215. >>17 byte x \b (part %d),
  1216. >5 leshort &0x0002 \b, contains comment
  1217. >5 leshort &0x0200 \b, sfx
  1218. >5 leshort &0x0400 \b, small dictionary
  1219. >5 leshort &0x0800 \b, multi-volume
  1220. >5 leshort &0x1000 \b, contains AV-String
  1221. >>30 string \x16*UNREGISTERED\x20VERSION* (unregistered)
  1222. >5 leshort &0x2000 \b, with recovery record
  1223. >5 leshort &0x4000 \b, locked
  1224. >5 leshort &0x8000 \b, solid
  1225. # Date in MS-DOS format (whatever that is)
  1226. #>18 lelong x Created on
  1227. # sfArk : compression program for Soundfonts (sf2) by Dirk Jagdmann
  1228. # <doj@cubic.org>
  1229. 0x1A string sfArk sfArk compressed Soundfont
  1230. >0x15 string 2
  1231. >>0x1 string >\0 Version %s
  1232. >>0x2A string >\0 : %s
  1233. # DR-DOS 7.03 Packed File *.??_
  1234. 0 string Packed\ File\ Personal NetWare Packed File
  1235. >12 string x \b, was "%.12s"
  1236. # EET archive
  1237. # From: Tilman Sauerbeck <tilman@code-monkey.de>
  1238. 0 belong 0x1ee7ff00 EET archive
  1239. !:mime application/x-eet
  1240. # rzip archives
  1241. 0 string RZIP rzip compressed data
  1242. >4 byte x - version %d
  1243. >5 byte x \b.%d
  1244. >6 belong x (%d bytes)
  1245. # From: "Robert Dale" <robdale@gmail.com>
  1246. 0 belong 123 dar archive,
  1247. >4 belong x label "%.8x
  1248. >>8 belong x %.8x
  1249. >>>12 beshort x %.4x"
  1250. >14 byte 0x54 end slice
  1251. >14 beshort 0x4e4e multi-part
  1252. >14 beshort 0x4e53 multi-part, with -S
  1253. # Symbian installation files
  1254. # http://www.thouky.co.uk/software/psifs/sis.html
  1255. # http://developer.symbian.com/main/downloads/papers/SymbianOSv91/softwareinstallsis.pdf
  1256. 8 lelong 0x10000419 Symbian installation file
  1257. !:mime application/vnd.symbian.install
  1258. >4 lelong 0x1000006D (EPOC release 3/4/5)
  1259. >4 lelong 0x10003A12 (EPOC release 6)
  1260. 0 lelong 0x10201A7A Symbian installation file (Symbian OS 9.x)
  1261. !:mime x-epoc/x-sisx-app
  1262. # From "Nelson A. de Oliveira" <naoliv@gmail.com>
  1263. 0 string MPQ\032 MoPaQ (MPQ) archive
  1264. # From: "Nelson A. de Oliveira" <naoliv@gmail.com>
  1265. # .kgb
  1266. 0 string KGB_arch KGB Archiver file
  1267. >10 string x with compression level %.1s
  1268. # xar (eXtensible ARchiver) archive
  1269. # xar archive format: http://code.google.com/p/xar/
  1270. # From: "David Remahl" <dremahl@apple.com>
  1271. 0 string xar! xar archive
  1272. !:mime application/x-xar
  1273. #>4 beshort x header size %d
  1274. >6 beshort x version %d,
  1275. #>8 quad x compressed TOC: %d,
  1276. #>16 quad x uncompressed TOC: %d,
  1277. >24 belong 0 no checksum
  1278. >24 belong 1 SHA-1 checksum
  1279. >24 belong 2 MD5 checksum
  1280. # Type: Parity Archive
  1281. # From: Daniel van Eeden <daniel_e@dds.nl>
  1282. 0 string PAR2 Parity Archive Volume Set
  1283. # Bacula volume format. (Volumes always start with a block header.)
  1284. # URL: http://bacula.org/3.0.x-manuals/en/developers/developers/Block_Header.html
  1285. # From: Adam Buchbinder <adam.buchbinder@gmail.com>
  1286. 12 string BB02 Bacula volume
  1287. >20 bedate x \b, started %s
  1288. # ePub is XHTML + XML inside a ZIP archive. The first member of the
  1289. # archive must be an uncompressed file called 'mimetype' with contents
  1290. # 'application/epub+zip'
  1291. # From: "Michael Gorny" <mgorny@gentoo.org>
  1292. # ZPAQ: http://mattmahoney.net/dc/zpaq.html
  1293. 0 string zPQ ZPAQ stream
  1294. >3 byte x \b, level %d
  1295. # From: Barry Carter <carter.barry@gmail.com>
  1296. # http://encode.ru/threads/456-zpaq-updates/page32
  1297. 0 string 7kSt ZPAQ file
  1298. # BBeB ebook, unencrypted (LRF format)
  1299. # URL: http://www.sven.de/librie/Librie/LrfFormat
  1300. # From: Adam Buchbinder <adam.buchbinder@gmail.com>
  1301. 0 string L\0R\0F\0\0\0 BBeB ebook data, unencrypted
  1302. >8 beshort x \b, version %d
  1303. >36 byte 1 \b, front-to-back
  1304. >36 byte 16 \b, back-to-front
  1305. >42 beshort x \b, (%dx,
  1306. >44 beshort x %d)
  1307. # Symantec GHOST image by Joerg Jenderek at May 2014
  1308. # http://us.norton.com/ghost/
  1309. # http://www.garykessler.net/library/file_sigs.html
  1310. 0 ubelong&0xFFFFf7f0 0xFEEF0100 Norton GHost image
  1311. # *.GHO
  1312. >2 ubyte&0x08 0x00 \b, first file
  1313. # *.GHS or *.[0-9] with cns program option
  1314. >2 ubyte&0x08 0x08 \b, split file
  1315. # part of split index interesting for *.ghs
  1316. >>4 ubyte x id=0x%x
  1317. # compression tag minus one equals numeric compression command line switch z[1-9]
  1318. >3 ubyte 0 \b, no compression
  1319. >3 ubyte 2 \b, fast compression (Z1)
  1320. >3 ubyte 3 \b, medium compression (Z2)
  1321. >3 ubyte >3
  1322. >>3 ubyte <11 \b, compression (Z%d-1)
  1323. >2 ubyte&0x08 0x00
  1324. # ~ 30 byte password field only for *.gho
  1325. >>12 ubequad !0 \b, password protected
  1326. >>44 ubyte !1
  1327. # 1~Image All, sector-by-sector only for *.gho
  1328. >>>10 ubyte 1 \b, sector copy
  1329. # 1~Image Boot track only for *.gho
  1330. >>>43 ubyte 1 \b, boot track
  1331. # 1~Image Disc only for *.gho implies Image Boot track and sector copy
  1332. >>44 ubyte 1 \b, disc sector copy
  1333. # optional image description only *.gho
  1334. >>0xff string >\0 "%-.254s"
  1335. # look for DOS sector end sequence
  1336. >0xE08 search/7776 \x55\xAA
  1337. >>&-512 indirect x \b; contains
  1338. # Google Chrome extensions
  1339. # https://developer.chrome.com/extensions/crx
  1340. # https://developer.chrome.com/extensions/hosting
  1341. 0 string Cr24 Google Chrome extension
  1342. !:mime application/x-chrome-extension
  1343. >4 ulong x \b, version %u
  1344. # SeqBox - Sequenced container
  1345. # ext: sbx, seqbox
  1346. # Marco Pontello marcopon@gmail.com
  1347. # reference: https://github.com/MarcoPon/SeqBox
  1348. 0 string SBx SeqBox,
  1349. >3 byte x version %d
  1350. # LyNX archive
  1351. 56 string USE\040LYNX\040TO\040DISSOLVE\040THIS\040FILE LyNX archive