xref: /freebsd/contrib/file/magic/Magdir/archive (revision a2dfb7224ec9933ee804cae54d51848dce938b6b)
1b6cee71dSXin LI#------------------------------------------------------------------------------
2*a2dfb722SXin LI# $File: archive,v 1.169 2022/09/12 13:13:28 christos Exp $
3b6cee71dSXin LI# archive:  file(1) magic for archive formats (see also "msdos" for self-
4b6cee71dSXin LI#           extracting compressed archives)
5b6cee71dSXin LI#
6b6cee71dSXin LI# cpio, ar, arc, arj, hpack, lha/lharc, rar, squish, uc2, zip, zoo, etc.
758a0f0d0SEitan Adler# pre-POSIX "tar" archives are also handled in the C code ../../src/is_tar.c.
8b6cee71dSXin LI
9b6cee71dSXin LI# POSIX tar archives
1058a0f0d0SEitan Adler# URL: https://en.wikipedia.org/wiki/Tar_(computing)
1158a0f0d0SEitan Adler# Reference: https://www.freebsd.org/cgi/man.cgi?query=tar&sektion=5&manpath=FreeBSD+8-current
1258a0f0d0SEitan Adler# header mainly padded with nul bytes
1358a0f0d0SEitan Adler500	quad		0
142dc4dbb9SEitan Adler!:strength /2
1558a0f0d0SEitan Adler# filename or extended attribute printable strings in range space null til umlaut ue
1658a0f0d0SEitan Adler>0	ubeshort	>0x1F00
1758a0f0d0SEitan Adler>>0	ubeshort	<0xFCFD
1858a0f0d0SEitan Adler# last 4 header bytes often null but tar\0 in gtarfail2.tar gtarfail.tar-bad
1958a0f0d0SEitan Adler# at https://sourceforge.net/projects/s-tar/files/testscripts/
2058a0f0d0SEitan Adler>>>508	ubelong&0x8B9E8DFF	0
2158a0f0d0SEitan Adler# nul, space or ascii digit 0-7 at start of mode
2258a0f0d0SEitan Adler>>>>100	ubyte&0xC8	=0
2358a0f0d0SEitan Adler>>>>>101 ubyte&0xC8	=0
2458a0f0d0SEitan Adler# nul, space at end of check sum
2558a0f0d0SEitan Adler>>>>>>155 ubyte&0xDF	=0
2658a0f0d0SEitan Adler# space or ascii digit 0 at start of check sum
2758a0f0d0SEitan Adler>>>>>>>148	ubyte&0xEF	=0x20
28*a2dfb722SXin LI# FOR DEBUGGING:
29*a2dfb722SXin LI#>>>>>>>>0	regex		\^[0-9]{2,4}[.](png|jpg|jpeg|tif|tiff|gif|bmp)	NAME "%s"
30*a2dfb722SXin LI# check for 1st image main name with digits used for sorting
31*a2dfb722SXin LI# and for name extension case insensitive like: PNG JPG JPEG TIF TIFF GIF BMP
32*a2dfb722SXin LI>>>>>>>>0	regex		\^[0-9]{2,4}[.](png|jpg|jpeg|tif|tiff|gif|bmp)
33*a2dfb722SXin LI#foo
34*a2dfb722SXin LI>>>>>>>>>0	use	tar-cbt
35*a2dfb722SXin LI# if 1st member name without digits and without used image suffix then it is a TAR archive
36*a2dfb722SXin LI>>>>>>>>0	default		x
37*a2dfb722SXin LI>>>>>>>>>0	use	tar-file
3858a0f0d0SEitan Adler#	minimal check and then display tar archive information which can also be
3958a0f0d0SEitan Adler#	embedded inside others like Android Backup, Clam AntiVirus database
4058a0f0d0SEitan Adler0	name		tar-file
4158a0f0d0SEitan Adler>257	string		!ustar
4258a0f0d0SEitan Adler# header padded with nuls
4358a0f0d0SEitan Adler>>257	ulong		=0
4458a0f0d0SEitan Adler# GNU tar version 1.29 with non pax format option without refusing
4558a0f0d0SEitan Adler# creates misleading V7 header for Long path, Multi-volume, Volume type
4658a0f0d0SEitan Adler>>>156	ubyte		0x4c		GNU tar archive
4758a0f0d0SEitan Adler!:mime	application/x-gtar
4858a0f0d0SEitan Adler!:ext	tar/gtar
4958a0f0d0SEitan Adler>>>156	ubyte		0x4d		GNU tar archive
5058a0f0d0SEitan Adler!:mime	application/x-gtar
5158a0f0d0SEitan Adler!:ext	tar/gtar
5258a0f0d0SEitan Adler>>>156	ubyte		0x56		GNU tar archive
5358a0f0d0SEitan Adler!:mime	application/x-gtar
5458a0f0d0SEitan Adler!:ext	tar/gtar
5558a0f0d0SEitan Adler>>>156	default		x		tar archive (V7)
5658a0f0d0SEitan Adler!:mime	application/x-tar
5758a0f0d0SEitan Adler!:ext	tar
5858a0f0d0SEitan Adler# other stuff in padding
5958a0f0d0SEitan Adler# some implementations add new fields to the blank area at the end of the header record
6058a0f0d0SEitan Adler# created for example by DOS TAR 3.20g 1994 Tim V.Shapore with -j option
6158a0f0d0SEitan Adler>>257	ulong		!0		tar archive (old)
6258a0f0d0SEitan Adler!:mime	application/x-tar
6358a0f0d0SEitan Adler!:ext	tar
6458a0f0d0SEitan Adler# magic in newer, GNU, posix variants
6558a0f0d0SEitan Adler>257	string		=ustar
6658a0f0d0SEitan Adler# 2 last char of magic and UStar version because string expression does not work
6758a0f0d0SEitan Adler# 2 space characters followed by a null for GNU variant
6858a0f0d0SEitan Adler>>261	ubelong		=0x72202000	POSIX tar archive (GNU)
6958a0f0d0SEitan Adler!:mime	application/x-gtar
7058a0f0d0SEitan Adler!:ext	tar/gtar
7158a0f0d0SEitan Adler# UStar version with ASCII "00"
7258a0f0d0SEitan Adler>>261	ubelong		0x72003030	POSIX
7358a0f0d0SEitan Adler# gLOBAL and ExTENSION type only found in POSIX.1-2001 format
7458a0f0d0SEitan Adler>>>156	ubyte		0x67		\b.1-2001
7558a0f0d0SEitan Adler>>>156	ubyte		0x78		\b.1-2001
7658a0f0d0SEitan Adler>>>156	ubyte		x		tar archive
7758a0f0d0SEitan Adler!:mime	application/x-ustar
7858a0f0d0SEitan Adler!:ext	tar/ustar
7958a0f0d0SEitan Adler# version with 2 binary nuls embedded in Android Backup like com.android.settings.ab
8058a0f0d0SEitan Adler>>261	ubelong		0x72000000	tar archive (ustar)
8158a0f0d0SEitan Adler!:mime	application/x-ustar
8258a0f0d0SEitan Adler!:ext	tar/ustar
8358a0f0d0SEitan Adler# not seen ustar variant with garbish version
8458a0f0d0SEitan Adler>>261	default		x		tar archive (unknown ustar)
8558a0f0d0SEitan Adler!:mime	application/x-ustar
8658a0f0d0SEitan Adler!:ext	tar/ustar
8758a0f0d0SEitan Adler# type flag of 1st tar archive member
8858a0f0d0SEitan Adler#>156	ubyte		x		\b, %c-type
8958a0f0d0SEitan Adler>156	ubyte		x
9058a0f0d0SEitan Adler>>156	ubyte		0		\b, file
9158a0f0d0SEitan Adler>>156	ubyte		0x30		\b, file
9258a0f0d0SEitan Adler>>156	ubyte		0x31		\b, hard link
9358a0f0d0SEitan Adler>>156	ubyte		0x32		\b, symlink
9458a0f0d0SEitan Adler>>156	ubyte		0x33		\b, char device
9558a0f0d0SEitan Adler>>156	ubyte		0x34		\b, block device
9658a0f0d0SEitan Adler>>156	ubyte		0x35		\b, directory
9758a0f0d0SEitan Adler>>156	ubyte		0x36		\b, fifo
9858a0f0d0SEitan Adler>>156	ubyte		0x37		\b, reserved
9958a0f0d0SEitan Adler>>156	ubyte		0x4c		\b, long path
10058a0f0d0SEitan Adler>>156	ubyte		0x4d		\b, multi volume
10158a0f0d0SEitan Adler>>156	ubyte		0x56		\b, volume
10258a0f0d0SEitan Adler>>156	ubyte		0x67		\b, global
10358a0f0d0SEitan Adler>>156	ubyte		0x78		\b, extension
10458a0f0d0SEitan Adler>>156	default		x		\b, type
10558a0f0d0SEitan Adler>>>156	ubyte		x		'%c'
10658a0f0d0SEitan Adler# name[100]
10758a0f0d0SEitan Adler>0	string		>\0		%-.60s
10858a0f0d0SEitan Adler# mode mainly stored as an octal number in ASCII null or space terminated
10958a0f0d0SEitan Adler>100	string		>\0		\b, mode %-.7s
11058a0f0d0SEitan Adler# user id mainly as octal numbers in ASCII null or space terminated
11158a0f0d0SEitan Adler>108	string		>\0		\b, uid %-.7s
11258a0f0d0SEitan Adler# group id mainly as octal numbers in ASCII null or space terminated
11358a0f0d0SEitan Adler>116	string		>\0		\b, gid %-.7s
11458a0f0d0SEitan Adler# size mainly as octal number in ASCII
11558a0f0d0SEitan Adler>124	ubyte		<0x38
11658a0f0d0SEitan Adler>>124	string		>\0		\b, size %-.12s
11758a0f0d0SEitan Adler# coding indicated by setting the high-order bit of the leftmost byte
11858a0f0d0SEitan Adler>124	ubyte		>0xEF		\b, size 0x
11958a0f0d0SEitan Adler>>124	ubyte		!0xff		\b%2.2x
12058a0f0d0SEitan Adler>>125	ubyte		!0xff		\b%2.2x
12158a0f0d0SEitan Adler>>126	ubyte		!0xff		\b%2.2x
12258a0f0d0SEitan Adler>>127	ubyte		!0xff		\b%2.2x
12358a0f0d0SEitan Adler>>128	ubyte		!0xff		\b%2.2x
12458a0f0d0SEitan Adler>>129	ubyte		!0xff		\b%2.2x
12558a0f0d0SEitan Adler>>130	ubyte		!0xff		\b%2.2x
12658a0f0d0SEitan Adler>>131	ubyte		!0xff		\b%2.2x
12758a0f0d0SEitan Adler>>132	ubyte		!0xff		\b%2.2x
12858a0f0d0SEitan Adler>>133	ubyte		!0xff		\b%2.2x
12958a0f0d0SEitan Adler>>134	ubyte		!0xff		\b%2.2x
13058a0f0d0SEitan Adler>>135	ubyte		!0xff		\b%2.2x
13158a0f0d0SEitan Adler# seconds since 0:0:0 1 jan 1970 UTC as octal number mainly in ASCII null or space terminated
13258a0f0d0SEitan Adler>136	string		>\0		\b, seconds %-.11s
13358a0f0d0SEitan Adler# header checksum stored as an octal number in ASCII null or space terminated
13458a0f0d0SEitan Adler#>148	string		x		\b, cksum %.7s
13558a0f0d0SEitan Adler# linkname[100]
13658a0f0d0SEitan Adler>157	string		>\0		\b, linkname %-.40s
13758a0f0d0SEitan Adler# additional fields for ustar
13858a0f0d0SEitan Adler>257	string		=ustar
13958a0f0d0SEitan Adler# owner user name null terminated
14058a0f0d0SEitan Adler>>265	string		>\0		\b, user %-.32s
14158a0f0d0SEitan Adler# group name null terminated
14258a0f0d0SEitan Adler>>297	string		>\0		\b, group %-.32s
14358a0f0d0SEitan Adler# device major minor if not zero
14458a0f0d0SEitan Adler>>329	ubequad&0xCFCFCFCFcFcFcFdf	!0
14558a0f0d0SEitan Adler>>>329	string		x		\b, devmaj %-.7s
14658a0f0d0SEitan Adler>>337	ubequad&0xCFCFCFCFcFcFcFdf	!0
14758a0f0d0SEitan Adler>>>337	string		x		\b, devmin %-.7s
14858a0f0d0SEitan Adler# prefix[155]
14958a0f0d0SEitan Adler>>345	string		>\0		\b, prefix %-.155s
15058a0f0d0SEitan Adler# old non ustar/POSIX tar
15158a0f0d0SEitan Adler>257	string		!ustar
15258a0f0d0SEitan Adler>>508	string		=tar\0
15358a0f0d0SEitan Adler# padding[255] in old star
15458a0f0d0SEitan Adler>>>257	string		>\0		\b, padding: %-.40s
15558a0f0d0SEitan Adler>>508	default		x
15658a0f0d0SEitan Adler# padding[255] in old tar sometimes comment field
15758a0f0d0SEitan Adler>>>257	string		>\0		\b, comment: %-.40s
158*a2dfb722SXin LI# Summary:	Comic Book Archive *.CBT with TAR format
159*a2dfb722SXin LI# URL:		https://en.wikipedia.org/wiki/Comic_book_archive
160*a2dfb722SXin LI#		http://fileformats.archiveteam.org/wiki/Comic_Book_Archive
161*a2dfb722SXin LI# Note:		there exist also RAR, ZIP, ACE and 7Z packed variants
162*a2dfb722SXin LI0	name		tar-cbt
163*a2dfb722SXin LI>0	string		x		Comic Book archive, tar archive
164*a2dfb722SXin LI#!:mime	application/x-tar
165*a2dfb722SXin LI!:mime	application/vnd.comicbook
166*a2dfb722SXin LI#!:mime	application/vnd.comicbook+tar
167*a2dfb722SXin LI!:ext	cbt
168*a2dfb722SXin LI# name[100] probably like: 19.jpg 0001.png 0002.png
169*a2dfb722SXin LI# or maybe like ComicInfo.xml
170*a2dfb722SXin LI>0	string		>\0		\b, 1st image %-.60s
171b6cee71dSXin LI
172b6cee71dSXin LI# Incremental snapshot gnu-tar format from:
17348c779cdSXin LI# https://www.gnu.org/software/tar/manual/html_node/Snapshot-Files.html
174b6cee71dSXin LI0	string		GNU\ tar-	GNU tar incremental snapshot data
175a4d6d3b8SXin LI>&0	regex		[0-9]\\.[0-9]+-[0-9]+	version %s
176b6cee71dSXin LI
177b6cee71dSXin LI# cpio archives
178b6cee71dSXin LI#
179b6cee71dSXin LI# Yes, the top two "cpio archive" formats *are* supposed to just be "short".
180b6cee71dSXin LI# The idea is to indicate archives produced on machines with the same
181b6cee71dSXin LI# byte order as the machine running "file" with "cpio archive", and
182b6cee71dSXin LI# to indicate archives produced on machines with the opposite byte order
183b6cee71dSXin LI# from the machine running "file" with "byte-swapped cpio archive".
184b6cee71dSXin LI#
185b6cee71dSXin LI# The SVR4 "cpio(4)" hints that there are additional formats, but they
186b6cee71dSXin LI# are defined as "short"s; I think all the new formats are
187b6cee71dSXin LI# character-header formats and thus are strings, not numbers.
188b6cee71dSXin LI0	short		070707		cpio archive
189b6cee71dSXin LI!:mime	application/x-cpio
190b6cee71dSXin LI0	short		0143561		byte-swapped cpio archive
191b6cee71dSXin LI!:mime	application/x-cpio # encoding: swapped
192b6cee71dSXin LI0	string		070707		ASCII cpio archive (pre-SVR4 or odc)
19343a5ec4eSXin LI!:mime	application/x-cpio
194b6cee71dSXin LI0	string		070701		ASCII cpio archive (SVR4 with no CRC)
19543a5ec4eSXin LI!:mime	application/x-cpio
196b6cee71dSXin LI0	string		070702		ASCII cpio archive (SVR4 with CRC)
19743a5ec4eSXin LI!:mime	application/x-cpio
198b6cee71dSXin LI
199b6cee71dSXin LI#
200b6cee71dSXin LI# Various archive formats used by various versions of the "ar"
201b6cee71dSXin LI# command.
202b6cee71dSXin LI#
203b6cee71dSXin LI
204b6cee71dSXin LI#
205b6cee71dSXin LI# Original UNIX archive formats.
206b6cee71dSXin LI# They were written with binary values in host byte order, and
207b6cee71dSXin LI# the magic number was a host "int", which might have been 16 bits
208b6cee71dSXin LI# or 32 bits.  We don't say "PDP-11" or "VAX", as there might have
209b6cee71dSXin LI# been ports to little-endian 16-bit-int or 32-bit-int platforms
210b6cee71dSXin LI# (x86?) using some of those formats; if none existed, feel free
211b6cee71dSXin LI# to use "PDP-11" for little-endian 16-bit and "VAX" for little-endian
212b6cee71dSXin LI# 32-bit.  There might have been big-endian ports of that sort as
213b6cee71dSXin LI# well.
214b6cee71dSXin LI#
215b6cee71dSXin LI0	leshort		0177555		very old 16-bit-int little-endian archive
216b6cee71dSXin LI0	beshort		0177555		very old 16-bit-int big-endian archive
217b6cee71dSXin LI0	lelong		0177555		very old 32-bit-int little-endian archive
218b6cee71dSXin LI0	belong		0177555		very old 32-bit-int big-endian archive
219b6cee71dSXin LI
220b6cee71dSXin LI0	leshort		0177545		old 16-bit-int little-endian archive
221b6cee71dSXin LI>2	string		__.SYMDEF	random library
222b6cee71dSXin LI0	beshort		0177545		old 16-bit-int big-endian archive
223b6cee71dSXin LI>2	string		__.SYMDEF	random library
224b6cee71dSXin LI0	lelong		0177545		old 32-bit-int little-endian archive
225b6cee71dSXin LI>4	string		__.SYMDEF	random library
226b6cee71dSXin LI0	belong		0177545		old 32-bit-int big-endian archive
227b6cee71dSXin LI>4	string		__.SYMDEF	random library
228b6cee71dSXin LI
229b6cee71dSXin LI#
230b6cee71dSXin LI# From "pdp" (but why a 4-byte quantity?)
231b6cee71dSXin LI#
232b6cee71dSXin LI0	lelong		0x39bed		PDP-11 old archive
233b6cee71dSXin LI0	lelong		0x39bee		PDP-11 4.0 archive
234b6cee71dSXin LI
235b6cee71dSXin LI#
236b6cee71dSXin LI# XXX - what flavor of APL used this, and was it a variant of
237b6cee71dSXin LI# some ar archive format?  It's similar to, but not the same
238b6cee71dSXin LI# as, the APL workspace magic numbers in pdp.
239b6cee71dSXin LI#
240b6cee71dSXin LI0	long		0100554		apl workspace
241b6cee71dSXin LI
242b6cee71dSXin LI#
243b6cee71dSXin LI# System V Release 1 portable(?) archive format.
244b6cee71dSXin LI#
245b6cee71dSXin LI0	string		=<ar>		System V Release 1 ar archive
246b6cee71dSXin LI!:mime	application/x-archive
247b6cee71dSXin LI
248b6cee71dSXin LI#
249b6cee71dSXin LI# Debian package; it's in the portable archive format, and needs to go
250b6cee71dSXin LI# before the entry for regular portable archives, as it's recognized as
251b6cee71dSXin LI# a portable archive whose first member has a name beginning with
252b6cee71dSXin LI# "debian".
253b6cee71dSXin LI#
25448c779cdSXin LI# Update: Joerg Jenderek
25548c779cdSXin LI# URL: https://en.wikipedia.org/wiki/Deb_(file_format)
256b6cee71dSXin LI0	string		=!<arch>\ndebian
25748c779cdSXin LI# https://manpages.debian.org/testing/dpkg/dpkg-split.1.en.html
25848c779cdSXin LI>14	string		-split	part of multipart Debian package
259b6cee71dSXin LI!:mime	application/vnd.debian.binary-package
26048c779cdSXin LI# udeb is used for stripped down deb file
26148c779cdSXin LI!:ext	deb/udeb
26248c779cdSXin LI>14	string		-binary	Debian binary package
263b6cee71dSXin LI!:mime	application/vnd.debian.binary-package
2642726a701SXin LI# For ipk packager see also https://en.wikipedia.org/wiki/Opkg
2652726a701SXin LI!:ext	deb/udeb/ipk
26648c779cdSXin LI# This should not happen
26748c779cdSXin LI>14	default		x	Unknown Debian package
26843a5ec4eSXin LI# NL terminated version; for most Debian cases this is 2.0 or 2.1 for split
269b6cee71dSXin LI>68	string		>\0		(format %s)
27048c779cdSXin LI#>68	string		!2.0\n
27148c779cdSXin LI#>>68	string		x		(format %.3s)
27248c779cdSXin LI>68	string		=2.0\n
27348c779cdSXin LI# 2nd archive name=control archive name like control.tar.gz or control.tar.xz
27448c779cdSXin LI>>72	string		>\0		\b, with %.14s
27548c779cdSXin LI# look for 3rd archive name=data archive name like data.tar.{gz,xz,bz2,lzma}
27648c779cdSXin LI>>0	search/0x93e4f	data.tar.	\b, data compression
27748c779cdSXin LI# the above line only works if FILE_BYTES_MAX in ../../src/file.h is raised
27848c779cdSXin LI# for example like libreoffice-dev-doc_1%3a5.2.7-1+rpi1+deb9u3_all.deb
2792726a701SXin LI>>>&0	string		x		%.2s
2802726a701SXin LI# skip space (0x20 BSD) and slash (0x2f System V) character marking end of name
2812726a701SXin LI>>>&2	ubyte		!0x20
2822726a701SXin LI>>>>&-1	ubyte		!0x2f
2832726a701SXin LI# display 3rd character of file name extension like 2 of bz2 or m of lzma
2842726a701SXin LI>>>>>&-1	ubyte	x		\b%c
2852726a701SXin LI>>>>>>&0	ubyte	!0x20
2862726a701SXin LI>>>>>>>&-1	ubyte	!0x2f
2872726a701SXin LI# display 4th character of file name extension like a of lzma
2882726a701SXin LI>>>>>>>>&-1	ubyte	x		\b%c
28943a5ec4eSXin LI# split debian package case
29048c779cdSXin LI>68	string		=2.1\n
29148c779cdSXin LI# dpkg-1.18.25/dpkg-split/info.c
29248c779cdSXin LI# NL terminated ASCII package name like ckermit
29348c779cdSXin LI>>&0	string		x		\b, %s
29448c779cdSXin LI# NL terminated package version like 302-5.3
29548c779cdSXin LI>>>&1	string		x		%s
29648c779cdSXin LI# NL terminated MD5 checksum
29748c779cdSXin LI>>>>&1	string		x		\b, MD5 %s
29848c779cdSXin LI# NL terminated original package length
29948c779cdSXin LI>>>>>&1	string		x		\b, unsplitted size %s
30048c779cdSXin LI# NL terminated part length
301d38c30c0SXin LI>>>>>>&1	string	x		\b, part length %s
30248c779cdSXin LI# NL terminated package part like n/m
30348c779cdSXin LI>>>>>>>&1	string	x		\b, part %s
30448c779cdSXin LI# NL terminated package architecture like armhf since dpkg 1.16.1 or later
30548c779cdSXin LI>>>>>>>>&1	string	x		\b, %s
306b6cee71dSXin LI
307b6cee71dSXin LI#
308b6cee71dSXin LI# MIPS archive; they're in the portable archive format, and need to go
309b6cee71dSXin LI# before the entry for regular portable archives, as it's recognized as
310b6cee71dSXin LI# a portable archive whose first member has a name beginning with
311b6cee71dSXin LI# "__________E".
312b6cee71dSXin LI#
313b6cee71dSXin LI0	string	=!<arch>\n__________E	MIPS archive
314b6cee71dSXin LI!:mime	application/x-archive
315b6cee71dSXin LI>20	string	U			with MIPS Ucode members
316b6cee71dSXin LI>21	string	L			with MIPSEL members
317b6cee71dSXin LI>21	string	B			with MIPSEB members
318b6cee71dSXin LI>19	string	L			and an EL hash table
319b6cee71dSXin LI>19	string	B			and an EB hash table
320b6cee71dSXin LI>22	string	X			-- out of date
321b6cee71dSXin LI
322b6cee71dSXin LI#
323b6cee71dSXin LI# BSD/SVR2-and-later portable archive formats.
324b6cee71dSXin LI#
32548c779cdSXin LI# Update: Joerg Jenderek
32648c779cdSXin LI# URL:		http://fileformats.archiveteam.org/wiki/AR
32748c779cdSXin LI# Reference:	https://www.unix.com/man-page/opensolaris/3HEAD/ar.h/
32848c779cdSXin LI# Note:		Mach-O universal binary in ./cafebabe is dependent
32948c779cdSXin LI# TODO:		unify current ar archive, MIPS archive, Debian package
33048c779cdSXin LI#		distinguish BSD, SVR; 32, 64 bit; HP from other 32-bit SVR;
33148c779cdSXin LI#		*.ar packages from *.a libraries. handle empty archive
3322dc4dbb9SEitan Adler0	string		=!<arch>\n		current ar archive
33348c779cdSXin LI# print first and possibly second ar_name[16] for debugging purpose
33448c779cdSXin LI#>8			string	x	\b, 1st "%.16s"
33548c779cdSXin LI#>68			string	x	\b, 2nd "%.16s"
336b6cee71dSXin LI!:mime	application/x-archive
33748c779cdSXin LI# a in most case for libraries; lib for Microsoft libraries; ar else cases
33848c779cdSXin LI!:ext	a/lib/ar
339b6cee71dSXin LI>8	string		__.SYMDEF	random library
34048c779cdSXin LI# first member with long marked name __.SYMDEF SORTED implies BSD library
341b6cee71dSXin LI>68	string		__.SYMDEF\ SORTED	random library
34248c779cdSXin LI# Reference: https://parisc.wiki.kernel.org/images-parisc/b/b2/Rad_11_0_32.pdf
34348c779cdSXin LI# "archive file" entry moved from ./hp
34448c779cdSXin LI# LST header system_id 0210h~PA-RISC 1.1,... identifies the target architecture
34548c779cdSXin LI# LST header a_magic 0619h~relocatable library
34648c779cdSXin LI>68	belong 		0x020b0619	- PA-RISC1.0 relocatable library
34748c779cdSXin LI>68	belong	 	0x02100619	- PA-RISC1.1 relocatable library
34848c779cdSXin LI>68	belong 		0x02110619	- PA-RISC1.2 relocatable library
34948c779cdSXin LI>68	belong 		0x02140619	- PA-RISC2.0 relocatable library
35048c779cdSXin LI#EOF for common ar archives
351b6cee71dSXin LI
352b6cee71dSXin LI#
353b6cee71dSXin LI# "Thin" archive, as can be produced by GNU ar.
354b6cee71dSXin LI#
355b6cee71dSXin LI0	string		=!<thin>\n	thin archive with
356b6cee71dSXin LI>68	belong		0		no symbol entries
357b6cee71dSXin LI>68	belong		1		%d symbol entry
358b6cee71dSXin LI>68	belong		>1		%d symbol entries
359b6cee71dSXin LI
36048c779cdSXin LI0	search/1	-h-		Software Tools format archive text
36148c779cdSXin LI
362b6cee71dSXin LI# ARC archiver, from Daniel Quinlan (quinlan@yggdrasil.com)
363b6cee71dSXin LI#
364b6cee71dSXin LI# The first byte is the magic (0x1a), byte 2 is the compression type for
365b6cee71dSXin LI# the first file (0x01 through 0x09), and bytes 3 to 15 are the MS-DOS
366b6cee71dSXin LI# filename of the first file (null terminated).  Since some types collide
367b6cee71dSXin LI# we only test some types on basis of frequency: 0x08 (83%), 0x09 (5%),
368b6cee71dSXin LI# 0x02 (5%), 0x03 (3%), 0x04 (2%), 0x06 (2%).  0x01 collides with terminfo.
369b6cee71dSXin LI0	lelong&0x8080ffff	0x0000081a	ARC archive data, dynamic LZW
370b6cee71dSXin LI!:mime	application/x-arc
371b6cee71dSXin LI0	lelong&0x8080ffff	0x0000091a	ARC archive data, squashed
372b6cee71dSXin LI!:mime	application/x-arc
373b6cee71dSXin LI0	lelong&0x8080ffff	0x0000021a	ARC archive data, uncompressed
374b6cee71dSXin LI!:mime	application/x-arc
375b6cee71dSXin LI0	lelong&0x8080ffff	0x0000031a	ARC archive data, packed
376b6cee71dSXin LI!:mime	application/x-arc
377b6cee71dSXin LI0	lelong&0x8080ffff	0x0000041a	ARC archive data, squeezed
378b6cee71dSXin LI!:mime	application/x-arc
379b6cee71dSXin LI0	lelong&0x8080ffff	0x0000061a	ARC archive data, crunched
380b6cee71dSXin LI!:mime	application/x-arc
381b6cee71dSXin LI# [JW] stuff taken from idarc, obviously ARC successors:
382b6cee71dSXin LI0	lelong&0x8080ffff	0x00000a1a	PAK archive data
383b6cee71dSXin LI!:mime	application/x-arc
384b6cee71dSXin LI0	lelong&0x8080ffff	0x0000141a	ARC+ archive data
385b6cee71dSXin LI!:mime	application/x-arc
386b6cee71dSXin LI0	lelong&0x8080ffff	0x0000481a	HYP archive data
387b6cee71dSXin LI!:mime	application/x-arc
388b6cee71dSXin LI
389b6cee71dSXin LI# Acorn archive formats (Disaster prone simpleton, m91dps@ecs.ox.ac.uk)
390b6cee71dSXin LI# I can't create either SPARK or ArcFS archives so I have not tested this stuff
391b6cee71dSXin LI# [GRR:  the original entries collide with ARC, above; replaced with combined
392b6cee71dSXin LI#  version (not tested)]
393b6cee71dSXin LI#0	byte		0x1a		RISC OS archive (spark format)
394b6cee71dSXin LI0	string		\032archive	RISC OS archive (ArcFS format)
395b6cee71dSXin LI0       string          Archive\000     RISC OS archive (ArcFS format)
396b6cee71dSXin LI
397b6cee71dSXin LI# All these were taken from idarc, many could not be verified. Unfortunately,
398b6cee71dSXin LI# there were many low-quality sigs, i.e. easy to trigger false positives.
399b6cee71dSXin LI# Please notify me of any real-world fishy/ambiguous signatures and I'll try
400b6cee71dSXin LI# to get my hands on the actual archiver and see if I find something better. [JW]
401b6cee71dSXin LI# probably many can be enhanced by finding some 0-byte or control char near the start
402b6cee71dSXin LI
403b6cee71dSXin LI# idarc calls this Crush/Uncompressed... *shrug*
404b6cee71dSXin LI0	string	CRUSH Crush archive data
405b6cee71dSXin LI# Squeeze It (.sqz)
406b6cee71dSXin LI0	string	HLSQZ Squeeze It archive data
407b6cee71dSXin LI# SQWEZ
408b6cee71dSXin LI0	string	SQWEZ SQWEZ archive data
409b6cee71dSXin LI# HPack (.hpk)
410b6cee71dSXin LI0	string	HPAK HPack archive data
411b6cee71dSXin LI# HAP
412b6cee71dSXin LI0	string	\x91\x33HF HAP archive data
413b6cee71dSXin LI# MD/MDCD
414b6cee71dSXin LI0	string	MDmd MDCD archive data
415b6cee71dSXin LI# LIM
416b6cee71dSXin LI0	string	LIM\x1a LIM archive data
417b6cee71dSXin LI# SAR
418b6cee71dSXin LI3	string	LH5 SAR archive data
419b6cee71dSXin LI# BSArc/BS2
420b6cee71dSXin LI0	string	\212\3SB\020\0	BSArc/BS2 archive data
421b6cee71dSXin LI# Bethesda Softworks Archive (Oblivion)
422b6cee71dSXin LI0	string	BSA\0 		BSArc archive data
423b6cee71dSXin LI>4	lelong	x		version %d
424b6cee71dSXin LI# MAR
425b6cee71dSXin LI2	string	=-ah MAR archive data
426b6cee71dSXin LI# ACB
427b6cee71dSXin LI#0	belong&0x00f800ff	0x00800000 ACB archive data
428b6cee71dSXin LI# CPZ
429b6cee71dSXin LI# TODO, this is what idarc says: 0	string	\0\0\0 CPZ archive data
430b6cee71dSXin LI# JRC
431b6cee71dSXin LI0	string	JRchive JRC archive data
432b6cee71dSXin LI# Quantum
433b6cee71dSXin LI0	string	DS\0 Quantum archive data
434b6cee71dSXin LI# ReSOF
435b6cee71dSXin LI0	string	PK\3\6 ReSOF archive data
436b6cee71dSXin LI# QuArk
437b6cee71dSXin LI0	string	7\4 QuArk archive data
438b6cee71dSXin LI# YAC
439b6cee71dSXin LI14	string	YC YAC archive data
440b6cee71dSXin LI# X1
441b6cee71dSXin LI0	string	X1 X1 archive data
442b6cee71dSXin LI0	string	XhDr X1 archive data
443b6cee71dSXin LI# CDC Codec (.dqt)
444b6cee71dSXin LI0	belong&0xffffe000	0x76ff2000 CDC Codec archive data
445b6cee71dSXin LI# AMGC
446b6cee71dSXin LI0	string	\xad6" AMGC archive data
447b6cee71dSXin LI# NuLIB
448b6cee71dSXin LI0	string	N\xc3\xb5F\xc3\xa9lx\xc3\xa5 NuLIB archive data
449b6cee71dSXin LI# PakLeo
450b6cee71dSXin LI0	string	LEOLZW PAKLeo archive data
451b6cee71dSXin LI# ChArc
452b6cee71dSXin LI0	string	SChF ChArc archive data
453b6cee71dSXin LI# PSA
454b6cee71dSXin LI0	string	PSA PSA archive data
455b6cee71dSXin LI# CrossePAC
456b6cee71dSXin LI0	string	DSIGDCC CrossePAC archive data
457b6cee71dSXin LI# Freeze
458b6cee71dSXin LI0	string	\x1f\x9f\x4a\x10\x0a Freeze archive data
459b6cee71dSXin LI# KBoom
460b6cee71dSXin LI0	string	\xc2\xa8MP\xc2\xa8 KBoom archive data
461b6cee71dSXin LI# NSQ, must go after CDC Codec
462b6cee71dSXin LI0	string	\x76\xff NSQ archive data
463b6cee71dSXin LI# DPA
464b6cee71dSXin LI0	string	Dirk\ Paehl DPA archive data
465b6cee71dSXin LI# BA
466b6cee71dSXin LI# TODO: idarc says "bytes 0-2 == bytes 3-5"
467b6cee71dSXin LI# TTComp
4683e41d09dSXin LI# URL: http://fileformats.archiveteam.org/wiki/TTComp_archive
4693e41d09dSXin LI# Update: Joerg Jenderek
4703e41d09dSXin LI# GRR: line below is too general as it matches also Panorama database "TCDB 2003-10 demo.pan", others
4713e41d09dSXin LI0	string	\0\6
4723e41d09dSXin LI# look for first keyword of Panorama database *.pan
4733e41d09dSXin LI>12	search/261	DESIGN
4743e41d09dSXin LI# skip keyword with low entropy
47543a5ec4eSXin LI>12	default		x
47643a5ec4eSXin LI# skip DOS 2.0 backup id file, sequence 6 with many nils like BACKUPID_xx6.@@@ handled by ./msdos
47743a5ec4eSXin LI>>8	quad		!0
47843a5ec4eSXin LI>>>0	use	ttcomp
47943a5ec4eSXin LI# variant ASCII, 4K dictionary (strength=48=50-2). With strength=49 wrong order! WHY?
48043a5ec4eSXin LI0	string	\1\6
48143a5ec4eSXin LI# TODO:
48243a5ec4eSXin LI# skip VAX-order 68k Blit mpx/mux executable (strength=50) handled by ./blit
48343a5ec4eSXin LI!:strength	-2
48443a5ec4eSXin LI>0	use	ttcomp
48543a5ec4eSXin LI0	string	\0\5
48643a5ec4eSXin LI# skip some DOS 2.0 backup id file, sequence 5 with many nils like BACKUPID_075.@@@ handled by ./msdos
48743a5ec4eSXin LI>8	quad	!0
48843a5ec4eSXin LI>>0	use	ttcomp
48943a5ec4eSXin LI0	string	\1\5
49043a5ec4eSXin LI# TODO:
49143a5ec4eSXin LI# variant ASCII, 2K dictionary (strength=48=50-2). With strength=49 wrong order! WHY?
49243a5ec4eSXin LI# skip ctab data (strength=50) handled by ./ibm6000
49343a5ec4eSXin LI# skip locale data table (strength=50) handled by ./digital
49443a5ec4eSXin LI!:strength	-2
49543a5ec4eSXin LI>0	use	ttcomp
49643a5ec4eSXin LI0	string	\0\4
49743a5ec4eSXin LI# skip many Maple help database *.hdb with version tag handled by ./maple
49843a5ec4eSXin LI>1028	string	!version
49943a5ec4eSXin LI# skip veclib maple.hdb by looking for Mable keyword
50043a5ec4eSXin LI>>4	search/1091	Maple\040
50143a5ec4eSXin LI#>4	search/34090	Maple\040
50243a5ec4eSXin LI>>4	default		x
50343a5ec4eSXin LI# skip DOS 2.0-3.2 backed up sequence 4 with many nils like LOTUS5.RAR handled by ./msdos
50443a5ec4eSXin LI# skip xBASE Compound Index file *.CDX with many nils
50543a5ec4eSXin LI>>>0x54	quad		!0
50643a5ec4eSXin LI>>>>0	use	ttcomp
50743a5ec4eSXin LI0	string	\1\4
50843a5ec4eSXin LI# TODO:
50943a5ec4eSXin LI# skip Commodore PET BASIC 4.0 program *.prg
51043a5ec4eSXin LI# variant ASCII, 1K dictionary (strength=48=50-2). With strength=49 wrong order! WHY?
51143a5ec4eSXin LI# skip shared library (strength=50) handled by ./ibm6000
51243a5ec4eSXin LI!:strength	-2
51343a5ec4eSXin LI>0	use	ttcomp
51443a5ec4eSXin LI#	display information of TTComp archive
51543a5ec4eSXin LI0	name	ttcomp
51643a5ec4eSXin LI# (version 5.25) labeled the entry as "TTComp archive data"
51743a5ec4eSXin LI>0	ubyte	x	TTComp archive data
51843a5ec4eSXin LI!:mime	application/x-compress-ttcomp
51943a5ec4eSXin LI# PBACKSCR.PI1
52043a5ec4eSXin LI!:ext	$xe/$ts/pi1/__d
52143a5ec4eSXin LI# compression type: 0~binary compression 1~ASCII compression
52243a5ec4eSXin LI>0	ubyte	0	\b, binary
52343a5ec4eSXin LI>0	ubyte	1	\b, ASCII
52443a5ec4eSXin LI# size of the dictionary:  4~1024 bytes 5~2048 bytes 6~4096 bytes
52543a5ec4eSXin LI>1	ubyte	4	\b, 1K
52643a5ec4eSXin LI>1	ubyte	5	\b, 2K
52743a5ec4eSXin LI>1	ubyte	6	\b, 4K
52843a5ec4eSXin LI>1	ubyte	x	dictionary
52943a5ec4eSXin LI#	https://mark0.net/forum/index.php?topic=848
53043a5ec4eSXin LI# last 3 bytes probably have only 8 possible bit sequences
53143a5ec4eSXin LI# xxxxxxxx 0000000x 11111111	____FFh
53243a5ec4eSXin LI# xxxxxxxx 10000000 01111111	__807Fh
53343a5ec4eSXin LI# 0xxxxxxx 11000000 00111111	__C03Fh
53443a5ec4eSXin LI# 00xxxxxx 11100000 00011111	__E01Fh
53543a5ec4eSXin LI# 000xxxxx 11110000 00001111	__F00Fh
53643a5ec4eSXin LI# 0000xxxx 11111000 00000111	__F807h
53743a5ec4eSXin LI# 00000xxx 11111100 00000011	__FC03h
53843a5ec4eSXin LI# 000000xx 11111110 00000001	__FE01h
53943a5ec4eSXin LI# but for quickgif.__d 0A7DD4h
54043a5ec4eSXin LI#>-3	ubyte		x	\b, last 3 bytes 0x%2.2x
54143a5ec4eSXin LI#>-2	ubeshort	x	\b%4.4x
542d38c30c0SXin LI# From:		Joerg Jenderek
543a4d6d3b8SXin LI# URL:		https://en.wikipedia.org/wiki/Disk_Copy
544d38c30c0SXin LI# reference:	http://nulib.com/library/FTN.e00005.htm
545d38c30c0SXin LI0x52	ubeshort	0x0100
54643a5ec4eSXin LI# test for disk image size equal or above 400k
54743a5ec4eSXin LI>0x40	ubelong		>409599
54843a5ec4eSXin LI# test also for disk image size equal or below 1440k to skip
54943a5ec4eSXin LI# windows7en.mbr UNICODE.DAT
550a4d6d3b8SXin LI#>>0x40	ubelong		<1474561
551a4d6d3b8SXin LI# test now for "low" disk image size equal or below 64 MiB to skip
552a4d6d3b8SXin LI# windows7en.mbr (B441BBAAh) UNICODE.DAT (0400AF05h)
553a4d6d3b8SXin LI>>0x40	ubelong		<0x04000001
554a4d6d3b8SXin LI# To skip Flags$StringJoiner.class with size 00106A61h test also for valid disk image sizes
555a4d6d3b8SXin LI# 00064000 for  400k GCR disks	dc42-400k-gcr.trid.xml
556a4d6d3b8SXin LI# 000c8000 for  800k GCR disks	dc42-800k-gcr.trid.xml
557a4d6d3b8SXin LI# 000b4000 for  720k MFM disks	dc42-720k-mfm.trid.xml
558a4d6d3b8SXin LI# 00168000 for 1440k MFM disks	dc42-1440k-mfm.trid.xml
559a4d6d3b8SXin LI#	https://lisaem.sunder.net/LisaProjectDocs.txt
560a4d6d3b8SXin LI# 00500000	05M	available
561a4d6d3b8SXin LI# 00A00000	10M	available
562a4d6d3b8SXin LI# 01800000	24M	possible
563a4d6d3b8SXin LI# 02000000	32M	uncertain
564a4d6d3b8SXin LI# 04000000	64M	uncertain
565a4d6d3b8SXin LI>>>0x40	ubelong&0xf8003fFF	0
566a4d6d3b8SXin LI# skip samples with invalid disk name length like:
567a4d6d3b8SXin LI# 181 (biosmd80.rom) 202 (Flags$StringJoiner.class) 90 (UNICODE.DAT)
568a4d6d3b8SXin LI>>>>0x0	ubyte			<64
569a4d6d3b8SXin LI>>>>>0	use			dc42-floppy
57043a5ec4eSXin LI#	display information of Apple DiskCopy 4.2 floppy image
57143a5ec4eSXin LI0	name		dc42-floppy
572a4d6d3b8SXin LI# disk name length; maximal 63
573a4d6d3b8SXin LI#>0	ubyte	    	x	DISK NAME LENGTH %u
574a4d6d3b8SXin LI# ASCII image pascal (maximal 63 bytes) name padded with NULs like:
575a4d6d3b8SXin LI# "Microsoft Mail" "Disquette 2" "IIe Installer Disk"
576a4d6d3b8SXin LI# "-lisaem.sunder.net hd-" (dc42-lisaem.trid.xml) "-not a Macintosh disk" (dc42-nonmac.trid.xml)
57743a5ec4eSXin LI>00	pstring/B	x	Apple DiskCopy 4.2 image %s
578d38c30c0SXin LI#!:mime	application/octet-stream
57943a5ec4eSXin LI!:mime	application/x-dc42-floppy-image
580d38c30c0SXin LI!:apple	dCpydImg
581a4d6d3b8SXin LI# probably also img like: "Utilitaires 2.img" "Installation 7.img"
582a4d6d3b8SXin LI!:ext	image/dc42/img
583a4d6d3b8SXin LI# data size in bytes like: 409600 737280 819200 1474560
58443a5ec4eSXin LI>0x40	ubelong		x	\b, %u bytes
58543a5ec4eSXin LI# for debugging purpose size in hexadecimal
58643a5ec4eSXin LI#>0x40	ubelong		x	(%#8.8x)
587a4d6d3b8SXin LI# tag size in bytes like: 0 (often) 2580h (PUID fmt/625) 4B00h (Microsoft Mail.image)
58843a5ec4eSXin LI>0x44	ubelong		>0	\b, %#x tag size
589d38c30c0SXin LI# data checksum
59043a5ec4eSXin LI#>0x48	ubelong		x	\b, %#x checksum
591d38c30c0SXin LI# tag checksum
59243a5ec4eSXin LI#>0x4c	ubelong		x	\b, %#x tag checksum
593a4d6d3b8SXin LI# disk encoding like: 0 1 2 3 (PUID: fmt/625)
59443a5ec4eSXin LI>0x50	ubyte		0	\b, GCR CLV ssdd (400k)
59543a5ec4eSXin LI>0x50	ubyte		1	\b, GCR CLV dsdd (800k)
59643a5ec4eSXin LI>0x50	ubyte		2	\b, MFM CAV dsdd (720k)
59743a5ec4eSXin LI>0x50	ubyte		3	\b, MFM CAV dshd (1440k)
59843a5ec4eSXin LI>0x50	ubyte		>3	\b, %#x encoding
599a4d6d3b8SXin LI# format byte like: 12h (Lisa 400K) 24h (400K Macintosh) 96h (800K Apple II disk)
600a4d6d3b8SXin LI# 2 (Mac 400k "Disquette Installation 13.image")
601a4d6d3b8SXin LI# 22h (double-sided MFM or Mac 800k "Disco 12.image" "IIe Installer Disk.image")
60243a5ec4eSXin LI>0x51	ubyte		x	\b, %#x format
60343a5ec4eSXin LI#>0x54	ubequad		x	\b, data %#16.16llx
604b6cee71dSXin LI# ESP, could this conflict with Easy Software Products' (e.g.ESP ghostscript) documentation?
605b6cee71dSXin LI0	string	ESP ESP archive data
606b6cee71dSXin LI# ZPack
607b6cee71dSXin LI0	string	\1ZPK\1 ZPack archive data
608b6cee71dSXin LI# Sky
609b6cee71dSXin LI0	string	\xbc\x40 Sky archive data
610b6cee71dSXin LI# UFA
611b6cee71dSXin LI0	string	UFA UFA archive data
612b6cee71dSXin LI# Dry
613b6cee71dSXin LI0	string	=-H2O DRY archive data
614b6cee71dSXin LI# FoxSQZ
615b6cee71dSXin LI0	string	FOXSQZ FoxSQZ archive data
616b6cee71dSXin LI# AR7
617b6cee71dSXin LI0	string	,AR7 AR7 archive data
618b6cee71dSXin LI# PPMZ
619b6cee71dSXin LI0	string	PPMZ PPMZ archive data
620b6cee71dSXin LI# MS Compress
62158a0f0d0SEitan Adler# Update: Joerg Jenderek
62258a0f0d0SEitan Adler# URL: http://fileformats.archiveteam.org/wiki/MS-DOS_installation_compression
62358a0f0d0SEitan Adler# Reference: https://hwiegman.home.xs4all.nl/fileformats/compress/szdd_kwaj_format.html
62458a0f0d0SEitan Adler# Note: use correct version of extracting tool like EXPAND, UNPACK, DECOMP or 7Z
62558a0f0d0SEitan Adler4	string	\x88\xf0\x27
62658a0f0d0SEitan Adler#		KWAJ variant
62758a0f0d0SEitan Adler>0	string	KWAJ		MS Compress archive data, KWAJ variant
62858a0f0d0SEitan Adler!:mime	application/x-ms-compress-kwaj
62958a0f0d0SEitan Adler# extension not working in version 5.32
63058a0f0d0SEitan Adler# magic/Magdir/archive, 284: Warning: EXTENSION type ` ??_' has bad char '?'
63158a0f0d0SEitan Adler# file: line 284: Bad magic entry '   ??_'
63258a0f0d0SEitan Adler!:ext	??_
63358a0f0d0SEitan Adler# compression method (0-4)
63458a0f0d0SEitan Adler>>8	uleshort	x	\b, %u method
63558a0f0d0SEitan Adler# offset of compressed data
63643a5ec4eSXin LI>>10	uleshort	x	\b, %#x offset
63758a0f0d0SEitan Adler#>>(10.s)	uleshort	x
63858a0f0d0SEitan Adler#>>>&-6		string	x	\b, TEST extension %-.3s
63958a0f0d0SEitan Adler# header flags to mark header extensions
64043a5ec4eSXin LI>>12	uleshort	>0	\b, %#x flags
64158a0f0d0SEitan Adler# 4 bytes: decompressed length of file
64258a0f0d0SEitan Adler>>12	uleshort	&0x01
64358a0f0d0SEitan Adler>>>14	ulelong		x	\b, original size: %u bytes
64458a0f0d0SEitan Adler# 2 bytes: unknown purpose
64558a0f0d0SEitan Adler# 2 bytes: length of unknown data + mentioned bytes
64658a0f0d0SEitan Adler# 1-9 bytes: null-terminated file name
64758a0f0d0SEitan Adler# 1-4 bytes: null-terminated file extension
64858a0f0d0SEitan Adler>>12	uleshort	&0x08
64958a0f0d0SEitan Adler>>>12	uleshort				^0x01
65058a0f0d0SEitan Adler>>>>12		uleshort			^0x02
65158a0f0d0SEitan Adler>>>>>12			uleshort		^0x04
65258a0f0d0SEitan Adler>>>>>>12			uleshort	^0x10
65358a0f0d0SEitan Adler>>>>>>>14				string	x	\b, %-.8s
65458a0f0d0SEitan Adler>>>>>>12			uleshort	&0x10
65558a0f0d0SEitan Adler>>>>>>>14				string	x	\b, %-.8s
65658a0f0d0SEitan Adler>>>>>>>>&1				string	x	\b.%-.3s
65758a0f0d0SEitan Adler>>>>>12			uleshort		&0x04
65858a0f0d0SEitan Adler>>>>>>12			uleshort	^0x10
65958a0f0d0SEitan Adler>>>>>>>(14.s)			uleshort	x
66058a0f0d0SEitan Adler>>>>>>>>&14				string	x	\b, %-.8s
66158a0f0d0SEitan Adler>>>>>>12			uleshort	&0x10
66258a0f0d0SEitan Adler>>>>>>>(14.s)			uleshort	x
66358a0f0d0SEitan Adler>>>>>>>>&14				string	x	\b, %-.8s
66458a0f0d0SEitan Adler>>>>>>>>>&1				string	x	\b.%-.3s
66558a0f0d0SEitan Adler>>>>12		uleshort			&0x02
66658a0f0d0SEitan Adler>>>>>12			uleshort		^0x04
66758a0f0d0SEitan Adler>>>>>>12			uleshort	^0x10
66858a0f0d0SEitan Adler>>>>>>>16				string	x	\b, %-.8s
66958a0f0d0SEitan Adler>>>>>>12			uleshort	&0x10
67058a0f0d0SEitan Adler>>>>>>>16				string	x	\b, %-.8s
67158a0f0d0SEitan Adler>>>>>>>>&1				string	x	\b.%-.3s
67258a0f0d0SEitan Adler>>>>>12			uleshort		&0x04
67358a0f0d0SEitan Adler>>>>>>12			uleshort	^0x10
67458a0f0d0SEitan Adler>>>>>>>(16.s)			uleshort	x
67558a0f0d0SEitan Adler>>>>>>>>&16				string	x	\b, %-.8s
67658a0f0d0SEitan Adler>>>>>>12			uleshort	&0x10
67758a0f0d0SEitan Adler>>>>>>>(16.s)			uleshort	x
67858a0f0d0SEitan Adler>>>>>>>&16				string	x	%-.8s
67958a0f0d0SEitan Adler>>>>>>>>&1				string	x	\b.%-.3s
68058a0f0d0SEitan Adler>>>12	uleshort				&0x01
68158a0f0d0SEitan Adler>>>>12		uleshort			^0x02
68258a0f0d0SEitan Adler>>>>>12			uleshort		^0x04
68358a0f0d0SEitan Adler>>>>>>12			uleshort	^0x10
68458a0f0d0SEitan Adler>>>>>>>18				string	x	\b, %-.8s
68558a0f0d0SEitan Adler>>>>>>12			uleshort	&0x10
68658a0f0d0SEitan Adler>>>>>>>18				string	x	\b, %-.8s
68758a0f0d0SEitan Adler>>>>>>>>&1				string	x	\b.%-.3s
68858a0f0d0SEitan Adler>>>>>12			uleshort		&0x04
68958a0f0d0SEitan Adler>>>>>>12			uleshort	^0x10
69058a0f0d0SEitan Adler>>>>>>>(18.s)			uleshort	x
69158a0f0d0SEitan Adler>>>>>>>>&18				string	x	\b, %-.8s
69258a0f0d0SEitan Adler>>>>>>12			uleshort	&0x10
69358a0f0d0SEitan Adler>>>>>>>(18.s)			uleshort	x
69458a0f0d0SEitan Adler>>>>>>>>&18				string	x	\b, %-.8s
69558a0f0d0SEitan Adler>>>>>>>>>&1				string	x	\b.%-.3s
69658a0f0d0SEitan Adler>>>>12		uleshort			&0x02
69758a0f0d0SEitan Adler>>>>>12			uleshort		^0x04
69858a0f0d0SEitan Adler>>>>>>12			uleshort	^0x10
69958a0f0d0SEitan Adler>>>>>>>20				string	x	\b, %-.8s
70058a0f0d0SEitan Adler>>>>>>12			uleshort	&0x10
70158a0f0d0SEitan Adler>>>>>>>20				string	x	\b, %-.8s
70258a0f0d0SEitan Adler>>>>>>>>&1				string	x	\b.%-.3s
70358a0f0d0SEitan Adler>>>>>12			uleshort		&0x04
70458a0f0d0SEitan Adler>>>>>>12			uleshort	^0x10
70558a0f0d0SEitan Adler>>>>>>>(20.s)			uleshort	x
70658a0f0d0SEitan Adler>>>>>>>>&20				string	x	\b, %-.8s
70758a0f0d0SEitan Adler>>>>>>12			uleshort	&0x10
70858a0f0d0SEitan Adler>>>>>>>(20.s)			uleshort	x
70958a0f0d0SEitan Adler>>>>>>>>&20				string	x	\b, %-.8s
71058a0f0d0SEitan Adler>>>>>>>>>&1				string	x	\b.%-.3s
71158a0f0d0SEitan Adler# 2 bytes: length of data + mentioned bytes
71258a0f0d0SEitan Adler#
71358a0f0d0SEitan Adler#		SZDD variant Haruhiko Okumura's LZSS or 7z type MsLZ
714a4d6d3b8SXin LI# URL:		http://fileformats.archiveteam.org/wiki/MS-DOS_installation_compression
715a4d6d3b8SXin LI# Reference:	http://www.cabextract.org.uk/libmspack/doc/szdd_kwaj_format.html
716a4d6d3b8SXin LI#		http://mark0.net/download/triddefs_xml.7z/defs/s/szdd.trid.xml
717a4d6d3b8SXin LI# Note:		called "Microsoft SZDD compressed (Haruhiko Okumura's LZSS)" by TrID
718a4d6d3b8SXin LI#		verfied by 7-Zip `7z l -tMsLZ -slt *.??_` as MsLZ
719a4d6d3b8SXin LI#		`deark -l -m lzss_oku -d2 setup-1-41.bin` as "LZSS.C by Haruhiko Okumura"
72058a0f0d0SEitan Adler>0	string	SZDD		MS Compress archive data, SZDD variant
721a4d6d3b8SXin LI# 2nd part of signature
722a4d6d3b8SXin LI#>>4	ubelong	0x88F02733	\b, SIGNATURE OK
72358a0f0d0SEitan Adler!:mime	application/x-ms-compress-szdd
72458a0f0d0SEitan Adler!:ext	??_
72558a0f0d0SEitan Adler# The character missing from the end of the filename (0=unknown)
72658a0f0d0SEitan Adler>>9	string	>\0		\b, %-.1s is last character of original name
72758a0f0d0SEitan Adler# https://www.betaarchive.com/forum/viewtopic.php?t=26161
72858a0f0d0SEitan Adler# Compression mode: "A" (0x41) found but sometimes "B" in Windows 3.1 builds 026 and 034e
72958a0f0d0SEitan Adler>>8	string	!A		\b, %-.1s method
73058a0f0d0SEitan Adler>>10	ulelong	>0		\b, original size: %u bytes
731a4d6d3b8SXin LI# Summary:	InstallShield archive with SZDD compressed
732a4d6d3b8SXin LI# URL:		https://community.flexera.com/t5/InstallShield-Knowledge-Base/InstallShield-Redistributable-Files/ta-p/5647
733a4d6d3b8SXin LI# From:		Joerg Jenderek
734a4d6d3b8SXin LI1	search/48/bs	SZDD\x88\xF0\x27\x33	InstallShield archive
735a4d6d3b8SXin LI#!:mime	application/octet-stream
736a4d6d3b8SXin LI!:mime	application/x-installshield-compress-szdd
737a4d6d3b8SXin LI!:ext	ibt
738a4d6d3b8SXin LI# name of compressed archive member like: setup.dl_ _setup7int.dl_ _setup2k.dl_ _igdi.dl_ cabinet.dl_
739a4d6d3b8SXin LI>0	string	x		%s
740a4d6d3b8SXin LI# name of uncompressed archive member like: setup.dll _Setup.dll IGdi.dll CABINET.DLL
741a4d6d3b8SXin LI>>&1	string	x		(%s)
742a4d6d3b8SXin LI# probably version like: 9.0.0.333 9.1.0.429 11.50.0.42618
743a4d6d3b8SXin LI>>>&1	string	x		\b, version %s
744a4d6d3b8SXin LI# SZDD member length like: 168048 169333 181842
745a4d6d3b8SXin LI>>>>&1	string	x		\b, %s bytes
746a4d6d3b8SXin LI# MS Compress archive data
747a4d6d3b8SXin LI#>&0	string		SZDD	\b, SIGNATURE FOUND
748a4d6d3b8SXin LI>&0	indirect	x
74958a0f0d0SEitan Adler#		QBasic SZDD variant
75058a0f0d0SEitan Adler3	string	\x88\xf0\x27
75158a0f0d0SEitan Adler>0	string	SZ\x20		MS Compress archive data, QBasic variant
75258a0f0d0SEitan Adler!:mime	application/x-ms-compress-sz
75358a0f0d0SEitan Adler!:ext	??$
75458a0f0d0SEitan Adler>>8	ulelong	>0		\b, original size: %u bytes
75558a0f0d0SEitan Adler
756a4d6d3b8SXin LI# Summary:	CAZIP compressed file
757a4d6d3b8SXin LI# From:		Joerg Jenderek
758a4d6d3b8SXin LI# URL:		http://fileformats.archiveteam.org/wiki/CAZIP
759a4d6d3b8SXin LI# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/c/caz.trid.xml
760a4d6d3b8SXin LI# Note:		Format is distinct from CAZIPXP compressed
761a4d6d3b8SXin LI0	string	\x0D\x0A\x1ACAZIP	CAZIP compressed file
762a4d6d3b8SXin LI#!:mime	application/octet-stream
763a4d6d3b8SXin LI!:mime	application/x-compress-cazip
764a4d6d3b8SXin LI# like: BLINKER.WR_ CLIPDEFS._ CAOSETUP.EX_ CLIPPER.EX_ FILEIO.C_
765a4d6d3b8SXin LI!:ext	??_/?_/_
766a4d6d3b8SXin LI
76743a5ec4eSXin LI# Summary:	FTCOMP compressed archive
76843a5ec4eSXin LI# From:		Joerg Jenderek
76943a5ec4eSXin LI# URL:		http://fileformats.archiveteam.org/wiki/FTCOMP
77043a5ec4eSXin LI# Reference:    http://mark0.net/download/triddefs_xml.7z/defs/a/ark-ftcomp.trid.xml
77143a5ec4eSXin LI# Note:		called by TrID "FTCOMP compressed archive"
77243a5ec4eSXin LI#		extracted by `unpack seahelp.hl_`
77343a5ec4eSXin LI24	string/b	FTCOMP		FTCOMP compressed archive
77443a5ec4eSXin LI#!:mime	application/octet-stream
77543a5ec4eSXin LI!:mime	application/x-compress-ftcomp
77643a5ec4eSXin LI!:ext	??_/??@/dll/drv/pk2/
77743a5ec4eSXin LI# probably A596FDFF magic at the beginning
77843a5ec4eSXin LI>0	ubelong		!0xA596FDFF	\b, at beginning %#x
77943a5ec4eSXin LI# probably original file name with directory like: \OS2\unpack.exe \SYSTEM\8514.DRV MAHJONGG.EXE
78043a5ec4eSXin LI>41	string		x		"%s"
78143a5ec4eSXin LI
782b6cee71dSXin LI# MP3 (archiver, not lossy audio compression)
783b6cee71dSXin LI0	string	MP3\x1a MP3-Archiver archive data
784b6cee71dSXin LI# ZET
785b6cee71dSXin LI0	string	OZ\xc3\x9d ZET archive data
786b6cee71dSXin LI# TSComp
787b6cee71dSXin LI0	string	\x65\x5d\x13\x8c\x08\x01\x03\x00 TSComp archive data
788b6cee71dSXin LI# ARQ
789b6cee71dSXin LI0	string	gW\4\1 ARQ archive data
790b6cee71dSXin LI# Squash
791b6cee71dSXin LI3	string	OctSqu Squash archive data
792b6cee71dSXin LI# Terse
793b6cee71dSXin LI0	string	\5\1\1\0 Terse archive data
794b6cee71dSXin LI# PUCrunch
795b6cee71dSXin LI0	string	\x01\x08\x0b\x08\xef\x00\x9e\x32\x30\x36\x31 PUCrunch archive data
796b6cee71dSXin LI# UHarc
797b6cee71dSXin LI0	string	UHA UHarc archive data
798b6cee71dSXin LI# ABComp
799b6cee71dSXin LI0	string	\2AB ABComp archive data
800b6cee71dSXin LI0	string	\3AB2 ABComp archive data
801b6cee71dSXin LI# CMP
802b6cee71dSXin LI0	string	CO\0 CMP archive data
803b6cee71dSXin LI# Splint
804b6cee71dSXin LI0	string	\x93\xb9\x06 Splint archive data
805b6cee71dSXin LI# InstallShield
806b6cee71dSXin LI0	string	\x13\x5d\x65\x8c InstallShield Z archive Data
807b6cee71dSXin LI# Gather
808b6cee71dSXin LI1	string	GTH Gather archive data
809b6cee71dSXin LI# BOA
810b6cee71dSXin LI0	string	BOA BOA archive data
811b6cee71dSXin LI# RAX
812b6cee71dSXin LI0	string	ULEB\xa RAX archive data
813b6cee71dSXin LI# Xtreme
814b6cee71dSXin LI0	string	ULEB\0 Xtreme archive data
815b6cee71dSXin LI# Pack Magic
816b6cee71dSXin LI0	string	@\xc3\xa2\1\0 Pack Magic archive data
817b6cee71dSXin LI# BTS
818b6cee71dSXin LI0	belong&0xfeffffff	0x1a034465 BTS archive data
819b6cee71dSXin LI# ELI 5750
820b6cee71dSXin LI0	string	Ora\  ELI 5750 archive data
821b6cee71dSXin LI# QFC
822b6cee71dSXin LI0	string	\x1aFC\x1a QFC archive data
823b6cee71dSXin LI0	string	\x1aQF\x1a QFC archive data
824b6cee71dSXin LI# PRO-PACK
825b6cee71dSXin LI0	string	RNC PRO-PACK archive data
826b6cee71dSXin LI# 777
827b6cee71dSXin LI0	string	777 777 archive data
828b6cee71dSXin LI# LZS221
829b6cee71dSXin LI0	string	sTaC LZS221 archive data
830b6cee71dSXin LI# HPA
831b6cee71dSXin LI0	string	HPA HPA archive data
832b6cee71dSXin LI# Arhangel
833b6cee71dSXin LI0	string	LG Arhangel archive data
834b6cee71dSXin LI# EXP1, uses bzip2
835b6cee71dSXin LI0	string	0123456789012345BZh EXP1 archive data
836b6cee71dSXin LI# IMP
837b6cee71dSXin LI0	string	IMP\xa IMP archive data
838b6cee71dSXin LI# NRV
839b6cee71dSXin LI0	string	\x00\x9E\x6E\x72\x76\xFF NRV archive data
840b6cee71dSXin LI# Squish
841b6cee71dSXin LI0	string	\x73\xb2\x90\xf4 Squish archive data
842b6cee71dSXin LI# Par
843b6cee71dSXin LI0	string	PHILIPP Par archive data
844b6cee71dSXin LI0	string	PAR Par archive data
845b6cee71dSXin LI# HIT
846b6cee71dSXin LI0	string	UB HIT archive data
847b6cee71dSXin LI# SBX
848b6cee71dSXin LI0	belong&0xfffff000	0x53423000 SBX archive data
849b6cee71dSXin LI# NaShrink
850b6cee71dSXin LI0	string	NSK NaShrink archive data
851b6cee71dSXin LI# SAPCAR
852b6cee71dSXin LI0	string	#\ CAR\ archive\ header SAPCAR archive data
853a4d6d3b8SXin LI0	string	CAR\ 2.00 SAPCAR archive data
854a4d6d3b8SXin LI0	string	CAR\ 2.01 SAPCAR archive data
855a4d6d3b8SXin LI#!:mime	application/octet-stream
856a4d6d3b8SXin LI!:mime	application/vnd.sar
857a4d6d3b8SXin LI!:ext	sar
858b6cee71dSXin LI# Disintegrator
859b6cee71dSXin LI0	string	DST Disintegrator archive data
860b6cee71dSXin LI# ASD
861b6cee71dSXin LI0	string	ASD ASD archive data
862b6cee71dSXin LI# InstallShield CAB
863a4d6d3b8SXin LI# Update:	Joerg Jenderek at Nov 2021
864a4d6d3b8SXin LI# URL:		https://en.wikipedia.org/wiki/InstallShield
865a4d6d3b8SXin LI# Reference:	https://github.com/twogood/unshield/blob/master/lib/cabfile.h
866a4d6d3b8SXin LI# Note:		Not compatible with Microsoft CAB files
867a4d6d3b8SXin LI# http://mark0.net/download/triddefs_xml.7z/defs/a/ark-cab-ishield.trid.xml
868a4d6d3b8SXin LI# CAB_SIGNATURE 0x28635349
869a4d6d3b8SXin LI0	string	ISc( InstallShield
870a4d6d3b8SXin LI#!:mime		application/octet-stream
871a4d6d3b8SXin LI!:mime		application/x-installshield
872a4d6d3b8SXin LI# http://mark0.net/download/triddefs_xml.7z/defs/a/ark-cab-ishield-hdr.trid.xml
873a4d6d3b8SXin LI>16	ulelong	!0	setup header
874a4d6d3b8SXin LI# like: _SYS1.HDR _USER1.HDR data1.hdr
875a4d6d3b8SXin LI!:ext	hdr
876a4d6d3b8SXin LI>16	ulelong	=0	CAB
877a4d6d3b8SXin LI# like: _SYS1.CAB _USER1.CAB DATA1.CAB  data2.cab
878a4d6d3b8SXin LI!:ext	cab
879a4d6d3b8SXin LI# https://github.com/twogood/unshield/blob/master/lib/helper.c
880a4d6d3b8SXin LI# version like:	0x1005201 0x100600c 0x1007000 0x1009500
881a4d6d3b8SXin LI#		0x2000578 0x20005dc 0x2000640 0x40007d0 0x4000834
882a4d6d3b8SXin LI>4	ulelong	x	\b, version %#x
883a4d6d3b8SXin LI# volume_info like: 0
884a4d6d3b8SXin LI>8	ulelong	!0	\b, volume_info %#x
885a4d6d3b8SXin LI# cab_descriptor_offset like: 0x200
886a4d6d3b8SXin LI>12	ulelong	!0x200	\b, offset %#x
887a4d6d3b8SXin LI#>0x200	ubequad	x	\b, at 0x200 %#16.16llx
888a4d6d3b8SXin LI# cab_descriptor_size like: 0 (*.cab) BD5 C8B DA5 E2A E36 116C 251D 4DA9 56F0 5CC2 6E4B 777D 779E 1F7C2
889a4d6d3b8SXin LI>16	ulelong	!0	\b, descriptor size %#x
890b6cee71dSXin LI# TOP4
891b6cee71dSXin LI0	string	T4\x1a TOP4 archive data
892b6cee71dSXin LI# BatComp left out: sig looks like COM executable
893b6cee71dSXin LI# so TODO: get real 4dos batcomp file and find sig
894b6cee71dSXin LI# BlakHole
895b6cee71dSXin LI0	string	BH\5\7 BlakHole archive data
896b6cee71dSXin LI# BIX
897b6cee71dSXin LI0	string	BIX0 BIX archive data
898b6cee71dSXin LI# ChiefLZA
899b6cee71dSXin LI0	string	ChfLZ ChiefLZA archive data
900b6cee71dSXin LI# Blink
901b6cee71dSXin LI0	string	Blink Blink archive data
902b6cee71dSXin LI# Logitech Compress
903b6cee71dSXin LI0	string	\xda\xfa Logitech Compress archive data
904b6cee71dSXin LI# ARS-Sfx (FIXME: really a SFX? then goto COM/EXE)
905b6cee71dSXin LI1	string	(C)\ STEPANYUK ARS-Sfx archive data
906b6cee71dSXin LI# AKT/AKT32
907b6cee71dSXin LI0	string	AKT32 AKT32 archive data
908b6cee71dSXin LI0	string	AKT AKT archive data
909b6cee71dSXin LI# NPack
910b6cee71dSXin LI0	string	MSTSM NPack archive data
911b6cee71dSXin LI# PFT
912b6cee71dSXin LI0	string	\0\x50\0\x14 PFT archive data
913b6cee71dSXin LI# SemOne
914b6cee71dSXin LI0	string	SEM SemOne archive data
915b6cee71dSXin LI# PPMD
916b6cee71dSXin LI0	string	\x8f\xaf\xac\x84 PPMD archive data
917b6cee71dSXin LI# FIZ
918b6cee71dSXin LI0	string	FIZ FIZ archive data
919b6cee71dSXin LI# MSXiE
920b6cee71dSXin LI0	belong&0xfffff0f0	0x4d530000 MSXiE archive data
921b6cee71dSXin LI# DeepFreezer
922b6cee71dSXin LI0	belong&0xfffffff0	0x797a3030 DeepFreezer archive data
923b6cee71dSXin LI# DC
924b6cee71dSXin LI0	string	=<DC- DC archive data
925b6cee71dSXin LI# TPac
926b6cee71dSXin LI0	string	\4TPAC\3 TPac archive data
927b6cee71dSXin LI# Ai
928b6cee71dSXin LI0	string	Ai\1\1\0 Ai archive data
929b6cee71dSXin LI0	string	Ai\1\0\0 Ai archive data
930b6cee71dSXin LI# Ai32
931b6cee71dSXin LI0	string	Ai\2\0 Ai32 archive data
932b6cee71dSXin LI0	string	Ai\2\1 Ai32 archive data
933b6cee71dSXin LI# SBC
934b6cee71dSXin LI0	string	SBC SBC archive data
935b6cee71dSXin LI# Ybs
936b6cee71dSXin LI0	string	YBS Ybs archive data
937b6cee71dSXin LI# DitPack
938b6cee71dSXin LI0	string	\x9e\0\0 DitPack archive data
939b6cee71dSXin LI# DMS
940b6cee71dSXin LI0	string	DMS! DMS archive data
941b6cee71dSXin LI# EPC
942b6cee71dSXin LI0	string	\x8f\xaf\xac\x8c EPC archive data
943b6cee71dSXin LI# VSARC
944b6cee71dSXin LI0	string	VS\x1a VSARC archive data
945b6cee71dSXin LI# PDZ
946b6cee71dSXin LI0	string	PDZ PDZ archive data
947b6cee71dSXin LI# ReDuq
948b6cee71dSXin LI0	string	rdqx ReDuq archive data
949b6cee71dSXin LI# GCA
950b6cee71dSXin LI0	string	GCAX GCA archive data
951b6cee71dSXin LI# PPMN
952b6cee71dSXin LI0	string	pN PPMN archive data
953b6cee71dSXin LI# WinImage
954b6cee71dSXin LI3	string	WINIMAGE WinImage archive data
955b6cee71dSXin LI# Compressia
956b6cee71dSXin LI0	string	CMP0CMP Compressia archive data
957b6cee71dSXin LI# UHBC
958b6cee71dSXin LI0	string	UHB UHBC archive data
959b6cee71dSXin LI# WinHKI
960b6cee71dSXin LI0	string	\x61\x5C\x04\x05 WinHKI archive data
961b6cee71dSXin LI# WWPack data file
962b6cee71dSXin LI0	string	WWP WWPack archive data
963b6cee71dSXin LI# BSN (BSA, PTS-DOS)
964b6cee71dSXin LI0	string	\xffBSG BSN archive data
965b6cee71dSXin LI1	string	\xffBSG BSN archive data
966b6cee71dSXin LI3	string	\xffBSG BSN archive data
967b6cee71dSXin LI1	string	\0\xae\2 BSN archive data
968b6cee71dSXin LI1	string	\0\xae\3 BSN archive data
969b6cee71dSXin LI1	string	\0\xae\7 BSN archive data
970b6cee71dSXin LI# AIN
971b6cee71dSXin LI0	string	\x33\x18 AIN archive data
972b6cee71dSXin LI0	string	\x33\x17 AIN archive data
9739ce06829SXin LI# XPA32 test moved and merged with XPA by Joerg Jenderek at Sep 2015
974b6cee71dSXin LI# SZip (TODO: doesn't catch all versions)
975b6cee71dSXin LI0	string	SZ\x0a\4 SZip archive data
976b6cee71dSXin LI# XPack DiskImage
9779ce06829SXin LI# *.XDI updated by Joerg Jenderek Sep 2015
9789ce06829SXin LI# ftp://ftp.sac.sk/pub/sac/pack/0index.txt
9799ce06829SXin LI# GRR: this test is still too general as it catches also text files starting with jm
9809ce06829SXin LI0	string	jm
9819ce06829SXin LI# only found examples with this additional characteristic 2 bytes
9829ce06829SXin LI>2	string	\x2\x4	Xpack DiskImage archive data
9839ce06829SXin LI#!:ext xdi
984b6cee71dSXin LI# XPack Data
9859ce06829SXin LI# *.xpa updated by Joerg Jenderek Sep 2015
9869ce06829SXin LI# ftp://ftp.elf.stuba.sk/pub/pc/pack/
9879ce06829SXin LI0	string	xpa	XPA
9889ce06829SXin LI!:ext	xpa
9899ce06829SXin LI# XPA32
9909ce06829SXin LI# ftp://ftp.elf.stuba.sk/pub/pc/pack/xpa32.zip
9919ce06829SXin LI# created by XPA32.EXE version 1.0.2 for Windows
9929ce06829SXin LI>0	string	xpa\0\1 \b32 archive data
9939ce06829SXin LI# created by XPACK.COM version 1.67m or 1.67r with short 0x1800
9949ce06829SXin LI>3	ubeshort	!0x0001	\bck archive data
995b6cee71dSXin LI# XPack Single Data
9969ce06829SXin LI# changed by Joerg Jenderek Sep 2015 back to like in version 5.12
9979ce06829SXin LI# letter 'I'+ acute accent is equivalent to \xcd
9989ce06829SXin LI0	string	\xcd\ jm	Xpack single archive data
9999ce06829SXin LI#!:mime	application/x-xpa-compressed
10009ce06829SXin LI!:ext xpa
1001b6cee71dSXin LI
1002b6cee71dSXin LI# TODO: missing due to unknown magic/magic at end of file:
1003b6cee71dSXin LI#DWC
1004b6cee71dSXin LI#ARG
1005b6cee71dSXin LI#ZAR
1006b6cee71dSXin LI#PC/3270
1007b6cee71dSXin LI#InstallIt
1008b6cee71dSXin LI#RKive
1009b6cee71dSXin LI#RK
1010b6cee71dSXin LI#XPack Diskimage
1011b6cee71dSXin LI
1012b6cee71dSXin LI# These were inspired by idarc, but actually verified
1013b6cee71dSXin LI# Dzip archiver (.dz)
101458a0f0d0SEitan Adler# Update: Joerg Jenderek
101558a0f0d0SEitan Adler# URL: http://speeddemosarchive.com/dzip/
101658a0f0d0SEitan Adler# reference: http://speeddemosarchive.com/dzip/dz29src.zip/main.c
101758a0f0d0SEitan Adler# GRR: line below is too general as it matches also ASCII texts like Doszip commander help dz.txt
101858a0f0d0SEitan Adler0	string	DZ
101958a0f0d0SEitan Adler# latest version is 2.9 dated 7 may 2003
102058a0f0d0SEitan Adler>2	byte	<4 Dzip archive data
102158a0f0d0SEitan Adler!:mime	application/x-dzip
102258a0f0d0SEitan Adler!:ext	dz
102358a0f0d0SEitan Adler>>2	byte	x \b, version %i
102458a0f0d0SEitan Adler>>3	byte	x \b.%i
102543a5ec4eSXin LI>>4	ulelong	x \b, offset %#x
102658a0f0d0SEitan Adler>>8	ulelong	x \b, %u files
1027b6cee71dSXin LI# ZZip archiver (.zz)
1028b6cee71dSXin LI0	string	ZZ\ \0\0 ZZip archive data
1029b6cee71dSXin LI0	string	ZZ0 ZZip archive data
1030b6cee71dSXin LI# PAQ archiver (.paq)
1031b6cee71dSXin LI0	string	\xaa\x40\x5f\x77\x1f\xe5\x82\x0d PAQ archive data
1032b6cee71dSXin LI0	string	PAQ PAQ archive data
1033b6cee71dSXin LI>3	byte&0xf0	0x30
1034b6cee71dSXin LI>>3	byte	x (v%c)
1035b6cee71dSXin LI# JAR archiver (.j), this is the successor to ARJ, not Java's JAR (which is essentially ZIP)
1036a4d6d3b8SXin LI# Update:	Joerg Jenderek
1037a4d6d3b8SXin LI# URL:		http://fileformats.archiveteam.org/wiki/JAR_(ARJ_Software)
1038a4d6d3b8SXin LI# reference:	http://mark0.net/download/triddefs_xml.7z/defs/a/ark-jar.trid.xml
1039a4d6d3b8SXin LI#		https://www.sac.sk/download/pack/jar102x.exe/TECHNOTE.DOC
1040a4d6d3b8SXin LI# Note:		called "JAR compressed archive" by TrID
1041b6cee71dSXin LI0xe	string	\x1aJar\x1b JAR (ARJ Software, Inc.) archive data
1042a4d6d3b8SXin LI#!:mime	application/octet-stream
1043a4d6d3b8SXin LI!:mime	application/x-compress-j
1044a4d6d3b8SXin LI>0	ulelong	x		\b, CRC32 %#x
1045a4d6d3b8SXin LI# standard suffix is ".j"; for multi volumes following order j01 j02 ... j99 100 ... 990
1046a4d6d3b8SXin LI!:ext	j/j01/j02
1047a4d6d3b8SXin LI# URL:		http://fileformats.archiveteam.org/wiki/JARCS
1048a4d6d3b8SXin LI# reference:	http://mark0.net/download/triddefs_xml.7z/defs/a/ark-jarcs.trid.xml
1049a4d6d3b8SXin LI# Note:		called "JARCS compressed archive" by TrID
1050b6cee71dSXin LI0	string	JARCS JAR (ARJ Software, Inc.) archive data
1051a4d6d3b8SXin LI#!:mime	application/octet-stream
1052a4d6d3b8SXin LI!:mime	application/x-compress-jar
1053a4d6d3b8SXin LI!:ext	jar
1054b6cee71dSXin LI
1055b6cee71dSXin LI# ARJ archiver (jason@jarthur.Claremont.EDU)
1056a4d6d3b8SXin LI# URL:		http://fileformats.archiveteam.org/wiki/ARJ
1057a4d6d3b8SXin LI# reference:	http://mark0.net/download/triddefs_xml.7z/defs/a/ark-arj.trid.xml
1058a4d6d3b8SXin LI#		https://github.com/FarGroup/FarManager/
1059a4d6d3b8SXin LI#		blob/master/plugins/multiarc/arc.doc/arj.txt
1060a4d6d3b8SXin LI# Note:		called "ARJ compressed archive" by TrID and
1061a4d6d3b8SXin LI#		"ARJ File Format" by DROID via PUID fmt/610
1062a4d6d3b8SXin LI#		verified by `7z l -tarj PHRACK1.ARJ` and
1063a4d6d3b8SXin LI#		`arj.exe l TEST-hk9.ARJ`
1064a4d6d3b8SXin LI0	leshort		0xea60
1065a4d6d3b8SXin LI# skip DROID fmt-610-signature-id-946.arj by check for valid file type of main header
1066a4d6d3b8SXin LI>0xA	ubyte		2
1067a4d6d3b8SXin LI>>0	use		arj-archive
1068a4d6d3b8SXin LI0	name		arj-archive
1069a4d6d3b8SXin LI>0	leshort		x		ARJ archive
1070b6cee71dSXin LI!:mime	application/x-arj
1071a4d6d3b8SXin LI# look for terminating 0-character of filename
1072a4d6d3b8SXin LI>0x26	search/1024	\0
1073a4d6d3b8SXin LI# file name extension is normally .arj but not for parts of multi volume
1074a4d6d3b8SXin LI#>>&-5	string		x		extension %.4s
1075a4d6d3b8SXin LI>>&-5	string/c	.arj		data
1076a4d6d3b8SXin LI!:ext	arj
1077a4d6d3b8SXin LI>>&-5	default		x
1078a4d6d3b8SXin LI# for multi volume first name is archive.arj then following parts archive.a01 archive.a02 ...
1079a4d6d3b8SXin LI>>>8	byte		&0x04		data
1080a4d6d3b8SXin LI!:ext	a01/a02
1081a4d6d3b8SXin LI# for SFX first name is archive.exe then following parts archive.e01 archive.e02 ...
1082a4d6d3b8SXin LI>>>8	byte		^0x04		data, SFX multi-volume
1083a4d6d3b8SXin LI!:ext	e01/e02
1084a4d6d3b8SXin LI# basic header size like: 0x002b 0x002c 0x04e0 0x04e3 0x04e7
1085a4d6d3b8SXin LI#>2	uleshort	x		basic header size %#4.4x
1086a4d6d3b8SXin LI# next fragment content like: 0x0a200a003a8fc713 0x524a000010bb3471 0x524a0000c73c70f9
1087a4d6d3b8SXin LI#>(2.s)	ubequad		x		NEXT FRAGMENT CONTENT %#16.16llx
1088a4d6d3b8SXin LI# first_hdr_size; seems to be same as basic header size
1089a4d6d3b8SXin LI#>2	uleshort	x		1st header size %#x
1090a4d6d3b8SXin LI# archiver version number like: 3 4 6 11 102
1091a4d6d3b8SXin LI>5	byte		x		\b, v%d
1092a4d6d3b8SXin LI# minimum archiver version to extract like: 1
1093a4d6d3b8SXin LI>6	ubyte		!1		\b, minimum %u to extract
1094a4d6d3b8SXin LI# FOR DEBUGGING
1095a4d6d3b8SXin LI#>8	byte		x		\b, FLAGS %#x
1096a4d6d3b8SXin LI# GARBLED_FLAG1; garble with password; g switch
1097a4d6d3b8SXin LI>8	byte		&0x01		\b, password-protected
1098a4d6d3b8SXin LI# encryption version: 0~old  1~old 2~new 3~reserved 4~40 bit key GOST
1099a4d6d3b8SXin LI>>0x20	ubyte		x		(v%u)
1100a4d6d3b8SXin LI#>8	byte		&0x02		\b, secured
1101a4d6d3b8SXin LI# ANSIPAGE_FLAG; indicates ANSI codepage used by ARJ32; hy switch
1102a4d6d3b8SXin LI>8	byte		&0x02		\b, ANSI codepage
1103a4d6d3b8SXin LI# VOLUME_FLAG indicates presence of succeeding volume; but apparently not for SFX
1104a4d6d3b8SXin LI>8	byte		&0x04		\b, multi-volume
1105a4d6d3b8SXin LI#>8	byte		&0x08		\b, file-offset
1106a4d6d3b8SXin LI# ARJPROT_FLAG; build with data protection record; hk switch
1107a4d6d3b8SXin LI>8	byte		&0x08		\b, recoverable
1108a4d6d3b8SXin LI# arj protection factor; maximal 10; switch hky -> factor=y+1
1109a4d6d3b8SXin LI>>0x22	byte		x		(factor %u)
1110a4d6d3b8SXin LI>8	byte		&0x10		\b, slash-switched
1111a4d6d3b8SXin LI# BACKUP_FLAG; obsolete
1112a4d6d3b8SXin LI>8	byte		&0x20		\b, backup
1113a4d6d3b8SXin LI# SECURED_FLAG;
1114a4d6d3b8SXin LI>8	byte		&0x40		\b, secured,
1115a4d6d3b8SXin LI# ALTNAME_FLAG; indicates dual-name archive
1116a4d6d3b8SXin LI>8	byte		&0x80		\b, dual-name
1117a4d6d3b8SXin LI# security version; 0~old 2~current
1118a4d6d3b8SXin LI>9	ubyte		!0
1119a4d6d3b8SXin LI>>9	ubyte		!2		\b, security version %u
1120a4d6d3b8SXin LI# file type; 2 in main header; 0~binary 1~7-bitText 2~comment 3~directory 4~VolumeLabel 5=ChapterLabel
1121a4d6d3b8SXin LI>0xA	ubyte		!2		\b, file type %u
1122a4d6d3b8SXin LI# date+time when original archive was created in MS-DOS format via ./msdos
1123a4d6d3b8SXin LI>0xC	ulelong		x		\b, created
1124a4d6d3b8SXin LI>0xC	use		dos-date
1125a4d6d3b8SXin LI# or date and time by new internal function
1126a4d6d3b8SXin LI#>0xE	lemsdosdate	x		%s
1127a4d6d3b8SXin LI#>0xC	lemsdostime	x		%s
1128a4d6d3b8SXin LI# FOR DEBUGGING
1129a4d6d3b8SXin LI#>0x12	uleshort	x		RAW DATE %#4.4x
1130a4d6d3b8SXin LI#>0x10	uleshort	x		RAW TIME %#4.4x
1131a4d6d3b8SXin LI# date+time when archive was last modified; sometimes nil or
1132a4d6d3b8SXin LI# maybe wrong like in HP4DRVR.ARJ
1133a4d6d3b8SXin LI#>0x10	ulelong		>0		\b, modified
1134a4d6d3b8SXin LI#>>0x10	use		dos-date
1135a4d6d3b8SXin LI# or date and time by new internal function
1136a4d6d3b8SXin LI#>>0x12	lemsdosdate	x		%s
1137a4d6d3b8SXin LI#>>0x10	lemsdostime	x		%s
1138a4d6d3b8SXin LI# archive size (currently used only for secured archives); MAYBE?
1139a4d6d3b8SXin LI#>0x14	ulelong		!0		\b, file size %u
1140a4d6d3b8SXin LI# security envelope file position; MAYBE?
1141a4d6d3b8SXin LI#>0x18	ulelong		!0		\b, at %#x security envelope
1142a4d6d3b8SXin LI# filespec position in filename; WHAT IS THAT?
1143a4d6d3b8SXin LI#>0x1C	uleshort	>0		\b, filespec position %#x
1144a4d6d3b8SXin LI# length in bytes of security envelope data like: 2CAh 301h 364h 471h
1145a4d6d3b8SXin LI>0x1E	uleshort	!0		\b, security envelope length %#x
1146a4d6d3b8SXin LI# last chapter like: 0 1
1147a4d6d3b8SXin LI>0x21	ubyte		!0		\b, last chapter %u
1148a4d6d3b8SXin LI# filename (null-terminated string); sometimes at 0x26 when 4 bytes for extra data
1149a4d6d3b8SXin LI>34	byte		x		\b, original name:
1150a4d6d3b8SXin LI# with extras data
1151a4d6d3b8SXin LI>34	byte		<0x0B
1152a4d6d3b8SXin LI>>38	string		x		%s
1153a4d6d3b8SXin LI# without extras data
1154a4d6d3b8SXin LI>34	byte		>0x0A
1155a4d6d3b8SXin LI>>34	string		x		%s
1156a4d6d3b8SXin LI# host OS: 0~MSDOS ... 11~WIN32
1157a4d6d3b8SXin LI>7	byte		0		\b, os: MS-DOS
1158a4d6d3b8SXin LI>7	byte		1		\b, os: PRIMOS
1159a4d6d3b8SXin LI>7	byte		2		\b, os: Unix
1160a4d6d3b8SXin LI>7	byte		3		\b, os: Amiga
1161a4d6d3b8SXin LI>7	byte		4		\b, os: Macintosh
1162a4d6d3b8SXin LI>7	byte		5		\b, os: OS/2
1163a4d6d3b8SXin LI>7	byte		6		\b, os: Apple ][ GS
1164a4d6d3b8SXin LI>7	byte		7		\b, os: Atari ST
1165a4d6d3b8SXin LI>7	byte		8		\b, os: NeXT
1166a4d6d3b8SXin LI>7	byte		9		\b, os: VAX/VMS
1167a4d6d3b8SXin LI>7	byte		10		\b, os: WIN95
1168a4d6d3b8SXin LI>7	byte		11		\b, os: WIN32
1169b6cee71dSXin LI# [JW] idarc says this is also possible
1170b6cee71dSXin LI2	leshort		0xea60		ARJ archive data
1171a4d6d3b8SXin LI#2	leshort		0xea60
1172a4d6d3b8SXin LI#>2	use		arj-archive
1173b6cee71dSXin LI
1174b6cee71dSXin LI# HA archiver (Greg Roelofs, newt@uchicago.edu)
1175b6cee71dSXin LI# This is a really bad format. A file containing HAWAII will match this...
1176b6cee71dSXin LI#0	string		HA		HA archive data,
1177b6cee71dSXin LI#>2	leshort		=1		1 file,
1178b6cee71dSXin LI#>2	leshort		>1		%hu files,
1179b6cee71dSXin LI#>4	byte&0x0f	=0		first is type CPY
1180b6cee71dSXin LI#>4	byte&0x0f	=1		first is type ASC
1181b6cee71dSXin LI#>4	byte&0x0f	=2		first is type HSC
1182b6cee71dSXin LI#>4	byte&0x0f	=0x0e		first is type DIR
1183b6cee71dSXin LI#>4	byte&0x0f	=0x0f		first is type SPECIAL
1184b6cee71dSXin LI# suggestion: at least identify small archives (<1024 files)
1185b6cee71dSXin LI0  belong&0xffff00fc 0x48410000 HA archive data
1186b6cee71dSXin LI>2	leshort		=1		1 file,
1187b6cee71dSXin LI>2	leshort		>1		%u files,
1188b6cee71dSXin LI>4	byte&0x0f	=0		first is type CPY
1189b6cee71dSXin LI>4	byte&0x0f	=1		first is type ASC
1190b6cee71dSXin LI>4	byte&0x0f	=2		first is type HSC
1191b6cee71dSXin LI>4	byte&0x0f	=0x0e		first is type DIR
1192b6cee71dSXin LI>4	byte&0x0f	=0x0f		first is type SPECIAL
1193b6cee71dSXin LI
1194b6cee71dSXin LI# HPACK archiver (Peter Gutmann, pgut1@cs.aukuni.ac.nz)
1195b6cee71dSXin LI0	string		HPAK		HPACK archive data
1196b6cee71dSXin LI
1197b6cee71dSXin LI# JAM Archive volume format, by Dmitry.Kohmanyuk@UA.net
1198b6cee71dSXin LI0	string		\351,\001JAM\ 		JAM archive,
1199b6cee71dSXin LI>7	string		>\0			version %.4s
1200b6cee71dSXin LI>0x26	byte		=0x27			-
1201b6cee71dSXin LI>>0x2b	string          >\0			label %.11s,
1202b6cee71dSXin LI>>0x27	lelong		x			serial %08x,
1203b6cee71dSXin LI>>0x36	string		>\0			fstype %.8s
1204b6cee71dSXin LI
1205b6cee71dSXin LI# LHARC/LHA archiver (Greg Roelofs, newt@uchicago.edu)
12063e41d09dSXin LI# Update: Joerg Jenderek
12073e41d09dSXin LI# URL: https://en.wikipedia.org/wiki/LHA_(file_format)
120848c779cdSXin LI# Reference: https://web.archive.org/web/20021005080911/http://www.osirusoft.com/joejared/lzhformat.html
12093e41d09dSXin LI#
12103e41d09dSXin LI#	check and display information of lharc (LHa,PMarc) file
12113e41d09dSXin LI0	name				lharc-file
12123e41d09dSXin LI# check 1st character of method id like -lz4- -lh5- or -pm2-
12133e41d09dSXin LI>2	string		-
12143e41d09dSXin LI# check 5th character of method id
12153e41d09dSXin LI>>6	string		-
12163e41d09dSXin LI# check header level 0 1 2 3
12173e41d09dSXin LI>>>20	ubyte		<4
12183e41d09dSXin LI# check 2nd, 3th and 4th character of method id
12193e41d09dSXin LI>>>>3	regex		\^(lh[0-9a-ex]|lz[s2-8]|pm[012]|pc1)		\b
12203e41d09dSXin LI!:mime	application/x-lzh-compressed
12213e41d09dSXin LI# creator type "LHA "
12223e41d09dSXin LI!:apple	????LHA
12233e41d09dSXin LI# display archive type name like "LHa/LZS archive data" or "LArc archive"
12243e41d09dSXin LI>>>>>2	string		-lz		\b
12253e41d09dSXin LI!:ext	lzs
12263e41d09dSXin LI# already known  -lzs- -lz4- -lz5- with old names
12273e41d09dSXin LI>>>>>>2	string	-lzs		LHa/LZS archive data
12283e41d09dSXin LI>>>>>>3	regex	\^lz[45]	LHarc 1.x archive data
12293e41d09dSXin LI# missing -lz?- with wikipedia names
12303e41d09dSXin LI>>>>>>3	regex	\^lz[2378]	LArc archive
12313e41d09dSXin LI# display archive type name like "LHa (2.x) archive data"
12323e41d09dSXin LI>>>>>2	string		-lh		\b
12333e41d09dSXin LI# already known -lh0- -lh1- -lh2- -lh3-  -lh4- -lh5- -lh6- -lh7- -lhd- variants with old names
12343e41d09dSXin LI>>>>>>3	regex		\^lh[01]	LHarc 1.x/ARX archive data
12353e41d09dSXin LI# LHice archiver use ".ICE" as name extension instead usual one ".lzh"
12363e41d09dSXin LI# FOOBAR archiver use ".foo" as name extension instead usual one
12373e41d09dSXin LI# "Florain Orjanov's and Olga Bachetska's ARchiver" not found at the moment
12383e41d09dSXin LI>>>>>>>2	string	-lh1		\b
12393e41d09dSXin LI!:ext lha/lzh/ice
12403e41d09dSXin LI>>>>>>3	regex		\^lh[23d]	LHa 2.x? archive data
12413e41d09dSXin LI>>>>>>3	regex		\^lh[7]		LHa (2.x)/LHark archive data
12423e41d09dSXin LI>>>>>>3	regex		\^lh[456]	LHa (2.x) archive data
12433e41d09dSXin LI>>>>>>>2	string	-lh5		\b
12443e41d09dSXin LI# https://en.wikipedia.org/wiki/BIOS
124543a5ec4eSXin LI# Some mainboard BIOS like Award use LHa compression. So archives with unusual extension are found like
12463e41d09dSXin LI# bios.rom , kd7_v14.bin, 1010.004, ...
12473e41d09dSXin LI!:ext lha/lzh/rom/bin
12483e41d09dSXin LI# missing -lh?- variants (Joe Jared)
12493e41d09dSXin LI>>>>>>3	regex		\^lh[89a-ce]	LHa (Joe Jared) archive
12503e41d09dSXin LI# UNLHA32 2.67a
12513e41d09dSXin LI>>>>>>2	string		-lhx		LHa (UNLHA32) archive
12523e41d09dSXin LI# lha archives with standard file name extensions ".lha" ".lzh"
12533e41d09dSXin LI>>>>>>3	regex		!\^(lh1|lh5)	\b
12543e41d09dSXin LI!:ext lha/lzh
12553e41d09dSXin LI# this should not happen if all -lh variants are described
12563e41d09dSXin LI>>>>>>2	default		x		LHa (unknown) archive
12573e41d09dSXin LI#!:ext	lha
12583e41d09dSXin LI# PMarc
12593e41d09dSXin LI>>>>>3	regex		\^pm[012]	PMarc archive data
12603e41d09dSXin LI!:ext pma
12613e41d09dSXin LI# append method id without leading and trailing minus character
12623e41d09dSXin LI>>>>>3	string		x		[%3.3s]
12633e41d09dSXin LI>>>>>>0	use	lharc-header
12643e41d09dSXin LI#
12653e41d09dSXin LI#	check and display information of lharc header
12663e41d09dSXin LI0	name				lharc-header
12673e41d09dSXin LI# header size 0x4 , 0x1b-0x61
12683e41d09dSXin LI>0	ubyte		x
12693e41d09dSXin LI# compressed data size != compressed file size
12703e41d09dSXin LI#>7	ulelong		x		\b, data size %d
12713e41d09dSXin LI# attribute: 0x2~?? 0x10~symlink|target 0x20~normal
127243a5ec4eSXin LI#>19	ubyte		x		\b, 19_%#x
12733e41d09dSXin LI# level identifier 0 1 2 3
12743e41d09dSXin LI#>20	ubyte		x		\b, level %d
12753e41d09dSXin LI# time stamp
127643a5ec4eSXin LI#>15		ubelong	x		DATE %#8.8x
12773e41d09dSXin LI# OS ID for level 1
12783e41d09dSXin LI>20	ubyte		1
12793e41d09dSXin LI# 0x20 types find for *.rom files
128043a5ec4eSXin LI>>(21.b+24)	ubyte	<0x21		\b, %#x OS
12813e41d09dSXin LI# ascii type like M for MSDOS
12823e41d09dSXin LI>>(21.b+24)	ubyte	>0x20		\b, '%c' OS
12833e41d09dSXin LI# OS ID for level 2
12843e41d09dSXin LI>20	ubyte		2
128543a5ec4eSXin LI#>>23	ubyte		x		\b, OS ID %#x
128643a5ec4eSXin LI>>23	ubyte		<0x21		\b, %#x OS
12873e41d09dSXin LI>>23	ubyte		>0x20		\b, '%c' OS
12883e41d09dSXin LI# filename only for level 0 and 1
12893e41d09dSXin LI>20	ubyte		<2
12903e41d09dSXin LI# length of filename
12913e41d09dSXin LI>>21		ubyte	>0		\b, with
12923e41d09dSXin LI# filename
12933e41d09dSXin LI>>>21		pstring	x		"%s"
12943e41d09dSXin LI#
12953e41d09dSXin LI#2	string		-lh0-		LHarc 1.x/ARX archive data [lh0]
12963e41d09dSXin LI#!:mime	application/x-lharc
12973e41d09dSXin LI2	string		-lh0-
12983e41d09dSXin LI>0	use	lharc-file
12993e41d09dSXin LI#2	string		-lh1-		LHarc 1.x/ARX archive data [lh1]
13003e41d09dSXin LI#!:mime	application/x-lharc
13013e41d09dSXin LI2	string		-lh1-
13023e41d09dSXin LI>0	use	lharc-file
13033e41d09dSXin LI# NEW -lz2- ... -lz8-
13043e41d09dSXin LI2	string		-lz2-
13053e41d09dSXin LI>0	use	lharc-file
13063e41d09dSXin LI2	string		-lz3-
13073e41d09dSXin LI>0	use	lharc-file
13083e41d09dSXin LI2	string		-lz4-
13093e41d09dSXin LI>0	use	lharc-file
13103e41d09dSXin LI2	string		-lz5-
13113e41d09dSXin LI>0	use	lharc-file
13123e41d09dSXin LI2	string		-lz7-
13133e41d09dSXin LI>0	use	lharc-file
13143e41d09dSXin LI2	string		-lz8-
13153e41d09dSXin LI>0	use	lharc-file
1316b6cee71dSXin LI#	[never seen any but the last; -lh4- reported in comp.compression:]
13173e41d09dSXin LI#2	string		-lzs-		LHa/LZS archive data [lzs]
13183e41d09dSXin LI2	string		-lzs-
13193e41d09dSXin LI>0	use	lharc-file
13203e41d09dSXin LI# According to wikipedia and others such a version does not exist
13213e41d09dSXin LI#2	string		-lh\40-		LHa 2.x? archive data [lh ]
13223e41d09dSXin LI#2	string		-lhd-		LHa 2.x? archive data [lhd]
13233e41d09dSXin LI2	string		-lhd-
13243e41d09dSXin LI>0	use	lharc-file
13253e41d09dSXin LI#2	string		-lh2-		LHa 2.x? archive data [lh2]
13263e41d09dSXin LI2	string		-lh2-
13273e41d09dSXin LI>0	use	lharc-file
13283e41d09dSXin LI#2	string		-lh3-		LHa 2.x? archive data [lh3]
13293e41d09dSXin LI2	string		-lh3-
13303e41d09dSXin LI>0	use	lharc-file
13313e41d09dSXin LI#2	string		-lh4-		LHa (2.x) archive data [lh4]
13323e41d09dSXin LI2	string		-lh4-
13333e41d09dSXin LI>0	use	lharc-file
13343e41d09dSXin LI#2	string		-lh5-		LHa (2.x) archive data [lh5]
13353e41d09dSXin LI2	string		-lh5-
13363e41d09dSXin LI>0	use	lharc-file
13373e41d09dSXin LI#2	string		-lh6-		LHa (2.x) archive data [lh6]
13383e41d09dSXin LI2	string		-lh6-
13393e41d09dSXin LI>0	use	lharc-file
13403e41d09dSXin LI#2	string		-lh7-		LHa (2.x)/LHark archive data [lh7]
13413e41d09dSXin LI2	string		-lh7-
13423e41d09dSXin LI# !:mime	application/x-lha
13433e41d09dSXin LI# >20	byte		x		- header level %d
13443e41d09dSXin LI>0	use	lharc-file
13453e41d09dSXin LI# NEW -lh8- ... -lhe- , -lhx-
13463e41d09dSXin LI2	string		-lh8-
13473e41d09dSXin LI>0	use	lharc-file
13483e41d09dSXin LI2	string		-lh9-
13493e41d09dSXin LI>0	use	lharc-file
13503e41d09dSXin LI2	string		-lha-
13513e41d09dSXin LI>0	use	lharc-file
13523e41d09dSXin LI2	string		-lhb-
13533e41d09dSXin LI>0	use	lharc-file
13543e41d09dSXin LI2	string		-lhc-
13553e41d09dSXin LI>0	use	lharc-file
13563e41d09dSXin LI2	string		-lhe-
13573e41d09dSXin LI>0	use	lharc-file
13583e41d09dSXin LI2	string		-lhx-
13593e41d09dSXin LI>0	use	lharc-file
1360b6cee71dSXin LI# taken from idarc [JW]
1361b6cee71dSXin LI2   string      -lZ         PUT archive data
13623e41d09dSXin LI# already done by LHarc magics
13633e41d09dSXin LI# this should never happen if all sub types of LZS archive are identified
13643e41d09dSXin LI#2   string      -lz         LZS archive data
1365b6cee71dSXin LI2   string      -sw1-       Swag archive data
1366b6cee71dSXin LI
13673e41d09dSXin LI0	name		rar-file-header
13683e41d09dSXin LI>24	byte		15		\b, v1.5
13693e41d09dSXin LI>24	byte		20		\b, v2.0
13703e41d09dSXin LI>24	byte		29		\b, v4
13713e41d09dSXin LI>15	byte		0		\b, os: MS-DOS
13723e41d09dSXin LI>15	byte		1		\b, os: OS/2
13733e41d09dSXin LI>15	byte		2		\b, os: Win32
13743e41d09dSXin LI>15	byte		3		\b, os: Unix
13753e41d09dSXin LI>15	byte		4		\b, os: Mac OS
13763e41d09dSXin LI>15	byte		5		\b, os: BeOS
13773e41d09dSXin LI
13783e41d09dSXin LI0	name		rar-archive-header
13793e41d09dSXin LI>3	leshort&0x1ff	>0		\b, flags:
13803e41d09dSXin LI>>3	leshort		&0x01		ArchiveVolume
13813e41d09dSXin LI>>3	leshort		&0x02		Commented
13823e41d09dSXin LI>>3	leshort		&0x04		Locked
13833e41d09dSXin LI>>3	leshort		&0x10		NewVolumeNaming
13843e41d09dSXin LI>>3	leshort		&0x08		Solid
13853e41d09dSXin LI>>3	leshort		&0x20		Authenticated
13863e41d09dSXin LI>>3	leshort		&0x40		RecoveryRecordPresent
13873e41d09dSXin LI>>3	leshort		&0x80		EncryptedBlockHeader
13883e41d09dSXin LI>>3	leshort		&0x100		FirstVolume
13893e41d09dSXin LI
13903e41d09dSXin LI# RAR (Roshal Archive) archive
13913e41d09dSXin LI0	string		Rar!\x1a\7\0		RAR archive data
1392b6cee71dSXin LI!:mime	application/x-rar
13933e41d09dSXin LI!:ext	rar/cbr
13943e41d09dSXin LI# file header
13953e41d09dSXin LI>(0xc.l+9)	byte	0x74
13963e41d09dSXin LI>>(0xc.l+7)	use	rar-file-header
13973e41d09dSXin LI# subblock seems to share information with file header
13983e41d09dSXin LI>(0xc.l+9)	byte	0x7a
13993e41d09dSXin LI>>(0xc.l+7)	use	rar-file-header
14003e41d09dSXin LI>9		byte	0x73
14013e41d09dSXin LI>>7		use	rar-archive-header
14023e41d09dSXin LI
14033e41d09dSXin LI0	string		Rar!\x1a\7\1\0		RAR archive data, v5
14043e41d09dSXin LI!:mime	application/x-rar
14053e41d09dSXin LI!:ext	rar
14063e41d09dSXin LI
14073e41d09dSXin LI# Very old RAR archive
140848c779cdSXin LI# https://jasonblanks.com/wp-includes/images/papers/KnowyourarchiveRAR.pdf
14093e41d09dSXin LI0	string		RE\x7e\x5e  RAR archive data (<v1.5)
14103e41d09dSXin LI!:mime	application/x-rar
14113e41d09dSXin LI!:ext	rar/cbr
1412b6cee71dSXin LI
1413b6cee71dSXin LI# SQUISH archiver (Greg Roelofs, newt@uchicago.edu)
1414b6cee71dSXin LI0	string		SQSH		squished archive data (Acorn RISCOS)
1415b6cee71dSXin LI
1416b6cee71dSXin LI# UC2 archiver (Greg Roelofs, newt@uchicago.edu)
1417b6cee71dSXin LI# [JW] see exe section for self-extracting version
1418b6cee71dSXin LI0	string		UC2\x1a		UC2 archive data
1419b6cee71dSXin LI
1420b6cee71dSXin LI# PKZIP multi-volume archive
1421b6cee71dSXin LI0	string		PK\x07\x08PK\x03\x04	Zip multi-volume archive data, at least PKZIP v2.50 to extract
1422b6cee71dSXin LI!:mime	application/zip
14233e41d09dSXin LI!:ext zip/cbz
1424b6cee71dSXin LI
1425b6cee71dSXin LI# Zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
1426b6cee71dSXin LI0	string		PK\005\006	Zip archive data (empty)
14273e41d09dSXin LI!:mime application/zip
14283e41d09dSXin LI!:ext zip/cbz
142948c779cdSXin LI!:strength +1
1430b6cee71dSXin LI0	string		PK\003\004
143148c779cdSXin LI!:strength +1
1432b6cee71dSXin LI
1433b6cee71dSXin LI# Specialised zip formats which start with a member named 'mimetype'
1434b6cee71dSXin LI# (stored uncompressed, with no 'extra field') containing the file's MIME type.
1435b6cee71dSXin LI# Check for have 8-byte name, 0-byte extra field, name "mimetype", and
1436b6cee71dSXin LI#  contents starting with "application/":
1437b6cee71dSXin LI>26	string		\x8\0\0\0mimetypeapplication/
1438b6cee71dSXin LI
1439b6cee71dSXin LI#  KOffice / OpenOffice & StarOffice / OpenDocument formats
1440b6cee71dSXin LI#    From: Abel Cheung <abel@oaka.org>
1441b6cee71dSXin LI
1442b6cee71dSXin LI#   KOffice (1.2 or above) formats
1443b6cee71dSXin LI#    (mimetype contains "application/vnd.kde.<SUBTYPE>")
1444b6cee71dSXin LI>>50	string	vnd.kde.		KOffice (>=1.2)
1445b6cee71dSXin LI>>>58	string	karbon			Karbon document
1446b6cee71dSXin LI>>>58	string	kchart			KChart document
1447b6cee71dSXin LI>>>58	string	kformula		KFormula document
1448b6cee71dSXin LI>>>58	string	kivio			Kivio document
1449b6cee71dSXin LI>>>58	string	kontour			Kontour document
1450b6cee71dSXin LI>>>58	string	kpresenter		KPresenter document
1451b6cee71dSXin LI>>>58	string	kspread			KSpread document
1452b6cee71dSXin LI>>>58	string	kword			KWord document
1453b6cee71dSXin LI
1454b6cee71dSXin LI#   OpenOffice formats (for OpenOffice 1.x / StarOffice 6/7)
1455b6cee71dSXin LI#    (mimetype contains "application/vnd.sun.xml.<SUBTYPE>")
14562726a701SXin LI# URL:		https://en.wikipedia.org/wiki/OpenOffice.org_XML
14572726a701SXin LI# reference:	http://fileformats.archiveteam.org/wiki/OpenOffice.org_XML
1458b6cee71dSXin LI>>50	string	vnd.sun.xml.		OpenOffice.org 1.x
1459b6cee71dSXin LI>>>62	string	writer			Writer
1460b6cee71dSXin LI>>>>68	byte	!0x2e			document
14612726a701SXin LI!:mime	application/vnd.sun.xml.writer
14622726a701SXin LI!:ext	sxw
1463b6cee71dSXin LI>>>>68	string	.template		template
14642726a701SXin LI!:mime	application/vnd.sun.xml.writer.template
14652726a701SXin LI!:ext	stw
14662726a701SXin LI>>>>68	string	.web			Web template
14672726a701SXin LI!:mime	application/vnd.sun.xml.writer.web
14682726a701SXin LI!:ext	stw
1469b6cee71dSXin LI>>>>68	string	.global			global document
14702726a701SXin LI!:mime	application/vnd.sun.xml.writer.global
14712726a701SXin LI!:ext	sxg
1472b6cee71dSXin LI>>>62	string	calc			Calc
1473b6cee71dSXin LI>>>>66	byte	!0x2e			spreadsheet
14742726a701SXin LI!:mime	application/vnd.sun.xml.calc
14752726a701SXin LI!:ext	sxc
1476b6cee71dSXin LI>>>>66	string	.template		template
14772726a701SXin LI!:mime	application/vnd.sun.xml.calc.template
14782726a701SXin LI!:ext	stc
1479b6cee71dSXin LI>>>62	string	draw			Draw
1480b6cee71dSXin LI>>>>66	byte	!0x2e			document
14812726a701SXin LI!:mime	application/vnd.sun.xml.draw
14822726a701SXin LI!:ext	sxd
1483b6cee71dSXin LI>>>>66	string	.template		template
14842726a701SXin LI!:mime	application/vnd.sun.xml.draw.template
14852726a701SXin LI!:ext	std
1486b6cee71dSXin LI>>>62	string	impress			Impress
1487b6cee71dSXin LI>>>>69	byte	!0x2e			presentation
14882726a701SXin LI!:mime	application/vnd.sun.xml.impress
14892726a701SXin LI!:ext	sxi
1490b6cee71dSXin LI>>>>69	string	.template		template
14912726a701SXin LI!:mime	application/vnd.sun.xml.impress.template
14922726a701SXin LI!:ext	sti
1493b6cee71dSXin LI>>>62	string	math			Math document
14942726a701SXin LI!:mime	application/vnd.sun.xml.math
14952726a701SXin LI!:ext	sxm
1496b6cee71dSXin LI>>>62	string	base			Database file
14972726a701SXin LI!:mime	application/vnd.sun.xml.base
14982726a701SXin LI!:ext	sdb
1499b6cee71dSXin LI
1500a4d6d3b8SXin LI# URL:	https://wiki.openoffice.org/wiki/Documentation/DevGuide/Extensions/File_Format
1501a4d6d3b8SXin LI# From:	Joerg Jenderek
1502a4d6d3b8SXin LI# Note:	only few OXT samples are detected here by mimetype member
1503a4d6d3b8SXin LI#	is used by OpenOffice and LibreOffice and probably also NeoOffice
1504a4d6d3b8SXin LI#	verified by `unzip -Zv *.oxt` or `7z l -slt *.oxt`
1505a4d6d3b8SXin LI>>50	string	vnd.openofficeorg.		OpenOffice
1506a4d6d3b8SXin LI>>>68	string	extension			\b/LibreOffice Extension
1507a4d6d3b8SXin LI# http://extension.nirsoft.net/oxt
1508a4d6d3b8SXin LI!:mime	application/vnd.openofficeorg.extension
1509a4d6d3b8SXin LI# like: Gallery-Puzzle.2.1.0.1.oxt
1510a4d6d3b8SXin LI!:ext	oxt
1511a4d6d3b8SXin LI
1512b6cee71dSXin LI#   OpenDocument formats (for OpenOffice 2.x / StarOffice >= 8)
15132726a701SXin LI#   URL: http://fileformats.archiveteam.org/wiki/OpenDocument
151448c779cdSXin LI#    https://lists.oasis-open.org/archives/office/200505/msg00006.html
1515b6cee71dSXin LI#    (mimetype contains "application/vnd.oasis.opendocument.<SUBTYPE>")
1516b6cee71dSXin LI>>50	string	vnd.oasis.opendocument.	OpenDocument
1517b6cee71dSXin LI>>>73	string	text
1518b6cee71dSXin LI>>>>77	byte	!0x2d			Text
1519b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.text
15202726a701SXin LI!:ext	odt
1521b6cee71dSXin LI>>>>77	string	-template		Text Template
1522b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.text-template
15232726a701SXin LI!:ext	ott
1524b6cee71dSXin LI>>>>77	string	-web			HTML Document Template
1525b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.text-web
15262726a701SXin LI!:ext	oth
1527b6cee71dSXin LI>>>>77	string	-master			Master Document
1528b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.text-master
15292726a701SXin LI!:ext	odm
1530b6cee71dSXin LI>>>73	string	graphics
1531b6cee71dSXin LI>>>>81	byte	!0x2d			Drawing
1532b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.graphics
15332726a701SXin LI!:ext	odg
15342726a701SXin LI>>>>81	string	-template		Drawing Template
1535b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.graphics-template
15362726a701SXin LI!:ext	otg
1537b6cee71dSXin LI>>>73	string	presentation
1538b6cee71dSXin LI>>>>85	byte	!0x2d			Presentation
1539b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.presentation
15402726a701SXin LI!:ext	odp
15412726a701SXin LI>>>>85	string	-template		Presentation Template
1542b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.presentation-template
15432726a701SXin LI!:ext	otp
1544b6cee71dSXin LI>>>73	string	spreadsheet
1545b6cee71dSXin LI>>>>84	byte	!0x2d			Spreadsheet
1546b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.spreadsheet
15472726a701SXin LI!:ext	ods
15482726a701SXin LI>>>>84	string	-template		Spreadsheet Template
1549b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.spreadsheet-template
15502726a701SXin LI!:ext	ots
1551b6cee71dSXin LI>>>73	string	chart
1552b6cee71dSXin LI>>>>78	byte	!0x2d			Chart
1553b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.chart
15542726a701SXin LI!:ext	odc
15552726a701SXin LI>>>>78	string	-template		Chart Template
1556b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.chart-template
15572726a701SXin LI!:ext	otc
1558b6cee71dSXin LI>>>73	string	formula
1559b6cee71dSXin LI>>>>80	byte	!0x2d			Formula
1560b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.formula
15612726a701SXin LI!:ext	odf
15622726a701SXin LI>>>>80	string	-template		Formula Template
1563b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.formula-template
15642726a701SXin LI!:ext	otf
15652726a701SXin LI# https://www.loc.gov/preservation/digital/formats/fdd/fdd000441.shtml
1566b6cee71dSXin LI>>>73	string	database		Database
1567b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.database
15682726a701SXin LI!:ext	odb
156958a0f0d0SEitan Adler# Valid for LibreOffice Base 6.0.1.1 at least
157058a0f0d0SEitan Adler>>>73	string	base 			Database
15712726a701SXin LI# https://bugs.documentfoundation.org/show_bug.cgi?id=45854
15722726a701SXin LI!:mime	application/vnd.oasis.opendocument.database
15732726a701SXin LI#!:mime	application/vnd.oasis.opendocument.base
15742726a701SXin LI!:ext	odb
1575b6cee71dSXin LI>>>73	string	image
1576b6cee71dSXin LI>>>>78	byte	!0x2d			Image
1577b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.image
15782726a701SXin LI!:ext	odi
15792726a701SXin LI>>>>78	string	-template		Image Template
1580b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.image-template
15812726a701SXin LI!:ext	oti
1582b6cee71dSXin LI
1583b6cee71dSXin LI#  EPUB (OEBPS) books using OCF (OEBPS Container Format)
158448c779cdSXin LI#    https://www.idpf.org/ocf/ocf1.0/download/ocf10.htm, section 4.
1585b6cee71dSXin LI#    From: Ralf Brown <ralf.brown@gmail.com>
1586b6cee71dSXin LI>>50	string	epub+zip	EPUB document
1587b6cee71dSXin LI!:mime application/epub+zip
1588b6cee71dSXin LI
1589d38c30c0SXin LI# From:	Joerg Jenderek
1590d38c30c0SXin LI# URL:	http://en.wikipedia.org/wiki/CorelDRAW
1591d38c30c0SXin LI# NOTE:	version; til 2 WL-based; from 3 til 13 by ./riff; from 14 zip based
1592d38c30c0SXin LI>>50	string	x-vnd.corel.	 Corel
1593d38c30c0SXin LI>>>62	string	draw.document+zip	Draw drawing, version 14-16
1594d38c30c0SXin LI!:mime	application/x-vnd.corel.draw.document+zip
1595d38c30c0SXin LI!:ext	cdr
1596d38c30c0SXin LI>>>62	string	draw.template+zip	Draw template, version 14-16
1597d38c30c0SXin LI!:mime	application/x-vnd.corel.draw.template+zip
1598d38c30c0SXin LI!:ext	cdrt
15992726a701SXin LI>>>62	string	zcf.draw.document+zip	Draw drawing, version 17-22
1600d38c30c0SXin LI!:mime	application/x-vnd.corel.zcf.draw.document+zip
1601d38c30c0SXin LI!:ext	cdr
16022726a701SXin LI>>>62	string	zcf.draw.template+zip	Draw template, version 17-22
1603d38c30c0SXin LI!:mime	application/x-vnd.corel.zcf.draw.template+zip
1604d38c30c0SXin LI!:ext	cdt/cdrt
16052726a701SXin LI# URL:	http://product.corel.com/help/CorelDRAW/540240626/Main/EN/Doc/CorelDRAW-Other-file-formats.html
16062726a701SXin LI>>>62	string	zcf.pattern+zip		Draw pattern, version 22
16072726a701SXin LI!:mime	application/x-vnd.corel.zcf.pattern+zip
16082726a701SXin LI!:ext	pat
16092726a701SXin LI# URL:		https://en.wikipedia.org/wiki/Corel_Designer
16102726a701SXin LI# Reference:	http://fileformats.archiveteam.org/wiki/Corel_Designer
16112726a701SXin LI# Note:		called by TrID "Corel DESIGN graphics"
16122726a701SXin LI>>>62	string	designer.document+zip		DESIGNER graphics, version 14-16
16132726a701SXin LI!:mime	application/x-vnd.corel.designer.document+zip
16142726a701SXin LI!:ext	des
16152726a701SXin LI>>>62	string	zcf.designer.document+zip	DESIGNER graphics, version 17-21
16162726a701SXin LI!:mime	application/x-vnd.corel.zcf.designer.document+zip
16172726a701SXin LI!:ext	des
16182726a701SXin LI# URL:	http://product.corel.com/help/CorelDRAW/540223850/Main/EN/Documentation/
16192726a701SXin LI#	CorelDRAW-Corel-Symbol-Library-CSL.html
16202726a701SXin LI>>>62	string	symbol.library+zip		Symbol Library, version 6-16.3
16212726a701SXin LI!:mime	application/x-vnd.corel.symbol.library+zip
16222726a701SXin LI!:ext	csl
16232726a701SXin LI>>>62	string	zcf.symbol.library+zip		Symbol Library, version 17-22
16242726a701SXin LI!:mime	application/x-vnd.corel.zcf.symbol.library+zip
16252726a701SXin LI!:ext	csl
1626d38c30c0SXin LI
1627b6cee71dSXin LI#  Catch other ZIP-with-mimetype formats
1628b6cee71dSXin LI#	In a ZIP file, the bytes immediately after a member's contents are
1629b6cee71dSXin LI#	always "PK". The 2 regex rules here print the "mimetype" member's
1630b6cee71dSXin LI#	contents up to the first 'P'. Luckily, most MIME types don't contain
1631b6cee71dSXin LI#	any capital 'P's. This is a kludge.
1632b6cee71dSXin LI#    (mimetype contains "application/<OTHER>")
1633d38c30c0SXin LI>>50		default	x			Zip data
1634d38c30c0SXin LI>>>38		regex	[!-OQ-~]+		(MIME type "%s"?)
1635b6cee71dSXin LI!:mime	application/zip
1636b6cee71dSXin LI#    (mimetype contents other than "application/*")
1637b6cee71dSXin LI>26		string	\x8\0\0\0mimetype
1638b6cee71dSXin LI>>38		string	!application/
1639b6cee71dSXin LI>>>38		regex	[!-OQ-~]+		Zip data (MIME type "%s"?)
1640b6cee71dSXin LI!:mime	application/zip
1641b6cee71dSXin LI
1642b6cee71dSXin LI# Java Jar files
1643b6cee71dSXin LI>(26.s+30)	leshort	0xcafe		Java archive data (JAR)
1644b6cee71dSXin LI!:mime	application/java-archive
1645b6cee71dSXin LI
164620f8619dSXin LI# iOS App
164720f8619dSXin LI>(26.s+30)	leshort	!0xcafe
164820f8619dSXin LI>>26		string	!\x8\0\0\0mimetype
164920f8619dSXin LI>>>30		string	Payload/
165020f8619dSXin LI>>>>38		search/64       .app/   iOS App
165120f8619dSXin LI!:mime application/x-ios-app
165220f8619dSXin LI
165343a5ec4eSXin LI# Dup, see above.
165443a5ec4eSXin LI#>30	search/100/b application/epub+zip	EPUB document
165543a5ec4eSXin LI#!:mime application/epub+zip
165620f8619dSXin LI
1657b6cee71dSXin LI# Generic zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
1658b6cee71dSXin LI#   Next line excludes specialized formats:
1659b6cee71dSXin LI>(26.s+30)	leshort	!0xcafe
16602726a701SXin LI>>30	search/100/b !application/epub+zip
16612726a701SXin LI>>>26    string          !\x8\0\0\0mimetype	Zip archive data
1662b6cee71dSXin LI!:mime	application/zip
16632726a701SXin LI>>>>4	beshort		x			\b, at least
16642726a701SXin LI>>>>4	use		zipversion
16652726a701SXin LI>>>>4	beshort		x			to extract
166643a5ec4eSXin LI>>>>8	beshort		x			\b, compression method=
166743a5ec4eSXin LI>>>>8	use		zipcompression
16682726a701SXin LI>>>>0x161	string		WINZIP		\b, WinZIP self-extracting
1669b6cee71dSXin LI
1670b6cee71dSXin LI# StarView Metafile
1671b6cee71dSXin LI# From Pierre Ducroquet <pinaraf@pinaraf.info>
1672b6cee71dSXin LI0	string	VCLMTF	StarView MetaFile
1673b6cee71dSXin LI>6	beshort	x	\b, version %d
1674b6cee71dSXin LI>8	belong	x	\b, size %d
1675b6cee71dSXin LI
1676b6cee71dSXin LI# Zoo archiver
1677b6cee71dSXin LI20	lelong		0xfdc4a7dc	Zoo archive data
1678b6cee71dSXin LI!:mime	application/x-zoo
1679b6cee71dSXin LI>4	byte		>48		\b, v%c.
1680b6cee71dSXin LI>>6	byte		>47		\b%c
1681b6cee71dSXin LI>>>7	byte		>47		\b%c
1682b6cee71dSXin LI>32	byte		>0		\b, modify: v%d
1683b6cee71dSXin LI>>33	byte		x		\b.%d+
1684b6cee71dSXin LI>42	lelong		0xfdc4a7dc	\b,
1685b6cee71dSXin LI>>70	byte		>0		extract: v%d
1686b6cee71dSXin LI>>>71	byte		x		\b.%d+
1687b6cee71dSXin LI
1688b6cee71dSXin LI# Shell archives
1689b6cee71dSXin LI10	string		#\ This\ is\ a\ shell\ archive	shell archive text
1690b6cee71dSXin LI!:mime	application/octet-stream
1691b6cee71dSXin LI
1692b6cee71dSXin LI#
1693b6cee71dSXin LI# LBR. NB: May conflict with the questionable
1694b6cee71dSXin LI#          "binary Computer Graphics Metafile" format.
1695b6cee71dSXin LI#
1696b6cee71dSXin LI0       string  \0\ \ \ \ \ \ \ \ \ \ \ \0\0    LBR archive data
1697b6cee71dSXin LI#
1698b6cee71dSXin LI# PMA (CP/M derivative of LHA)
16993e41d09dSXin LI# Update: Joerg Jenderek
17003e41d09dSXin LI# URL: https://en.wikipedia.org/wiki/LHA_(file_format)
1701b6cee71dSXin LI#
17023e41d09dSXin LI#2       string          -pm0-           PMarc archive data [pm0]
17033e41d09dSXin LI2	string		-pm0-
17043e41d09dSXin LI>0	use	lharc-file
17053e41d09dSXin LI#2       string          -pm1-           PMarc archive data [pm1]
17063e41d09dSXin LI2	string		-pm1-
17073e41d09dSXin LI>0	use	lharc-file
17083e41d09dSXin LI#2       string          -pm2-           PMarc archive data [pm2]
17093e41d09dSXin LI2	string		-pm2-
17103e41d09dSXin LI>0	use	lharc-file
1711b6cee71dSXin LI2       string          -pms-           PMarc SFX archive (CP/M, DOS)
17123e41d09dSXin LI#!:mime	application/x-foobar-exec
17133e41d09dSXin LI!:ext com
1714b6cee71dSXin LI5       string          -pc1-           PopCom compressed executable (CP/M)
17153e41d09dSXin LI#!:mime	application/x-
17163e41d09dSXin LI#!:ext com
1717b6cee71dSXin LI
1718b6cee71dSXin LI# From Rafael Laboissiere <rafael@laboissiere.net>
1719b6cee71dSXin LI# The Project Revision Control System (see
1720b6cee71dSXin LI# http://prcs.sourceforge.net) generates a packaged project
1721b6cee71dSXin LI# file which is recognized by the following entry:
1722b6cee71dSXin LI0	leshort		0xeb81	PRCS packaged project
1723b6cee71dSXin LI
1724b6cee71dSXin LI# Microsoft cabinets
1725b6cee71dSXin LI# by David Necas (Yeti) <yeti@physics.muni.cz>
1726b6cee71dSXin LI#0	string	MSCF\0\0\0\0	Microsoft cabinet file data,
1727b6cee71dSXin LI#>25	byte	x		v%d
1728b6cee71dSXin LI#>24	byte	x		\b.%d
1729b6cee71dSXin LI# MPi: All CABs have version 1.3, so this is pointless.
1730b6cee71dSXin LI# Better magic in debian-additions.
1731b6cee71dSXin LI
1732b6cee71dSXin LI# GTKtalog catalogs
1733b6cee71dSXin LI# by David Necas (Yeti) <yeti@physics.muni.cz>
1734b6cee71dSXin LI4	string	gtktalog\ 	GTKtalog catalog data,
1735b6cee71dSXin LI>13	string	3		version 3
1736b6cee71dSXin LI>>14	beshort	0x677a		(gzipped)
1737b6cee71dSXin LI>>14	beshort	!0x677a		(not gzipped)
1738b6cee71dSXin LI>13	string	>3		version %s
1739b6cee71dSXin LI
1740b6cee71dSXin LI############################################################################
1741b6cee71dSXin LI# Parity archive reconstruction file, the 'par' file format now used on Usenet.
1742b6cee71dSXin LI0       string          PAR\0	PARity archive data
1743b6cee71dSXin LI>48	leshort		=0	- Index file
1744b6cee71dSXin LI>48	leshort		>0	- file number %d
1745b6cee71dSXin LI
1746b6cee71dSXin LI# Felix von Leitner <felix-file@fefe.de>
1747b6cee71dSXin LI0	string	d8:announce	BitTorrent file
1748b6cee71dSXin LI!:mime	application/x-bittorrent
1749*a2dfb722SXin LI!:ext	torrent
17503e41d09dSXin LI# Durval Menezes, <jmgthbfile at durval dot com>
17513e41d09dSXin LI0	string	d13:announce-list	BitTorrent file
17523e41d09dSXin LI!:mime	application/x-bittorrent
1753*a2dfb722SXin LI!:ext	torrent
1754d38c30c0SXin LI0	string	d7:comment	BitTorrent file
1755d38c30c0SXin LI!:mime	application/x-bittorrent
1756*a2dfb722SXin LI!:ext	torrent
1757d38c30c0SXin LI0	string	d4:info		BitTorrent file
1758d38c30c0SXin LI!:mime	application/x-bittorrent
1759*a2dfb722SXin LI!:ext	torrent
1760b6cee71dSXin LI
1761b6cee71dSXin LI# Atari MSA archive - Teemu Hukkanen <tjhukkan@iki.fi>
1762a4d6d3b8SXin LI# URL:		http://fileformats.archiveteam.org/wiki/MSA_(Magic_Shadow_Archiver)
1763a4d6d3b8SXin LI# Reference:	http://info-coach.fr/atari/documents/_mydoc/FD_Image_File_Format.pdf
1764a4d6d3b8SXin LI#		http://mark0.net/download/triddefs_xml.7z/defs/m/msa.trid.xml
1765a4d6d3b8SXin LI# Update:	Joerg Jenderek
1766a4d6d3b8SXin LI# Note:		called by TrID "Atari MSA Disk Image" and verified by
1767a4d6d3b8SXin LI#		command like `deark -l -m msa -d2 PDATS578.msa` as " Atari ST floppy disk image"
1768a4d6d3b8SXin LI# GRR: line below is too general as it matches setup.skin
1769a4d6d3b8SXin LI0	beshort 0x0e0f
1770a4d6d3b8SXin LI# skip foo setup.skin with unrealistic high number 52255 of sides by check for valid "low" value
1771a4d6d3b8SXin LI>4	ubeshort <2		Atari MSA archive data
1772a4d6d3b8SXin LI#!:mime	application/octet-stream
1773a4d6d3b8SXin LI!:mime	application/x-atari-msa
1774a4d6d3b8SXin LI!:ext	msa
1775a4d6d3b8SXin LI# sectors per track like: 9 10
1776a4d6d3b8SXin LI>>2	beshort x		\b, %d sectors per track
1777a4d6d3b8SXin LI# sides (0 or 1; add 1 to this to get correct number of sides)
1778a4d6d3b8SXin LI>>4	beshort 0		\b, 1 sided
1779a4d6d3b8SXin LI>>4	beshort 1		\b, 2 sided
1780a4d6d3b8SXin LI# starting track like: 0
1781a4d6d3b8SXin LI>>6	beshort x		\b, starting track: %d
1782a4d6d3b8SXin LI# ending track like: 39 79 80 81
1783a4d6d3b8SXin LI>>8	beshort x		\b, ending track: %d
1784a4d6d3b8SXin LI# tracks content
1785a4d6d3b8SXin LI#>>10	ubequad x		\b, track content %#16.16llx
1786b6cee71dSXin LI
1787b6cee71dSXin LI# Alternate ZIP string (amc@arwen.cs.berkeley.edu)
1788b6cee71dSXin LI0	string	PK00PK\003\004	Zip archive data
178958a0f0d0SEitan Adler!:mime	application/zip
179058a0f0d0SEitan Adler!:ext zip/cbz
1791b6cee71dSXin LI
1792b6cee71dSXin LI# ACE archive (from http://www.wotsit.org/download.asp?f=ace)
1793b6cee71dSXin LI# by Stefan `Sec` Zehl <sec@42.org>
1794b6cee71dSXin LI7	string		**ACE**		ACE archive data
1795a4d6d3b8SXin LI!:mime	application/x-ace-compressed
1796a4d6d3b8SXin LI!:ext	ace
1797b6cee71dSXin LI>15	byte	>0		version %d
1798b6cee71dSXin LI>16	byte	=0x00		\b, from MS-DOS
1799b6cee71dSXin LI>16	byte	=0x01		\b, from OS/2
1800b6cee71dSXin LI>16	byte	=0x02		\b, from Win/32
1801b6cee71dSXin LI>16	byte	=0x03		\b, from Unix
1802b6cee71dSXin LI>16	byte	=0x04		\b, from MacOS
1803b6cee71dSXin LI>16	byte	=0x05		\b, from WinNT
1804b6cee71dSXin LI>16	byte	=0x06		\b, from Primos
1805b6cee71dSXin LI>16	byte	=0x07		\b, from AppleGS
1806b6cee71dSXin LI>16	byte	=0x08		\b, from Atari
1807b6cee71dSXin LI>16	byte	=0x09		\b, from Vax/VMS
1808b6cee71dSXin LI>16	byte	=0x0A		\b, from Amiga
1809b6cee71dSXin LI>16	byte	=0x0B		\b, from Next
1810b6cee71dSXin LI>14	byte	x		\b, version %d to extract
1811b6cee71dSXin LI>5	leshort &0x0080		\b, multiple volumes,
1812b6cee71dSXin LI>>17	byte	x		\b (part %d),
1813b6cee71dSXin LI>5	leshort &0x0002		\b, contains comment
1814b6cee71dSXin LI>5	leshort	&0x0200		\b, sfx
1815b6cee71dSXin LI>5	leshort	&0x0400		\b, small dictionary
1816b6cee71dSXin LI>5	leshort	&0x0800		\b, multi-volume
1817b6cee71dSXin LI>5	leshort	&0x1000		\b, contains AV-String
1818b6cee71dSXin LI>>30	string	\x16*UNREGISTERED\x20VERSION*	(unregistered)
1819b6cee71dSXin LI>5	leshort &0x2000		\b, with recovery record
1820b6cee71dSXin LI>5	leshort &0x4000		\b, locked
1821b6cee71dSXin LI>5	leshort &0x8000		\b, solid
1822b6cee71dSXin LI# Date in MS-DOS format (whatever that is)
1823b6cee71dSXin LI#>18	lelong	x		Created on
1824b6cee71dSXin LI
1825b6cee71dSXin LI# sfArk : compression program for Soundfonts (sf2) by Dirk Jagdmann
1826b6cee71dSXin LI# <doj@cubic.org>
1827b6cee71dSXin LI0x1A	string	sfArk		sfArk compressed Soundfont
1828b6cee71dSXin LI>0x15	string	2
1829b6cee71dSXin LI>>0x1	string	>\0		Version %s
1830b6cee71dSXin LI>>0x2A	string	>\0		: %s
1831b6cee71dSXin LI
1832b6cee71dSXin LI# DR-DOS 7.03 Packed File *.??_
183343a5ec4eSXin LI# Reference: http://www.antonis.de/dos/dos-tuts/mpdostip/html/nwdostip.htm
183443a5ec4eSXin LI# Note:	unpacked by PNUNPACK.EXE
183543a5ec4eSXin LI0	string	Packed\ File\
183643a5ec4eSXin LI# by looking for Control-Z skip ASCII text starting with Packed File
183743a5ec4eSXin LI>0x18	ubyte	0x1a		Personal NetWare Packed File
183843a5ec4eSXin LI!:mime	application/x-novell-compress
183943a5ec4eSXin LI!:ext	??_
184043a5ec4eSXin LI>>12	string	x		\b, was "%.12s"
184143a5ec4eSXin LI# 1 or 2
184243a5ec4eSXin LI#>>0x19	ubyte	x		\b, at 0x19 %u
184343a5ec4eSXin LI>>0x1b	ulelong	x		with %u bytes
1844b6cee71dSXin LI
1845b6cee71dSXin LI# EET archive
1846b6cee71dSXin LI# From: Tilman Sauerbeck <tilman@code-monkey.de>
1847b6cee71dSXin LI0	belong	0x1ee7ff00	EET archive
1848b6cee71dSXin LI!:mime	application/x-eet
1849b6cee71dSXin LI
1850b6cee71dSXin LI# rzip archives
1851b6cee71dSXin LI0	string	RZIP		rzip compressed data
1852b6cee71dSXin LI>4	byte	x		- version %d
1853b6cee71dSXin LI>5	byte	x		\b.%d
1854b6cee71dSXin LI>6	belong	x		(%d bytes)
1855b6cee71dSXin LI
185648c779cdSXin LI# From:		Joerg Jenderek
185748c779cdSXin LI# URL:		https://help.foxitsoftware.com/kb/install-fzip-file.php
185848c779cdSXin LI# reference:	http://mark0.net/download/triddefs_xml.7z/
185948c779cdSXin LI#		defs/f/fzip.trid.xml
186048c779cdSXin LI# Note: unknown compression; No "PK" zip magic; normally in directory like
186148c779cdSXin LI#	"%APPDATA%\Foxit Software\Addon\Foxit Reader\Install"
186248c779cdSXin LI0	ubequad	0x2506781901010000	Foxit add-on/update
186348c779cdSXin LI!:mime	application/x-fzip
186448c779cdSXin LI!:ext	fzip
186548c779cdSXin LI
1866b6cee71dSXin LI# From: "Robert Dale" <robdale@gmail.com>
1867b6cee71dSXin LI0	belong	123		dar archive,
1868b6cee71dSXin LI>4	belong	x		label "%.8x
1869b6cee71dSXin LI>>8	belong	x		%.8x
1870b6cee71dSXin LI>>>12	beshort	x		%.4x"
1871b6cee71dSXin LI>14	byte	0x54		end slice
1872b6cee71dSXin LI>14	beshort	0x4e4e		multi-part
1873b6cee71dSXin LI>14	beshort	0x4e53		multi-part, with -S
1874b6cee71dSXin LI
1875b6cee71dSXin LI# Symbian installation files
187648c779cdSXin LI#  https://www.thouky.co.uk/software/psifs/sis.html
1877b6cee71dSXin LI#  http://developer.symbian.com/main/downloads/papers/SymbianOSv91/softwareinstallsis.pdf
1878b6cee71dSXin LI8	lelong	0x10000419	Symbian installation file
1879b6cee71dSXin LI!:mime	application/vnd.symbian.install
1880b6cee71dSXin LI>4	lelong	0x1000006D	(EPOC release 3/4/5)
1881b6cee71dSXin LI>4	lelong	0x10003A12	(EPOC release 6)
1882b6cee71dSXin LI0	lelong	0x10201A7A	Symbian installation file (Symbian OS 9.x)
1883b6cee71dSXin LI!:mime	x-epoc/x-sisx-app
1884b6cee71dSXin LI
1885b6cee71dSXin LI# From "Nelson A. de Oliveira" <naoliv@gmail.com>
1886b6cee71dSXin LI0	string	MPQ\032		MoPaQ (MPQ) archive
1887b6cee71dSXin LI
1888b6cee71dSXin LI# From: "Nelson A. de Oliveira" <naoliv@gmail.com>
1889b6cee71dSXin LI# .kgb
1890b6cee71dSXin LI0	string KGB_arch		KGB Archiver file
1891b6cee71dSXin LI>10	string x		with compression level %.1s
1892b6cee71dSXin LI
1893b6cee71dSXin LI# xar (eXtensible ARchiver) archive
189448c779cdSXin LI# URL: https://en.wikipedia.org/wiki/Xar_(archiver)
189548c779cdSXin LI# xar archive format: https://code.google.com/p/xar/
1896b6cee71dSXin LI# From: "David Remahl" <dremahl@apple.com>
189748c779cdSXin LI# Update: Joerg Jenderek
189848c779cdSXin LI# TODO: lzma compression; X509Data for pkg and xip
189948c779cdSXin LI# Note: verified by `xar --dump-header -f FullBundleUpdate.xar` or
190048c779cdSXin LI# 7z t -txar Xcode_10.2_beta_4.xip`
1901b6cee71dSXin LI0	string	xar!		xar archive
19023e41d09dSXin LI!:mime	application/x-xar
190348c779cdSXin LI# pkg for Mac OSX installer package like FullBundleUpdate.pkg
190448c779cdSXin LI# xip for signed Apple software like Xcode_10.2_beta_4.xip
190548c779cdSXin LI!:ext	xar/pkg/xip
190648c779cdSXin LI# always 28 in older archives
190748c779cdSXin LI>4	ubeshort >28		\b, header size %u
190848c779cdSXin LI# currently there exit only version 1 since about 2014
190948c779cdSXin LI>6	ubeshort >1		version %u,
191048c779cdSXin LI>8	ubequad	x		compressed TOC: %llu,
191148c779cdSXin LI#>16	ubequad	x		uncompressed TOC: %llu,
191248c779cdSXin LI# cksum_alg 0-2 in older and also 3-4 in newer
1913b6cee71dSXin LI>24	belong	0		no checksum
1914b6cee71dSXin LI>24	belong	1		SHA-1 checksum
1915b6cee71dSXin LI>24	belong	2		MD5 checksum
191648c779cdSXin LI>24	belong	3		SHA-256 checksum
191748c779cdSXin LI>24	belong	4		SHA-512 checksum
191843a5ec4eSXin LI>24	belong	>4		unknown %#x checksum
191948c779cdSXin LI#>24	belong	>4		checksum
192048c779cdSXin LI#			For no compression jump 0 bytes
192148c779cdSXin LI>24	belong	0
192248c779cdSXin LI>>0		ubyte	x
192348c779cdSXin LI# jump more bytes forward by header size
192448c779cdSXin LI>>>&(4.S)	ubyte	x
192548c779cdSXin LI# jump more bytes forward by compressed table of contents size
192643a5ec4eSXin LI#>>>>&(8.Q)	ubequad	x	\b, heap data %#llx
192748c779cdSXin LI>>>>&(8.Q)	ubyte	x
192848c779cdSXin LI# look for data by ./compress after message with 1 space at end
192948c779cdSXin LI>>>>>&-3	indirect x	\b, contains
193048c779cdSXin LI#			For SHA-1 jump 20 minus 2 bytes
193148c779cdSXin LI>24	belong	1
193248c779cdSXin LI>>18		ubyte	x
193348c779cdSXin LI# jump more bytes forward by header size
193448c779cdSXin LI>>>&(4.S)	ubyte	x
193548c779cdSXin LI# jump more bytes forward by compressed table of contents size
193648c779cdSXin LI>>>>&(8.Q)	ubyte	x
193748c779cdSXin LI# data compressed by gzip, bzip, lzma or none
193848c779cdSXin LI>>>>>&-1	indirect x	\b, contains
193948c779cdSXin LI#			For SHA-256 jump 32 minus 2 bytes
194048c779cdSXin LI>24	belong	3
194148c779cdSXin LI>>30		ubyte	x
194248c779cdSXin LI# jump more bytes forward by header size
194348c779cdSXin LI>>>&(4.S)	ubyte	x
194448c779cdSXin LI# jump more bytes forward by compressed table of contents size
194548c779cdSXin LI>>>>&(8.Q)	ubyte	x
194648c779cdSXin LI>>>>>&-1	indirect x	\b, contains
194748c779cdSXin LI#			For SHA-512 jump 64 minus 2 bytes
194848c779cdSXin LI>24	belong	4
194948c779cdSXin LI>>62		ubyte	x
195048c779cdSXin LI# jump more bytes forward by header size
195148c779cdSXin LI>>>&(4.S)	ubyte	x
195248c779cdSXin LI# jump more bytes forward by compressed table of contents size
195348c779cdSXin LI>>>>&(8.Q)	ubyte	x
195448c779cdSXin LI>>>>>&-1	indirect x	\b, contains
1955b6cee71dSXin LI
1956b6cee71dSXin LI# Type: Parity Archive
1957b6cee71dSXin LI# From: Daniel van Eeden <daniel_e@dds.nl>
1958b6cee71dSXin LI0	string	PAR2		Parity Archive Volume Set
1959b6cee71dSXin LI
1960b6cee71dSXin LI# Bacula volume format. (Volumes always start with a block header.)
196148c779cdSXin LI# URL: https://bacula.org/3.0.x-manuals/en/developers/developers/Block_Header.html
1962b6cee71dSXin LI# From: Adam Buchbinder <adam.buchbinder@gmail.com>
1963b6cee71dSXin LI12	string	BB02		Bacula volume
1964b6cee71dSXin LI>20	bedate	x		\b, started %s
1965b6cee71dSXin LI
1966b6cee71dSXin LI# ePub is XHTML + XML inside a ZIP archive.  The first member of the
1967b6cee71dSXin LI#   archive must be an uncompressed file called 'mimetype' with contents
1968b6cee71dSXin LI#   'application/epub+zip'
1969b6cee71dSXin LI
1970b6cee71dSXin LI
1971b6cee71dSXin LI# From: "Michael Gorny" <mgorny@gentoo.org>
1972b6cee71dSXin LI# ZPAQ: http://mattmahoney.net/dc/zpaq.html
1973b6cee71dSXin LI0	string	zPQ	ZPAQ stream
1974b6cee71dSXin LI>3	byte	x	\b, level %d
19755f0216bdSXin LI# From: Barry Carter <carter.barry@gmail.com>
197648c779cdSXin LI# https://encode.ru/threads/456-zpaq-updates/page32
19775f0216bdSXin LI0	string	7kSt	ZPAQ file
1978b6cee71dSXin LI
1979b6cee71dSXin LI# BBeB ebook, unencrypted (LRF format)
198048c779cdSXin LI# URL: https://www.sven.de/librie/Librie/LrfFormat
1981b6cee71dSXin LI# From: Adam Buchbinder <adam.buchbinder@gmail.com>
1982b6cee71dSXin LI0	string	L\0R\0F\0\0\0	BBeB ebook data, unencrypted
1983b6cee71dSXin LI>8	beshort	x		\b, version %d
1984b6cee71dSXin LI>36	byte	1		\b, front-to-back
1985b6cee71dSXin LI>36	byte	16		\b, back-to-front
1986b6cee71dSXin LI>42	beshort	x		\b, (%dx,
1987b6cee71dSXin LI>44	beshort	x		%d)
1988b6cee71dSXin LI
1989b6cee71dSXin LI# Symantec GHOST image by Joerg Jenderek at May 2014
199048c779cdSXin LI# https://us.norton.com/ghost/
199148c779cdSXin LI# https://www.garykessler.net/library/file_sigs.html
1992b6cee71dSXin LI0		ubelong&0xFFFFf7f0	0xFEEF0100	Norton GHost image
1993b6cee71dSXin LI# *.GHO
1994b6cee71dSXin LI>2		ubyte&0x08		0x00		\b, first file
1995b6cee71dSXin LI# *.GHS or *.[0-9] with cns program option
1996b6cee71dSXin LI>2		ubyte&0x08		0x08		\b, split file
1997b6cee71dSXin LI# part of split index interesting for *.ghs
199843a5ec4eSXin LI>>4		ubyte			x		id=%#x
1999b6cee71dSXin LI# compression tag minus one equals numeric compression command line switch z[1-9]
2000b6cee71dSXin LI>3		ubyte			0		\b, no compression
2001b6cee71dSXin LI>3		ubyte			2		\b, fast compression (Z1)
2002b6cee71dSXin LI>3		ubyte			3		\b, medium compression (Z2)
2003b6cee71dSXin LI>3		ubyte			>3
2004b6cee71dSXin LI>>3		ubyte			<11		\b, compression (Z%d-1)
2005b6cee71dSXin LI>2		ubyte&0x08		0x00
2006b6cee71dSXin LI# ~ 30 byte password field only for *.gho
2007b6cee71dSXin LI>>12		ubequad			!0		\b, password protected
2008b6cee71dSXin LI>>44		ubyte			!1
2009b6cee71dSXin LI# 1~Image All, sector-by-sector only for *.gho
2010b6cee71dSXin LI>>>10		ubyte			1		\b, sector copy
2011b6cee71dSXin LI# 1~Image Boot track only for *.gho
2012b6cee71dSXin LI>>>43		ubyte			1		\b, boot track
2013b6cee71dSXin LI# 1~Image Disc only for *.gho implies Image Boot track and sector copy
2014b6cee71dSXin LI>>44		ubyte			1		\b, disc sector copy
2015b6cee71dSXin LI# optional image description only *.gho
2016b6cee71dSXin LI>>0xff		string			>\0		"%-.254s"
2017b6cee71dSXin LI# look for DOS sector end sequence
2018b6cee71dSXin LI>0xE08	search/7776		\x55\xAA
2019b6cee71dSXin LI>>&-512	indirect		x		\b; contains
2020b6cee71dSXin LI
20213e41d09dSXin LI# Google Chrome extensions
20223e41d09dSXin LI# https://developer.chrome.com/extensions/crx
20233e41d09dSXin LI# https://developer.chrome.com/extensions/hosting
20243e41d09dSXin LI0	string	Cr24	Google Chrome extension
20253e41d09dSXin LI!:mime	application/x-chrome-extension
20263e41d09dSXin LI>4	ulong	x	\b, version %u
202740427ccaSGordon Tetlow
202840427ccaSGordon Tetlow# SeqBox - Sequenced container
202940427ccaSGordon Tetlow# ext: sbx, seqbox
203040427ccaSGordon Tetlow# Marco Pontello marcopon@gmail.com
203140427ccaSGordon Tetlow# reference: https://github.com/MarcoPon/SeqBox
203240427ccaSGordon Tetlow0	string	SBx	SeqBox,
203340427ccaSGordon Tetlow>3	byte	x	version %d
203458a0f0d0SEitan Adler
203558a0f0d0SEitan Adler# LyNX archive
203658a0f0d0SEitan Adler56	string	USE\040LYNX\040TO\040DISSOLVE\040THIS\040FILE	 LyNX archive
203748c779cdSXin LI
203848c779cdSXin LI# From: Joerg Jenderek
203948c779cdSXin LI# URL: https://www.acronis.com/
204048c779cdSXin LI# Reference: https://en.wikipedia.org/wiki/TIB_(file_format)
204148c779cdSXin LI# Note: only tested with True Image 2013 Build 5962 and 2019 Build 14110
204248c779cdSXin LI0	ubequad		0xce24b9a220000000	Acronis True Image backup
204348c779cdSXin LI!:mime	application/x-acronis-tib
204448c779cdSXin LI!:ext	tib
204548c779cdSXin LI# 01000000
204643a5ec4eSXin LI#>20	ubelong		x			\b, at 20 %#x
204748c779cdSXin LI# 20000000
204843a5ec4eSXin LI#>28	ubelong		x			\b, at 28 %#x
204948c779cdSXin LI# strings like "Generic- SD/MMC 1.00" "Unknown Disk" "Msft Virtual Disk 1.0"
205048c779cdSXin LI# ???
205148c779cdSXin LI# strings like "\Device\0000011e" "\Device\0000015a"
205248c779cdSXin LI#>0	search/0x6852300/cs	\\Device\\
205348c779cdSXin LI#>>&-1	pstring		x			\b, %s
205448c779cdSXin LI# "\Device\HarddiskVolume30" "\Device\HarddiskVolume39"
205548c779cdSXin LI#>>>&1	search/180/cs	\\Device\\
205648c779cdSXin LI#>>>>&-1	pstring		x			\b, %s
205748c779cdSXin LI#>>>>>&0	search/29/cs	\0\0\xc8\0
205848c779cdSXin LI# disk label
205948c779cdSXin LI#>>>>>>&10	lestring16	x		\b, disk label %11.11s
206048c779cdSXin LI#>>>>>>&9	plestring16	x		\b, disk label "%11.11s"
206148c779cdSXin LI#>>>>>>&10	ubequad	x			%16.16llx
206248c779cdSXin LI
206348c779cdSXin LI
206448c779cdSXin LI# Gentoo XPAK binary package
206548c779cdSXin LI# by Michal Gorny <mgorny@gentoo.org>
206648c779cdSXin LI# https://gitweb.gentoo.org/proj/portage.git/tree/man/xpak.5
206748c779cdSXin LI-4	string	STOP
206848c779cdSXin LI>-16	string	XPAKSTOP	Gentoo binary package (XPAK)
206948c779cdSXin LI
207048c779cdSXin LI# From:		Joerg Jenderek
207148c779cdSXin LI# URL:		https://kodi.wiki/view/TexturePacker
207248c779cdSXin LI# Reference:	https://mirrors.kodi.tv/releases/source/17.3-Krypton.tar.gz
207348c779cdSXin LI# /xbmc-Krypton/xbmc/guilib/XBTF.h
207448c779cdSXin LI# /xbmc-Krypton/xbmc/guilib/XBTF.cpp
207548c779cdSXin LI0	string	XBTF
207648c779cdSXin LI# skip ASCII text by looking for terminating \0 of path
207748c779cdSXin LI>264	ubyte	0		XBMC texture package
207848c779cdSXin LI!:mime	application/x-xbmc-xbt
207948c779cdSXin LI!:ext	xbt
208048c779cdSXin LI# XBTF_VERSION 2
208148c779cdSXin LI>>4	string	!2		\b, version %-.1s
208248c779cdSXin LI# nofFiles /xbmc-Krypton/xbmc/guilib/XBTFReader.cpp
208348c779cdSXin LI>>5	ulelong	x		\b, %u file
208448c779cdSXin LI# plural s
208548c779cdSXin LI>>5	ulelong	>1		\bs
208648c779cdSXin LI# path[CXBTFFile[MaximumPathLength=256]
208748c779cdSXin LI>>9	string	x		\b, 1st %s
208848c779cdSXin LI
208943a5ec4eSXin LI# ALZIP archive
209043a5ec4eSXin LI# by Hyungjun Park <hyungjun.park@worksmobile.com>, Hajin Jang <hajin_jang@worksmobile.com>
209143a5ec4eSXin LI# http://kippler.com/win/unalz/
209243a5ec4eSXin LI# https://salsa.debian.org/l10n-korean-team/unalz
209343a5ec4eSXin LI0	string	ALZ\001		ALZ archive data
209443a5ec4eSXin LI!:ext   alz
209543a5ec4eSXin LI
209643a5ec4eSXin LI# https://cf-aldn.altools.co.kr/setup/EGG_Specification.zip
209743a5ec4eSXin LI0	string	EGGA		EGG archive data,
209843a5ec4eSXin LI!:ext   egg
209943a5ec4eSXin LI>5	byte	x		version %u
210043a5ec4eSXin LI>4	byte	x		\b.%u
210143a5ec4eSXin LI>>0x0E	ulelong	=0x08E28222
210243a5ec4eSXin LI>>0x0E	ulelong	=0x24F5A262	\b, split
210343a5ec4eSXin LI>>0x0E	ulelong	=0x24E5A060	\b, solid
210443a5ec4eSXin LI>>0x0E	default	x		\b, unknown
210543a5ec4eSXin LI
210643a5ec4eSXin LI# PAQ9A archive
210743a5ec4eSXin LI# URL: http://mattmahoney.net/dc/#paq9a
210843a5ec4eSXin LI# Note: Line 1186 of paq9a.cpp gives the magic bytes
210943a5ec4eSXin LI0	string	pQ9\001		PAQ9A archive
2110*a2dfb722SXin LI
2111*a2dfb722SXin LI# From wof (wof@stachelkaktus.net)
2112*a2dfb722SXin LI0	string	Unison\ archive\ format	Unison archive format
2113