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