archive 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. #------------------------------------------------------------------------------
  2. # archive: file(1) magic for archive formats (see also "msdos" for self-
  3. # extracting compressed archives)
  4. #
  5. # cpio, ar, arc, arj, hpack, lha/lharc, rar, squish, uc2, zip, zoo, etc.
  6. # pre-POSIX "tar" archives are handled in the C code.
  7. # POSIX tar archives
  8. 257 string ustar\0 POSIX tar archive
  9. 257 string ustar\040\040\0 GNU tar archive
  10. # cpio archives
  11. #
  12. # Yes, the top two "cpio archive" formats *are* supposed to just be "short".
  13. # The idea is to indicate archives produced on machines with the same
  14. # byte order as the machine running "file" with "cpio archive", and
  15. # to indicate archives produced on machines with the opposite byte order
  16. # from the machine running "file" with "byte-swapped cpio archive".
  17. #
  18. # The SVR4 "cpio(4)" hints that there are additional formats, but they
  19. # are defined as "short"s; I think all the new formats are
  20. # character-header formats and thus are strings, not numbers.
  21. 0 short 070707 cpio archive
  22. 0 short 0143561 byte-swapped cpio archive
  23. 0 string 070707 ASCII cpio archive (pre-SVR4 or odc)
  24. 0 string 070701 ASCII cpio archive (SVR4 with no CRC)
  25. 0 string 070702 ASCII cpio archive (SVR4 with CRC)
  26. # other archives
  27. 0 long 0177555 very old archive
  28. 0 short 0177555 very old PDP-11 archive
  29. 0 long 0177545 old archive
  30. 0 short 0177545 old PDP-11 archive
  31. 0 long 0100554 apl workspace
  32. 0 string =<ar> archive
  33. # MIPS archive (needs to go first)
  34. #
  35. 0 string !<arch>\n__________E MIPS archive
  36. >20 string U with MIPS Ucode members
  37. >21 string L with MIPSEL members
  38. >21 string B with MIPSEB members
  39. >19 string L and an EL hash table
  40. >19 string B and an EB hash table
  41. >22 string X -- out of date
  42. 0 string !<arch> archive
  43. >8 string __.SYMDEF random library
  44. 0 string -h- Software Tools format archive text
  45. #
  46. # XXX - why are there multiple <ar> thingies? Note that 0x213c6172 is
  47. # "!<ar", so, for new-style (4.xBSD/SVR2andup) archives, we have:
  48. #
  49. # 0 string !<arch> current ar archive
  50. # 0 long 0x213c6172 archive file
  51. #
  52. # and for SVR3.1 archives, we have:
  53. #
  54. # 0 string \<ar> System V Release 1 ar archive
  55. # 0 string =<ar> archive
  56. # 0 string =<ar> archive
  57. #
  58. # XXX - did Aegis really store shared libraries, breakpointed modules,
  59. # and absolute code program modules in the same format as new-style
  60. # "ar" archives?
  61. #
  62. 0 string !<arch> current ar archive
  63. >8 string __.SYMDEF random library
  64. >8 string debian-split part of multipart Debian package
  65. >8 string debian-binary Debian binary package
  66. >0 belong =65538 - pre SR9.5
  67. >0 belong =65539 - post SR9.5
  68. >0 beshort 2 - object archive
  69. >0 beshort 3 - shared library module
  70. >0 beshort 4 - debug break-pointed module
  71. >0 beshort 5 - absolute code program module
  72. 0 string \<ar> System V Release 1 ar archive
  73. 0 string =<ar> archive
  74. #
  75. # XXX - from "vax", which appears to collect a bunch of byte-swapped
  76. # thingies, to help you recognize VAX files on big-endian machines;
  77. # with "leshort", "lelong", and "string", that's no longer necessary....
  78. #
  79. 0 belong 0x65ff0000 VAX 3.0 archive
  80. 0 belong 0x3c61723e VAX 5.0 archive
  81. #
  82. 0 long 0x213c6172 archive file
  83. 0 lelong 0177555 very old VAX archive
  84. 0 leshort 0177555 very old PDP-11 archive
  85. #
  86. # XXX - "pdp" claims that 0177545 can have an __.SYMDEF member and thus
  87. # be a random library (it said 0xff65 rather than 0177545).
  88. #
  89. 0 lelong 0177545 old VAX archive
  90. >8 string __.SYMDEF random library
  91. 0 leshort 0177545 old PDP-11 archive
  92. >8 string __.SYMDEF random library
  93. #
  94. 0 string =<ar> archive
  95. #
  96. # From "pdp":
  97. #
  98. 0 lelong 0x39bed PDP-11 old archive
  99. 0 lelong 0x39bee PDP-11 4.0 archive
  100. #
  101. 0 string -h- Software Tools format archive text
  102. # ARC archiver, from Daniel Quinlan (quinlan@yggdrasil.com)
  103. #
  104. # The first byte is the magic (0x1a), byte 2 is the compression type for
  105. # the first file (0x01 through 0x09), and bytes 3 to 15 are the MS-DOS
  106. # filename of the first file (null terminated). Since some types collide
  107. # we only test some types on basis of frequency: 0x08 (83%), 0x09 (5%),
  108. # 0x02 (5%), 0x03 (3%), 0x04 (2%), 0x06 (2%). 0x01 collides with terminfo.
  109. 0 lelong&0x8080ffff 0x0000081a ARC archive data, dynamic LZW
  110. 0 lelong&0x8080ffff 0x0000091a ARC archive data, squashed
  111. 0 lelong&0x8080ffff 0x0000021a ARC archive data, uncompressed
  112. 0 lelong&0x8080ffff 0x0000031a ARC archive data, packed
  113. 0 lelong&0x8080ffff 0x0000041a ARC archive data, squeezed
  114. 0 lelong&0x8080ffff 0x0000061a ARC archive data, crunched
  115. # Acorn archive formats (Disaster prone simpleton, m91dps@ecs.ox.ac.uk)
  116. # I can't create either SPARK or ArcFS archives so I have not tested this stuff
  117. # [GRR: the original entries collide with ARC, above; replaced with combined
  118. # version (not tested)]
  119. #0 byte 0x1a RISC OS archive
  120. #>1 string archive (ArcFS format)
  121. 0 string \032archive RISC OS archive (ArcFS format)
  122. # ARJ archiver (jason@jarthur.Claremont.EDU)
  123. 0 leshort 0xea60 ARJ archive data
  124. >5 byte x \b, v%d,
  125. >8 byte &0x04 multi-volume,
  126. >8 byte &0x10 slash-switched,
  127. >8 byte &0x20 backup,
  128. >34 string x original name: %s,
  129. >7 byte 0 os: MS-DOS
  130. >7 byte 1 os: PRIMOS
  131. >7 byte 2 os: Unix
  132. >7 byte 3 os: Amiga
  133. >7 byte 4 os: Macintosh
  134. >7 byte 5 os: OS/2
  135. >7 byte 6 os: Apple ][ GS
  136. >7 byte 7 os: Atari ST
  137. >7 byte 8 os: NeXT
  138. >7 byte 9 os: VAX/VMS
  139. >3 byte >0 %d]
  140. # HA archiver (Greg Roelofs, newt@uchicago.edu)
  141. # This is a really bad format. A file containing HAWAII will match this...
  142. #0 string HA HA archive data,
  143. #>2 leshort =1 1 file,
  144. #>2 leshort >1 %u files,
  145. #>4 byte&0x0f =0 first is type CPY
  146. #>4 byte&0x0f =1 first is type ASC
  147. #>4 byte&0x0f =2 first is type HSC
  148. #>4 byte&0x0f =0x0e first is type DIR
  149. #>4 byte&0x0f =0x0f first is type SPECIAL
  150. # HPACK archiver (Peter Gutmann, pgut1@cs.aukuni.ac.nz)
  151. 0 string HPAK HPACK archive data
  152. # JAM Archive volume format, by Dmitry.Kohmanyuk@UA.net
  153. 0 string \351,\001JAM\ JAM archive,
  154. >7 string >\0 version %.4s
  155. >0x26 byte =0x27 -
  156. >>0x2b string >\0 label %.11s,
  157. >>0x27 lelong x serial %08x,
  158. >>0x36 string >\0 fstype %.8s
  159. # LHARC/LHA archiver (Greg Roelofs, newt@uchicago.edu)
  160. 2 string -lh0- LHarc 1.x archive data [lh0]
  161. 2 string -lh1- LHarc 1.x archive data [lh1]
  162. 2 string -lz4- LHarc 1.x archive data [lz4]
  163. 2 string -lz5- LHarc 1.x archive data [lz5]
  164. # [never seen any but the last; -lh4- reported in comp.compression:]
  165. 2 string -lzs- LHa 2.x? archive data [lzs]
  166. 2 string -lh - LHa 2.x? archive data [lh ]
  167. 2 string -lhd- LHa 2.x? archive data [lhd]
  168. 2 string -lh2- LHa 2.x? archive data [lh2]
  169. 2 string -lh3- LHa 2.x? archive data [lh3]
  170. 2 string -lh4- LHa (2.x) archive data [lh4]
  171. 2 string -lh5- LHa (2.x) archive data [lh5]
  172. >20 byte x - header level %d
  173. # RAR archiver (Greg Roelofs, newt@uchicago.edu)
  174. 0 string Rar! RAR archive data
  175. # SQUISH archiver (Greg Roelofs, newt@uchicago.edu)
  176. 0 string SQSH squished archive data (Acorn RISCOS)
  177. # UC2 archiver (Greg Roelofs, newt@uchicago.edu)
  178. # I can't figure out the self-extracting form of these buggers...
  179. 0 string UC2\x1a UC2 archive data
  180. # ZIP archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
  181. 0 string PK\003\004 Zip archive data
  182. >4 byte 0x09 \b, at least v0.9 to extract
  183. >4 byte 0x0a \b, at least v1.0 to extract
  184. >4 byte 0x0b \b, at least v1.1 to extract
  185. >4 byte 0x14 \b, at least v2.0 to extract
  186. # Zoo archiver
  187. 20 lelong 0xfdc4a7dc Zoo archive data
  188. >4 byte >48 \b, v%c.
  189. >>6 byte >47 \b%c
  190. >>>7 byte >47 \b%c
  191. >32 byte >0 \b, modify: v%d
  192. >>33 byte x \b.%d+
  193. >42 lelong 0xfdc4a7dc \b,
  194. >>70 byte >0 extract: v%d
  195. >>>71 byte x \b.%d+
  196. # Shell archives
  197. 10 string #\ This\ is\ a\ shell\ archive shell archive text