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
7 # Zip Central Directory record
9 >0 string PK\001\002 Zip archive data
10 >>4 leshort x \b, made by
13 >>6 leshort x \b, extract using at least
15 >>12 ledate x \b, last modified %s
16 >>24 lelong >0 \b, uncompressed size %d
17 >>10 leshort x \b, method=
18 >>10 use zipcompression
20 # URL: https://en.wikipedia.org/wiki/Zip_(file_format)
21 # reference: https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.6.TXT
22 # Zip known compressions
25 >0 leshort 1 \bShrinking
26 >0 leshort 6 \bImploding
27 >0 leshort 7 \bTokenizing
28 >0 leshort 8 \bdeflate
29 >0 leshort 9 \bdeflate64
30 >0 leshort 10 \bLibrary imploding
31 #>0 leshort 11 \bReserved by PKWARE
33 #>0 leshort 13 \bReserved by PKWARE
35 #>0 leshort 15 \bReserved by PKWARE
36 >0 leshort 16 \bCMPSC Compression
37 #>0 leshort 17 \bReserved by PKWARE
38 >0 leshort 18 \bIBM TERSE
39 >0 leshort 19 \bIBM LZ77
40 # https://support.winzip.com/hc/en-us/articles/115012122828-Compression-method-used-for-this-file-is-94
44 >0 leshort 97 \bWavPack
46 >0 leshort 99 \bAES Encrypted
52 # The lower byte indicates the ZIP version of this file. The value/10 indicates
53 # the major version number, and the value mod 10 is the minor version number.
56 # >0 leshort 0x09 v0.9
57 # >0 leshort 0x0a v1.0
58 # >0 leshort 0x0b v1.1
59 # >0 leshort 0x14 v2.0
60 # >0 leshort 0x15 v2.1
61 # >0 leshort 0x19 v2.5
62 # >0 leshort 0x1b v2.7
63 # >0 leshort 0x2d v4.5
64 # >0 leshort 0x2e v4.6
65 # >0 leshort 0x32 v5.0
66 # >0 leshort 0x33 v5.1
67 # >0 leshort 0x34 v5.2
68 # >0 leshort 0x3d v6.1
69 # >0 leshort 0x3e v6.2
70 # >0 leshort 0x3f v6.3
72 # >>0 leshort x v?[%#x]
74 # display compatible host system name of ZIP archive
76 # The upper byte indicates the compatibility of the file attribute information.
77 # If the file is compatible with MS-DOS (v 2.04g) then this value will be zero.
86 >1 ubyte 13 Acorn Risc
93 >1 ubyte 10 Windows NTFS
96 >1 ubyte 15 alternate MVS
100 #>1 ubyte >19 unused 0x%x
102 # Zip End Of Central Directory record
103 -22 string PK\005\006
104 #>4 leshort >1 \b, %d disks
105 #>6 leshort >1 \b, central directory disk %d
106 #>8 leshort >1 \b, %d central directories on this disk
107 #>10 leshort >1 \b, %d central directories
108 #>12 lelong x \b, %d central directory bytes
110 >>20 pstring/l >0 \b, %s