archive 46 KB

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