xref: /freebsd/contrib/file/magic/Magdir/zip (revision 43a5ec4eb41567cc92586503212743d89686d78f)
158a0f0d0SEitan Adler#------------------------------------------------------------------------------
2*43a5ec4eSXin LI# $File: zip,v 1.7 2021/04/26 15:56:00 christos Exp $
358a0f0d0SEitan Adler# zip:  file(1) magic for zip files; this is not use
458a0f0d0SEitan Adler# Note the version of magic in archive is currently stronger, this is
558a0f0d0SEitan Adler# just an example until negative offsets are supported better
658a0f0d0SEitan Adler
72726a701SXin LI# Zip Central Directory record
858a0f0d0SEitan Adler0	name		zipcd
948c779cdSXin LI>0	string		PK\001\002	Zip archive data
10*43a5ec4eSXin LI!:mime	application/zip
1158a0f0d0SEitan Adler>>4	leshort		x		\b, made by
1258a0f0d0SEitan Adler>>4	use		zipversion
132726a701SXin LI>>4	use		ziphost
1458a0f0d0SEitan Adler>>6	leshort		x		\b, extract using at least
1558a0f0d0SEitan Adler>>6	use		zipversion
1658a0f0d0SEitan Adler>>12	ledate		x		\b, last modified %s
1758a0f0d0SEitan Adler>>24	lelong		>0		\b, uncompressed size %d
1858a0f0d0SEitan Adler>>10	leshort		x		\b, method=
1958a0f0d0SEitan Adler>>10	use		zipcompression
2058a0f0d0SEitan Adler
212726a701SXin LI# URL:		https://en.wikipedia.org/wiki/Zip_(file_format)
22*43a5ec4eSXin LI# reference:	https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT (Version: 6.3.9)
2358a0f0d0SEitan Adler# Zip known compressions
2458a0f0d0SEitan Adler0	name		zipcompression
2558a0f0d0SEitan Adler>0	leshort		0		\bstore
262726a701SXin LI>0	leshort		1		\bShrinking
272726a701SXin LI>0	leshort		6		\bImploding
282726a701SXin LI>0	leshort		7		\bTokenizing
2958a0f0d0SEitan Adler>0	leshort		8		\bdeflate
3058a0f0d0SEitan Adler>0	leshort		9		\bdeflate64
312726a701SXin LI>0	leshort		10		\bLibrary imploding
322726a701SXin LI#>0	leshort		11 		\bReserved by PKWARE
3358a0f0d0SEitan Adler>0	leshort		12		\bbzip2
342726a701SXin LI#>0	leshort		13 		\bReserved by PKWARE
3558a0f0d0SEitan Adler>0	leshort		14		\blzma
362726a701SXin LI#>0	leshort		15 		\bReserved by PKWARE
37*43a5ec4eSXin LI>0	leshort		16		\bCMPSC (IBM z/OS)
382726a701SXin LI#>0	leshort		17 		\bReserved by PKWARE
392726a701SXin LI>0	leshort		18		\bIBM TERSE
40*43a5ec4eSXin LI>0	leshort		19		\bIBM LZ77 (z/Architecture)
41*43a5ec4eSXin LI>0	leshort		20		\bZstd (deprecated)
42*43a5ec4eSXin LI>0	leshort		93		\bZstd
4358a0f0d0SEitan Adler>0	leshort		94		\bMP3
4458a0f0d0SEitan Adler>0	leshort		95		\bxz
4558a0f0d0SEitan Adler>0	leshort		96		\bJpeg
4658a0f0d0SEitan Adler>0	leshort		97		\bWavPack
4758a0f0d0SEitan Adler>0	leshort		98		\bPPMd
4858a0f0d0SEitan Adler>0	leshort		99		\bAES Encrypted
4958a0f0d0SEitan Adler>0	default		x
5058a0f0d0SEitan Adler>>0	leshort		x		\b[%#x]
5158a0f0d0SEitan Adler
5258a0f0d0SEitan Adler# Zip known versions
5358a0f0d0SEitan Adler0	name		zipversion
542726a701SXin LI# The lower byte indicates the ZIP version of this file. The value/10 indicates
552726a701SXin LI# the major version number, and the value mod 10 is the minor version number.
562726a701SXin LI>0	ubyte/10	x		v%u
572726a701SXin LI>0	ubyte%10	x		\b.%u
582726a701SXin LI# >0	leshort		0x09		v0.9
592726a701SXin LI# >0	leshort		0x0a		v1.0
602726a701SXin LI# >0	leshort		0x0b		v1.1
612726a701SXin LI# >0	leshort		0x14		v2.0
622726a701SXin LI# >0	leshort		0x15		v2.1
632726a701SXin LI# >0	leshort		0x19		v2.5
642726a701SXin LI# >0	leshort		0x1b		v2.7
652726a701SXin LI# >0	leshort		0x2d		v4.5
662726a701SXin LI# >0	leshort		0x2e		v4.6
672726a701SXin LI# >0	leshort		0x32		v5.0
682726a701SXin LI# >0	leshort		0x33		v5.1
692726a701SXin LI# >0	leshort		0x34		v5.2
702726a701SXin LI# >0	leshort		0x3d		v6.1
712726a701SXin LI# >0	leshort		0x3e		v6.2
722726a701SXin LI# >0	leshort		0x3f		v6.3
732726a701SXin LI# >0	default		x
742726a701SXin LI# >>0	leshort		x		v?[%#x]
752726a701SXin LI
762726a701SXin LI#	display compatible host system name of ZIP archive
772726a701SXin LI0	name		ziphost
782726a701SXin LI# The upper byte indicates the compatibility of the file attribute information.
792726a701SXin LI# If the file is compatible with MS-DOS (v 2.04g) then this value will be zero.
802726a701SXin LI#>1	ubyte		0		DOS
812726a701SXin LI>1	ubyte		1 		Amiga
822726a701SXin LI>1	ubyte		2		OpenVMS
832726a701SXin LI>1	ubyte		3		UNIX
842726a701SXin LI>1	ubyte		4		VM/CMS
852726a701SXin LI>1	ubyte		6		OS/2
862726a701SXin LI>1	ubyte		7		Macintosh
872726a701SXin LI>1	ubyte		11		MVS
882726a701SXin LI>1	ubyte		13		Acorn Risc
892726a701SXin LI>1	ubyte		16		BeOS
902726a701SXin LI>1	ubyte		17		Tandem
912726a701SXin LI# 9 untested
922726a701SXin LI>1	ubyte		5		Atari ST
932726a701SXin LI>1	ubyte		8		Z-System
942726a701SXin LI>1	ubyte		9		CP/M
952726a701SXin LI>1	ubyte		10		Windows NTFS
962726a701SXin LI>1	ubyte		12		VSE
972726a701SXin LI>1	ubyte		14		VFAT
982726a701SXin LI>1	ubyte		15		alternate MVS
992726a701SXin LI>1	ubyte		18		OS/400
1002726a701SXin LI>1	ubyte		19		OS X
1012726a701SXin LI# unused
102*43a5ec4eSXin LI#>1	ubyte		>19		unused %#x
10358a0f0d0SEitan Adler
10458a0f0d0SEitan Adler# Zip End Of Central Directory record
10548c779cdSXin LI-22	string		PK\005\006
10658a0f0d0SEitan Adler#>4	leshort		>1		\b, %d disks
10758a0f0d0SEitan Adler#>6	leshort		>1		\b, central directory disk %d
10858a0f0d0SEitan Adler#>8	leshort		>1		\b, %d central directories on this disk
10958a0f0d0SEitan Adler#>10	leshort		>1		\b, %d central directories
11058a0f0d0SEitan Adler#>12	lelong		x		\b, %d central directory bytes
11158a0f0d0SEitan Adler>(16.l)	use		zipcd
112d38c30c0SXin LI>>20	pstring/l	>0		\b, %s
113