zip 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #------------------------------------------------------------------------------
  2. # $File: zip,v 1.4 2020/03/03 13:46:52 christos Exp $
  3. # zip: file(1) magic for zip files; this is not use
  4. # Note the version of magic in archive is currently stronger, this is
  5. # just an example until negative offsets are supported better
  6. # Zip Central Directory record
  7. 0 name zipcd
  8. >0 string PK\001\002 Zip archive data
  9. >>4 leshort x \b, made by
  10. >>4 use zipversion
  11. >>4 use ziphost
  12. >>6 leshort x \b, extract using at least
  13. >>6 use zipversion
  14. >>12 ledate x \b, last modified %s
  15. >>24 lelong >0 \b, uncompressed size %d
  16. >>10 leshort x \b, method=
  17. >>10 use zipcompression
  18. # URL: https://en.wikipedia.org/wiki/Zip_(file_format)
  19. # reference: https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.6.TXT
  20. # Zip known compressions
  21. 0 name zipcompression
  22. >0 leshort 0 \bstore
  23. >0 leshort 1 \bShrinking
  24. >0 leshort 6 \bImploding
  25. >0 leshort 7 \bTokenizing
  26. >0 leshort 8 \bdeflate
  27. >0 leshort 9 \bdeflate64
  28. >0 leshort 10 \bLibrary imploding
  29. #>0 leshort 11 \bReserved by PKWARE
  30. >0 leshort 12 \bbzip2
  31. #>0 leshort 13 \bReserved by PKWARE
  32. >0 leshort 14 \blzma
  33. #>0 leshort 15 \bReserved by PKWARE
  34. >0 leshort 16 \bCMPSC Compression
  35. #>0 leshort 17 \bReserved by PKWARE
  36. >0 leshort 18 \bIBM TERSE
  37. >0 leshort 19 \bIBM LZ77
  38. # https://support.winzip.com/hc/en-us/articles/115012122828-Compression-method-used-for-this-file-is-94
  39. >0 leshort 94 \bMP3
  40. >0 leshort 95 \bxz
  41. >0 leshort 96 \bJpeg
  42. >0 leshort 97 \bWavPack
  43. >0 leshort 98 \bPPMd
  44. >0 leshort 99 \bAES Encrypted
  45. >0 default x
  46. >>0 leshort x \b[%#x]
  47. # Zip known versions
  48. 0 name zipversion
  49. # The lower byte indicates the ZIP version of this file. The value/10 indicates
  50. # the major version number, and the value mod 10 is the minor version number.
  51. >0 ubyte/10 x v%u
  52. >0 ubyte%10 x \b.%u
  53. # >0 leshort 0x09 v0.9
  54. # >0 leshort 0x0a v1.0
  55. # >0 leshort 0x0b v1.1
  56. # >0 leshort 0x14 v2.0
  57. # >0 leshort 0x15 v2.1
  58. # >0 leshort 0x19 v2.5
  59. # >0 leshort 0x1b v2.7
  60. # >0 leshort 0x2d v4.5
  61. # >0 leshort 0x2e v4.6
  62. # >0 leshort 0x32 v5.0
  63. # >0 leshort 0x33 v5.1
  64. # >0 leshort 0x34 v5.2
  65. # >0 leshort 0x3d v6.1
  66. # >0 leshort 0x3e v6.2
  67. # >0 leshort 0x3f v6.3
  68. # >0 default x
  69. # >>0 leshort x v?[%#x]
  70. # display compatible host system name of ZIP archive
  71. 0 name ziphost
  72. # The upper byte indicates the compatibility of the file attribute information.
  73. # If the file is compatible with MS-DOS (v 2.04g) then this value will be zero.
  74. #>1 ubyte 0 DOS
  75. >1 ubyte 1 Amiga
  76. >1 ubyte 2 OpenVMS
  77. >1 ubyte 3 UNIX
  78. >1 ubyte 4 VM/CMS
  79. >1 ubyte 6 OS/2
  80. >1 ubyte 7 Macintosh
  81. >1 ubyte 11 MVS
  82. >1 ubyte 13 Acorn Risc
  83. >1 ubyte 16 BeOS
  84. >1 ubyte 17 Tandem
  85. # 9 untested
  86. >1 ubyte 5 Atari ST
  87. >1 ubyte 8 Z-System
  88. >1 ubyte 9 CP/M
  89. >1 ubyte 10 Windows NTFS
  90. >1 ubyte 12 VSE
  91. >1 ubyte 14 VFAT
  92. >1 ubyte 15 alternate MVS
  93. >1 ubyte 18 OS/400
  94. >1 ubyte 19 OS X
  95. # unused
  96. #>1 ubyte >19 unused 0x%x
  97. # Zip End Of Central Directory record
  98. -22 string PK\005\006
  99. #>4 leshort >1 \b, %d disks
  100. #>6 leshort >1 \b, central directory disk %d
  101. #>8 leshort >1 \b, %d central directories on this disk
  102. #>10 leshort >1 \b, %d central directories
  103. #>12 lelong x \b, %d central directory bytes
  104. >(16.l) use zipcd
  105. >>20 pstring/l >0 \b, %s