xref: /freebsd/contrib/file/magic/Magdir/zip (revision d7d962ead0b6e5e8a39202d0590022082bf5bfb6)
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
7# Zip Central Directory record
80	name		zipcd
9>0	string		PK\001\002	Zip archive data
10>>4	leshort		x		\b, made by
11>>4	use		zipversion
12>>4	use		ziphost
13>>6	leshort		x		\b, extract using at least
14>>6	use		zipversion
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
19
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
230	name		zipcompression
24>0	leshort		0		\bstore
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
32>0	leshort		12		\bbzip2
33#>0	leshort		13 		\bReserved by PKWARE
34>0	leshort		14		\blzma
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
41>0	leshort		94		\bMP3
42>0	leshort		95		\bxz
43>0	leshort		96		\bJpeg
44>0	leshort		97		\bWavPack
45>0	leshort		98		\bPPMd
46>0	leshort		99		\bAES Encrypted
47>0	default		x
48>>0	leshort		x		\b[%#x]
49
50# Zip known versions
510	name		zipversion
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.
54>0	ubyte/10	x		v%u
55>0	ubyte%10	x		\b.%u
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
71# >0	default		x
72# >>0	leshort		x		v?[%#x]
73
74#	display compatible host system name of ZIP archive
750	name		ziphost
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.
78#>1	ubyte		0		DOS
79>1	ubyte		1 		Amiga
80>1	ubyte		2		OpenVMS
81>1	ubyte		3		UNIX
82>1	ubyte		4		VM/CMS
83>1	ubyte		6		OS/2
84>1	ubyte		7		Macintosh
85>1	ubyte		11		MVS
86>1	ubyte		13		Acorn Risc
87>1	ubyte		16		BeOS
88>1	ubyte		17		Tandem
89# 9 untested
90>1	ubyte		5		Atari ST
91>1	ubyte		8		Z-System
92>1	ubyte		9		CP/M
93>1	ubyte		10		Windows NTFS
94>1	ubyte		12		VSE
95>1	ubyte		14		VFAT
96>1	ubyte		15		alternate MVS
97>1	ubyte		18		OS/400
98>1	ubyte		19		OS X
99# unused
100#>1	ubyte		>19		unused 0x%x
101
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
109>(16.l)	use		zipcd
110>>20	pstring/l	>0		\b, %s
111