xref: /freebsd/contrib/file/magic/Magdir/archive (revision ae316d1d1cffd71ab7751f94e10118777a88e027)
1b6cee71dSXin LI#------------------------------------------------------------------------------
2*ae316d1dSXin LI# $File: archive,v 1.207 2024/11/27 15:37:46 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*ae316d1dSXin LI# check for specific 1st member name that indicates other mime type and file name suffix
29*ae316d1dSXin LI>>>>>>>>0	string		TpmEmuTpms/permall
30*ae316d1dSXin LI# maybe also look for 2nd tar member efi/nvram containing UEFI variables part
31*ae316d1dSXin LI#>>>>>>>>>512	search/0x1800	efi/nvram\0		EFI_PART_FOUND
32*ae316d1dSXin LI>>>>>>>>>0	use	tar-nvram
33a2dfb722SXin LI# FOR DEBUGGING:
34a2dfb722SXin LI#>>>>>>>>0	regex		\^[0-9]{2,4}[.](png|jpg|jpeg|tif|tiff|gif|bmp)	NAME "%s"
35a2dfb722SXin LI# check for 1st image main name with digits used for sorting
36a2dfb722SXin LI# and for name extension case insensitive like: PNG JPG JPEG TIF TIFF GIF BMP
37a2dfb722SXin LI>>>>>>>>0	regex		\^[0-9]{2,4}[.](png|jpg|jpeg|tif|tiff|gif|bmp)
38a2dfb722SXin LI>>>>>>>>>0	use	tar-cbt
39898496eeSXin LI# check for 1st member name with ovf suffix
40898496eeSXin LI>>>>>>>>0	regex		\^.{1,96}[.](ovf)
41898496eeSXin LI>>>>>>>>>0	use	tar-ova
42*ae316d1dSXin LI# look for relative directory ./var/ or ./lte/ as 1st member name that indicates AVM firmware with other file name suffix
43*ae316d1dSXin LI>>>>>>>>0	ubequad&0xFFffE5eaE8ffFFff	0x2e2f6460602f0000
44*ae316d1dSXin LI>>>>>>>>>0	use	tar-avm
45*ae316d1dSXin LI# maybe look for AVM specific 2nd name entry
46*ae316d1dSXin LI# >>>>>>>>>517	string		/content\0	content~
47*ae316d1dSXin LI# >>>>>>>>>>0	use	tar-avm
48*ae316d1dSXin LI# >>>>>>>>>517	string		/install\0	install~
49*ae316d1dSXin LI# >>>>>>>>>>0	use	tar-avm
50*ae316d1dSXin LI# >>>>>>>>>517	string		/chksum\0	chksum~
51*ae316d1dSXin LI# >>>>>>>>>>0	use	tar-avm
52*ae316d1dSXin LI# >>>>>>>>>517	string		/modfw.nfo\0	modfw~
53*ae316d1dSXin LI# >>>>>>>>>>0	use	tar-avm
54*ae316d1dSXin LI# most (419/429) *.WBM (71/71) *.WBT with user name jcameron of Webmin developer Jamie Cameron in first tar archive member
55*ae316d1dSXin LI>>>>>>>>265	string		jcameron
56*ae316d1dSXin LI>>>>>>>>>0	use	tar-webmin
57*ae316d1dSXin LI# if 1st member name without digits and without used image suffix, without *.ovf,
58*ae316d1dSXin LI# ./var/ , ./lte/ and TpmEmuTpms/ then it is a pure TAR archive or Webmin without jcameron user name
59a2dfb722SXin LI>>>>>>>>0	default		x
60*ae316d1dSXin LI# few (10/429) *.WBM without user name jcameron in 1st tar member but with WBM module.info name like:
61*ae316d1dSXin LI# apcupsd-0.81-2.wbm csavupdate.wbm cwmail.wbm dac960.wbm etcupdate.wbm logviewer.wbm memcached.wbm rinetd.wbm shoutcast.wbm vacationadmin-webmin-module-1.1.2.wbm
62*ae316d1dSXin LI# few (10/95) *.WBT without user name jcameron in 1st tar member but with WBT theme.info name like:
63*ae316d1dSXin LI# authentic-theme-21.09.5.wbt Mozilla-Modern.wbt virtual-server-theme-2.7.wbt fkn-webmintheme.0.6.0.wbt
64*ae316d1dSXin LI>>>>>>>>>512	search/210965/s	e.info\0
65*ae316d1dSXin LI>>>>>>>>>>0	use	tar-webmin
66*ae316d1dSXin LI# pure TAR
67*ae316d1dSXin LI>>>>>>>>>0	default		x
68*ae316d1dSXin LI>>>>>>>>>>0	use	tar-file
69*ae316d1dSXin LI# Note:	called "TAR - Tape ARchive" by TrID, "Tape Archive Format" by DROID via PUID x-fmt/265
70*ae316d1dSXin LI#	and "Tar archive" by shared MIME-info database from freedesktop.org
7158a0f0d0SEitan Adler#	minimal check and then display tar archive information which can also be
7258a0f0d0SEitan Adler#	embedded inside others like Android Backup, Clam AntiVirus database
7358a0f0d0SEitan Adler0	name		tar-file
7458a0f0d0SEitan Adler>257	string		!ustar
7558a0f0d0SEitan Adler# header padded with nuls
7658a0f0d0SEitan Adler>>257	ulong		=0
7758a0f0d0SEitan Adler# GNU tar version 1.29 with non pax format option without refusing
7858a0f0d0SEitan Adler# creates misleading V7 header for Long path, Multi-volume, Volume type
7958a0f0d0SEitan Adler>>>156	ubyte		0x4c		GNU tar archive
8058a0f0d0SEitan Adler!:mime	application/x-gtar
8158a0f0d0SEitan Adler!:ext	tar/gtar
8258a0f0d0SEitan Adler>>>156	ubyte		0x4d		GNU tar archive
8358a0f0d0SEitan Adler!:mime	application/x-gtar
8458a0f0d0SEitan Adler!:ext	tar/gtar
8558a0f0d0SEitan Adler>>>156	ubyte		0x56		GNU tar archive
8658a0f0d0SEitan Adler!:mime	application/x-gtar
8758a0f0d0SEitan Adler!:ext	tar/gtar
8858a0f0d0SEitan Adler>>>156	default		x		tar archive (V7)
8958a0f0d0SEitan Adler!:mime	application/x-tar
9058a0f0d0SEitan Adler!:ext	tar
9158a0f0d0SEitan Adler# other stuff in padding
9258a0f0d0SEitan Adler# some implementations add new fields to the blank area at the end of the header record
9358a0f0d0SEitan Adler# created for example by DOS TAR 3.20g 1994 Tim V.Shapore with -j option
9458a0f0d0SEitan Adler>>257	ulong		!0		tar archive (old)
9558a0f0d0SEitan Adler!:mime	application/x-tar
9658a0f0d0SEitan Adler!:ext	tar
9758a0f0d0SEitan Adler# magic in newer, GNU, posix variants
9858a0f0d0SEitan Adler>257	string		=ustar
9958a0f0d0SEitan Adler# 2 last char of magic and UStar version because string expression does not work
10058a0f0d0SEitan Adler# 2 space characters followed by a null for GNU variant
10158a0f0d0SEitan Adler>>261	ubelong		=0x72202000	POSIX tar archive (GNU)
10258a0f0d0SEitan Adler!:mime	application/x-gtar
10358a0f0d0SEitan Adler!:ext	tar/gtar
10458a0f0d0SEitan Adler# UStar version with ASCII "00"
10558a0f0d0SEitan Adler>>261	ubelong		0x72003030	POSIX
10658a0f0d0SEitan Adler# gLOBAL and ExTENSION type only found in POSIX.1-2001 format
10758a0f0d0SEitan Adler>>>156	ubyte		0x67		\b.1-2001
10858a0f0d0SEitan Adler>>>156	ubyte		0x78		\b.1-2001
10958a0f0d0SEitan Adler>>>156	ubyte		x		tar archive
11058a0f0d0SEitan Adler!:mime	application/x-ustar
11158a0f0d0SEitan Adler!:ext	tar/ustar
11258a0f0d0SEitan Adler# version with 2 binary nuls embedded in Android Backup like com.android.settings.ab
11358a0f0d0SEitan Adler>>261	ubelong		0x72000000	tar archive (ustar)
11458a0f0d0SEitan Adler!:mime	application/x-ustar
11558a0f0d0SEitan Adler!:ext	tar/ustar
11658a0f0d0SEitan Adler# not seen ustar variant with garbish version
11758a0f0d0SEitan Adler>>261	default		x		tar archive (unknown ustar)
11858a0f0d0SEitan Adler!:mime	application/x-ustar
11958a0f0d0SEitan Adler!:ext	tar/ustar
120*ae316d1dSXin LI# show information for 1st tar archive member
121*ae316d1dSXin LI>0	use	tar-entry
122*ae316d1dSXin LI#	display information of tar archive member (file type, name, permissions, user, group)
123*ae316d1dSXin LI0	name		tar-entry
124*ae316d1dSXin LI# type flag of tar archive member
12558a0f0d0SEitan Adler#>156	ubyte		x		\b, %c-type
12658a0f0d0SEitan Adler>156	ubyte		x
12758a0f0d0SEitan Adler>>156	ubyte		0		\b, file
12858a0f0d0SEitan Adler>>156	ubyte		0x30		\b, file
12958a0f0d0SEitan Adler>>156	ubyte		0x31		\b, hard link
13058a0f0d0SEitan Adler>>156	ubyte		0x32		\b, symlink
13158a0f0d0SEitan Adler>>156	ubyte		0x33		\b, char device
13258a0f0d0SEitan Adler>>156	ubyte		0x34		\b, block device
13358a0f0d0SEitan Adler>>156	ubyte		0x35		\b, directory
13458a0f0d0SEitan Adler>>156	ubyte		0x36		\b, fifo
13558a0f0d0SEitan Adler>>156	ubyte		0x37		\b, reserved
13658a0f0d0SEitan Adler>>156	ubyte		0x4c		\b, long path
13758a0f0d0SEitan Adler>>156	ubyte		0x4d		\b, multi volume
13858a0f0d0SEitan Adler>>156	ubyte		0x56		\b, volume
13958a0f0d0SEitan Adler>>156	ubyte		0x67		\b, global
14058a0f0d0SEitan Adler>>156	ubyte		0x78		\b, extension
14158a0f0d0SEitan Adler>>156	default		x		\b, type
14258a0f0d0SEitan Adler>>>156	ubyte		x		'%c'
14358a0f0d0SEitan Adler# name[100]
14458a0f0d0SEitan Adler>0	string		>\0		%-.60s
14558a0f0d0SEitan Adler# mode mainly stored as an octal number in ASCII null or space terminated
14658a0f0d0SEitan Adler>100	string		>\0		\b, mode %-.7s
14758a0f0d0SEitan Adler# user id mainly as octal numbers in ASCII null or space terminated
14858a0f0d0SEitan Adler>108	string		>\0		\b, uid %-.7s
14958a0f0d0SEitan Adler# group id mainly as octal numbers in ASCII null or space terminated
15058a0f0d0SEitan Adler>116	string		>\0		\b, gid %-.7s
15158a0f0d0SEitan Adler# size mainly as octal number in ASCII
15258a0f0d0SEitan Adler>124	ubyte		<0x38
15358a0f0d0SEitan Adler>>124	string		>\0		\b, size %-.12s
15458a0f0d0SEitan Adler# coding indicated by setting the high-order bit of the leftmost byte
15558a0f0d0SEitan Adler>124	ubyte		>0xEF		\b, size 0x
15658a0f0d0SEitan Adler>>124	ubyte		!0xff		\b%2.2x
15758a0f0d0SEitan Adler>>125	ubyte		!0xff		\b%2.2x
15858a0f0d0SEitan Adler>>126	ubyte		!0xff		\b%2.2x
15958a0f0d0SEitan Adler>>127	ubyte		!0xff		\b%2.2x
16058a0f0d0SEitan Adler>>128	ubyte		!0xff		\b%2.2x
16158a0f0d0SEitan Adler>>129	ubyte		!0xff		\b%2.2x
16258a0f0d0SEitan Adler>>130	ubyte		!0xff		\b%2.2x
16358a0f0d0SEitan Adler>>131	ubyte		!0xff		\b%2.2x
16458a0f0d0SEitan Adler>>132	ubyte		!0xff		\b%2.2x
16558a0f0d0SEitan Adler>>133	ubyte		!0xff		\b%2.2x
16658a0f0d0SEitan Adler>>134	ubyte		!0xff		\b%2.2x
16758a0f0d0SEitan Adler>>135	ubyte		!0xff		\b%2.2x
16858a0f0d0SEitan Adler# seconds since 0:0:0 1 jan 1970 UTC as octal number mainly in ASCII null or space terminated
16958a0f0d0SEitan Adler>136	string		>\0		\b, seconds %-.11s
17058a0f0d0SEitan Adler# header checksum stored as an octal number in ASCII null or space terminated
17158a0f0d0SEitan Adler#>148	string		x		\b, cksum %.7s
17258a0f0d0SEitan Adler# linkname[100]
17358a0f0d0SEitan Adler>157	string		>\0		\b, linkname %-.40s
17458a0f0d0SEitan Adler# additional fields for ustar
17558a0f0d0SEitan Adler>257	string		=ustar
17658a0f0d0SEitan Adler# owner user name null terminated
17758a0f0d0SEitan Adler>>265	string		>\0		\b, user %-.32s
17858a0f0d0SEitan Adler# group name null terminated
17958a0f0d0SEitan Adler>>297	string		>\0		\b, group %-.32s
180*ae316d1dSXin LI# device major minor if not zero (binary or ASCII)
18158a0f0d0SEitan Adler>>329	ubequad&0xCFCFCFCFcFcFcFdf	!0
18258a0f0d0SEitan Adler>>>329	string		x		\b, devmaj %-.7s
18358a0f0d0SEitan Adler>>337	ubequad&0xCFCFCFCFcFcFcFdf	!0
18458a0f0d0SEitan Adler>>>337	string		x		\b, devmin %-.7s
18558a0f0d0SEitan Adler# prefix[155]
18658a0f0d0SEitan Adler>>345	string		>\0		\b, prefix %-.155s
18758a0f0d0SEitan Adler# old non ustar/POSIX tar
18858a0f0d0SEitan Adler>257	string		!ustar
18958a0f0d0SEitan Adler>>508	string		=tar\0
19058a0f0d0SEitan Adler# padding[255] in old star
19158a0f0d0SEitan Adler>>>257	string		>\0		\b, padding: %-.40s
19258a0f0d0SEitan Adler>>508	default		x
19358a0f0d0SEitan Adler# padding[255] in old tar sometimes comment field
19458a0f0d0SEitan Adler>>>257	string		>\0		\b, comment: %-.40s
195*ae316d1dSXin LI# Summary:	VirtualBox NvramFile with UEFI variables packed inside TAR archive
196*ae316d1dSXin LI# URL:		hhttps://www.virtualbox.org/manual/ch08.html#vboxmanage-modifynvram
197*ae316d1dSXin LI# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/n/nvram-virtualbox-tar.trid.xml
198*ae316d1dSXin LI# Note:		called "VirtualBox saved (U)EFI BIOS settings (TAR) by TrID and
199*ae316d1dSXin LI#		verified by 7-Zip `7z l -ttar Mint-21.1.nvram` and
200*ae316d1dSXin LI#		VirtualBox `VBoxManage modifynvram "Mint-21.1" listvars`
201*ae316d1dSXin LI0	name		tar-nvram
202*ae316d1dSXin LI#
203*ae316d1dSXin LI>0	string		x		VirtualBox NVRAM file
204*ae316d1dSXin LI#!:mime	application/x-gtar
205*ae316d1dSXin LI!:mime	application/x-virtualbox-nvram
206*ae316d1dSXin LI!:ext	nvram
207*ae316d1dSXin LI# first name[100] like: TpmEmuTpms/permall
208*ae316d1dSXin LI>0	use	tar-entry
209*ae316d1dSXin LI# 2nd tar member efi/nvram contains UEFI variables part described by ./virtual
210*ae316d1dSXin LI>512	search/0x1800/s	efi/nvram\0
211*ae316d1dSXin LI>>&0	use	tar-entry
212*ae316d1dSXin LI# 2nd tar member efi/nvram content could be described by ./virtual
213*ae316d1dSXin LI#>>&512	indirect	x
214a2dfb722SXin LI# Summary:	Comic Book Archive *.CBT with TAR format
215a2dfb722SXin LI# URL:		https://en.wikipedia.org/wiki/Comic_book_archive
216a2dfb722SXin LI#		http://fileformats.archiveteam.org/wiki/Comic_Book_Archive
217a2dfb722SXin LI# Note:		there exist also RAR, ZIP, ACE and 7Z packed variants
218a2dfb722SXin LI0	name		tar-cbt
219a2dfb722SXin LI>0	string		x		Comic Book archive, tar archive
220a2dfb722SXin LI#!:mime	application/x-tar
221a2dfb722SXin LI!:mime	application/vnd.comicbook
222a2dfb722SXin LI#!:mime	application/vnd.comicbook+tar
223a2dfb722SXin LI!:ext	cbt
224a2dfb722SXin LI# name[100] probably like: 19.jpg 0001.png 0002.png
225a2dfb722SXin LI# or maybe like ComicInfo.xml
226*ae316d1dSXin LI#>0	string		>\0		\b, 1st image %-.60s
227*ae316d1dSXin LI>0	use	tar-entry
228898496eeSXin LI# Summary:	Open Virtualization Format *.OVF with disk images and more packed as TAR archive *.OVA
229898496eeSXin LI# From:		Joerg Jenderek
230898496eeSXin LI# URL:		https://en.wikipedia.org/wiki/Open_Virtualization_Format
231898496eeSXin LI#		http://fileformats.archiveteam.org/wiki/OVF_(Open_Virtualization_Format)
232898496eeSXin LI# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/o/ova.trid.xml
233898496eeSXin LI# Note:		called "Open Virtualization Format package" by TrID
234898496eeSXin LI#		assuming *.ovf comes first
235898496eeSXin LI0	name		tar-ova
236898496eeSXin LI>0	string		x		Open Virtualization Format Archive
237898496eeSXin LI#!:mime	application/x-ustar
238898496eeSXin LI# http://extension.nirsoft.net/ova
239898496eeSXin LI!:mime	application/x-virtualbox-ova
240898496eeSXin LI!:ext	ova
241898496eeSXin LI# assuming name[100] like: DOS-0.9.ovf FreeDOS_1.ovf Win98SE_DE.ovf
242*ae316d1dSXin LI#>0	string		>\0		\b, with %-.60s
243*ae316d1dSXin LI>0	use	tar-entry
244*ae316d1dSXin LI# Summary:	AVM firmware (FRITZ!OS) for the FRITZ!Box (router)
245*ae316d1dSXin LI# From:		Joerg Jenderek
246*ae316d1dSXin LI# URL:		https://en.wikipedia.org/wiki/Fritz!Box
247*ae316d1dSXin LI#		https://www.redteam-pentesting.de/de/advisories/rt-sa-2014-010/-avm-fritz-box-firmware-signature-bypass
248*ae316d1dSXin LI# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/i/image-avm.trid.xml
249*ae316d1dSXin LI# Note:		verified by 7-Zip `7z l -ttar FRITZ.Box_4040-07.57.image`
250*ae316d1dSXin LI0	name		tar-avm
251*ae316d1dSXin LI>0	string		x		AVM FRITZ!Box firmware
252*ae316d1dSXin LI#!:mime	application/x-gtar
253*ae316d1dSXin LI!:mime	application/x-avm-image
254*ae316d1dSXin LI!:ext	image
255*ae316d1dSXin LI# tar member ./var/content starts with line like "Product=Fritz_Box_HW227 (FRITZ!Box 4040)"
256*ae316d1dSXin LI>>1024	search/512	Product=Fritz_Box_
257*ae316d1dSXin LI>>>&0	string		x		%s
258*ae316d1dSXin LI# version string like: 07.57 07.58
259*ae316d1dSXin LI>>>1044	search		Version=	\b, version
260*ae316d1dSXin LI>>>>&0	string		x		%s
261*ae316d1dSXin LI# product phrase too far behind (dozen MB) in many samples like: FRITZ.Box_4040-07.12.image FRITZ.Box_6820v3_LTE-07.57.image
262*ae316d1dSXin LI# so try to look for other characteristic foo
263*ae316d1dSXin LI# >>1024	default		x		OTHER_PATTERN!
264*ae316d1dSXin LI# >>>1023	search		AVM_PATTERN	PATTERNfound
265*ae316d1dSXin LI# first name[100] like: ./var/ ./lte/
266*ae316d1dSXin LI>0	use	tar-entry
267*ae316d1dSXin LI# if 1st entry is directory then show 2nd entry
268*ae316d1dSXin LI>156	ubyte		0x35
269*ae316d1dSXin LI# 2nd tar member name like: ./var/content (often ) ./var/install ./var/chksum ./lte/modfw.nfo
270*ae316d1dSXin LI>>512	use	tar-entry
271*ae316d1dSXin LI# Summary:	Webmin Module or Theme
272*ae316d1dSXin LI# From:		Joerg Jenderek
273*ae316d1dSXin LI# URL:		https://en.wikipedia.org/wiki/Webmin
274*ae316d1dSXin LI#		https://webmin.com/docs/development/creating-modules/
275*ae316d1dSXin LI#		https://webmin.com/docs/development/creating-themes/
276*ae316d1dSXin LI# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/w/wbm.trid.xml
277*ae316d1dSXin LI#		http://mark0.net/download/triddefs_xml.7z/defs/w/wbt.trid.xml
278*ae316d1dSXin LI#		http://mark0.net/download/triddefs_xml.7z/defs/w/wbt-gif.trid.xml
279*ae316d1dSXin LI# Note:		called "Webmin Module" "Webmin Theme" by TrID
280*ae316d1dSXin LI#		most verfied by 7-Zip `7z l -ttar *.wbm | grep "\module.info"` and
281*ae316d1dSXin LI#		`7z l -ttar *.wbt | grep "\theme.info"`
282*ae316d1dSXin LI0	name		tar-webmin
283*ae316d1dSXin LI>0	string		x		Webmin
284*ae316d1dSXin LI# Webmin module or theme
285*ae316d1dSXin LI>>512	search/1767941/s /module.info	Module
286*ae316d1dSXin LI!:mime	application/x-webmin-module
287*ae316d1dSXin LI!:ext	wbm
288*ae316d1dSXin LI# According to documentation module.info is mandatory but instead theme.info is found in
289*ae316d1dSXin LI# old-blue-theme.wbm old-blue-theme-1.0.wbm old-mscstyle3.wbm virtual-server-mobile.wbm
290*ae316d1dSXin LI# GRR:  maybe here wrong file name suffix WBM instead of WBT
291*ae316d1dSXin LI>>512	default		x
292*ae316d1dSXin LI>>>512	search/3149333/s /theme.info	Theme
293*ae316d1dSXin LI!:mime	application/x-webmin-theme
294*ae316d1dSXin LI!:ext	wbt
295*ae316d1dSXin LI# next 3 lines should not happen
296*ae316d1dSXin LI>>>512	default		x		Module or Theme
297*ae316d1dSXin LI!:mime	application/x-webmin
298*ae316d1dSXin LI!:ext	wbm/wbt
299*ae316d1dSXin LI# GNU or POSIX tar
300*ae316d1dSXin LI>257	string		=ustar		(
301*ae316d1dSXin LI# 2 space characters followed by a null for GNU variant for most (428/429) WBM samples
302*ae316d1dSXin LI>>261	ubelong		=0x72202000	\bGNU tar)
303*ae316d1dSXin LI#!:mime	application/x-gtar
304*ae316d1dSXin LI# UStar version variant with ASCII "00" as in few (1/429) samples like cwmail.wbm
305*ae316d1dSXin LI>>261	ubelong		0x72003030	\bPOSIX tar)
306*ae316d1dSXin LI#!:mime	application/x-ustar
307*ae316d1dSXin LI#>>>156	ubyte		x		tar archive
308*ae316d1dSXin LI# Apparently first archive member name[100] is directory like: dynbind/ ssh/ virtualmin-powerdns/ virtual-server-mobile/ vnc/
309*ae316d1dSXin LI>>0	use	tar-entry
310*ae316d1dSXin LI# look for characteristic WBM module info name starting with "module.info" for language variant like in: ssh2.wbm
311*ae316d1dSXin LI>>512	search/1767941/s /module.info
312*ae316d1dSXin LI# look for TAR magic of WBM archive module info
313*ae316d1dSXin LI>>>&0	search/257/s	ustar
314*ae316d1dSXin LI# show details for WBM archive member module info
315*ae316d1dSXin LI>>>>&-257 use	tar-entry
316*ae316d1dSXin LI# look for characteristic WBT theme info name with "theme.info" like in: authentic-theme-21.09.5.wbt
317*ae316d1dSXin LI>>512	search/3149333/s /theme.info\0
318*ae316d1dSXin LI# look for TAR magic of WBT archive theme info
319*ae316d1dSXin LI>>>&0	search/257/s	ustar
320*ae316d1dSXin LI>>>>&-257 use	tar-entry
321b6cee71dSXin LI
322b6cee71dSXin LI# Incremental snapshot gnu-tar format from:
32348c779cdSXin LI# https://www.gnu.org/software/tar/manual/html_node/Snapshot-Files.html
324b6cee71dSXin LI0	string		GNU\ tar-	GNU tar incremental snapshot data
325a4d6d3b8SXin LI>&0	regex		[0-9]\\.[0-9]+-[0-9]+	version %s
326b6cee71dSXin LI
327b6cee71dSXin LI# cpio archives
328b6cee71dSXin LI#
329b6cee71dSXin LI# Yes, the top two "cpio archive" formats *are* supposed to just be "short".
330b6cee71dSXin LI# The idea is to indicate archives produced on machines with the same
331b6cee71dSXin LI# byte order as the machine running "file" with "cpio archive", and
332b6cee71dSXin LI# to indicate archives produced on machines with the opposite byte order
333b6cee71dSXin LI# from the machine running "file" with "byte-swapped cpio archive".
334b6cee71dSXin LI#
335b6cee71dSXin LI# The SVR4 "cpio(4)" hints that there are additional formats, but they
336b6cee71dSXin LI# are defined as "short"s; I think all the new formats are
337b6cee71dSXin LI# character-header formats and thus are strings, not numbers.
338898496eeSXin LI# URL:		http://fileformats.archiveteam.org/wiki/Cpio
339898496eeSXin LI#		https://en.wikipedia.org/wiki/Cpio
340898496eeSXin LI# Reference:	https://people.freebsd.org/~kientzle/libarchive/man/cpio.5.txt
341898496eeSXin LI# Update:	Joerg Jenderek
342898496eeSXin LI#
343898496eeSXin LI# Reference:    http://mark0.net/download/triddefs_xml.7z/defs/a/ark-cpio-bin.trid.xml
344898496eeSXin LI# Note:		called "CPIO archive (binary)" by TrID, "cpio/Binary LE" by 7-Zip and "CPIO" by DROID via PUID fmt/635
345898496eeSXin LI0	short		070707
346898496eeSXin LI# skip DROID fmt-635-signature-id-960.cpio by looking for pathname of 1st entry
347898496eeSXin LI>26	string		>\0		cpio archive
348b6cee71dSXin LI!:mime	application/x-cpio
349898496eeSXin LI# https://download.opensuse.org/distribution/leap/15.4/iso/openSUSE-Leap-15.4-NET-x86_64-Media.iso
350898496eeSXin LI# boot/x86_64/loader/bootlogo
351898496eeSXin LI# message.cpi
352898496eeSXin LI!:ext	/cpio/cpi
353898496eeSXin LI>>0	use	cpio-bin
354898496eeSXin LI# Reference:    http://mark0.net/download/triddefs_xml.7z/defs/a/ark-cpio-bin-sw.trid.xml
355898496eeSXin LI# Note:		called "CPIO archive (byte swapped binary)" by TrID and "Cpio/Binary BE" by 7-Zip
356b6cee71dSXin LI0	short		0143561		byte-swapped cpio archive
357b6cee71dSXin LI!:mime	application/x-cpio # encoding: swapped
358898496eeSXin LI# https://telparia.com/fileFormatSamples/archive/cpio/skeleton2.cpio
359898496eeSXin LI!:ext	cpio
360898496eeSXin LI>0	use	cpio-bin-be
361898496eeSXin LI# Reference:    http://mark0.net/download/triddefs_xml.7z/defs/a/ark-cpio.trid.xml
362898496eeSXin LI# Note:		called "CPIO archive (portable)" by TrID, "cpio/Portable ASCII" by 7-Zip and "cpio/odc" by GNU cpio
363b6cee71dSXin LI0	string		070707		ASCII cpio archive (pre-SVR4 or odc)
36443a5ec4eSXin LI!:mime	application/x-cpio
365898496eeSXin LI# https://telparia.com/fileFormatSamples/archive/cpio/ pthreads-1.60B5.osr5src.cpio cinema.cpi VOL.000.008 VOL.000.012
366898496eeSXin LI!:ext	cpio/cpi/008/012
367898496eeSXin LI# Note:		called "CPIO archive (portable)" by TrID, "cpio/New ASCII" by 7-Zip and "cpio/newc" by GNU cpio
368b6cee71dSXin LI0	string		070701		ASCII cpio archive (SVR4 with no CRC)
36943a5ec4eSXin LI!:mime	application/x-cpio
370898496eeSXin LI# https://telparia.com/fileFormatSamples/archive/cpio/MainActor-2.06.3.cpio
371898496eeSXin LI!:ext	cpio
372898496eeSXin LI# Note:		called "CPIO archive (portable)" by TrID, "cpio/New CRC" by 7-Zip and "cpio/crc" by GNU cpio
373b6cee71dSXin LI0	string		070702		ASCII cpio archive (SVR4 with CRC)
37443a5ec4eSXin LI!:mime	application/x-cpio
375898496eeSXin LI# http://ftp.gnu.org/gnu/tar/tar-1.27.cpio.gz
376898496eeSXin LI# https://telparia.com/fileFormatSamples/archive/cpio/pcmcia
377898496eeSXin LI!:ext	/cpio
378898496eeSXin LI#	display information of old binary cpio archive
379898496eeSXin LI# Note:	verfied by 7-Zip `7z l -tcpio -slt *.cpio` and
380898496eeSXin LI#	`cpio -ivt --numeric-uid-gid --file=clam.bin-le.cpio`
381898496eeSXin LI0	name	cpio-bin
382898496eeSXin LI# c_dev; device number; WHAT IS THAT?
383898496eeSXin LI>2	uleshort	x		\b; device %u
384898496eeSXin LI# c_ino; truncated inode number; use `ls --inode`
385898496eeSXin LI>4	uleshort	x		\b, inode %u
386898496eeSXin LI# c_mode; mode specifies permissions and file type like: ?622~?rw-r--r-- by `ls -l`
387898496eeSXin LI>6	uleshort	x		\b, mode %o
388898496eeSXin LI# c_uid; numeric user id; use `ls --numeric-uid-gid`
389898496eeSXin LI>8	uleshort	x		\b, uid %u
390898496eeSXin LI# c_gid; numeric group id
391898496eeSXin LI>10	uleshort	x		\b, gid %u
392898496eeSXin LI# c_nlink; links to this file; directories at least 2
393898496eeSXin LI>12	uleshort	>1		\b, %u links
394898496eeSXin LI# c_rdev; device number for block and character entries; zero for all other entries by writers
395898496eeSXin LI# like 0x0440 for /dev/ttyS0
396898496eeSXin LI>14	uleshort	>0		\b, device %#4.4x
397898496eeSXin LI# c_mtime[2]; modification time in seconds since 1 January 1970; most-significant 16 bits first
398898496eeSXin LI>16	medate		x		\b, modified %s
399898496eeSXin LI# c_filesize[2]; size of pathname; most-significant 16 bits first like: 544
400898496eeSXin LI>22	melong		x		\b, %u bytes
401898496eeSXin LI# c_namesize; bytes in the pathname that follows the header like: 9
402898496eeSXin LI#>20	uleshort	x		\b, namesize %u
403898496eeSXin LI# pathname of entry like: "clam.exe"
404898496eeSXin LI>26	string		x		"%s"
405898496eeSXin LI#	display information of old binary byte swapped cpio archive
406898496eeSXin LI# Note:	verfied by 7-Zip `7z l -tcpio -slt *.cpio` and
407898496eeSXin LI#	`LANGUAGE=C cpio -ivt --numeric-uid-gid --file=clam.bin-be.cpio`
408898496eeSXin LI0	name	cpio-bin-be
409898496eeSXin LI>2	ubeshort	x		\b; device %u
410898496eeSXin LI>4	ubeshort	x		\b, inode %u
411898496eeSXin LI>6	ubeshort	x		\b, mode %o
412898496eeSXin LI>8	ubeshort	x		\b, uid %u
413898496eeSXin LI>10	ubeshort	x		\b, gid %u
414898496eeSXin LI>12	ubeshort	>1		\b, %u links
415898496eeSXin LI>14	ubeshort	>0		\b, device %#4.4x
416898496eeSXin LI>16	bedate		x		\b, modified %s
417898496eeSXin LI>22	ubelong	 	x		\b, %u bytes
418898496eeSXin LI#>20	ubeshort	x		\b, namesize %u
419898496eeSXin LI>26	string		x		"%s"
420b6cee71dSXin LI
421b6cee71dSXin LI#
422b6cee71dSXin LI# Various archive formats used by various versions of the "ar"
423b6cee71dSXin LI# command.
424b6cee71dSXin LI#
425b6cee71dSXin LI
426b6cee71dSXin LI#
427b6cee71dSXin LI# Original UNIX archive formats.
428b6cee71dSXin LI# They were written with binary values in host byte order, and
429b6cee71dSXin LI# the magic number was a host "int", which might have been 16 bits
430b6cee71dSXin LI# or 32 bits.  We don't say "PDP-11" or "VAX", as there might have
431b6cee71dSXin LI# been ports to little-endian 16-bit-int or 32-bit-int platforms
432b6cee71dSXin LI# (x86?) using some of those formats; if none existed, feel free
433b6cee71dSXin LI# to use "PDP-11" for little-endian 16-bit and "VAX" for little-endian
434b6cee71dSXin LI# 32-bit.  There might have been big-endian ports of that sort as
435b6cee71dSXin LI# well.
436b6cee71dSXin LI#
437b6cee71dSXin LI0	leshort		0177555		very old 16-bit-int little-endian archive
438b6cee71dSXin LI0	beshort		0177555		very old 16-bit-int big-endian archive
439b6cee71dSXin LI0	lelong		0177555		very old 32-bit-int little-endian archive
440b6cee71dSXin LI0	belong		0177555		very old 32-bit-int big-endian archive
441b6cee71dSXin LI
442b6cee71dSXin LI0	leshort		0177545		old 16-bit-int little-endian archive
443b6cee71dSXin LI>2	string		__.SYMDEF	random library
444b6cee71dSXin LI0	beshort		0177545		old 16-bit-int big-endian archive
445b6cee71dSXin LI>2	string		__.SYMDEF	random library
446b6cee71dSXin LI0	lelong		0177545		old 32-bit-int little-endian archive
447b6cee71dSXin LI>4	string		__.SYMDEF	random library
448b6cee71dSXin LI0	belong		0177545		old 32-bit-int big-endian archive
449b6cee71dSXin LI>4	string		__.SYMDEF	random library
450b6cee71dSXin LI
451b6cee71dSXin LI#
452b6cee71dSXin LI# From "pdp" (but why a 4-byte quantity?)
453b6cee71dSXin LI#
454b6cee71dSXin LI0	lelong		0x39bed		PDP-11 old archive
455b6cee71dSXin LI0	lelong		0x39bee		PDP-11 4.0 archive
456b6cee71dSXin LI
457b6cee71dSXin LI#
458b6cee71dSXin LI# XXX - what flavor of APL used this, and was it a variant of
459b6cee71dSXin LI# some ar archive format?  It's similar to, but not the same
460b6cee71dSXin LI# as, the APL workspace magic numbers in pdp.
461b6cee71dSXin LI#
462b6cee71dSXin LI0	long		0100554		apl workspace
463b6cee71dSXin LI
464b6cee71dSXin LI#
465b6cee71dSXin LI# System V Release 1 portable(?) archive format.
466b6cee71dSXin LI#
467b6cee71dSXin LI0	string		=<ar>		System V Release 1 ar archive
468b6cee71dSXin LI!:mime	application/x-archive
469b6cee71dSXin LI
470b6cee71dSXin LI#
471b6cee71dSXin LI# Debian package; it's in the portable archive format, and needs to go
472b6cee71dSXin LI# before the entry for regular portable archives, as it's recognized as
473b6cee71dSXin LI# a portable archive whose first member has a name beginning with
474b6cee71dSXin LI# "debian".
475b6cee71dSXin LI#
47648c779cdSXin LI# Update: Joerg Jenderek
47748c779cdSXin LI# URL: https://en.wikipedia.org/wiki/Deb_(file_format)
478b6cee71dSXin LI0	string		=!<arch>\ndebian
47948c779cdSXin LI# https://manpages.debian.org/testing/dpkg/dpkg-split.1.en.html
48048c779cdSXin LI>14	string		-split	part of multipart Debian package
481b6cee71dSXin LI!:mime	application/vnd.debian.binary-package
48248c779cdSXin LI# udeb is used for stripped down deb file
48348c779cdSXin LI!:ext	deb/udeb
48448c779cdSXin LI>14	string		-binary	Debian binary package
485b6cee71dSXin LI!:mime	application/vnd.debian.binary-package
4862726a701SXin LI# For ipk packager see also https://en.wikipedia.org/wiki/Opkg
4872726a701SXin LI!:ext	deb/udeb/ipk
48848c779cdSXin LI# This should not happen
48948c779cdSXin LI>14	default		x	Unknown Debian package
49043a5ec4eSXin LI# NL terminated version; for most Debian cases this is 2.0 or 2.1 for split
491b6cee71dSXin LI>68	string		>\0		(format %s)
49248c779cdSXin LI#>68	string		!2.0\n
49348c779cdSXin LI#>>68	string		x		(format %.3s)
49448c779cdSXin LI>68	string		=2.0\n
49548c779cdSXin LI# 2nd archive name=control archive name like control.tar.gz or control.tar.xz
496898496eeSXin LI# or control.tar.zst
497898496eeSXin LI>>72	string		>\0		\b, with %.15s
49848c779cdSXin LI# look for 3rd archive name=data archive name like data.tar.{gz,xz,bz2,lzma}
49948c779cdSXin LI>>0	search/0x93e4f	data.tar.	\b, data compression
50048c779cdSXin LI# the above line only works if FILE_BYTES_MAX in ../../src/file.h is raised
50148c779cdSXin LI# for example like libreoffice-dev-doc_1%3a5.2.7-1+rpi1+deb9u3_all.deb
5022726a701SXin LI>>>&0	string		x		%.2s
5032726a701SXin LI# skip space (0x20 BSD) and slash (0x2f System V) character marking end of name
5042726a701SXin LI>>>&2	ubyte		!0x20
5052726a701SXin LI>>>>&-1	ubyte		!0x2f
5062726a701SXin LI# display 3rd character of file name extension like 2 of bz2 or m of lzma
5072726a701SXin LI>>>>>&-1	ubyte	x		\b%c
5082726a701SXin LI>>>>>>&0	ubyte	!0x20
5092726a701SXin LI>>>>>>>&-1	ubyte	!0x2f
5102726a701SXin LI# display 4th character of file name extension like a of lzma
5112726a701SXin LI>>>>>>>>&-1	ubyte	x		\b%c
51243a5ec4eSXin LI# split debian package case
51348c779cdSXin LI>68	string		=2.1\n
51448c779cdSXin LI# dpkg-1.18.25/dpkg-split/info.c
51548c779cdSXin LI# NL terminated ASCII package name like ckermit
51648c779cdSXin LI>>&0	string		x		\b, %s
51748c779cdSXin LI# NL terminated package version like 302-5.3
51848c779cdSXin LI>>>&1	string		x		%s
51948c779cdSXin LI# NL terminated MD5 checksum
52048c779cdSXin LI>>>>&1	string		x		\b, MD5 %s
52148c779cdSXin LI# NL terminated original package length
52248c779cdSXin LI>>>>>&1	string		x		\b, unsplitted size %s
52348c779cdSXin LI# NL terminated part length
524d38c30c0SXin LI>>>>>>&1	string	x		\b, part length %s
52548c779cdSXin LI# NL terminated package part like n/m
52648c779cdSXin LI>>>>>>>&1	string	x		\b, part %s
52748c779cdSXin LI# NL terminated package architecture like armhf since dpkg 1.16.1 or later
52848c779cdSXin LI>>>>>>>>&1	string	x		\b, %s
529b6cee71dSXin LI
530b6cee71dSXin LI#
531b6cee71dSXin LI# MIPS archive; they're in the portable archive format, and need to go
532b6cee71dSXin LI# before the entry for regular portable archives, as it's recognized as
533b6cee71dSXin LI# a portable archive whose first member has a name beginning with
534b6cee71dSXin LI# "__________E".
535b6cee71dSXin LI#
536b6cee71dSXin LI0	string	=!<arch>\n__________E	MIPS archive
537b6cee71dSXin LI!:mime	application/x-archive
538b6cee71dSXin LI>20	string	U			with MIPS Ucode members
539b6cee71dSXin LI>21	string	L			with MIPSEL members
540b6cee71dSXin LI>21	string	B			with MIPSEB members
541b6cee71dSXin LI>19	string	L			and an EL hash table
542b6cee71dSXin LI>19	string	B			and an EB hash table
543b6cee71dSXin LI>22	string	X			-- out of date
544b6cee71dSXin LI
545b6cee71dSXin LI#
546b6cee71dSXin LI# BSD/SVR2-and-later portable archive formats.
547b6cee71dSXin LI#
54848c779cdSXin LI# Update: Joerg Jenderek
54948c779cdSXin LI# URL:		http://fileformats.archiveteam.org/wiki/AR
55048c779cdSXin LI# Reference:	https://www.unix.com/man-page/opensolaris/3HEAD/ar.h/
55148c779cdSXin LI# Note:		Mach-O universal binary in ./cafebabe is dependent
55248c779cdSXin LI# TODO:		unify current ar archive, MIPS archive, Debian package
55348c779cdSXin LI#		distinguish BSD, SVR; 32, 64 bit; HP from other 32-bit SVR;
55448c779cdSXin LI#		*.ar packages from *.a libraries. handle empty archive
5552dc4dbb9SEitan Adler0	string		=!<arch>\n		current ar archive
55648c779cdSXin LI# print first and possibly second ar_name[16] for debugging purpose
55748c779cdSXin LI#>8			string	x	\b, 1st "%.16s"
55848c779cdSXin LI#>68			string	x	\b, 2nd "%.16s"
559b6cee71dSXin LI!:mime	application/x-archive
56048c779cdSXin LI# a in most case for libraries; lib for Microsoft libraries; ar else cases
56148c779cdSXin LI!:ext	a/lib/ar
562b6cee71dSXin LI>8	string		__.SYMDEF	random library
56348c779cdSXin LI# first member with long marked name __.SYMDEF SORTED implies BSD library
564b6cee71dSXin LI>68	string		__.SYMDEF\ SORTED	random library
56548c779cdSXin LI# Reference: https://parisc.wiki.kernel.org/images-parisc/b/b2/Rad_11_0_32.pdf
56648c779cdSXin LI# "archive file" entry moved from ./hp
56748c779cdSXin LI# LST header system_id 0210h~PA-RISC 1.1,... identifies the target architecture
56848c779cdSXin LI# LST header a_magic 0619h~relocatable library
56948c779cdSXin LI>68	belong 		0x020b0619	- PA-RISC1.0 relocatable library
57048c779cdSXin LI>68	belong	 	0x02100619	- PA-RISC1.1 relocatable library
57148c779cdSXin LI>68	belong 		0x02110619	- PA-RISC1.2 relocatable library
57248c779cdSXin LI>68	belong 		0x02140619	- PA-RISC2.0 relocatable library
57348c779cdSXin LI#EOF for common ar archives
574b6cee71dSXin LI
575b6cee71dSXin LI#
576b6cee71dSXin LI# "Thin" archive, as can be produced by GNU ar.
577b6cee71dSXin LI#
578b6cee71dSXin LI0	string		=!<thin>\n	thin archive with
579b6cee71dSXin LI>68	belong		0		no symbol entries
580b6cee71dSXin LI>68	belong		1		%d symbol entry
581b6cee71dSXin LI>68	belong		>1		%d symbol entries
582b6cee71dSXin LI
58348c779cdSXin LI0	search/1	-h-		Software Tools format archive text
58448c779cdSXin LI
585b6cee71dSXin LI# ARC archiver, from Daniel Quinlan (quinlan@yggdrasil.com)
586b6cee71dSXin LI#
587b6cee71dSXin LI# The first byte is the magic (0x1a), byte 2 is the compression type for
588b6cee71dSXin LI# the first file (0x01 through 0x09), and bytes 3 to 15 are the MS-DOS
589b6cee71dSXin LI# filename of the first file (null terminated).  Since some types collide
590b6cee71dSXin LI# we only test some types on basis of frequency: 0x08 (83%), 0x09 (5%),
591b6cee71dSXin LI# 0x02 (5%), 0x03 (3%), 0x04 (2%), 0x06 (2%).  0x01 collides with terminfo.
592b6cee71dSXin LI0	lelong&0x8080ffff	0x0000081a	ARC archive data, dynamic LZW
593b6cee71dSXin LI!:mime	application/x-arc
594b6cee71dSXin LI0	lelong&0x8080ffff	0x0000091a	ARC archive data, squashed
595b6cee71dSXin LI!:mime	application/x-arc
596b6cee71dSXin LI0	lelong&0x8080ffff	0x0000021a	ARC archive data, uncompressed
597b6cee71dSXin LI!:mime	application/x-arc
598b6cee71dSXin LI0	lelong&0x8080ffff	0x0000031a	ARC archive data, packed
599b6cee71dSXin LI!:mime	application/x-arc
600b6cee71dSXin LI0	lelong&0x8080ffff	0x0000041a	ARC archive data, squeezed
601b6cee71dSXin LI!:mime	application/x-arc
602b6cee71dSXin LI0	lelong&0x8080ffff	0x0000061a	ARC archive data, crunched
603b6cee71dSXin LI!:mime	application/x-arc
604b6cee71dSXin LI# [JW] stuff taken from idarc, obviously ARC successors:
605b6cee71dSXin LI0	lelong&0x8080ffff	0x00000a1a	PAK archive data
606b6cee71dSXin LI!:mime	application/x-arc
607b6cee71dSXin LI0	lelong&0x8080ffff	0x0000141a	ARC+ archive data
608b6cee71dSXin LI!:mime	application/x-arc
609b6cee71dSXin LI0	lelong&0x8080ffff	0x0000481a	HYP archive data
610b6cee71dSXin LI!:mime	application/x-arc
611b6cee71dSXin LI
612b6cee71dSXin LI# Acorn archive formats (Disaster prone simpleton, m91dps@ecs.ox.ac.uk)
613b6cee71dSXin LI# I can't create either SPARK or ArcFS archives so I have not tested this stuff
614b6cee71dSXin LI# [GRR:  the original entries collide with ARC, above; replaced with combined
615b6cee71dSXin LI#  version (not tested)]
616b6cee71dSXin LI#0	byte		0x1a		RISC OS archive (spark format)
617b6cee71dSXin LI0	string		\032archive	RISC OS archive (ArcFS format)
618b6cee71dSXin LI0       string          Archive\000     RISC OS archive (ArcFS format)
619b6cee71dSXin LI
620b6cee71dSXin LI# All these were taken from idarc, many could not be verified. Unfortunately,
621b6cee71dSXin LI# there were many low-quality sigs, i.e. easy to trigger false positives.
622b6cee71dSXin LI# Please notify me of any real-world fishy/ambiguous signatures and I'll try
623b6cee71dSXin LI# to get my hands on the actual archiver and see if I find something better. [JW]
624b6cee71dSXin LI# probably many can be enhanced by finding some 0-byte or control char near the start
625b6cee71dSXin LI
626b6cee71dSXin LI# idarc calls this Crush/Uncompressed... *shrug*
627b6cee71dSXin LI0	string	CRUSH Crush archive data
628b6cee71dSXin LI# Squeeze It (.sqz)
629b6cee71dSXin LI0	string	HLSQZ Squeeze It archive data
630b6cee71dSXin LI# SQWEZ
631b6cee71dSXin LI0	string	SQWEZ SQWEZ archive data
632b6cee71dSXin LI# HPack (.hpk)
633b6cee71dSXin LI0	string	HPAK HPack archive data
634b6cee71dSXin LI# HAP
635b6cee71dSXin LI0	string	\x91\x33HF HAP archive data
636b6cee71dSXin LI# MD/MDCD
637b6cee71dSXin LI0	string	MDmd MDCD archive data
638b6cee71dSXin LI# LIM
639b6cee71dSXin LI0	string	LIM\x1a LIM archive data
640b6cee71dSXin LI# SAR
641b6cee71dSXin LI3	string	LH5 SAR archive data
642b6cee71dSXin LI# BSArc/BS2
643b6cee71dSXin LI0	string	\212\3SB\020\0	BSArc/BS2 archive data
644b6cee71dSXin LI# Bethesda Softworks Archive (Oblivion)
645b6cee71dSXin LI0	string	BSA\0 		BSArc archive data
646b6cee71dSXin LI>4	lelong	x		version %d
647b6cee71dSXin LI# MAR
648b6cee71dSXin LI2	string	=-ah MAR archive data
649b6cee71dSXin LI# ACB
650b6cee71dSXin LI#0	belong&0x00f800ff	0x00800000 ACB archive data
651b6cee71dSXin LI# CPZ
652b6cee71dSXin LI# TODO, this is what idarc says: 0	string	\0\0\0 CPZ archive data
653b6cee71dSXin LI# JRC
654b6cee71dSXin LI0	string	JRchive JRC archive data
655b6cee71dSXin LI# Quantum
656b6cee71dSXin LI0	string	DS\0 Quantum archive data
657b6cee71dSXin LI# ReSOF
658b6cee71dSXin LI0	string	PK\3\6 ReSOF archive data
659b6cee71dSXin LI# QuArk
660b6cee71dSXin LI0	string	7\4 QuArk archive data
661b6cee71dSXin LI# YAC
662b6cee71dSXin LI14	string	YC YAC archive data
663b6cee71dSXin LI# X1
664b6cee71dSXin LI0	string	X1 X1 archive data
665b6cee71dSXin LI0	string	XhDr X1 archive data
666b6cee71dSXin LI# CDC Codec (.dqt)
667b6cee71dSXin LI0	belong&0xffffe000	0x76ff2000 CDC Codec archive data
668b6cee71dSXin LI# AMGC
669b6cee71dSXin LI0	string	\xad6" AMGC archive data
670b6cee71dSXin LI# NuLIB
671b6cee71dSXin LI0	string	N\xc3\xb5F\xc3\xa9lx\xc3\xa5 NuLIB archive data
672b6cee71dSXin LI# PakLeo
673b6cee71dSXin LI0	string	LEOLZW PAKLeo archive data
674b6cee71dSXin LI# ChArc
675b6cee71dSXin LI0	string	SChF ChArc archive data
676b6cee71dSXin LI# PSA
677b6cee71dSXin LI0	string	PSA PSA archive data
678b6cee71dSXin LI# CrossePAC
679b6cee71dSXin LI0	string	DSIGDCC CrossePAC archive data
680b6cee71dSXin LI# Freeze
681b6cee71dSXin LI0	string	\x1f\x9f\x4a\x10\x0a Freeze archive data
682b6cee71dSXin LI# KBoom
683b6cee71dSXin LI0	string	\xc2\xa8MP\xc2\xa8 KBoom archive data
684b6cee71dSXin LI# NSQ, must go after CDC Codec
685b6cee71dSXin LI0	string	\x76\xff NSQ archive data
686b6cee71dSXin LI# DPA
687b6cee71dSXin LI0	string	Dirk\ Paehl DPA archive data
688b6cee71dSXin LI# BA
689b6cee71dSXin LI# TODO: idarc says "bytes 0-2 == bytes 3-5"
690b6cee71dSXin LI# TTComp
6913e41d09dSXin LI# URL: http://fileformats.archiveteam.org/wiki/TTComp_archive
6923e41d09dSXin LI# Update: Joerg Jenderek
6933e41d09dSXin LI# GRR: line below is too general as it matches also Panorama database "TCDB 2003-10 demo.pan", others
6943e41d09dSXin LI0	string	\0\6
6953e41d09dSXin LI# look for first keyword of Panorama database *.pan
6963e41d09dSXin LI>12	search/261	DESIGN
6973e41d09dSXin LI# skip keyword with low entropy
69843a5ec4eSXin LI>12	default		x
69943a5ec4eSXin LI# skip DOS 2.0 backup id file, sequence 6 with many nils like BACKUPID_xx6.@@@ handled by ./msdos
70043a5ec4eSXin LI>>8	quad		!0
70143a5ec4eSXin LI>>>0	use	ttcomp
70243a5ec4eSXin LI# variant ASCII, 4K dictionary (strength=48=50-2). With strength=49 wrong order! WHY?
70343a5ec4eSXin LI0	string	\1\6
70443a5ec4eSXin LI# TODO:
70543a5ec4eSXin LI# skip VAX-order 68k Blit mpx/mux executable (strength=50) handled by ./blit
70643a5ec4eSXin LI!:strength	-2
70743a5ec4eSXin LI>0	use	ttcomp
70843a5ec4eSXin LI0	string	\0\5
70943a5ec4eSXin LI# skip some DOS 2.0 backup id file, sequence 5 with many nils like BACKUPID_075.@@@ handled by ./msdos
71043a5ec4eSXin LI>8	quad	!0
71143a5ec4eSXin LI>>0	use	ttcomp
71243a5ec4eSXin LI0	string	\1\5
71343a5ec4eSXin LI# TODO:
71443a5ec4eSXin LI# variant ASCII, 2K dictionary (strength=48=50-2). With strength=49 wrong order! WHY?
71543a5ec4eSXin LI# skip ctab data (strength=50) handled by ./ibm6000
71643a5ec4eSXin LI# skip locale data table (strength=50) handled by ./digital
71743a5ec4eSXin LI!:strength	-2
71843a5ec4eSXin LI>0	use	ttcomp
71943a5ec4eSXin LI0	string	\0\4
72043a5ec4eSXin LI# skip many Maple help database *.hdb with version tag handled by ./maple
72143a5ec4eSXin LI>1028	string	!version
72243a5ec4eSXin LI# skip veclib maple.hdb by looking for Mable keyword
72343a5ec4eSXin LI>>4	search/1091	Maple\040
72443a5ec4eSXin LI#>4	search/34090	Maple\040
72543a5ec4eSXin LI>>4	default		x
72643a5ec4eSXin LI# skip DOS 2.0-3.2 backed up sequence 4 with many nils like LOTUS5.RAR handled by ./msdos
72743a5ec4eSXin LI# skip xBASE Compound Index file *.CDX with many nils
72843a5ec4eSXin LI>>>0x54	quad		!0
72943a5ec4eSXin LI>>>>0	use	ttcomp
73043a5ec4eSXin LI0	string	\1\4
73143a5ec4eSXin LI# TODO:
73243a5ec4eSXin LI# skip shared library (strength=50) handled by ./ibm6000
73343a5ec4eSXin LI!:strength	-2
734898496eeSXin LI# skip Commodore PET BASIC programs (Mastermind.prg) with last 3 nil bytes (\0~end of line followed by 0000h line offset)
735898496eeSXin LI#>-4	ubelong		x	LAST_BYTES=%8.8x
736898496eeSXin LI>-4	ubelong&0x00FFffFF	!0
737898496eeSXin LI>>0	use	ttcomp
73843a5ec4eSXin LI#	display information of TTComp archive
73943a5ec4eSXin LI0	name	ttcomp
74043a5ec4eSXin LI# (version 5.25) labeled the entry as "TTComp archive data"
74143a5ec4eSXin LI>0	ubyte	x	TTComp archive data
74243a5ec4eSXin LI!:mime	application/x-compress-ttcomp
74343a5ec4eSXin LI# PBACKSCR.PI1
74443a5ec4eSXin LI!:ext	$xe/$ts/pi1/__d
74543a5ec4eSXin LI# compression type: 0~binary compression 1~ASCII compression
74643a5ec4eSXin LI>0	ubyte	0	\b, binary
74743a5ec4eSXin LI>0	ubyte	1	\b, ASCII
74843a5ec4eSXin LI# size of the dictionary:  4~1024 bytes 5~2048 bytes 6~4096 bytes
74943a5ec4eSXin LI>1	ubyte	4	\b, 1K
75043a5ec4eSXin LI>1	ubyte	5	\b, 2K
75143a5ec4eSXin LI>1	ubyte	6	\b, 4K
75243a5ec4eSXin LI>1	ubyte	x	dictionary
75343a5ec4eSXin LI#	https://mark0.net/forum/index.php?topic=848
75443a5ec4eSXin LI# last 3 bytes probably have only 8 possible bit sequences
75543a5ec4eSXin LI# xxxxxxxx 0000000x 11111111	____FFh
75643a5ec4eSXin LI# xxxxxxxx 10000000 01111111	__807Fh
75743a5ec4eSXin LI# 0xxxxxxx 11000000 00111111	__C03Fh
75843a5ec4eSXin LI# 00xxxxxx 11100000 00011111	__E01Fh
75943a5ec4eSXin LI# 000xxxxx 11110000 00001111	__F00Fh
76043a5ec4eSXin LI# 0000xxxx 11111000 00000111	__F807h
76143a5ec4eSXin LI# 00000xxx 11111100 00000011	__FC03h
76243a5ec4eSXin LI# 000000xx 11111110 00000001	__FE01h
76343a5ec4eSXin LI# but for quickgif.__d 0A7DD4h
76443a5ec4eSXin LI#>-3	ubyte		x	\b, last 3 bytes 0x%2.2x
76543a5ec4eSXin LI#>-2	ubeshort	x	\b%4.4x
766d38c30c0SXin LI# From:		Joerg Jenderek
767a4d6d3b8SXin LI# URL:		https://en.wikipedia.org/wiki/Disk_Copy
768d38c30c0SXin LI# reference:	http://nulib.com/library/FTN.e00005.htm
769d38c30c0SXin LI0x52	ubeshort	0x0100
77043a5ec4eSXin LI# test for disk image size equal or above 400k
77143a5ec4eSXin LI>0x40	ubelong		>409599
77243a5ec4eSXin LI# test also for disk image size equal or below 1440k to skip
77343a5ec4eSXin LI# windows7en.mbr UNICODE.DAT
774a4d6d3b8SXin LI#>>0x40	ubelong		<1474561
775a4d6d3b8SXin LI# test now for "low" disk image size equal or below 64 MiB to skip
776a4d6d3b8SXin LI# windows7en.mbr (B441BBAAh) UNICODE.DAT (0400AF05h)
777a4d6d3b8SXin LI>>0x40	ubelong		<0x04000001
778a4d6d3b8SXin LI# To skip Flags$StringJoiner.class with size 00106A61h test also for valid disk image sizes
779a4d6d3b8SXin LI# 00064000 for  400k GCR disks	dc42-400k-gcr.trid.xml
780a4d6d3b8SXin LI# 000c8000 for  800k GCR disks	dc42-800k-gcr.trid.xml
781a4d6d3b8SXin LI# 000b4000 for  720k MFM disks	dc42-720k-mfm.trid.xml
782a4d6d3b8SXin LI# 00168000 for 1440k MFM disks	dc42-1440k-mfm.trid.xml
783a4d6d3b8SXin LI#	https://lisaem.sunder.net/LisaProjectDocs.txt
784a4d6d3b8SXin LI# 00500000	05M	available
785a4d6d3b8SXin LI# 00A00000	10M	available
786a4d6d3b8SXin LI# 01800000	24M	possible
787a4d6d3b8SXin LI# 02000000	32M	uncertain
788a4d6d3b8SXin LI# 04000000	64M	uncertain
789a4d6d3b8SXin LI>>>0x40	ubelong&0xf8003fFF	0
790a4d6d3b8SXin LI# skip samples with invalid disk name length like:
791a4d6d3b8SXin LI# 181 (biosmd80.rom) 202 (Flags$StringJoiner.class) 90 (UNICODE.DAT)
792a4d6d3b8SXin LI>>>>0x0	ubyte			<64
793a4d6d3b8SXin LI>>>>>0	use			dc42-floppy
79443a5ec4eSXin LI#	display information of Apple DiskCopy 4.2 floppy image
79543a5ec4eSXin LI0	name		dc42-floppy
796a4d6d3b8SXin LI# disk name length; maximal 63
797a4d6d3b8SXin LI#>0	ubyte	    	x	DISK NAME LENGTH %u
798a4d6d3b8SXin LI# ASCII image pascal (maximal 63 bytes) name padded with NULs like:
799a4d6d3b8SXin LI# "Microsoft Mail" "Disquette 2" "IIe Installer Disk"
800a4d6d3b8SXin LI# "-lisaem.sunder.net hd-" (dc42-lisaem.trid.xml) "-not a Macintosh disk" (dc42-nonmac.trid.xml)
80143a5ec4eSXin LI>00	pstring/B	x	Apple DiskCopy 4.2 image %s
802d38c30c0SXin LI#!:mime	application/octet-stream
80343a5ec4eSXin LI!:mime	application/x-dc42-floppy-image
804d38c30c0SXin LI!:apple	dCpydImg
805a4d6d3b8SXin LI# probably also img like: "Utilitaires 2.img" "Installation 7.img"
806a4d6d3b8SXin LI!:ext	image/dc42/img
807a4d6d3b8SXin LI# data size in bytes like: 409600 737280 819200 1474560
80843a5ec4eSXin LI>0x40	ubelong		x	\b, %u bytes
80943a5ec4eSXin LI# for debugging purpose size in hexadecimal
81043a5ec4eSXin LI#>0x40	ubelong		x	(%#8.8x)
811a4d6d3b8SXin LI# tag size in bytes like: 0 (often) 2580h (PUID fmt/625) 4B00h (Microsoft Mail.image)
81243a5ec4eSXin LI>0x44	ubelong		>0	\b, %#x tag size
813d38c30c0SXin LI# data checksum
81443a5ec4eSXin LI#>0x48	ubelong		x	\b, %#x checksum
815d38c30c0SXin LI# tag checksum
81643a5ec4eSXin LI#>0x4c	ubelong		x	\b, %#x tag checksum
817a4d6d3b8SXin LI# disk encoding like: 0 1 2 3 (PUID: fmt/625)
81843a5ec4eSXin LI>0x50	ubyte		0	\b, GCR CLV ssdd (400k)
81943a5ec4eSXin LI>0x50	ubyte		1	\b, GCR CLV dsdd (800k)
82043a5ec4eSXin LI>0x50	ubyte		2	\b, MFM CAV dsdd (720k)
82143a5ec4eSXin LI>0x50	ubyte		3	\b, MFM CAV dshd (1440k)
82243a5ec4eSXin LI>0x50	ubyte		>3	\b, %#x encoding
823a4d6d3b8SXin LI# format byte like: 12h (Lisa 400K) 24h (400K Macintosh) 96h (800K Apple II disk)
824a4d6d3b8SXin LI# 2 (Mac 400k "Disquette Installation 13.image")
825a4d6d3b8SXin LI# 22h (double-sided MFM or Mac 800k "Disco 12.image" "IIe Installer Disk.image")
82643a5ec4eSXin LI>0x51	ubyte		x	\b, %#x format
82743a5ec4eSXin LI#>0x54	ubequad		x	\b, data %#16.16llx
828b6cee71dSXin LI# ESP, could this conflict with Easy Software Products' (e.g.ESP ghostscript) documentation?
829b6cee71dSXin LI0	string	ESP ESP archive data
830b6cee71dSXin LI# ZPack
831b6cee71dSXin LI0	string	\1ZPK\1 ZPack archive data
832b6cee71dSXin LI# Sky
833b6cee71dSXin LI0	string	\xbc\x40 Sky archive data
834b6cee71dSXin LI# UFA
835b6cee71dSXin LI0	string	UFA UFA archive data
836b6cee71dSXin LI# Dry
837b6cee71dSXin LI0	string	=-H2O DRY archive data
838b6cee71dSXin LI# FoxSQZ
839b6cee71dSXin LI0	string	FOXSQZ FoxSQZ archive data
840b6cee71dSXin LI# AR7
841b6cee71dSXin LI0	string	,AR7 AR7 archive data
842b6cee71dSXin LI# PPMZ
843b6cee71dSXin LI0	string	PPMZ PPMZ archive data
844b6cee71dSXin LI# MS Compress
84558a0f0d0SEitan Adler# Update: Joerg Jenderek
84658a0f0d0SEitan Adler# URL: http://fileformats.archiveteam.org/wiki/MS-DOS_installation_compression
84758a0f0d0SEitan Adler# Reference: https://hwiegman.home.xs4all.nl/fileformats/compress/szdd_kwaj_format.html
84858a0f0d0SEitan Adler# Note: use correct version of extracting tool like EXPAND, UNPACK, DECOMP or 7Z
84958a0f0d0SEitan Adler4	string	\x88\xf0\x27
85058a0f0d0SEitan Adler#		KWAJ variant
85158a0f0d0SEitan Adler>0	string	KWAJ		MS Compress archive data, KWAJ variant
85258a0f0d0SEitan Adler!:mime	application/x-ms-compress-kwaj
85358a0f0d0SEitan Adler# extension not working in version 5.32
85458a0f0d0SEitan Adler# magic/Magdir/archive, 284: Warning: EXTENSION type ` ??_' has bad char '?'
85558a0f0d0SEitan Adler# file: line 284: Bad magic entry '   ??_'
85658a0f0d0SEitan Adler!:ext	??_
85758a0f0d0SEitan Adler# compression method (0-4)
85858a0f0d0SEitan Adler>>8	uleshort	x	\b, %u method
85958a0f0d0SEitan Adler# offset of compressed data
86043a5ec4eSXin LI>>10	uleshort	x	\b, %#x offset
86158a0f0d0SEitan Adler#>>(10.s)	uleshort	x
86258a0f0d0SEitan Adler#>>>&-6		string	x	\b, TEST extension %-.3s
86358a0f0d0SEitan Adler# header flags to mark header extensions
86443a5ec4eSXin LI>>12	uleshort	>0	\b, %#x flags
86558a0f0d0SEitan Adler# 4 bytes: decompressed length of file
86658a0f0d0SEitan Adler>>12	uleshort	&0x01
86758a0f0d0SEitan Adler>>>14	ulelong		x	\b, original size: %u bytes
86858a0f0d0SEitan Adler# 2 bytes: unknown purpose
86958a0f0d0SEitan Adler# 2 bytes: length of unknown data + mentioned bytes
87058a0f0d0SEitan Adler# 1-9 bytes: null-terminated file name
87158a0f0d0SEitan Adler# 1-4 bytes: null-terminated file extension
87258a0f0d0SEitan Adler>>12	uleshort	&0x08
87358a0f0d0SEitan Adler>>>12	uleshort				^0x01
87458a0f0d0SEitan Adler>>>>12		uleshort			^0x02
87558a0f0d0SEitan Adler>>>>>12			uleshort		^0x04
87658a0f0d0SEitan Adler>>>>>>12			uleshort	^0x10
87758a0f0d0SEitan Adler>>>>>>>14				string	x	\b, %-.8s
87858a0f0d0SEitan Adler>>>>>>12			uleshort	&0x10
87958a0f0d0SEitan Adler>>>>>>>14				string	x	\b, %-.8s
88058a0f0d0SEitan Adler>>>>>>>>&1				string	x	\b.%-.3s
88158a0f0d0SEitan Adler>>>>>12			uleshort		&0x04
88258a0f0d0SEitan Adler>>>>>>12			uleshort	^0x10
88358a0f0d0SEitan Adler>>>>>>>(14.s)			uleshort	x
88458a0f0d0SEitan Adler>>>>>>>>&14				string	x	\b, %-.8s
88558a0f0d0SEitan Adler>>>>>>12			uleshort	&0x10
88658a0f0d0SEitan Adler>>>>>>>(14.s)			uleshort	x
88758a0f0d0SEitan Adler>>>>>>>>&14				string	x	\b, %-.8s
88858a0f0d0SEitan Adler>>>>>>>>>&1				string	x	\b.%-.3s
88958a0f0d0SEitan Adler>>>>12		uleshort			&0x02
89058a0f0d0SEitan Adler>>>>>12			uleshort		^0x04
89158a0f0d0SEitan Adler>>>>>>12			uleshort	^0x10
89258a0f0d0SEitan Adler>>>>>>>16				string	x	\b, %-.8s
89358a0f0d0SEitan Adler>>>>>>12			uleshort	&0x10
89458a0f0d0SEitan Adler>>>>>>>16				string	x	\b, %-.8s
89558a0f0d0SEitan Adler>>>>>>>>&1				string	x	\b.%-.3s
89658a0f0d0SEitan Adler>>>>>12			uleshort		&0x04
89758a0f0d0SEitan Adler>>>>>>12			uleshort	^0x10
89858a0f0d0SEitan Adler>>>>>>>(16.s)			uleshort	x
89958a0f0d0SEitan Adler>>>>>>>>&16				string	x	\b, %-.8s
90058a0f0d0SEitan Adler>>>>>>12			uleshort	&0x10
901*ae316d1dSXin LI#>>>>>>>(16.s)			uleshort	x
90258a0f0d0SEitan Adler>>>>>>>&16				string	x	%-.8s
90358a0f0d0SEitan Adler>>>>>>>>&1				string	x	\b.%-.3s
90458a0f0d0SEitan Adler>>>12	uleshort				&0x01
90558a0f0d0SEitan Adler>>>>12		uleshort			^0x02
90658a0f0d0SEitan Adler>>>>>12			uleshort		^0x04
90758a0f0d0SEitan Adler>>>>>>12			uleshort	^0x10
90858a0f0d0SEitan Adler>>>>>>>18				string	x	\b, %-.8s
90958a0f0d0SEitan Adler>>>>>>12			uleshort	&0x10
91058a0f0d0SEitan Adler>>>>>>>18				string	x	\b, %-.8s
91158a0f0d0SEitan Adler>>>>>>>>&1				string	x	\b.%-.3s
91258a0f0d0SEitan Adler>>>>>12			uleshort		&0x04
91358a0f0d0SEitan Adler>>>>>>12			uleshort	^0x10
91458a0f0d0SEitan Adler>>>>>>>(18.s)			uleshort	x
91558a0f0d0SEitan Adler>>>>>>>>&18				string	x	\b, %-.8s
91658a0f0d0SEitan Adler>>>>>>12			uleshort	&0x10
91758a0f0d0SEitan Adler>>>>>>>(18.s)			uleshort	x
91858a0f0d0SEitan Adler>>>>>>>>&18				string	x	\b, %-.8s
91958a0f0d0SEitan Adler>>>>>>>>>&1				string	x	\b.%-.3s
92058a0f0d0SEitan Adler>>>>12		uleshort			&0x02
92158a0f0d0SEitan Adler>>>>>12			uleshort		^0x04
92258a0f0d0SEitan Adler>>>>>>12			uleshort	^0x10
92358a0f0d0SEitan Adler>>>>>>>20				string	x	\b, %-.8s
92458a0f0d0SEitan Adler>>>>>>12			uleshort	&0x10
92558a0f0d0SEitan Adler>>>>>>>20				string	x	\b, %-.8s
92658a0f0d0SEitan Adler>>>>>>>>&1				string	x	\b.%-.3s
92758a0f0d0SEitan Adler>>>>>12			uleshort		&0x04
92858a0f0d0SEitan Adler>>>>>>12			uleshort	^0x10
92958a0f0d0SEitan Adler>>>>>>>(20.s)			uleshort	x
93058a0f0d0SEitan Adler>>>>>>>>&20				string	x	\b, %-.8s
93158a0f0d0SEitan Adler>>>>>>12			uleshort	&0x10
93258a0f0d0SEitan Adler>>>>>>>(20.s)			uleshort	x
93358a0f0d0SEitan Adler>>>>>>>>&20				string	x	\b, %-.8s
93458a0f0d0SEitan Adler>>>>>>>>>&1				string	x	\b.%-.3s
93558a0f0d0SEitan Adler# 2 bytes: length of data + mentioned bytes
93658a0f0d0SEitan Adler#
93758a0f0d0SEitan Adler#		SZDD variant Haruhiko Okumura's LZSS or 7z type MsLZ
938a4d6d3b8SXin LI# URL:		http://fileformats.archiveteam.org/wiki/MS-DOS_installation_compression
939a4d6d3b8SXin LI# Reference:	http://www.cabextract.org.uk/libmspack/doc/szdd_kwaj_format.html
940a4d6d3b8SXin LI#		http://mark0.net/download/triddefs_xml.7z/defs/s/szdd.trid.xml
941a4d6d3b8SXin LI# Note:		called "Microsoft SZDD compressed (Haruhiko Okumura's LZSS)" by TrID
942a4d6d3b8SXin LI#		verfied by 7-Zip `7z l -tMsLZ -slt *.??_` as MsLZ
943a4d6d3b8SXin LI#		`deark -l -m lzss_oku -d2 setup-1-41.bin` as "LZSS.C by Haruhiko Okumura"
94458a0f0d0SEitan Adler>0	string	SZDD		MS Compress archive data, SZDD variant
945a4d6d3b8SXin LI# 2nd part of signature
946a4d6d3b8SXin LI#>>4	ubelong	0x88F02733	\b, SIGNATURE OK
94758a0f0d0SEitan Adler!:mime	application/x-ms-compress-szdd
94858a0f0d0SEitan Adler!:ext	??_
94958a0f0d0SEitan Adler# The character missing from the end of the filename (0=unknown)
95058a0f0d0SEitan Adler>>9	string	>\0		\b, %-.1s is last character of original name
95158a0f0d0SEitan Adler# https://www.betaarchive.com/forum/viewtopic.php?t=26161
95258a0f0d0SEitan Adler# Compression mode: "A" (0x41) found but sometimes "B" in Windows 3.1 builds 026 and 034e
95358a0f0d0SEitan Adler>>8	string	!A		\b, %-.1s method
95458a0f0d0SEitan Adler>>10	ulelong	>0		\b, original size: %u bytes
955a4d6d3b8SXin LI# Summary:	InstallShield archive with SZDD compressed
956a4d6d3b8SXin LI# URL:		https://community.flexera.com/t5/InstallShield-Knowledge-Base/InstallShield-Redistributable-Files/ta-p/5647
957a4d6d3b8SXin LI# From:		Joerg Jenderek
958a4d6d3b8SXin LI1	search/48/bs	SZDD\x88\xF0\x27\x33	InstallShield archive
959a4d6d3b8SXin LI#!:mime	application/octet-stream
960a4d6d3b8SXin LI!:mime	application/x-installshield-compress-szdd
961a4d6d3b8SXin LI!:ext	ibt
962a4d6d3b8SXin LI# name of compressed archive member like: setup.dl_ _setup7int.dl_ _setup2k.dl_ _igdi.dl_ cabinet.dl_
963a4d6d3b8SXin LI>0	string	x		%s
964a4d6d3b8SXin LI# name of uncompressed archive member like: setup.dll _Setup.dll IGdi.dll CABINET.DLL
965a4d6d3b8SXin LI>>&1	string	x		(%s)
966a4d6d3b8SXin LI# probably version like: 9.0.0.333 9.1.0.429 11.50.0.42618
967a4d6d3b8SXin LI>>>&1	string	x		\b, version %s
968a4d6d3b8SXin LI# SZDD member length like: 168048 169333 181842
969a4d6d3b8SXin LI>>>>&1	string	x		\b, %s bytes
970a4d6d3b8SXin LI# MS Compress archive data
971a4d6d3b8SXin LI#>&0	string		SZDD	\b, SIGNATURE FOUND
972a4d6d3b8SXin LI>&0	indirect	x
97358a0f0d0SEitan Adler#		QBasic SZDD variant
97458a0f0d0SEitan Adler3	string	\x88\xf0\x27
97558a0f0d0SEitan Adler>0	string	SZ\x20		MS Compress archive data, QBasic variant
97658a0f0d0SEitan Adler!:mime	application/x-ms-compress-sz
97758a0f0d0SEitan Adler!:ext	??$
97858a0f0d0SEitan Adler>>8	ulelong	>0		\b, original size: %u bytes
97958a0f0d0SEitan Adler
980898496eeSXin LI# Summary:	lzss compressed/EDI Pack
981898496eeSXin LI# From:		Joerg Jenderek
982898496eeSXin LI# URL:		http://fileformats.archiveteam.org/wiki/EDI_Install_packed_file
983898496eeSXin LI# Note:		called "EDI Install LZS compressed data" by TrID and verified by
984898496eeSXin LI#		command like `deark -l -m edi_pack -d2 BOOK01A.IC$` as "EDI Pack LZSS1"
985898496eeSXin LI0	string					EDILZSS
986898496eeSXin LI>7	string					1
987898496eeSXin LI# look for point character before orginal file name extension
988898496eeSXin LI>>8	search/9/b				.
989898496eeSXin LI# check suffix of possible orginal file anme
990898496eeSXin LI#>>>&0		ubelong				x	SUFFIX=%8.8x
991898496eeSXin LI# samples without valid character after point in original file name field like: FENNEL.LZS PLANTAIN.LZS
992898496eeSXin LI>>>&0		ubyte				<0x20
993898496eeSXin LI>>>>0			use				edi-lzs
994898496eeSXin LI# samples with valid character after point in original file name field
995898496eeSXin LI>>>&0		ubyte				>0x1F
996898496eeSXin LI# check 2nd charcter of suffix
997898496eeSXin LI#>>>>&0			ubyte	x			2ND_SUFFIX=%x
998898496eeSXin LI# sample with one valid character after point followed by \0 in original file name field like: SPELMATE.H$
999898496eeSXin LI>>>>&0			ubyte			=0
1000898496eeSXin LI>>>>>0				use			edi-pack
1001898496eeSXin LI>>>>&0			ubyte			>0x1F
1002898496eeSXin LI# check 3rd charcter of suffix
1003898496eeSXin LI#>>>>>&0				ubyte		x	3RD_SUFFIX=%x
1004898496eeSXin LI# no sample with 2 valid characters after point followed by \0 in original file name field
1005898496eeSXin LI>>>>>&0				ubyte		=0
1006898496eeSXin LI>>>>>>0					use		edi-pack
1007898496eeSXin LI# samples with valid 3rd character after point in original file name field
1008898496eeSXin LI>>>>>&0				ubyte		>0x1F
1009898496eeSXin LI# sample with 3 valid character after point followed by \0 in original file name field like: BOOK01A.IC$ CTL3D.DL$
1010898496eeSXin LI>>>>>>&0				ubyte	=0
1011898496eeSXin LI>>>>>>>0					use	edi-pack
1012898496eeSXin LI# sample with 3 valid character after point followed by no \0 in original file name field like: HERBTEXT.LZS
1013898496eeSXin LI>>>>>>&0				ubyte	!0
1014898496eeSXin LI>>>>>>>0					use	edi-lzs
1015898496eeSXin LI# no sample with invalid 3rd character after point in original file name field
1016898496eeSXin LI>>>>>&0				default		x
1017898496eeSXin LI>>>>>>0					use		edi-lzs
1018898496eeSXin LI# sample with invalid 2nd character after point in original file name field like: LACERATE.LZS SPLINTER.LZS
1019898496eeSXin LI>>>>&0			default			x
1020898496eeSXin LI>>>>>0	use						edi-lzs
1021898496eeSXin LI# sample without point character in original file name field like GUNSHOT.LZS
1022898496eeSXin LI>>8	default					x
1023898496eeSXin LI>>>0		use					edi-lzs
1024898496eeSXin LI# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/e/edi-lzss2.trid.xml
1025898496eeSXin LI# Note:		called "EDI Install Pro LZSS2 compressed data" by TrID and verified by
1026898496eeSXin LI#		command like `deark -l -m edi_pack -d2 4WAY.WA$` as "EDI Pack LZSS2"
1027898496eeSXin LI>7	string			2			EDI LZSS2 packed
1028898496eeSXin LI#!:mime	application/octet-stream
1029898496eeSXin LI!:mime	application/x-edi-pack-lzss
1030898496eeSXin LI# the name of a compressed file often ends in character '$' or '_'
1031898496eeSXin LI!:ext	??$/??_
1032898496eeSXin LI# original filename, NUL-terminated, padded to 13 bytes like: mci.vbx 4way.wav skymap.exe cmdialog.vbx
1033898496eeSXin LI>>8		string		x			"%-0.13s"
1034898496eeSXin LI# original file size, as a 4-byte integer.
1035898496eeSXin LI>>21		ulelong		x			\b, %u bytes
1036898496eeSXin LI# compressed data like: ff5249464606ec00 ff4d5aa601010000
1037898496eeSXin LI>>>25		ubequad		x			\b, data %#16.16llx...
1038898496eeSXin LI0	name		edi-pack
1039898496eeSXin LI# Note:		verified by command like `deark -l -d2 SPELMATE.H$` as "EDI Pack LZSS1"
1040898496eeSXin LI# original filename, NUL-terminated, padded to 13 bytes like: ctl3d.dll spelmate.h filemenu.rc owl.def index-it.exe
1041898496eeSXin LI# but not like \377Aloe.lzs\273 (HERBTEXT.LZS)
1042898496eeSXin LI>8	string		x				EDI LZSS packed "%-.13s"
1043898496eeSXin LI#!:mime	application/octet-stream
1044898496eeSXin LI!:mime	application/x-edi-pack-lzss
1045898496eeSXin LI# the name of a compressed file often ends in character '$' or '_'
1046898496eeSXin LI!:ext	??$/?$
1047898496eeSXin LI# compressed data like: f7000001eff02020 ff4d5aa900020000 ff2f2a207370656c
1048898496eeSXin LI>21	ubequad		x				\b, data %#16.16llx...
1049898496eeSXin LI# URL:		http://fileformats.archiveteam.org/wiki/EDI_LZSSLib
1050898496eeSXin LI# Note:		verified partly by command like `deark -l -m edi_pack -d2 GUNSHOT.LZS` as "EDI LZSSLib"
1051898496eeSXin LI0	name		edi-lzs
1052898496eeSXin LI# Note:		verified by command like `deark -l -d2 GUNSHOT.LZS` as "EDI LZSSLib"
1053898496eeSXin LI# no original filename looks like: \277BM\226.\0 \277BM.n\001 \277BM\226.\0 \277BM.g\001 \377Aloe.lzs\273
1054898496eeSXin LI>8	string		x				EDI LZSSLib packed
1055898496eeSXin LI#!:mime	application/octet-stream
1056898496eeSXin LI!:mime	application/x-edi-pack-lzss
1057898496eeSXin LI# The name of a compressed file ends with LZS suffix
1058898496eeSXin LI!:ext	lzs
1059898496eeSXin LI# compressed data like: bf424df6e10100f3 ff416c6f652e6c7a ff416c6f652e6c7a
1060898496eeSXin LI>8	ubequad		x				\b, data %#16.16llx...
1061898496eeSXin LI
1062a4d6d3b8SXin LI# Summary:	CAZIP compressed file
1063a4d6d3b8SXin LI# From:		Joerg Jenderek
1064a4d6d3b8SXin LI# URL:		http://fileformats.archiveteam.org/wiki/CAZIP
1065a4d6d3b8SXin LI# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/c/caz.trid.xml
1066a4d6d3b8SXin LI# Note:		Format is distinct from CAZIPXP compressed
1067a4d6d3b8SXin LI0	string	\x0D\x0A\x1ACAZIP	CAZIP compressed file
1068a4d6d3b8SXin LI#!:mime	application/octet-stream
1069a4d6d3b8SXin LI!:mime	application/x-compress-cazip
1070a4d6d3b8SXin LI# like: BLINKER.WR_ CLIPDEFS._ CAOSETUP.EX_ CLIPPER.EX_ FILEIO.C_
1071a4d6d3b8SXin LI!:ext	??_/?_/_
1072a4d6d3b8SXin LI
107343a5ec4eSXin LI# Summary:	FTCOMP compressed archive
107443a5ec4eSXin LI# From:		Joerg Jenderek
107543a5ec4eSXin LI# URL:		http://fileformats.archiveteam.org/wiki/FTCOMP
107643a5ec4eSXin LI# Reference:    http://mark0.net/download/triddefs_xml.7z/defs/a/ark-ftcomp.trid.xml
107743a5ec4eSXin LI# Note:		called by TrID "FTCOMP compressed archive"
107843a5ec4eSXin LI#		extracted by `unpack seahelp.hl_`
107943a5ec4eSXin LI24	string/b	FTCOMP		FTCOMP compressed archive
108043a5ec4eSXin LI#!:mime	application/octet-stream
108143a5ec4eSXin LI!:mime	application/x-compress-ftcomp
108243a5ec4eSXin LI!:ext	??_/??@/dll/drv/pk2/
108343a5ec4eSXin LI# probably A596FDFF magic at the beginning
108443a5ec4eSXin LI>0	ubelong		!0xA596FDFF	\b, at beginning %#x
108543a5ec4eSXin LI# probably original file name with directory like: \OS2\unpack.exe \SYSTEM\8514.DRV MAHJONGG.EXE
108643a5ec4eSXin LI>41	string		x		"%s"
108743a5ec4eSXin LI
1088b6cee71dSXin LI# MP3 (archiver, not lossy audio compression)
1089b6cee71dSXin LI0	string	MP3\x1a MP3-Archiver archive data
1090b6cee71dSXin LI# ZET
1091b6cee71dSXin LI0	string	OZ\xc3\x9d ZET archive data
1092b6cee71dSXin LI# TSComp
1093*ae316d1dSXin LI# Update:	Joerg Jenderek 2023 Nov
1094*ae316d1dSXin LI# URL:		http://fileformats.archiveteam.org/wiki/TSComp
1095*ae316d1dSXin LI# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/t/tscomp.trid.xml
1096*ae316d1dSXin LI#		https://entropymine.com/deark/releases/deark-1.6.5.tar.gz
1097*ae316d1dSXin LI#		deark-1.6.5/modules/installshld.c
1098*ae316d1dSXin LI# Note:		called "TSComp compressed data" by TrID
1099*ae316d1dSXin LI#		verified by command like `deark -m tscomp -l -d2 MAKERRES.DL$`
1100*ae316d1dSXin LI#		The "13" might be a version number. The "8c" is a mystery
1101*ae316d1dSXin LI0	string	\x65\x5d\x13\x8c\x08\x01\x03\x00 TSComp archive
1102*ae316d1dSXin LI#!:mime	application/octet-stream
1103*ae316d1dSXin LI!:mime	application/x-tscomp-compressed
1104*ae316d1dSXin LI# filename style: 0~old version 1~without wildcard 2~with wildcard
1105*ae316d1dSXin LI#>0x08	ubyte		x				\b, filename style %u
1106*ae316d1dSXin LI>0x08	ubyte		0				data, filename style 0
1107*ae316d1dSXin LI# no example found
1108*ae316d1dSXin LI!:ext	??$
1109*ae316d1dSXin LI#>0x08	ubyte		1				data, without wildcard
1110*ae316d1dSXin LI>0x08	ubyte		1				data
1111*ae316d1dSXin LI# for single-file archives, often the last letter of the filename extension is changed to "$"; but also name like: BUILD3.BM!
1112*ae316d1dSXin LI!:ext	??$/??!
1113*ae316d1dSXin LI>0x08	ubyte		2				data, with wildcard
1114*ae316d1dSXin LI# for multi-file archives common extensions seem to be .lib and .cmp, but also names like: SAMPMIF$ OTDATA.$$$ TWOFILES.TSC WIN.PAK
1115*ae316d1dSXin LI!:ext	/lib/cmp/$$$/tsc/pak
1116*ae316d1dSXin LI# fnlen; pascal string length; original 1st file name like: CHFORMAT.MML
1117*ae316d1dSXin LI>0x1c	pstring		x				\b, %s
1118*ae316d1dSXin LI# md->fi->timestamp
1119*ae316d1dSXin LI>0x16	lemsdosdate	x				\b, modified %s
1120*ae316d1dSXin LI>0x18	lemsdostime	x				%s
1121*ae316d1dSXin LI# 1st compressed size: like 180 (SAMPMML$$)
1122*ae316d1dSXin LI>0x0E	ulelong		x				\b, compressed size %u
1123*ae316d1dSXin LI# de_dbg_indent(c, 1): like: 12h
1124*ae316d1dSXin LI#>0x0d	ubyte		x				b, at 0xD %#x
1125*ae316d1dSXin LI# like: 0
1126*ae316d1dSXin LI#>0x1A	ubeshort	x				\b, at 0x1A %#x
1127*ae316d1dSXin LI# 2nd member offset
1128*ae316d1dSXin LI#>0x12	ulelong		x				\b, next offset %#x
1129*ae316d1dSXin LI>0x12	ulelong		>0
1130*ae316d1dSXin LI# original 2nd archive member name like: FORMATS.MML
1131*ae316d1dSXin LI>>(0x12.l+15)	pstring	x				\b, %s ...
1132b6cee71dSXin LI# ARQ
1133b6cee71dSXin LI0	string	gW\4\1 ARQ archive data
1134b6cee71dSXin LI# Squash
1135b6cee71dSXin LI3	string	OctSqu Squash archive data
1136b6cee71dSXin LI# Terse
1137b6cee71dSXin LI0	string	\5\1\1\0 Terse archive data
1138b6cee71dSXin LI# UHarc
1139b6cee71dSXin LI0	string	UHA UHarc archive data
1140b6cee71dSXin LI# ABComp
1141b6cee71dSXin LI0	string	\2AB ABComp archive data
1142b6cee71dSXin LI0	string	\3AB2 ABComp archive data
1143b6cee71dSXin LI# CMP
1144b6cee71dSXin LI0	string	CO\0 CMP archive data
1145b6cee71dSXin LI# Splint
1146b6cee71dSXin LI0	string	\x93\xb9\x06 Splint archive data
1147b6cee71dSXin LI# InstallShield
1148b6cee71dSXin LI0	string	\x13\x5d\x65\x8c InstallShield Z archive Data
1149b6cee71dSXin LI# Gather
1150b6cee71dSXin LI1	string	GTH Gather archive data
1151b6cee71dSXin LI# BOA
1152b6cee71dSXin LI0	string	BOA BOA archive data
1153b6cee71dSXin LI# RAX
1154b6cee71dSXin LI0	string	ULEB\xa RAX archive data
1155b6cee71dSXin LI# Xtreme
1156b6cee71dSXin LI0	string	ULEB\0 Xtreme archive data
1157b6cee71dSXin LI# Pack Magic
1158b6cee71dSXin LI0	string	@\xc3\xa2\1\0 Pack Magic archive data
1159b6cee71dSXin LI# BTS
1160b6cee71dSXin LI0	belong&0xfeffffff	0x1a034465 BTS archive data
1161b6cee71dSXin LI# ELI 5750
1162b6cee71dSXin LI0	string	Ora\  ELI 5750 archive data
1163b6cee71dSXin LI# QFC
1164b6cee71dSXin LI0	string	\x1aFC\x1a QFC archive data
1165b6cee71dSXin LI0	string	\x1aQF\x1a QFC archive data
1166898496eeSXin LI# PRO-PACK https://www.segaretro.org/Rob_Northen_compression
1167898496eeSXin LI0	string	RNC
1168898496eeSXin LI>3	byte	1	PRO-PACK archive data (compression 1)
1169898496eeSXin LI>3	byte	2	PRO-PACK archive data (compression 2)
1170b6cee71dSXin LI# 777
1171b6cee71dSXin LI0	string	777 777 archive data
1172b6cee71dSXin LI# LZS221
1173b6cee71dSXin LI0	string	sTaC LZS221 archive data
1174b6cee71dSXin LI# HPA
1175b6cee71dSXin LI0	string	HPA HPA archive data
1176b6cee71dSXin LI# Arhangel
1177b6cee71dSXin LI0	string	LG Arhangel archive data
1178b6cee71dSXin LI# EXP1, uses bzip2
1179b6cee71dSXin LI0	string	0123456789012345BZh EXP1 archive data
1180b6cee71dSXin LI# IMP
1181b6cee71dSXin LI0	string	IMP\xa IMP archive data
1182b6cee71dSXin LI# NRV
1183b6cee71dSXin LI0	string	\x00\x9E\x6E\x72\x76\xFF NRV archive data
1184b6cee71dSXin LI# Squish
1185b6cee71dSXin LI0	string	\x73\xb2\x90\xf4 Squish archive data
1186b6cee71dSXin LI# Par
1187b6cee71dSXin LI0	string	PHILIPP Par archive data
1188b6cee71dSXin LI0	string	PAR Par archive data
1189b6cee71dSXin LI# HIT
1190b6cee71dSXin LI0	string	UB HIT archive data
1191b6cee71dSXin LI# SBX
1192b6cee71dSXin LI0	belong&0xfffff000	0x53423000 SBX archive data
1193b6cee71dSXin LI# NaShrink
1194b6cee71dSXin LI0	string	NSK NaShrink archive data
1195b6cee71dSXin LI# SAPCAR
1196b6cee71dSXin LI0	string	#\ CAR\ archive\ header SAPCAR archive data
1197a4d6d3b8SXin LI0	string	CAR\ 2.00 SAPCAR archive data
1198a4d6d3b8SXin LI0	string	CAR\ 2.01 SAPCAR archive data
1199a4d6d3b8SXin LI#!:mime	application/octet-stream
1200a4d6d3b8SXin LI!:mime	application/vnd.sar
1201a4d6d3b8SXin LI!:ext	sar
1202b6cee71dSXin LI# Disintegrator
1203b6cee71dSXin LI0	string	DST Disintegrator archive data
1204b6cee71dSXin LI# ASD
1205b6cee71dSXin LI0	string	ASD ASD archive data
1206b6cee71dSXin LI# InstallShield CAB
1207a4d6d3b8SXin LI# Update:	Joerg Jenderek at Nov 2021
1208a4d6d3b8SXin LI# URL:		https://en.wikipedia.org/wiki/InstallShield
1209a4d6d3b8SXin LI# Reference:	https://github.com/twogood/unshield/blob/master/lib/cabfile.h
1210a4d6d3b8SXin LI# Note:		Not compatible with Microsoft CAB files
1211a4d6d3b8SXin LI# http://mark0.net/download/triddefs_xml.7z/defs/a/ark-cab-ishield.trid.xml
1212a4d6d3b8SXin LI# CAB_SIGNATURE 0x28635349
1213a4d6d3b8SXin LI0	string	ISc( InstallShield
1214a4d6d3b8SXin LI#!:mime		application/octet-stream
1215a4d6d3b8SXin LI!:mime		application/x-installshield
1216a4d6d3b8SXin LI# http://mark0.net/download/triddefs_xml.7z/defs/a/ark-cab-ishield-hdr.trid.xml
1217a4d6d3b8SXin LI>16	ulelong	!0	setup header
1218a4d6d3b8SXin LI# like: _SYS1.HDR _USER1.HDR data1.hdr
1219a4d6d3b8SXin LI!:ext	hdr
1220a4d6d3b8SXin LI>16	ulelong	=0	CAB
1221a4d6d3b8SXin LI# like: _SYS1.CAB _USER1.CAB DATA1.CAB  data2.cab
1222a4d6d3b8SXin LI!:ext	cab
1223a4d6d3b8SXin LI# https://github.com/twogood/unshield/blob/master/lib/helper.c
1224a4d6d3b8SXin LI# version like:	0x1005201 0x100600c 0x1007000 0x1009500
1225a4d6d3b8SXin LI#		0x2000578 0x20005dc 0x2000640 0x40007d0 0x4000834
1226a4d6d3b8SXin LI>4	ulelong	x	\b, version %#x
1227a4d6d3b8SXin LI# volume_info like: 0
1228a4d6d3b8SXin LI>8	ulelong	!0	\b, volume_info %#x
1229a4d6d3b8SXin LI# cab_descriptor_offset like: 0x200
1230a4d6d3b8SXin LI>12	ulelong	!0x200	\b, offset %#x
1231a4d6d3b8SXin LI#>0x200	ubequad	x	\b, at 0x200 %#16.16llx
1232a4d6d3b8SXin LI# cab_descriptor_size like: 0 (*.cab) BD5 C8B DA5 E2A E36 116C 251D 4DA9 56F0 5CC2 6E4B 777D 779E 1F7C2
1233a4d6d3b8SXin LI>16	ulelong	!0	\b, descriptor size %#x
1234b6cee71dSXin LI# TOP4
1235b6cee71dSXin LI0	string	T4\x1a TOP4 archive data
1236b6cee71dSXin LI# BatComp left out: sig looks like COM executable
1237b6cee71dSXin LI# so TODO: get real 4dos batcomp file and find sig
1238b6cee71dSXin LI# BlakHole
1239b6cee71dSXin LI0	string	BH\5\7 BlakHole archive data
1240b6cee71dSXin LI# BIX
1241b6cee71dSXin LI0	string	BIX0 BIX archive data
1242b6cee71dSXin LI# ChiefLZA
1243b6cee71dSXin LI0	string	ChfLZ ChiefLZA archive data
1244b6cee71dSXin LI# Blink
1245b6cee71dSXin LI0	string	Blink Blink archive data
1246b6cee71dSXin LI# Logitech Compress
1247b6cee71dSXin LI0	string	\xda\xfa Logitech Compress archive data
1248b6cee71dSXin LI# ARS-Sfx (FIXME: really a SFX? then goto COM/EXE)
1249b6cee71dSXin LI1	string	(C)\ STEPANYUK ARS-Sfx archive data
1250b6cee71dSXin LI# AKT/AKT32
1251b6cee71dSXin LI0	string	AKT32 AKT32 archive data
1252b6cee71dSXin LI0	string	AKT AKT archive data
1253b6cee71dSXin LI# NPack
1254b6cee71dSXin LI0	string	MSTSM NPack archive data
1255b6cee71dSXin LI# PFT
1256b6cee71dSXin LI0	string	\0\x50\0\x14 PFT archive data
1257b6cee71dSXin LI# SemOne
1258b6cee71dSXin LI0	string	SEM SemOne archive data
1259b6cee71dSXin LI# PPMD
1260b6cee71dSXin LI0	string	\x8f\xaf\xac\x84 PPMD archive data
1261b6cee71dSXin LI# FIZ
1262b6cee71dSXin LI0	string	FIZ FIZ archive data
1263b6cee71dSXin LI# MSXiE
1264b6cee71dSXin LI0	belong&0xfffff0f0	0x4d530000 MSXiE archive data
1265b6cee71dSXin LI# DeepFreezer
1266b6cee71dSXin LI0	belong&0xfffffff0	0x797a3030 DeepFreezer archive data
1267b6cee71dSXin LI# DC
1268b6cee71dSXin LI0	string	=<DC- DC archive data
1269b6cee71dSXin LI# TPac
1270b6cee71dSXin LI0	string	\4TPAC\3 TPac archive data
1271b6cee71dSXin LI# Ai
1272898496eeSXin LI# Update:	Joerg Jenderek
1273898496eeSXin LI# URL:		http://fileformats.archiveteam.org/wiki/Ai_Archiver
1274b6cee71dSXin LI0	string	Ai\1\1\0 Ai archive data
1275898496eeSXin LI#!:mime	application/octet-stream
1276898496eeSXin LI!:mime	application/x-compress-ai
1277898496eeSXin LI!:ext	ai
1278b6cee71dSXin LI0	string	Ai\1\0\0 Ai archive data
1279898496eeSXin LI#!:mime	application/octet-stream
1280898496eeSXin LI!:mime	application/x-compress-ai
1281898496eeSXin LI!:ext	ai
1282b6cee71dSXin LI# Ai32
1283898496eeSXin LI# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/a/ark-ai.trid.xml
1284898496eeSXin LI# Note:		called "Ai Archivator compressed archive" by TrID
1285b6cee71dSXin LI0	string	Ai\2\0 Ai32 archive data
1286898496eeSXin LI#!:mime	application/octet-stream
1287898496eeSXin LI!:mime	application/x-compress-ai
1288898496eeSXin LI!:ext	ai
1289898496eeSXin LI# original file name
1290898496eeSXin LI>8	pstring/h x	"%s"
1291898496eeSXin LI# according to TrID the next 3 bytes are nil
1292898496eeSXin LI>5	ubyte	!0	\b, at 5 %#x
1293898496eeSXin LI>6	ubyte	!0	\b, at 6 %#x
1294898496eeSXin LI>7	ubyte	!0	\b, at 7 %#x
1295898496eeSXin LI# the fourth byte with value 0 is probably a flag for "non solid" mode
1296898496eeSXin LI#>3	ubyte	=0x00	\b, unsolid mode
1297b6cee71dSXin LI0	string	Ai\2\1 Ai32 archive data
1298898496eeSXin LI#!:mime	application/octet-stream
1299898496eeSXin LI!:mime	application/x-compress-ai
1300898496eeSXin LI!:ext	ai
1301898496eeSXin LI# original file name
1302898496eeSXin LI>8	pstring/h x	"%s"
1303898496eeSXin LI# the fourth byte with value 0x01 is probably a flag for "solid" mode; this is not the default
1304898496eeSXin LI>3	ubyte	=0x01	\b, solid mode
1305b6cee71dSXin LI# SBC
1306b6cee71dSXin LI0	string	SBC SBC archive data
1307b6cee71dSXin LI# Ybs
1308b6cee71dSXin LI0	string	YBS Ybs archive data
1309b6cee71dSXin LI# DitPack
1310b6cee71dSXin LI0	string	\x9e\0\0 DitPack archive data
1311b6cee71dSXin LI# DMS
1312b6cee71dSXin LI0	string	DMS! DMS archive data
1313b6cee71dSXin LI# EPC
1314b6cee71dSXin LI0	string	\x8f\xaf\xac\x8c EPC archive data
1315b6cee71dSXin LI# VSARC
1316b6cee71dSXin LI0	string	VS\x1a VSARC archive data
1317b6cee71dSXin LI# PDZ
1318b6cee71dSXin LI0	string	PDZ PDZ archive data
1319b6cee71dSXin LI# ReDuq
1320b6cee71dSXin LI0	string	rdqx ReDuq archive data
1321b6cee71dSXin LI# GCA
1322b6cee71dSXin LI0	string	GCAX GCA archive data
1323b6cee71dSXin LI# PPMN
1324b6cee71dSXin LI0	string	pN PPMN archive data
1325b6cee71dSXin LI# WinImage
1326b6cee71dSXin LI3	string	WINIMAGE WinImage archive data
1327b6cee71dSXin LI# Compressia
1328b6cee71dSXin LI0	string	CMP0CMP Compressia archive data
1329b6cee71dSXin LI# UHBC
1330b6cee71dSXin LI0	string	UHB UHBC archive data
1331b6cee71dSXin LI# WinHKI
1332b6cee71dSXin LI0	string	\x61\x5C\x04\x05 WinHKI archive data
1333b6cee71dSXin LI# WWPack data file
1334b6cee71dSXin LI0	string	WWP WWPack archive data
1335b6cee71dSXin LI# BSN (BSA, PTS-DOS)
1336b6cee71dSXin LI0	string	\xffBSG BSN archive data
1337b6cee71dSXin LI1	string	\xffBSG BSN archive data
1338b6cee71dSXin LI3	string	\xffBSG BSN archive data
1339b6cee71dSXin LI1	string	\0\xae\2 BSN archive data
1340b6cee71dSXin LI1	string	\0\xae\3 BSN archive data
1341b6cee71dSXin LI1	string	\0\xae\7 BSN archive data
1342b6cee71dSXin LI# AIN
1343b6cee71dSXin LI0	string	\x33\x18 AIN archive data
1344b6cee71dSXin LI0	string	\x33\x17 AIN archive data
13459ce06829SXin LI# XPA32 test moved and merged with XPA by Joerg Jenderek at Sep 2015
1346b6cee71dSXin LI# SZip (TODO: doesn't catch all versions)
1347b6cee71dSXin LI0	string	SZ\x0a\4 SZip archive data
1348b6cee71dSXin LI# XPack DiskImage
13499ce06829SXin LI# *.XDI updated by Joerg Jenderek Sep 2015
13509ce06829SXin LI# ftp://ftp.sac.sk/pub/sac/pack/0index.txt
13519ce06829SXin LI# GRR: this test is still too general as it catches also text files starting with jm
13529ce06829SXin LI0	string	jm
13539ce06829SXin LI# only found examples with this additional characteristic 2 bytes
13549ce06829SXin LI>2	string	\x2\x4	Xpack DiskImage archive data
13559ce06829SXin LI#!:ext xdi
1356b6cee71dSXin LI# XPack Data
13579ce06829SXin LI# *.xpa updated by Joerg Jenderek Sep 2015
13589ce06829SXin LI# ftp://ftp.elf.stuba.sk/pub/pc/pack/
13599ce06829SXin LI0	string	xpa	XPA
13609ce06829SXin LI!:ext	xpa
13619ce06829SXin LI# XPA32
13629ce06829SXin LI# ftp://ftp.elf.stuba.sk/pub/pc/pack/xpa32.zip
13639ce06829SXin LI# created by XPA32.EXE version 1.0.2 for Windows
13649ce06829SXin LI>0	string	xpa\0\1 \b32 archive data
13659ce06829SXin LI# created by XPACK.COM version 1.67m or 1.67r with short 0x1800
13669ce06829SXin LI>3	ubeshort	!0x0001	\bck archive data
1367b6cee71dSXin LI# XPack Single Data
13689ce06829SXin LI# changed by Joerg Jenderek Sep 2015 back to like in version 5.12
13699ce06829SXin LI# letter 'I'+ acute accent is equivalent to \xcd
13709ce06829SXin LI0	string	\xcd\ jm	Xpack single archive data
13719ce06829SXin LI#!:mime	application/x-xpa-compressed
13729ce06829SXin LI!:ext xpa
1373b6cee71dSXin LI
1374b6cee71dSXin LI# TODO: missing due to unknown magic/magic at end of file:
1375b6cee71dSXin LI#DWC
1376b6cee71dSXin LI#ARG
1377b6cee71dSXin LI#ZAR
1378b6cee71dSXin LI#PC/3270
1379b6cee71dSXin LI#InstallIt
1380b6cee71dSXin LI#RKive
1381b6cee71dSXin LI#RK
1382b6cee71dSXin LI#XPack Diskimage
1383b6cee71dSXin LI
1384b6cee71dSXin LI# These were inspired by idarc, but actually verified
1385b6cee71dSXin LI# Dzip archiver (.dz)
138658a0f0d0SEitan Adler# Update: Joerg Jenderek
138758a0f0d0SEitan Adler# URL: http://speeddemosarchive.com/dzip/
138858a0f0d0SEitan Adler# reference: http://speeddemosarchive.com/dzip/dz29src.zip/main.c
138958a0f0d0SEitan Adler# GRR: line below is too general as it matches also ASCII texts like Doszip commander help dz.txt
139058a0f0d0SEitan Adler0	string	DZ
139158a0f0d0SEitan Adler# latest version is 2.9 dated 7 may 2003
139258a0f0d0SEitan Adler>2	byte	<4 Dzip archive data
139358a0f0d0SEitan Adler!:mime	application/x-dzip
139458a0f0d0SEitan Adler!:ext	dz
139558a0f0d0SEitan Adler>>2	byte	x \b, version %i
139658a0f0d0SEitan Adler>>3	byte	x \b.%i
139743a5ec4eSXin LI>>4	ulelong	x \b, offset %#x
139858a0f0d0SEitan Adler>>8	ulelong	x \b, %u files
1399b6cee71dSXin LI# ZZip archiver (.zz)
1400b6cee71dSXin LI0	string	ZZ\ \0\0 ZZip archive data
1401b6cee71dSXin LI0	string	ZZ0 ZZip archive data
1402b6cee71dSXin LI# PAQ archiver (.paq)
1403b6cee71dSXin LI0	string	\xaa\x40\x5f\x77\x1f\xe5\x82\x0d PAQ archive data
1404b6cee71dSXin LI0	string	PAQ PAQ archive data
1405b6cee71dSXin LI>3	byte&0xf0	0x30
1406b6cee71dSXin LI>>3	byte	x (v%c)
1407b6cee71dSXin LI# JAR archiver (.j), this is the successor to ARJ, not Java's JAR (which is essentially ZIP)
1408a4d6d3b8SXin LI# Update:	Joerg Jenderek
1409a4d6d3b8SXin LI# URL:		http://fileformats.archiveteam.org/wiki/JAR_(ARJ_Software)
1410a4d6d3b8SXin LI# reference:	http://mark0.net/download/triddefs_xml.7z/defs/a/ark-jar.trid.xml
1411a4d6d3b8SXin LI#		https://www.sac.sk/download/pack/jar102x.exe/TECHNOTE.DOC
1412a4d6d3b8SXin LI# Note:		called "JAR compressed archive" by TrID
1413b6cee71dSXin LI0xe	string	\x1aJar\x1b JAR (ARJ Software, Inc.) archive data
1414a4d6d3b8SXin LI#!:mime	application/octet-stream
1415a4d6d3b8SXin LI!:mime	application/x-compress-j
1416a4d6d3b8SXin LI>0	ulelong	x		\b, CRC32 %#x
1417a4d6d3b8SXin LI# standard suffix is ".j"; for multi volumes following order j01 j02 ... j99 100 ... 990
1418a4d6d3b8SXin LI!:ext	j/j01/j02
1419a4d6d3b8SXin LI# URL:		http://fileformats.archiveteam.org/wiki/JARCS
1420a4d6d3b8SXin LI# reference:	http://mark0.net/download/triddefs_xml.7z/defs/a/ark-jarcs.trid.xml
1421a4d6d3b8SXin LI# Note:		called "JARCS compressed archive" by TrID
1422b6cee71dSXin LI0	string	JARCS JAR (ARJ Software, Inc.) archive data
1423a4d6d3b8SXin LI#!:mime	application/octet-stream
1424a4d6d3b8SXin LI!:mime	application/x-compress-jar
1425a4d6d3b8SXin LI!:ext	jar
1426b6cee71dSXin LI
1427b6cee71dSXin LI# ARJ archiver (jason@jarthur.Claremont.EDU)
1428a4d6d3b8SXin LI# URL:		http://fileformats.archiveteam.org/wiki/ARJ
1429a4d6d3b8SXin LI# reference:	http://mark0.net/download/triddefs_xml.7z/defs/a/ark-arj.trid.xml
1430a4d6d3b8SXin LI#		https://github.com/FarGroup/FarManager/
1431a4d6d3b8SXin LI#		blob/master/plugins/multiarc/arc.doc/arj.txt
1432a4d6d3b8SXin LI# Note:		called "ARJ compressed archive" by TrID and
1433a4d6d3b8SXin LI#		"ARJ File Format" by DROID via PUID fmt/610
1434a4d6d3b8SXin LI#		verified by `7z l -tarj PHRACK1.ARJ` and
1435a4d6d3b8SXin LI#		`arj.exe l TEST-hk9.ARJ`
1436a4d6d3b8SXin LI0	leshort		0xea60
1437a4d6d3b8SXin LI# skip DROID fmt-610-signature-id-946.arj by check for valid file type of main header
1438a4d6d3b8SXin LI>0xA	ubyte		2
1439a4d6d3b8SXin LI>>0	use		arj-archive
1440a4d6d3b8SXin LI0	name		arj-archive
1441a4d6d3b8SXin LI>0	leshort		x		ARJ archive
1442b6cee71dSXin LI!:mime	application/x-arj
1443a4d6d3b8SXin LI# look for terminating 0-character of filename
1444a4d6d3b8SXin LI>0x26	search/1024	\0
1445a4d6d3b8SXin LI# file name extension is normally .arj but not for parts of multi volume
1446a4d6d3b8SXin LI#>>&-5	string		x		extension %.4s
1447a4d6d3b8SXin LI>>&-5	string/c	.arj		data
1448a4d6d3b8SXin LI!:ext	arj
1449a4d6d3b8SXin LI>>&-5	default		x
1450a4d6d3b8SXin LI# for multi volume first name is archive.arj then following parts archive.a01 archive.a02 ...
1451a4d6d3b8SXin LI>>>8	byte		&0x04		data
1452a4d6d3b8SXin LI!:ext	a01/a02
1453a4d6d3b8SXin LI# for SFX first name is archive.exe then following parts archive.e01 archive.e02 ...
1454a4d6d3b8SXin LI>>>8	byte		^0x04		data, SFX multi-volume
1455a4d6d3b8SXin LI!:ext	e01/e02
1456a4d6d3b8SXin LI# basic header size like: 0x002b 0x002c 0x04e0 0x04e3 0x04e7
1457a4d6d3b8SXin LI#>2	uleshort	x		basic header size %#4.4x
1458a4d6d3b8SXin LI# next fragment content like: 0x0a200a003a8fc713 0x524a000010bb3471 0x524a0000c73c70f9
1459a4d6d3b8SXin LI#>(2.s)	ubequad		x		NEXT FRAGMENT CONTENT %#16.16llx
1460a4d6d3b8SXin LI# first_hdr_size; seems to be same as basic header size
1461a4d6d3b8SXin LI#>2	uleshort	x		1st header size %#x
1462a4d6d3b8SXin LI# archiver version number like: 3 4 6 11 102
1463a4d6d3b8SXin LI>5	byte		x		\b, v%d
1464a4d6d3b8SXin LI# minimum archiver version to extract like: 1
1465a4d6d3b8SXin LI>6	ubyte		!1		\b, minimum %u to extract
1466a4d6d3b8SXin LI# FOR DEBUGGING
1467a4d6d3b8SXin LI#>8	byte		x		\b, FLAGS %#x
1468a4d6d3b8SXin LI# GARBLED_FLAG1; garble with password; g switch
1469a4d6d3b8SXin LI>8	byte		&0x01		\b, password-protected
1470a4d6d3b8SXin LI# encryption version: 0~old  1~old 2~new 3~reserved 4~40 bit key GOST
1471a4d6d3b8SXin LI>>0x20	ubyte		x		(v%u)
1472a4d6d3b8SXin LI#>8	byte		&0x02		\b, secured
1473a4d6d3b8SXin LI# ANSIPAGE_FLAG; indicates ANSI codepage used by ARJ32; hy switch
1474a4d6d3b8SXin LI>8	byte		&0x02		\b, ANSI codepage
1475a4d6d3b8SXin LI# VOLUME_FLAG indicates presence of succeeding volume; but apparently not for SFX
1476a4d6d3b8SXin LI>8	byte		&0x04		\b, multi-volume
1477a4d6d3b8SXin LI#>8	byte		&0x08		\b, file-offset
1478a4d6d3b8SXin LI# ARJPROT_FLAG; build with data protection record; hk switch
1479a4d6d3b8SXin LI>8	byte		&0x08		\b, recoverable
1480a4d6d3b8SXin LI# arj protection factor; maximal 10; switch hky -> factor=y+1
1481a4d6d3b8SXin LI>>0x22	byte		x		(factor %u)
1482a4d6d3b8SXin LI>8	byte		&0x10		\b, slash-switched
1483a4d6d3b8SXin LI# BACKUP_FLAG; obsolete
1484a4d6d3b8SXin LI>8	byte		&0x20		\b, backup
1485a4d6d3b8SXin LI# SECURED_FLAG;
1486a4d6d3b8SXin LI>8	byte		&0x40		\b, secured,
1487a4d6d3b8SXin LI# ALTNAME_FLAG; indicates dual-name archive
1488a4d6d3b8SXin LI>8	byte		&0x80		\b, dual-name
1489a4d6d3b8SXin LI# security version; 0~old 2~current
1490a4d6d3b8SXin LI>9	ubyte		!0
1491a4d6d3b8SXin LI>>9	ubyte		!2		\b, security version %u
1492a4d6d3b8SXin LI# file type; 2 in main header; 0~binary 1~7-bitText 2~comment 3~directory 4~VolumeLabel 5=ChapterLabel
1493a4d6d3b8SXin LI>0xA	ubyte		!2		\b, file type %u
1494a4d6d3b8SXin LI# date+time when original archive was created in MS-DOS format via ./msdos
1495a4d6d3b8SXin LI>0xC	ulelong		x		\b, created
1496a4d6d3b8SXin LI>0xC	use		dos-date
1497a4d6d3b8SXin LI# or date and time by new internal function
1498a4d6d3b8SXin LI#>0xE	lemsdosdate	x		%s
1499a4d6d3b8SXin LI#>0xC	lemsdostime	x		%s
1500a4d6d3b8SXin LI# FOR DEBUGGING
1501a4d6d3b8SXin LI#>0x12	uleshort	x		RAW DATE %#4.4x
1502a4d6d3b8SXin LI#>0x10	uleshort	x		RAW TIME %#4.4x
1503a4d6d3b8SXin LI# date+time when archive was last modified; sometimes nil or
1504a4d6d3b8SXin LI# maybe wrong like in HP4DRVR.ARJ
1505a4d6d3b8SXin LI#>0x10	ulelong		>0		\b, modified
1506a4d6d3b8SXin LI#>>0x10	use		dos-date
1507a4d6d3b8SXin LI# or date and time by new internal function
1508a4d6d3b8SXin LI#>>0x12	lemsdosdate	x		%s
1509a4d6d3b8SXin LI#>>0x10	lemsdostime	x		%s
1510a4d6d3b8SXin LI# archive size (currently used only for secured archives); MAYBE?
1511a4d6d3b8SXin LI#>0x14	ulelong		!0		\b, file size %u
1512a4d6d3b8SXin LI# security envelope file position; MAYBE?
1513a4d6d3b8SXin LI#>0x18	ulelong		!0		\b, at %#x security envelope
1514a4d6d3b8SXin LI# filespec position in filename; WHAT IS THAT?
1515a4d6d3b8SXin LI#>0x1C	uleshort	>0		\b, filespec position %#x
1516a4d6d3b8SXin LI# length in bytes of security envelope data like: 2CAh 301h 364h 471h
1517a4d6d3b8SXin LI>0x1E	uleshort	!0		\b, security envelope length %#x
1518a4d6d3b8SXin LI# last chapter like: 0 1
1519a4d6d3b8SXin LI>0x21	ubyte		!0		\b, last chapter %u
1520a4d6d3b8SXin LI# filename (null-terminated string); sometimes at 0x26 when 4 bytes for extra data
1521a4d6d3b8SXin LI>34	byte		x		\b, original name:
1522a4d6d3b8SXin LI# with extras data
1523a4d6d3b8SXin LI>34	byte		<0x0B
1524a4d6d3b8SXin LI>>38	string		x		%s
1525a4d6d3b8SXin LI# without extras data
1526a4d6d3b8SXin LI>34	byte		>0x0A
1527a4d6d3b8SXin LI>>34	string		x		%s
1528a4d6d3b8SXin LI# host OS: 0~MSDOS ... 11~WIN32
1529a4d6d3b8SXin LI>7	byte		0		\b, os: MS-DOS
1530a4d6d3b8SXin LI>7	byte		1		\b, os: PRIMOS
1531a4d6d3b8SXin LI>7	byte		2		\b, os: Unix
1532a4d6d3b8SXin LI>7	byte		3		\b, os: Amiga
1533a4d6d3b8SXin LI>7	byte		4		\b, os: Macintosh
1534a4d6d3b8SXin LI>7	byte		5		\b, os: OS/2
1535a4d6d3b8SXin LI>7	byte		6		\b, os: Apple ][ GS
1536a4d6d3b8SXin LI>7	byte		7		\b, os: Atari ST
1537a4d6d3b8SXin LI>7	byte		8		\b, os: NeXT
1538a4d6d3b8SXin LI>7	byte		9		\b, os: VAX/VMS
1539a4d6d3b8SXin LI>7	byte		10		\b, os: WIN95
1540a4d6d3b8SXin LI>7	byte		11		\b, os: WIN32
1541b6cee71dSXin LI# [JW] idarc says this is also possible
1542b6cee71dSXin LI2	leshort		0xea60		ARJ archive data
1543a4d6d3b8SXin LI#2	leshort		0xea60
1544a4d6d3b8SXin LI#>2	use		arj-archive
1545b6cee71dSXin LI
1546b6cee71dSXin LI# HA archiver (Greg Roelofs, newt@uchicago.edu)
1547b6cee71dSXin LI# This is a really bad format. A file containing HAWAII will match this...
1548b6cee71dSXin LI#0	string		HA		HA archive data,
1549b6cee71dSXin LI#>2	leshort		=1		1 file,
1550*ae316d1dSXin LI#>2	leshort		>1		%u files,
1551b6cee71dSXin LI#>4	byte&0x0f	=0		first is type CPY
1552b6cee71dSXin LI#>4	byte&0x0f	=1		first is type ASC
1553b6cee71dSXin LI#>4	byte&0x0f	=2		first is type HSC
1554b6cee71dSXin LI#>4	byte&0x0f	=0x0e		first is type DIR
1555b6cee71dSXin LI#>4	byte&0x0f	=0x0f		first is type SPECIAL
1556b6cee71dSXin LI# suggestion: at least identify small archives (<1024 files)
1557b6cee71dSXin LI0  belong&0xffff00fc 0x48410000 HA archive data
1558b6cee71dSXin LI>2	leshort		=1		1 file,
1559b6cee71dSXin LI>2	leshort		>1		%u files,
1560b6cee71dSXin LI>4	byte&0x0f	=0		first is type CPY
1561b6cee71dSXin LI>4	byte&0x0f	=1		first is type ASC
1562b6cee71dSXin LI>4	byte&0x0f	=2		first is type HSC
1563b6cee71dSXin LI>4	byte&0x0f	=0x0e		first is type DIR
1564b6cee71dSXin LI>4	byte&0x0f	=0x0f		first is type SPECIAL
1565b6cee71dSXin LI
1566b6cee71dSXin LI# HPACK archiver (Peter Gutmann, pgut1@cs.aukuni.ac.nz)
1567b6cee71dSXin LI0	string		HPAK		HPACK archive data
1568b6cee71dSXin LI
1569b6cee71dSXin LI# JAM Archive volume format, by Dmitry.Kohmanyuk@UA.net
1570b6cee71dSXin LI0	string		\351,\001JAM\ 		JAM archive,
1571b6cee71dSXin LI>7	string		>\0			version %.4s
1572b6cee71dSXin LI>0x26	byte		=0x27			-
1573b6cee71dSXin LI>>0x2b	string          >\0			label %.11s,
1574b6cee71dSXin LI>>0x27	lelong		x			serial %08x,
1575b6cee71dSXin LI>>0x36	string		>\0			fstype %.8s
1576b6cee71dSXin LI
1577b6cee71dSXin LI# LHARC/LHA archiver (Greg Roelofs, newt@uchicago.edu)
15783e41d09dSXin LI# Update: Joerg Jenderek
15793e41d09dSXin LI# URL: https://en.wikipedia.org/wiki/LHA_(file_format)
158048c779cdSXin LI# Reference: https://web.archive.org/web/20021005080911/http://www.osirusoft.com/joejared/lzhformat.html
15813e41d09dSXin LI#
15823e41d09dSXin LI#	check and display information of lharc (LHa,PMarc) file
15833e41d09dSXin LI0	name				lharc-file
15843e41d09dSXin LI# check 1st character of method id like -lz4- -lh5- or -pm2-
15853e41d09dSXin LI>2	string		-
15863e41d09dSXin LI# check 5th character of method id
15873e41d09dSXin LI>>6	string		-
15883e41d09dSXin LI# check header level 0 1 2 3
15893e41d09dSXin LI>>>20	ubyte		<4
15903e41d09dSXin LI# check 2nd, 3th and 4th character of method id
15913e41d09dSXin LI>>>>3	regex		\^(lh[0-9a-ex]|lz[s2-8]|pm[012]|pc1)		\b
15923e41d09dSXin LI!:mime	application/x-lzh-compressed
15933e41d09dSXin LI# creator type "LHA "
15943e41d09dSXin LI!:apple	????LHA
15953e41d09dSXin LI# display archive type name like "LHa/LZS archive data" or "LArc archive"
15963e41d09dSXin LI>>>>>2	string		-lz		\b
15973e41d09dSXin LI!:ext	lzs
15983e41d09dSXin LI# already known  -lzs- -lz4- -lz5- with old names
15993e41d09dSXin LI>>>>>>2	string	-lzs		LHa/LZS archive data
16003e41d09dSXin LI>>>>>>3	regex	\^lz[45]	LHarc 1.x archive data
16013e41d09dSXin LI# missing -lz?- with wikipedia names
16023e41d09dSXin LI>>>>>>3	regex	\^lz[2378]	LArc archive
16033e41d09dSXin LI# display archive type name like "LHa (2.x) archive data"
16043e41d09dSXin LI>>>>>2	string		-lh		\b
16053e41d09dSXin LI# already known -lh0- -lh1- -lh2- -lh3-  -lh4- -lh5- -lh6- -lh7- -lhd- variants with old names
16063e41d09dSXin LI>>>>>>3	regex		\^lh[01]	LHarc 1.x/ARX archive data
16073e41d09dSXin LI# LHice archiver use ".ICE" as name extension instead usual one ".lzh"
16083e41d09dSXin LI# FOOBAR archiver use ".foo" as name extension instead usual one
1609898496eeSXin LI# "Florian Orjanov's and Olga Bachetska's ARchiver" not found at the moment
16103e41d09dSXin LI>>>>>>>2	string	-lh1		\b
16113e41d09dSXin LI!:ext lha/lzh/ice
16123e41d09dSXin LI>>>>>>3	regex		\^lh[23d]	LHa 2.x? archive data
16133e41d09dSXin LI>>>>>>3	regex		\^lh[7]		LHa (2.x)/LHark archive data
16143e41d09dSXin LI>>>>>>3	regex		\^lh[456]	LHa (2.x) archive data
16153e41d09dSXin LI>>>>>>>2	string	-lh5		\b
16163e41d09dSXin LI# https://en.wikipedia.org/wiki/BIOS
161743a5ec4eSXin LI# Some mainboard BIOS like Award use LHa compression. So archives with unusual extension are found like
16183e41d09dSXin LI# bios.rom , kd7_v14.bin, 1010.004, ...
16193e41d09dSXin LI!:ext lha/lzh/rom/bin
16203e41d09dSXin LI# missing -lh?- variants (Joe Jared)
16213e41d09dSXin LI>>>>>>3	regex		\^lh[89a-ce]	LHa (Joe Jared) archive
16223e41d09dSXin LI# UNLHA32 2.67a
16233e41d09dSXin LI>>>>>>2	string		-lhx		LHa (UNLHA32) archive
16243e41d09dSXin LI# lha archives with standard file name extensions ".lha" ".lzh"
16253e41d09dSXin LI>>>>>>3	regex		!\^(lh1|lh5)	\b
16263e41d09dSXin LI!:ext lha/lzh
16273e41d09dSXin LI# this should not happen if all -lh variants are described
16283e41d09dSXin LI>>>>>>2	default		x		LHa (unknown) archive
16293e41d09dSXin LI#!:ext	lha
16303e41d09dSXin LI# PMarc
16313e41d09dSXin LI>>>>>3	regex		\^pm[012]	PMarc archive data
16323e41d09dSXin LI!:ext pma
16333e41d09dSXin LI# append method id without leading and trailing minus character
16343e41d09dSXin LI>>>>>3	string		x		[%3.3s]
16353e41d09dSXin LI>>>>>>0	use	lharc-header
16363e41d09dSXin LI#
16373e41d09dSXin LI#	check and display information of lharc header
16383e41d09dSXin LI0	name				lharc-header
16393e41d09dSXin LI# header size 0x4 , 0x1b-0x61
1640*ae316d1dSXin LI#>0	ubyte		x
16413e41d09dSXin LI# compressed data size != compressed file size
16423e41d09dSXin LI#>7	ulelong		x		\b, data size %d
16433e41d09dSXin LI# attribute: 0x2~?? 0x10~symlink|target 0x20~normal
164443a5ec4eSXin LI#>19	ubyte		x		\b, 19_%#x
16453e41d09dSXin LI# level identifier 0 1 2 3
16463e41d09dSXin LI#>20	ubyte		x		\b, level %d
16473e41d09dSXin LI# time stamp
164843a5ec4eSXin LI#>15		ubelong	x		DATE %#8.8x
16493e41d09dSXin LI# OS ID for level 1
16503e41d09dSXin LI>20	ubyte		1
16513e41d09dSXin LI# 0x20 types find for *.rom files
165243a5ec4eSXin LI>>(21.b+24)	ubyte	<0x21		\b, %#x OS
16533e41d09dSXin LI# ascii type like M for MSDOS
16543e41d09dSXin LI>>(21.b+24)	ubyte	>0x20		\b, '%c' OS
16553e41d09dSXin LI# OS ID for level 2
16563e41d09dSXin LI>20	ubyte		2
165743a5ec4eSXin LI#>>23	ubyte		x		\b, OS ID %#x
165843a5ec4eSXin LI>>23	ubyte		<0x21		\b, %#x OS
16593e41d09dSXin LI>>23	ubyte		>0x20		\b, '%c' OS
16603e41d09dSXin LI# filename only for level 0 and 1
16613e41d09dSXin LI>20	ubyte		<2
16623e41d09dSXin LI# length of filename
16633e41d09dSXin LI>>21		ubyte	>0		\b, with
16643e41d09dSXin LI# filename
16653e41d09dSXin LI>>>21		pstring	x		"%s"
16663e41d09dSXin LI#
16673e41d09dSXin LI#2	string		-lh0-		LHarc 1.x/ARX archive data [lh0]
16683e41d09dSXin LI#!:mime	application/x-lharc
16693e41d09dSXin LI2	string		-lh0-
16703e41d09dSXin LI>0	use	lharc-file
16713e41d09dSXin LI#2	string		-lh1-		LHarc 1.x/ARX archive data [lh1]
16723e41d09dSXin LI#!:mime	application/x-lharc
16733e41d09dSXin LI2	string		-lh1-
16743e41d09dSXin LI>0	use	lharc-file
16753e41d09dSXin LI# NEW -lz2- ... -lz8-
16763e41d09dSXin LI2	string		-lz2-
16773e41d09dSXin LI>0	use	lharc-file
16783e41d09dSXin LI2	string		-lz3-
16793e41d09dSXin LI>0	use	lharc-file
16803e41d09dSXin LI2	string		-lz4-
16813e41d09dSXin LI>0	use	lharc-file
16823e41d09dSXin LI2	string		-lz5-
16833e41d09dSXin LI>0	use	lharc-file
16843e41d09dSXin LI2	string		-lz7-
16853e41d09dSXin LI>0	use	lharc-file
16863e41d09dSXin LI2	string		-lz8-
16873e41d09dSXin LI>0	use	lharc-file
1688b6cee71dSXin LI#	[never seen any but the last; -lh4- reported in comp.compression:]
16893e41d09dSXin LI#2	string		-lzs-		LHa/LZS archive data [lzs]
16903e41d09dSXin LI2	string		-lzs-
16913e41d09dSXin LI>0	use	lharc-file
16923e41d09dSXin LI# According to wikipedia and others such a version does not exist
16933e41d09dSXin LI#2	string		-lh\40-		LHa 2.x? archive data [lh ]
16943e41d09dSXin LI#2	string		-lhd-		LHa 2.x? archive data [lhd]
16953e41d09dSXin LI2	string		-lhd-
16963e41d09dSXin LI>0	use	lharc-file
16973e41d09dSXin LI#2	string		-lh2-		LHa 2.x? archive data [lh2]
16983e41d09dSXin LI2	string		-lh2-
16993e41d09dSXin LI>0	use	lharc-file
17003e41d09dSXin LI#2	string		-lh3-		LHa 2.x? archive data [lh3]
17013e41d09dSXin LI2	string		-lh3-
17023e41d09dSXin LI>0	use	lharc-file
17033e41d09dSXin LI#2	string		-lh4-		LHa (2.x) archive data [lh4]
17043e41d09dSXin LI2	string		-lh4-
17053e41d09dSXin LI>0	use	lharc-file
17063e41d09dSXin LI#2	string		-lh5-		LHa (2.x) archive data [lh5]
17073e41d09dSXin LI2	string		-lh5-
17083e41d09dSXin LI>0	use	lharc-file
17093e41d09dSXin LI#2	string		-lh6-		LHa (2.x) archive data [lh6]
17103e41d09dSXin LI2	string		-lh6-
17113e41d09dSXin LI>0	use	lharc-file
17123e41d09dSXin LI#2	string		-lh7-		LHa (2.x)/LHark archive data [lh7]
17133e41d09dSXin LI2	string		-lh7-
17143e41d09dSXin LI# !:mime	application/x-lha
17153e41d09dSXin LI# >20	byte		x		- header level %d
17163e41d09dSXin LI>0	use	lharc-file
17173e41d09dSXin LI# NEW -lh8- ... -lhe- , -lhx-
17183e41d09dSXin LI2	string		-lh8-
17193e41d09dSXin LI>0	use	lharc-file
17203e41d09dSXin LI2	string		-lh9-
17213e41d09dSXin LI>0	use	lharc-file
17223e41d09dSXin LI2	string		-lha-
17233e41d09dSXin LI>0	use	lharc-file
17243e41d09dSXin LI2	string		-lhb-
17253e41d09dSXin LI>0	use	lharc-file
17263e41d09dSXin LI2	string		-lhc-
17273e41d09dSXin LI>0	use	lharc-file
17283e41d09dSXin LI2	string		-lhe-
17293e41d09dSXin LI>0	use	lharc-file
17303e41d09dSXin LI2	string		-lhx-
17313e41d09dSXin LI>0	use	lharc-file
1732b6cee71dSXin LI# taken from idarc [JW]
1733b6cee71dSXin LI2   string      -lZ         PUT archive data
17343e41d09dSXin LI# already done by LHarc magics
17353e41d09dSXin LI# this should never happen if all sub types of LZS archive are identified
17363e41d09dSXin LI#2   string      -lz         LZS archive data
1737b6cee71dSXin LI2   string      -sw1-       Swag archive data
1738b6cee71dSXin LI
17393e41d09dSXin LI0	name		rar-file-header
17403e41d09dSXin LI>24	byte		15		\b, v1.5
17413e41d09dSXin LI>24	byte		20		\b, v2.0
17423e41d09dSXin LI>24	byte		29		\b, v4
17433e41d09dSXin LI>15	byte		0		\b, os: MS-DOS
17443e41d09dSXin LI>15	byte		1		\b, os: OS/2
17453e41d09dSXin LI>15	byte		2		\b, os: Win32
17463e41d09dSXin LI>15	byte		3		\b, os: Unix
17473e41d09dSXin LI>15	byte		4		\b, os: Mac OS
17483e41d09dSXin LI>15	byte		5		\b, os: BeOS
17493e41d09dSXin LI
17503e41d09dSXin LI0	name		rar-archive-header
17513e41d09dSXin LI>3	leshort&0x1ff	>0		\b, flags:
17523e41d09dSXin LI>>3	leshort		&0x01		ArchiveVolume
17533e41d09dSXin LI>>3	leshort		&0x02		Commented
17543e41d09dSXin LI>>3	leshort		&0x04		Locked
17553e41d09dSXin LI>>3	leshort		&0x10		NewVolumeNaming
17563e41d09dSXin LI>>3	leshort		&0x08		Solid
17573e41d09dSXin LI>>3	leshort		&0x20		Authenticated
17583e41d09dSXin LI>>3	leshort		&0x40		RecoveryRecordPresent
17593e41d09dSXin LI>>3	leshort		&0x80		EncryptedBlockHeader
17603e41d09dSXin LI>>3	leshort		&0x100		FirstVolume
17613e41d09dSXin LI
17623e41d09dSXin LI# RAR (Roshal Archive) archive
17633e41d09dSXin LI0	string		Rar!\x1a\7\0		RAR archive data
1764*ae316d1dSXin LI!:mime	application/vnd.rar
17653e41d09dSXin LI!:ext	rar/cbr
17663e41d09dSXin LI# file header
17673e41d09dSXin LI>(0xc.l+9)	byte	0x74
17683e41d09dSXin LI>>(0xc.l+7)	use	rar-file-header
17693e41d09dSXin LI# subblock seems to share information with file header
17703e41d09dSXin LI>(0xc.l+9)	byte	0x7a
17713e41d09dSXin LI>>(0xc.l+7)	use	rar-file-header
17723e41d09dSXin LI>9		byte	0x73
17733e41d09dSXin LI>>7		use	rar-archive-header
17743e41d09dSXin LI
17753e41d09dSXin LI0	string		Rar!\x1a\7\1\0		RAR archive data, v5
1776*ae316d1dSXin LI!:mime	application/vnd.rar
17773e41d09dSXin LI!:ext	rar
17783e41d09dSXin LI
17793e41d09dSXin LI# Very old RAR archive
178048c779cdSXin LI# https://jasonblanks.com/wp-includes/images/papers/KnowyourarchiveRAR.pdf
17813e41d09dSXin LI0	string		RE\x7e\x5e  RAR archive data (<v1.5)
1782*ae316d1dSXin LI!:mime	application/vnd.rar
17833e41d09dSXin LI!:ext	rar/cbr
1784b6cee71dSXin LI
1785b6cee71dSXin LI# SQUISH archiver (Greg Roelofs, newt@uchicago.edu)
1786b6cee71dSXin LI0	string		SQSH		squished archive data (Acorn RISCOS)
1787b6cee71dSXin LI
1788b6cee71dSXin LI# UC2 archiver (Greg Roelofs, newt@uchicago.edu)
1789b6cee71dSXin LI# [JW] see exe section for self-extracting version
1790b6cee71dSXin LI0	string		UC2\x1a		UC2 archive data
1791b6cee71dSXin LI
1792b6cee71dSXin LI# PKZIP multi-volume archive
1793b6cee71dSXin LI0	string		PK\x07\x08PK\x03\x04	Zip multi-volume archive data, at least PKZIP v2.50 to extract
1794b6cee71dSXin LI!:mime	application/zip
17953e41d09dSXin LI!:ext zip/cbz
1796b6cee71dSXin LI
1797*ae316d1dSXin LI
1798898496eeSXin LI0	string		PK\003\004
1799898496eeSXin LI!:strength +1
1800*ae316d1dSXin LI# IOS/IPadOS IPA file (Zip archive)
1801*ae316d1dSXin LI# Starts with Payload (file name length = 19)
1802*ae316d1dSXin LI>26	uleshort	8
1803*ae316d1dSXin LI>>30  	string		Payload		IOS/iPadOS IPA file
1804*ae316d1dSXin LI>>>&26  search/6000	PK\003\004
1805*ae316d1dSXin LI>>>>&34	string		x	containing %s
1806*ae316d1dSXin LI!:mime	application/x-ios-app
1807*ae316d1dSXin LI!:ext	ipa
1808*ae316d1dSXin LI
1809*ae316d1dSXin LI# Android APK file (Zip archive)
1810898496eeSXin LI# Starts with AndroidManifest.xml (file name length = 19)
1811898496eeSXin LI>26	uleshort	19
1812898496eeSXin LI>>30	string	AndroidManifest.xml	Android package (APK), with AndroidManifest.xml
1813898496eeSXin LI!:mime	application/vnd.android.package-archive
1814898496eeSXin LI!:ext	apk
1815898496eeSXin LI>>>-22	string	PK\005\006
1816898496eeSXin LI>>>>(-6.l-16)	string	APK\x20Sig\x20Block\x2042	\b, with APK Signing Block
1817898496eeSXin LI# Starts with META-INF/com/android/build/gradle/app-metadata.properties
1818898496eeSXin LI>26	uleshort	57
1819898496eeSXin LI>>30	string	META-INF/com/android/build/gradle/
1820898496eeSXin LI>>>&0	string	app-metadata.properties	Android package (APK), with gradle app-metadata.properties
1821898496eeSXin LI!:mime	application/vnd.android.package-archive
1822898496eeSXin LI!:ext	apk
1823898496eeSXin LI>>>>-22	string	PK\005\006
1824898496eeSXin LI>>>>>(-6.l-16)	string	APK\x20Sig\x20Block\x2042	\b, with APK Signing Block
1825898496eeSXin LI# Starts with classes.dex (file name length = 11)
1826898496eeSXin LI>26	uleshort	11
1827898496eeSXin LI>>30	string	classes.dex	Android package (APK), with classes.dex
1828898496eeSXin LI!:mime	application/vnd.android.package-archive
1829898496eeSXin LI!:ext	apk
1830898496eeSXin LI>>>-22	string	PK\005\006
1831898496eeSXin LI>>>>(-6.l-16)	string	APK\x20Sig\x20Block\x2042	\b, with APK Signing Block
1832898496eeSXin LI# Starts with META-INF/MANIFEST.MF (file name length = 20)
1833898496eeSXin LI# NB: checks for resources.arsc, classes.dex, etc. as well to avoid matching JAR files
1834898496eeSXin LI>26	uleshort	20
1835898496eeSXin LI>>30	string	META-INF/MANIFEST.MF
1836898496eeSXin LI# Contains resources.arsc (near the end, in the central directory)
1837898496eeSXin LI>>>-512	search	resources.arsc	Android package (APK), with MANIFEST.MF and resources.arsc
1838898496eeSXin LI!:mime	application/vnd.android.package-archive
1839898496eeSXin LI!:ext	apk
1840898496eeSXin LI>>>>-22	string	PK\005\006
1841898496eeSXin LI>>>>>(-6.l-16)	string	APK\x20Sig\x20Block\x2042	\b, with APK Signing Block
1842898496eeSXin LI>>>-512	default x
1843898496eeSXin LI# Contains classes.dex (near the end, in the central directory)
1844898496eeSXin LI>>>>-512	search	classes.dex	Android package (APK), with MANIFEST.MF and classes.dex
1845898496eeSXin LI!:mime	application/vnd.android.package-archive
1846898496eeSXin LI!:ext	apk
1847898496eeSXin LI>>>>>-22	string	PK\005\006
1848898496eeSXin LI>>>>>>(-6.l-16)	string	APK\x20Sig\x20Block\x2042	\b, with APK Signing Block
1849898496eeSXin LI>>>>-512	default x
1850898496eeSXin LI# Contains lib/armeabi (near the end, in the central directory)
1851898496eeSXin LI>>>>>-512	search	lib/armeabi	Android package (APK), with MANIFEST.MF and armeabi lib
1852898496eeSXin LI!:mime	application/vnd.android.package-archive
1853898496eeSXin LI!:ext	apk
1854898496eeSXin LI>>>>>>-22	string	PK\005\006
1855898496eeSXin LI>>>>>>>(-6.l-16)	string	APK\x20Sig\x20Block\x2042	\b, with APK Signing Block
1856898496eeSXin LI>>>>>-512	default x
1857898496eeSXin LI# Contains drawables (near the end, in the central directory)
1858898496eeSXin LI>>>>>>-512	search	res/drawable	Android package (APK), with MANIFEST.MF and drawables
1859898496eeSXin LI!:mime	application/vnd.android.package-archive
1860898496eeSXin LI!:ext	apk
1861898496eeSXin LI>>>>>>>-22	string	PK\005\006
1862898496eeSXin LI>>>>>>>>(-6.l-16)	string	APK\x20Sig\x20Block\x2042	\b, with APK Signing Block
1863898496eeSXin LI# It may or may not be an APK file, but it's definitely a Java JAR file
1864898496eeSXin LI>>>>>>-512	default x	Java archive data (JAR)
1865898496eeSXin LI!:mime	application/java-archive
1866898496eeSXin LI!:ext	jar
1867898496eeSXin LI# Starts with zipflinger virtual entry (28 + 104 = 132 bytes)
1868898496eeSXin LI# See https://github.com/obfusk/apksigcopier/blob/666f5b7/apksigcopier/__init__.py#L230
1869898496eeSXin LI>4	string	\x00\x00\x00\x00\x00\x00
1870898496eeSXin LI>>&0	string	\x21\x08\x21\x02
1871898496eeSXin LI>>>&0	string	\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
1872898496eeSXin LI>>>>&0	string	\x00\x00	Android package (APK), with zipflinger virtual entry
1873898496eeSXin LI!:mime	application/vnd.android.package-archive
1874898496eeSXin LI!:ext	apk
1875898496eeSXin LI>>>>>-22	string	PK\005\006
1876898496eeSXin LI>>>>>>(-6.l-16)	string	APK\x20Sig\x20Block\x2042	\b, with APK Signing Block
1877898496eeSXin LI
1878b6cee71dSXin LI
1879b6cee71dSXin LI# Specialised zip formats which start with a member named 'mimetype'
1880b6cee71dSXin LI# (stored uncompressed, with no 'extra field') containing the file's MIME type.
1881b6cee71dSXin LI# Check for have 8-byte name, 0-byte extra field, name "mimetype", and
1882b6cee71dSXin LI#  contents starting with "application/":
1883b6cee71dSXin LI>26	string		\x8\0\0\0mimetypeapplication/
1884b6cee71dSXin LI
1885b6cee71dSXin LI#  KOffice / OpenOffice & StarOffice / OpenDocument formats
1886b6cee71dSXin LI#    From: Abel Cheung <abel@oaka.org>
1887b6cee71dSXin LI
1888b6cee71dSXin LI#   KOffice (1.2 or above) formats
1889b6cee71dSXin LI#    (mimetype contains "application/vnd.kde.<SUBTYPE>")
1890b6cee71dSXin LI>>50	string	vnd.kde.		KOffice (>=1.2)
1891b6cee71dSXin LI>>>58	string	karbon			Karbon document
1892b6cee71dSXin LI>>>58	string	kchart			KChart document
1893b6cee71dSXin LI>>>58	string	kformula		KFormula document
1894b6cee71dSXin LI>>>58	string	kivio			Kivio document
1895b6cee71dSXin LI>>>58	string	kontour			Kontour document
1896b6cee71dSXin LI>>>58	string	kpresenter		KPresenter document
1897b6cee71dSXin LI>>>58	string	kspread			KSpread document
1898b6cee71dSXin LI>>>58	string	kword			KWord document
1899b6cee71dSXin LI
1900b6cee71dSXin LI#   OpenOffice formats (for OpenOffice 1.x / StarOffice 6/7)
1901b6cee71dSXin LI#    (mimetype contains "application/vnd.sun.xml.<SUBTYPE>")
19022726a701SXin LI# URL:		https://en.wikipedia.org/wiki/OpenOffice.org_XML
19032726a701SXin LI# reference:	http://fileformats.archiveteam.org/wiki/OpenOffice.org_XML
1904b6cee71dSXin LI>>50	string	vnd.sun.xml.		OpenOffice.org 1.x
1905b6cee71dSXin LI>>>62	string	writer			Writer
1906b6cee71dSXin LI>>>>68	byte	!0x2e			document
19072726a701SXin LI!:mime	application/vnd.sun.xml.writer
19082726a701SXin LI!:ext	sxw
1909b6cee71dSXin LI>>>>68	string	.template		template
19102726a701SXin LI!:mime	application/vnd.sun.xml.writer.template
19112726a701SXin LI!:ext	stw
19122726a701SXin LI>>>>68	string	.web			Web template
19132726a701SXin LI!:mime	application/vnd.sun.xml.writer.web
19142726a701SXin LI!:ext	stw
1915b6cee71dSXin LI>>>>68	string	.global			global document
19162726a701SXin LI!:mime	application/vnd.sun.xml.writer.global
19172726a701SXin LI!:ext	sxg
1918b6cee71dSXin LI>>>62	string	calc			Calc
1919b6cee71dSXin LI>>>>66	byte	!0x2e			spreadsheet
19202726a701SXin LI!:mime	application/vnd.sun.xml.calc
19212726a701SXin LI!:ext	sxc
1922b6cee71dSXin LI>>>>66	string	.template		template
19232726a701SXin LI!:mime	application/vnd.sun.xml.calc.template
19242726a701SXin LI!:ext	stc
1925b6cee71dSXin LI>>>62	string	draw			Draw
1926b6cee71dSXin LI>>>>66	byte	!0x2e			document
19272726a701SXin LI!:mime	application/vnd.sun.xml.draw
19282726a701SXin LI!:ext	sxd
1929b6cee71dSXin LI>>>>66	string	.template		template
19302726a701SXin LI!:mime	application/vnd.sun.xml.draw.template
19312726a701SXin LI!:ext	std
1932b6cee71dSXin LI>>>62	string	impress			Impress
1933b6cee71dSXin LI>>>>69	byte	!0x2e			presentation
19342726a701SXin LI!:mime	application/vnd.sun.xml.impress
19352726a701SXin LI!:ext	sxi
1936b6cee71dSXin LI>>>>69	string	.template		template
19372726a701SXin LI!:mime	application/vnd.sun.xml.impress.template
19382726a701SXin LI!:ext	sti
1939b6cee71dSXin LI>>>62	string	math			Math document
19402726a701SXin LI!:mime	application/vnd.sun.xml.math
19412726a701SXin LI!:ext	sxm
1942b6cee71dSXin LI>>>62	string	base			Database file
19432726a701SXin LI!:mime	application/vnd.sun.xml.base
19442726a701SXin LI!:ext	sdb
1945b6cee71dSXin LI
1946a4d6d3b8SXin LI# URL:	https://wiki.openoffice.org/wiki/Documentation/DevGuide/Extensions/File_Format
1947a4d6d3b8SXin LI# From:	Joerg Jenderek
1948a4d6d3b8SXin LI# Note:	only few OXT samples are detected here by mimetype member
1949a4d6d3b8SXin LI#	is used by OpenOffice and LibreOffice and probably also NeoOffice
1950a4d6d3b8SXin LI#	verified by `unzip -Zv *.oxt` or `7z l -slt *.oxt`
1951a4d6d3b8SXin LI>>50	string	vnd.openofficeorg.		OpenOffice
1952a4d6d3b8SXin LI>>>68	string	extension			\b/LibreOffice Extension
1953a4d6d3b8SXin LI# http://extension.nirsoft.net/oxt
1954a4d6d3b8SXin LI!:mime	application/vnd.openofficeorg.extension
1955a4d6d3b8SXin LI# like: Gallery-Puzzle.2.1.0.1.oxt
1956a4d6d3b8SXin LI!:ext	oxt
1957a4d6d3b8SXin LI
1958b6cee71dSXin LI#   OpenDocument formats (for OpenOffice 2.x / StarOffice >= 8)
19592726a701SXin LI#   URL: http://fileformats.archiveteam.org/wiki/OpenDocument
196048c779cdSXin LI#    https://lists.oasis-open.org/archives/office/200505/msg00006.html
1961b6cee71dSXin LI#    (mimetype contains "application/vnd.oasis.opendocument.<SUBTYPE>")
1962b6cee71dSXin LI>>50	string	vnd.oasis.opendocument.	OpenDocument
1963b6cee71dSXin LI>>>73	string	text
1964b6cee71dSXin LI>>>>77	byte	!0x2d			Text
1965b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.text
19662726a701SXin LI!:ext	odt
1967b6cee71dSXin LI>>>>77	string	-template		Text Template
1968b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.text-template
19692726a701SXin LI!:ext	ott
1970b6cee71dSXin LI>>>>77	string	-web			HTML Document Template
1971b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.text-web
19722726a701SXin LI!:ext	oth
1973898496eeSXin LI>>>>77	string	-master
1974898496eeSXin LI>>>>>84	byte	!0x2d			Master Document
1975b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.text-master
19762726a701SXin LI!:ext	odm
1977898496eeSXin LI>>>>>84	string	-template		Master Template
1978898496eeSXin LI!:mime	application/vnd.oasis.opendocument.text-master-template
1979898496eeSXin LI!:ext	otm
1980b6cee71dSXin LI>>>73	string	graphics
1981b6cee71dSXin LI>>>>81	byte	!0x2d			Drawing
1982b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.graphics
19832726a701SXin LI!:ext	odg
19842726a701SXin LI>>>>81	string	-template		Drawing Template
1985b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.graphics-template
19862726a701SXin LI!:ext	otg
1987b6cee71dSXin LI>>>73	string	presentation
1988b6cee71dSXin LI>>>>85	byte	!0x2d			Presentation
1989b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.presentation
19902726a701SXin LI!:ext	odp
19912726a701SXin LI>>>>85	string	-template		Presentation Template
1992b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.presentation-template
19932726a701SXin LI!:ext	otp
1994b6cee71dSXin LI>>>73	string	spreadsheet
1995b6cee71dSXin LI>>>>84	byte	!0x2d			Spreadsheet
1996b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.spreadsheet
19972726a701SXin LI!:ext	ods
19982726a701SXin LI>>>>84	string	-template		Spreadsheet Template
1999b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.spreadsheet-template
20002726a701SXin LI!:ext	ots
2001b6cee71dSXin LI>>>73	string	chart
2002b6cee71dSXin LI>>>>78	byte	!0x2d			Chart
2003b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.chart
20042726a701SXin LI!:ext	odc
20052726a701SXin LI>>>>78	string	-template		Chart Template
2006b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.chart-template
20072726a701SXin LI!:ext	otc
2008b6cee71dSXin LI>>>73	string	formula
2009b6cee71dSXin LI>>>>80	byte	!0x2d			Formula
2010b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.formula
20112726a701SXin LI!:ext	odf
20122726a701SXin LI>>>>80	string	-template		Formula Template
2013b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.formula-template
20142726a701SXin LI!:ext	otf
20152726a701SXin LI# https://www.loc.gov/preservation/digital/formats/fdd/fdd000441.shtml
2016b6cee71dSXin LI>>>73	string	database		Database
2017b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.database
20182726a701SXin LI!:ext	odb
201958a0f0d0SEitan Adler# Valid for LibreOffice Base 6.0.1.1 at least
202058a0f0d0SEitan Adler>>>73	string	base 			Database
20212726a701SXin LI# https://bugs.documentfoundation.org/show_bug.cgi?id=45854
2022898496eeSXin LI!:mime	application/vnd.oasis.opendocument.base
20232726a701SXin LI!:ext	odb
2024b6cee71dSXin LI>>>73	string	image
2025b6cee71dSXin LI>>>>78	byte	!0x2d			Image
2026b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.image
20272726a701SXin LI!:ext	odi
20282726a701SXin LI>>>>78	string	-template		Image Template
2029b6cee71dSXin LI!:mime	application/vnd.oasis.opendocument.image-template
20302726a701SXin LI!:ext	oti
2031b6cee71dSXin LI
2032b6cee71dSXin LI#  EPUB (OEBPS) books using OCF (OEBPS Container Format)
203348c779cdSXin LI#    https://www.idpf.org/ocf/ocf1.0/download/ocf10.htm, section 4.
2034b6cee71dSXin LI#    From: Ralf Brown <ralf.brown@gmail.com>
2035b6cee71dSXin LI>>50	string	epub+zip	EPUB document
2036b6cee71dSXin LI!:mime application/epub+zip
2037b6cee71dSXin LI
2038898496eeSXin LI# From: Hajin Jang <jb6804@naver.com>
2039898496eeSXin LI# hwpx (OWPML) document format follows OCF specification.
2040898496eeSXin LI# Hangul Word Processor 2010+ supports HWPX format.
2041898496eeSXin LI# URL: https://www.hancom.com/etc/hwpDownload.do
2042898496eeSXin LI#      https://standard.go.kr/KSCI/standardIntro/getStandardSearchView.do?menuId=503&topMenuId=502&ksNo=KSX6101
2043898496eeSXin LI#      https://e-ks.kr/streamdocs/view/sd;streamdocsId=72059197557727331
2044898496eeSXin LI>>50	string	hwp+zip     Hancom HWP (Hangul Word Processor) file, HWPX
2045898496eeSXin LI!:mime application/x-hwp+zip
2046898496eeSXin LI!:ext	hwpx
2047898496eeSXin LI
2048d38c30c0SXin LI# From:	Joerg Jenderek
2049d38c30c0SXin LI# URL:	http://en.wikipedia.org/wiki/CorelDRAW
2050d38c30c0SXin LI# NOTE:	version; til 2 WL-based; from 3 til 13 by ./riff; from 14 zip based
2051d38c30c0SXin LI>>50	string	x-vnd.corel.	 Corel
2052d38c30c0SXin LI>>>62	string	draw.document+zip	Draw drawing, version 14-16
2053d38c30c0SXin LI!:mime	application/x-vnd.corel.draw.document+zip
2054d38c30c0SXin LI!:ext	cdr
2055d38c30c0SXin LI>>>62	string	draw.template+zip	Draw template, version 14-16
2056d38c30c0SXin LI!:mime	application/x-vnd.corel.draw.template+zip
2057d38c30c0SXin LI!:ext	cdrt
20582726a701SXin LI>>>62	string	zcf.draw.document+zip	Draw drawing, version 17-22
2059d38c30c0SXin LI!:mime	application/x-vnd.corel.zcf.draw.document+zip
2060d38c30c0SXin LI!:ext	cdr
20612726a701SXin LI>>>62	string	zcf.draw.template+zip	Draw template, version 17-22
2062d38c30c0SXin LI!:mime	application/x-vnd.corel.zcf.draw.template+zip
2063d38c30c0SXin LI!:ext	cdt/cdrt
20642726a701SXin LI# URL:	http://product.corel.com/help/CorelDRAW/540240626/Main/EN/Doc/CorelDRAW-Other-file-formats.html
20652726a701SXin LI>>>62	string	zcf.pattern+zip		Draw pattern, version 22
20662726a701SXin LI!:mime	application/x-vnd.corel.zcf.pattern+zip
20672726a701SXin LI!:ext	pat
20682726a701SXin LI# URL:		https://en.wikipedia.org/wiki/Corel_Designer
20692726a701SXin LI# Reference:	http://fileformats.archiveteam.org/wiki/Corel_Designer
20702726a701SXin LI# Note:		called by TrID "Corel DESIGN graphics"
20712726a701SXin LI>>>62	string	designer.document+zip		DESIGNER graphics, version 14-16
20722726a701SXin LI!:mime	application/x-vnd.corel.designer.document+zip
20732726a701SXin LI!:ext	des
20742726a701SXin LI>>>62	string	zcf.designer.document+zip	DESIGNER graphics, version 17-21
20752726a701SXin LI!:mime	application/x-vnd.corel.zcf.designer.document+zip
20762726a701SXin LI!:ext	des
20772726a701SXin LI# URL:	http://product.corel.com/help/CorelDRAW/540223850/Main/EN/Documentation/
20782726a701SXin LI#	CorelDRAW-Corel-Symbol-Library-CSL.html
20792726a701SXin LI>>>62	string	symbol.library+zip		Symbol Library, version 6-16.3
20802726a701SXin LI!:mime	application/x-vnd.corel.symbol.library+zip
20812726a701SXin LI!:ext	csl
20822726a701SXin LI>>>62	string	zcf.symbol.library+zip		Symbol Library, version 17-22
20832726a701SXin LI!:mime	application/x-vnd.corel.zcf.symbol.library+zip
20842726a701SXin LI!:ext	csl
2085d38c30c0SXin LI
2086b6cee71dSXin LI#  Catch other ZIP-with-mimetype formats
2087b6cee71dSXin LI#	In a ZIP file, the bytes immediately after a member's contents are
2088b6cee71dSXin LI#	always "PK". The 2 regex rules here print the "mimetype" member's
2089b6cee71dSXin LI#	contents up to the first 'P'. Luckily, most MIME types don't contain
2090b6cee71dSXin LI#	any capital 'P's. This is a kludge.
2091b6cee71dSXin LI#    (mimetype contains "application/<OTHER>")
2092d38c30c0SXin LI>>50		default	x			Zip data
2093d38c30c0SXin LI>>>38		regex	[!-OQ-~]+		(MIME type "%s"?)
2094b6cee71dSXin LI!:mime	application/zip
2095b6cee71dSXin LI#    (mimetype contents other than "application/*")
2096b6cee71dSXin LI>26		string	\x8\0\0\0mimetype
2097b6cee71dSXin LI>>38		string	!application/
2098b6cee71dSXin LI>>>38		regex	[!-OQ-~]+		Zip data (MIME type "%s"?)
2099b6cee71dSXin LI!:mime	application/zip
2100b6cee71dSXin LI
2101898496eeSXin LI# Java Jar files (see also APK files above)
2102b6cee71dSXin LI>(26.s+30)	leshort	0xcafe		Java archive data (JAR)
2103b6cee71dSXin LI!:mime	application/java-archive
2104898496eeSXin LI!:ext	jar
2105b6cee71dSXin LI
210620f8619dSXin LI# iOS App
210720f8619dSXin LI>(26.s+30)	leshort	!0xcafe
210820f8619dSXin LI>>26		string	!\x8\0\0\0mimetype
210920f8619dSXin LI>>>30		string	Payload/
211020f8619dSXin LI>>>>38		search/64       .app/   iOS App
211120f8619dSXin LI!:mime application/x-ios-app
211220f8619dSXin LI
211343a5ec4eSXin LI# Dup, see above.
211443a5ec4eSXin LI#>30	search/100/b application/epub+zip	EPUB document
211543a5ec4eSXin LI#!:mime application/epub+zip
211620f8619dSXin LI
2117*ae316d1dSXin LI# APK Signing Block
2118b6cee71dSXin LI>(26.s+30)	leshort	!0xcafe
21192726a701SXin LI>>30	search/100/b !application/epub+zip
2120*ae316d1dSXin LI>>>26    string          !\x8\0\0\0mimetype
2121*ae316d1dSXin LI>>>>-22	string	PK\005\006
2122*ae316d1dSXin LI>>>>>(-6.l-16)	string	APK\x20Sig\x20Block\x2042	Android package (APK), with APK Signing Block
2123*ae316d1dSXin LI!:mime	application/vnd.android.package-archive
2124*ae316d1dSXin LI!:ext	apk
2125*ae316d1dSXin LI
2126*ae316d1dSXin LI# Keyman Compiled Package File (keyman.com)
2127*ae316d1dSXin LI# https://help.keyman.com/developer/current-version/reference/file-types/kmp
2128*ae316d1dSXin LI# Find start of central directory
2129*ae316d1dSXin LI>>>>>(-6.l)	string		PK\001\002
2130*ae316d1dSXin LI# Scan central directory for string 'kmp.json', will suffice for a
2131*ae316d1dSXin LI# package containing about 150 files
2132*ae316d1dSXin LI>>>>>>(-6.l)	search/9000	kmp.json	Keyman Compiled Package File
2133*ae316d1dSXin LI!:mime	application/vnd.keyman.kmp+zip
2134*ae316d1dSXin LI!:ext kmp
2135*ae316d1dSXin LI
2136*ae316d1dSXin LI# Generic zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
2137*ae316d1dSXin LI#   Next line excludes specialized formats:
2138*ae316d1dSXin LI>>>>+4	default		x
2139*ae316d1dSXin LI>>>>>4	beshort		x			Zip archive data, at least
2140b6cee71dSXin LI!:mime	application/zip
2141*ae316d1dSXin LI>>>>>4	use		zipversion
2142*ae316d1dSXin LI>>>>>4	beshort		x			to extract
2143*ae316d1dSXin LI>>>>>8	beshort		x			\b, compression method=
2144*ae316d1dSXin LI>>>>>8	use		zipcompression
2145*ae316d1dSXin LI>>>>>0x161	string		WINZIP		\b, WinZIP self-extracting
2146*ae316d1dSXin LI
2147*ae316d1dSXin LI# Zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
2148*ae316d1dSXin LI0	string		PK\005\006	Zip archive data (empty)
2149*ae316d1dSXin LI!:mime application/zip
2150*ae316d1dSXin LI!:ext zip/cbz
2151*ae316d1dSXin LI!:strength +1
2152b6cee71dSXin LI
2153b6cee71dSXin LI# StarView Metafile
2154b6cee71dSXin LI# From Pierre Ducroquet <pinaraf@pinaraf.info>
2155b6cee71dSXin LI0	string	VCLMTF	StarView MetaFile
2156b6cee71dSXin LI>6	beshort	x	\b, version %d
2157b6cee71dSXin LI>8	belong	x	\b, size %d
2158b6cee71dSXin LI
2159b6cee71dSXin LI# Zoo archiver
2160898496eeSXin LI# Update: Joerg Jenderek
2161898496eeSXin LI# URL:		https://en.wikipedia.org/wiki/Zoo_(file_format)
2162898496eeSXin LI#		http://fileformats.archiveteam.org/wiki/Zoo
2163898496eeSXin LI# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/a/ark-zoo-strict.trid.xml
2164898496eeSXin LI#		http://distcache.freebsd.org/ports-distfiles/zoo-2.10pl1.tar.gz/zoo.h
2165898496eeSXin LI# Note:		called "ZOO compressed archive (strict)" by TrID and "ZOO Compressed Archive" by DROID via PUID x-fmt/269
2166898496eeSXin LI#		verified by command like `deark -m zoo -l -d2 WHRCGA.ZOO`
2167898496eeSXin LI20	lelong		0xfdc4a7dc
2168898496eeSXin LI# skip DROID x-fmt-269-signature-id-621.zoo by looking for valid major version to manipulate archive
2169898496eeSXin LI>32	byte		>0		Zoo archive data
2170b6cee71dSXin LI!:mime	application/x-zoo
2171898496eeSXin LI# bak is extension of backup-ed zoo
2172898496eeSXin LI!:ext	zoo/bak
2173898496eeSXin LI# version in text form like: 1.50 2.00 2.10
2174898496eeSXin LI>>4	byte		>48		\b, v%c.
2175898496eeSXin LI>>>6	byte		>47		\b%c
2176898496eeSXin LI>>>>7	byte		>47		\b%c
2177898496eeSXin LI# ZOO files typically start with "ZOO ?.?? Archive.", followed by the bytes 0x1a 0x0 0x0; not used by Zoo and they may be anything
2178898496eeSXin LI>>8	string		!\040Archive.\032 \b, at 8
2179898496eeSXin LI>>>8	string		x		text "%0.10s"
2180898496eeSXin LI# major_ver.minor_ver; minimum version needed to manipulate archive like: 1.0 2.0
2181898496eeSXin LI>>32	byte		>0		\b, modify: v%d
2182898496eeSXin LI>>>33	byte		x		\b.%d+
2183898496eeSXin LI# major_ver.minor_ver; minimum version needed to extract after modify like in old versions
2184898496eeSXin LI>>(24.l+28)	ubyte	x		\b, extract: v%u
2185898496eeSXin LI>>(24.l+29)	ubyte	x		\b.%u+
2186898496eeSXin LI# with zoo 2.00 additional fields have been added in the archive header
2187898496eeSXin LI>>32	byte		>1
2188898496eeSXin LI# type; type of archive header like: 1 2
2189898496eeSXin LI>>>34		ubyte	!1		\b, header type %u
2190898496eeSXin LI# acmt_pos; position of archive comment like: 6258 30599 61369 149501
2191898496eeSXin LI>>>35		lelong	>0		\b, at %d
2192898496eeSXin LI# acmt_len; length of archive comment like: 258
2193898496eeSXin LI>>>>39			uleshort x	%u bytes comment
2194898496eeSXin LI#>>>>(35.l)		ubequad	x	COMMENT=%16.16llx
2195898496eeSXin LI# 1st character of comment maybe is CarriageReturn (0x0d)
2196898496eeSXin LI>>>>(35.l) 		ubyte	<040
2197898496eeSXin LI# 2nd character of comment maybe is LineFeed (0x0a)
2198898496eeSXin LI>>>>>(35.l+1) 		ubyte	<040
2199898496eeSXin LI# comment string after CRLF like "Anonymous ftp site garbo.uwasa.fi 128.214.87.1 moderated by"
2200898496eeSXin LI>>>>>>(35.l+2)		string	x	%s
2201898496eeSXin LI# next character of remaining comment maybe is CarriageReturn (0x0d)
2202898496eeSXin LI>>>>>>>&0		ubyte	<040
2203898496eeSXin LI>>>>>>>>&0		ubyte	<040
2204898496eeSXin LI# 2nd comment part like: Timo Salmi ts@chyde.uwasa.fi      PC directories and uploads\015\012Harri Valkama hv@chyde.uwasa.fi   PC, Mac, Unix files, and upload
2205898496eeSXin LI>>>>>>>>>&0		string	>037	%s
2206898496eeSXin LI# vdata; archive-level versioning byte like: 1 3
2207898496eeSXin LI>>>41		ubyte	!1		\b, vdata %#x
2208898496eeSXin LI# zoo_start; pointer to 1st entry header
2209898496eeSXin LI>>24	lelong		x		\b; at %u
2210898496eeSXin LI# zoo_minus; zoo_start -1 for consistency checking
2211898496eeSXin LI#>>28	lelong		x		\b, zoo_minus %#x
2212898496eeSXin LI# zoo_tag; tag for check
2213898496eeSXin LI#>>(24.l+0) ulelong	!0xfdc4a7dc	\b, zoo_tag=%8.8x
2214898496eeSXin LI# type; type of directory entry like: 1 2
2215898496eeSXin LI>>(24.l+4)	ubyte	!2		type=%u
2216898496eeSXin LI# packing_method; 0~no packing 1~normal LZW 2~lzh
2217898496eeSXin LI>>(24.l+5)	ubyte		x	method=
2218898496eeSXin LI>>>(24.l+5)	ubyte		0	\bnot-compressed
2219898496eeSXin LI>>>(24.l+5)	ubyte		1	\blzd
2220898496eeSXin LI>>>(24.l+5)	ubyte		2	\blzh
2221898496eeSXin LI# next; position of next directory entry
2222898496eeSXin LI>>(24.l+6)	ulelong		x	\b, next entry at %u
2223898496eeSXin LI# offset; position of file data for this entry
2224898496eeSXin LI#>>(24.l+10) ulelong		x	\b, data at %u
2225898496eeSXin LI# file_crc; CRC-16 of file data
2226898496eeSXin LI>>(24.l+18)	uleshort	x	\b, CRC %#4.4x
2227898496eeSXin LI# comment; zero if none or points to entry comment like ADD9h (WHRCGA.ZOO)
2228898496eeSXin LI>>(24.l+32)	lelong		>0	\b, at %#x
2229898496eeSXin LI# cmt_size; if not 0 for none then length of entry comment like: 46
2230898496eeSXin LI>>>(24.l+36)	uleshort	>0	%u bytes comment
2231898496eeSXin LI# entry comment itself like: "CGA .GL file showing menu input from keyboard"
2232898496eeSXin LI>>>>(&-6.l)	string		x	"%s"
2233898496eeSXin LI# org_size; original size of file
2234898496eeSXin LI>>(24.l+20)	ulelong		x	\b, size %u
2235898496eeSXin LI# size_now; compressed size of file
2236898496eeSXin LI>>(24.l+24)	ulelong		x	(%u compressed)
2237898496eeSXin LI# major_ver.minor_ver; minimum version needed to extract already done
2238898496eeSXin LI# deleted; will be 1 if deleted, 0 if not
2239898496eeSXin LI>>(24.l+30)	ubyte		=1	\b, deleted
2240898496eeSXin LI# struc; file structure if any; WHAT IS THAT?
2241898496eeSXin LI>>(24.l+31)	ubyte		!0	\b, structured
2242898496eeSXin LI# fname[13]; short/DOS file name like 12345678.012
2243898496eeSXin LI>>(24.l+38)	string	x		\b, %0.13s
2244898496eeSXin LI# for directory entry type 2 with variable part
2245898496eeSXin LI>>(24.l+4)	ubyte	=2
2246898496eeSXin LI# var_dir_len; length of variable part of dir entry
2247898496eeSXin LI>>>(24.l+51)		uleshort >0
2248898496eeSXin LI#>>>(24.l+51)		uleshort >0	\b, variable part length %u
2249898496eeSXin LI# namlen; length of long filename
2250898496eeSXin LI#>>>>(24.l+56)		ubyte	x	\b, namlen %u
2251898496eeSXin LI# dirlen; length of directory name
2252898496eeSXin LI#>>>>(24.l+57)		ubyte	x	\b, dirlen %u
2253898496eeSXin LI# if file length positive then show long file name
2254898496eeSXin LI>>>>(24.l+56)		ubyte	>0
2255898496eeSXin LI# lfname[256]; long file name \0-terminated
2256898496eeSXin LI>>>>>(24.l+58)		string	x	"%s"
2257898496eeSXin LI# if directory length positive then jump before file name field and then jump this addtional length plus 2 (\0-terminator + dirlen field) to following directory name
2258898496eeSXin LI>>>>(24.l+57)		ubyte	>0
2259898496eeSXin LI>>>>>(24.l+55)		ubyte	x
2260898496eeSXin LI# dirname[256]; directory name \0-terminated
2261898496eeSXin LI>>>>>>&(&0.b+2)		string	x	in "%s"
2262898496eeSXin LI# dir_crc; CRC of directory entry
2263898496eeSXin LI#>>>(24.l+54)		uleshort x	\b, entry CRC %#4.4x
2264898496eeSXin LI# tz; timezone where file was archived; 7Fh~unknown 4~1.00hoursWestOfUTC 12 16 20~5.00hoursWestOfUTC -107~26.75hoursEastOfUTC -4~1.00hoursEastOfUTC
2265898496eeSXin LI>>>(24.l+53)		byte	!0x7f	\b, time zone %d/4
2266898496eeSXin LI# date; last mod file date in DOS format
2267898496eeSXin LI>>>(24.l+14)		lemsdosdate x	\b, modified %s
2268898496eeSXin LI# time; last mod file time in DOS format
2269898496eeSXin LI>>>(24.l+16)		lemsdostime x	%s
2270b6cee71dSXin LI
2271b6cee71dSXin LI# Shell archives
2272b6cee71dSXin LI10	string		#\ This\ is\ a\ shell\ archive	shell archive text
2273b6cee71dSXin LI!:mime	application/octet-stream
2274b6cee71dSXin LI
2275b6cee71dSXin LI#
2276b6cee71dSXin LI# LBR. NB: May conflict with the questionable
2277b6cee71dSXin LI#          "binary Computer Graphics Metafile" format.
2278b6cee71dSXin LI#
2279b6cee71dSXin LI0       string  \0\ \ \ \ \ \ \ \ \ \ \ \0\0    LBR archive data
2280b6cee71dSXin LI#
2281b6cee71dSXin LI# PMA (CP/M derivative of LHA)
22823e41d09dSXin LI# Update: Joerg Jenderek
22833e41d09dSXin LI# URL: https://en.wikipedia.org/wiki/LHA_(file_format)
2284b6cee71dSXin LI#
22853e41d09dSXin LI#2       string          -pm0-           PMarc archive data [pm0]
22863e41d09dSXin LI2	string		-pm0-
22873e41d09dSXin LI>0	use	lharc-file
22883e41d09dSXin LI#2       string          -pm1-           PMarc archive data [pm1]
22893e41d09dSXin LI2	string		-pm1-
22903e41d09dSXin LI>0	use	lharc-file
22913e41d09dSXin LI#2       string          -pm2-           PMarc archive data [pm2]
22923e41d09dSXin LI2	string		-pm2-
22933e41d09dSXin LI>0	use	lharc-file
2294b6cee71dSXin LI2       string          -pms-           PMarc SFX archive (CP/M, DOS)
22953e41d09dSXin LI#!:mime	application/x-foobar-exec
22963e41d09dSXin LI!:ext com
2297b6cee71dSXin LI5       string          -pc1-           PopCom compressed executable (CP/M)
22983e41d09dSXin LI#!:mime	application/x-
22993e41d09dSXin LI#!:ext com
2300b6cee71dSXin LI
2301b6cee71dSXin LI# From Rafael Laboissiere <rafael@laboissiere.net>
2302b6cee71dSXin LI# The Project Revision Control System (see
2303b6cee71dSXin LI# http://prcs.sourceforge.net) generates a packaged project
2304b6cee71dSXin LI# file which is recognized by the following entry:
2305b6cee71dSXin LI0	leshort		0xeb81	PRCS packaged project
2306b6cee71dSXin LI
2307b6cee71dSXin LI# Microsoft cabinets
2308b6cee71dSXin LI# by David Necas (Yeti) <yeti@physics.muni.cz>
2309b6cee71dSXin LI#0	string	MSCF\0\0\0\0	Microsoft cabinet file data,
2310b6cee71dSXin LI#>25	byte	x		v%d
2311b6cee71dSXin LI#>24	byte	x		\b.%d
2312b6cee71dSXin LI# MPi: All CABs have version 1.3, so this is pointless.
2313b6cee71dSXin LI# Better magic in debian-additions.
2314b6cee71dSXin LI
2315b6cee71dSXin LI# GTKtalog catalogs
2316b6cee71dSXin LI# by David Necas (Yeti) <yeti@physics.muni.cz>
2317b6cee71dSXin LI4	string	gtktalog\ 	GTKtalog catalog data,
2318b6cee71dSXin LI>13	string	3		version 3
2319b6cee71dSXin LI>>14	beshort	0x677a		(gzipped)
2320b6cee71dSXin LI>>14	beshort	!0x677a		(not gzipped)
2321b6cee71dSXin LI>13	string	>3		version %s
2322b6cee71dSXin LI
2323b6cee71dSXin LI############################################################################
2324b6cee71dSXin LI# Parity archive reconstruction file, the 'par' file format now used on Usenet.
2325b6cee71dSXin LI0       string          PAR\0	PARity archive data
2326b6cee71dSXin LI>48	leshort		=0	- Index file
2327b6cee71dSXin LI>48	leshort		>0	- file number %d
2328b6cee71dSXin LI
2329b6cee71dSXin LI# Felix von Leitner <felix-file@fefe.de>
2330b6cee71dSXin LI0	string	d8:announce	BitTorrent file
2331b6cee71dSXin LI!:mime	application/x-bittorrent
2332a2dfb722SXin LI!:ext	torrent
23333e41d09dSXin LI# Durval Menezes, <jmgthbfile at durval dot com>
23343e41d09dSXin LI0	string	d13:announce-list	BitTorrent file
23353e41d09dSXin LI!:mime	application/x-bittorrent
2336a2dfb722SXin LI!:ext	torrent
2337d38c30c0SXin LI0	string	d7:comment	BitTorrent file
2338d38c30c0SXin LI!:mime	application/x-bittorrent
2339a2dfb722SXin LI!:ext	torrent
2340d38c30c0SXin LI0	string	d4:info		BitTorrent file
2341d38c30c0SXin LI!:mime	application/x-bittorrent
2342a2dfb722SXin LI!:ext	torrent
2343b6cee71dSXin LI
2344b6cee71dSXin LI# Atari MSA archive - Teemu Hukkanen <tjhukkan@iki.fi>
2345a4d6d3b8SXin LI# URL:		http://fileformats.archiveteam.org/wiki/MSA_(Magic_Shadow_Archiver)
2346a4d6d3b8SXin LI# Reference:	http://info-coach.fr/atari/documents/_mydoc/FD_Image_File_Format.pdf
2347a4d6d3b8SXin LI#		http://mark0.net/download/triddefs_xml.7z/defs/m/msa.trid.xml
2348a4d6d3b8SXin LI# Update:	Joerg Jenderek
2349a4d6d3b8SXin LI# Note:		called by TrID "Atari MSA Disk Image" and verified by
2350a4d6d3b8SXin LI#		command like `deark -l -m msa -d2 PDATS578.msa` as " Atari ST floppy disk image"
2351a4d6d3b8SXin LI# GRR: line below is too general as it matches setup.skin
2352a4d6d3b8SXin LI0	beshort 0x0e0f
2353a4d6d3b8SXin LI# skip foo setup.skin with unrealistic high number 52255 of sides by check for valid "low" value
2354a4d6d3b8SXin LI>4	ubeshort <2		Atari MSA archive data
2355a4d6d3b8SXin LI#!:mime	application/octet-stream
2356a4d6d3b8SXin LI!:mime	application/x-atari-msa
2357a4d6d3b8SXin LI!:ext	msa
2358a4d6d3b8SXin LI# sectors per track like: 9 10
2359a4d6d3b8SXin LI>>2	beshort x		\b, %d sectors per track
2360a4d6d3b8SXin LI# sides (0 or 1; add 1 to this to get correct number of sides)
2361a4d6d3b8SXin LI>>4	beshort 0		\b, 1 sided
2362a4d6d3b8SXin LI>>4	beshort 1		\b, 2 sided
2363a4d6d3b8SXin LI# starting track like: 0
2364a4d6d3b8SXin LI>>6	beshort x		\b, starting track: %d
2365a4d6d3b8SXin LI# ending track like: 39 79 80 81
2366a4d6d3b8SXin LI>>8	beshort x		\b, ending track: %d
2367a4d6d3b8SXin LI# tracks content
2368a4d6d3b8SXin LI#>>10	ubequad x		\b, track content %#16.16llx
2369b6cee71dSXin LI
2370b6cee71dSXin LI# Alternate ZIP string (amc@arwen.cs.berkeley.edu)
2371b6cee71dSXin LI0	string	PK00PK\003\004	Zip archive data
237258a0f0d0SEitan Adler!:mime	application/zip
237358a0f0d0SEitan Adler!:ext zip/cbz
2374b6cee71dSXin LI
2375898496eeSXin LI# Recognize ZIP archives with prepended data by end-of-central-directory record
2376898496eeSXin LI# https://en.wikipedia.org/wiki/ZIP_(file_format)#End_of_central_directory_record_(EOCD)
2377898496eeSXin LI# by Michal Gorny <mgorny@gentoo.org>
2378898496eeSXin LI-2	uleshort	0
2379898496eeSXin LI>&-22	string	PK\005\006
2380898496eeSXin LI# without #!
2381898496eeSXin LI>>0	string	!#!	Zip archive, with extra data prepended
2382898496eeSXin LI!:mime	application/zip
2383898496eeSXin LI!:ext zip/cbz
2384898496eeSXin LI# with #!
2385898496eeSXin LI>>0	string/w	#!\ 	a
2386898496eeSXin LI>>>&-1	string/T	x	%s script executable (Zip archive)
2387898496eeSXin LI
2388b6cee71dSXin LI# ACE archive (from http://www.wotsit.org/download.asp?f=ace)
2389b6cee71dSXin LI# by Stefan `Sec` Zehl <sec@42.org>
2390b6cee71dSXin LI7	string		**ACE**		ACE archive data
2391a4d6d3b8SXin LI!:mime	application/x-ace-compressed
2392a4d6d3b8SXin LI!:ext	ace
2393b6cee71dSXin LI>15	byte	>0		version %d
2394b6cee71dSXin LI>16	byte	=0x00		\b, from MS-DOS
2395b6cee71dSXin LI>16	byte	=0x01		\b, from OS/2
2396b6cee71dSXin LI>16	byte	=0x02		\b, from Win/32
2397b6cee71dSXin LI>16	byte	=0x03		\b, from Unix
2398b6cee71dSXin LI>16	byte	=0x04		\b, from MacOS
2399b6cee71dSXin LI>16	byte	=0x05		\b, from WinNT
2400b6cee71dSXin LI>16	byte	=0x06		\b, from Primos
2401b6cee71dSXin LI>16	byte	=0x07		\b, from AppleGS
2402b6cee71dSXin LI>16	byte	=0x08		\b, from Atari
2403b6cee71dSXin LI>16	byte	=0x09		\b, from Vax/VMS
2404b6cee71dSXin LI>16	byte	=0x0A		\b, from Amiga
2405b6cee71dSXin LI>16	byte	=0x0B		\b, from Next
2406b6cee71dSXin LI>14	byte	x		\b, version %d to extract
2407b6cee71dSXin LI>5	leshort &0x0080		\b, multiple volumes,
2408b6cee71dSXin LI>>17	byte	x		\b (part %d),
2409b6cee71dSXin LI>5	leshort &0x0002		\b, contains comment
2410b6cee71dSXin LI>5	leshort	&0x0200		\b, sfx
2411b6cee71dSXin LI>5	leshort	&0x0400		\b, small dictionary
2412b6cee71dSXin LI>5	leshort	&0x0800		\b, multi-volume
2413b6cee71dSXin LI>5	leshort	&0x1000		\b, contains AV-String
2414b6cee71dSXin LI>>30	string	\x16*UNREGISTERED\x20VERSION*	(unregistered)
2415b6cee71dSXin LI>5	leshort &0x2000		\b, with recovery record
2416b6cee71dSXin LI>5	leshort &0x4000		\b, locked
2417b6cee71dSXin LI>5	leshort &0x8000		\b, solid
2418b6cee71dSXin LI# Date in MS-DOS format (whatever that is)
2419b6cee71dSXin LI#>18	lelong	x		Created on
2420b6cee71dSXin LI
2421b6cee71dSXin LI# sfArk : compression program for Soundfonts (sf2) by Dirk Jagdmann
2422b6cee71dSXin LI# <doj@cubic.org>
2423b6cee71dSXin LI0x1A	string	sfArk		sfArk compressed Soundfont
2424b6cee71dSXin LI>0x15	string	2
2425b6cee71dSXin LI>>0x1	string	>\0		Version %s
2426b6cee71dSXin LI>>0x2A	string	>\0		: %s
2427b6cee71dSXin LI
2428b6cee71dSXin LI# DR-DOS 7.03 Packed File *.??_
242943a5ec4eSXin LI# Reference: http://www.antonis.de/dos/dos-tuts/mpdostip/html/nwdostip.htm
243043a5ec4eSXin LI# Note:	unpacked by PNUNPACK.EXE
243143a5ec4eSXin LI0	string	Packed\ File\
243243a5ec4eSXin LI# by looking for Control-Z skip ASCII text starting with Packed File
243343a5ec4eSXin LI>0x18	ubyte	0x1a		Personal NetWare Packed File
243443a5ec4eSXin LI!:mime	application/x-novell-compress
243543a5ec4eSXin LI!:ext	??_
243643a5ec4eSXin LI>>12	string	x		\b, was "%.12s"
243743a5ec4eSXin LI# 1 or 2
243843a5ec4eSXin LI#>>0x19	ubyte	x		\b, at 0x19 %u
243943a5ec4eSXin LI>>0x1b	ulelong	x		with %u bytes
2440b6cee71dSXin LI
2441b6cee71dSXin LI# EET archive
2442b6cee71dSXin LI# From: Tilman Sauerbeck <tilman@code-monkey.de>
2443b6cee71dSXin LI0	belong	0x1ee7ff00	EET archive
2444b6cee71dSXin LI!:mime	application/x-eet
2445b6cee71dSXin LI
244648c779cdSXin LI# From:		Joerg Jenderek
244748c779cdSXin LI# URL:		https://help.foxitsoftware.com/kb/install-fzip-file.php
244848c779cdSXin LI# reference:	http://mark0.net/download/triddefs_xml.7z/
244948c779cdSXin LI#		defs/f/fzip.trid.xml
245048c779cdSXin LI# Note: unknown compression; No "PK" zip magic; normally in directory like
245148c779cdSXin LI#	"%APPDATA%\Foxit Software\Addon\Foxit Reader\Install"
245248c779cdSXin LI0	ubequad	0x2506781901010000	Foxit add-on/update
245348c779cdSXin LI!:mime	application/x-fzip
245448c779cdSXin LI!:ext	fzip
245548c779cdSXin LI
2456b6cee71dSXin LI# From: "Robert Dale" <robdale@gmail.com>
2457b6cee71dSXin LI0	belong	123		dar archive,
2458b6cee71dSXin LI>4	belong	x		label "%.8x
2459b6cee71dSXin LI>>8	belong	x		%.8x
2460b6cee71dSXin LI>>>12	beshort	x		%.4x"
2461b6cee71dSXin LI>14	byte	0x54		end slice
2462b6cee71dSXin LI>14	beshort	0x4e4e		multi-part
2463b6cee71dSXin LI>14	beshort	0x4e53		multi-part, with -S
2464b6cee71dSXin LI
2465b6cee71dSXin LI# Symbian installation files
246648c779cdSXin LI#  https://www.thouky.co.uk/software/psifs/sis.html
2467b6cee71dSXin LI#  http://developer.symbian.com/main/downloads/papers/SymbianOSv91/softwareinstallsis.pdf
2468b6cee71dSXin LI8	lelong	0x10000419	Symbian installation file
2469b6cee71dSXin LI!:mime	application/vnd.symbian.install
2470b6cee71dSXin LI>4	lelong	0x1000006D	(EPOC release 3/4/5)
2471b6cee71dSXin LI>4	lelong	0x10003A12	(EPOC release 6)
2472b6cee71dSXin LI0	lelong	0x10201A7A	Symbian installation file (Symbian OS 9.x)
2473b6cee71dSXin LI!:mime	x-epoc/x-sisx-app
2474b6cee71dSXin LI
2475b6cee71dSXin LI# From "Nelson A. de Oliveira" <naoliv@gmail.com>
2476b6cee71dSXin LI0	string	MPQ\032		MoPaQ (MPQ) archive
2477b6cee71dSXin LI
2478b6cee71dSXin LI# From: "Nelson A. de Oliveira" <naoliv@gmail.com>
2479b6cee71dSXin LI# .kgb
2480b6cee71dSXin LI0	string KGB_arch		KGB Archiver file
2481b6cee71dSXin LI>10	string x		with compression level %.1s
2482b6cee71dSXin LI
2483b6cee71dSXin LI# xar (eXtensible ARchiver) archive
248448c779cdSXin LI# URL: https://en.wikipedia.org/wiki/Xar_(archiver)
248548c779cdSXin LI# xar archive format: https://code.google.com/p/xar/
2486b6cee71dSXin LI# From: "David Remahl" <dremahl@apple.com>
248748c779cdSXin LI# Update: Joerg Jenderek
248848c779cdSXin LI# TODO: lzma compression; X509Data for pkg and xip
248948c779cdSXin LI# Note: verified by `xar --dump-header -f FullBundleUpdate.xar` or
249048c779cdSXin LI# 7z t -txar Xcode_10.2_beta_4.xip`
2491b6cee71dSXin LI0	string	xar!		xar archive
24923e41d09dSXin LI!:mime	application/x-xar
249348c779cdSXin LI# pkg for Mac OSX installer package like FullBundleUpdate.pkg
249448c779cdSXin LI# xip for signed Apple software like Xcode_10.2_beta_4.xip
249548c779cdSXin LI!:ext	xar/pkg/xip
249648c779cdSXin LI# always 28 in older archives
249748c779cdSXin LI>4	ubeshort >28		\b, header size %u
249848c779cdSXin LI# currently there exit only version 1 since about 2014
249948c779cdSXin LI>6	ubeshort >1		version %u,
250048c779cdSXin LI>8	ubequad	x		compressed TOC: %llu,
250148c779cdSXin LI#>16	ubequad	x		uncompressed TOC: %llu,
250248c779cdSXin LI# cksum_alg 0-2 in older and also 3-4 in newer
2503b6cee71dSXin LI>24	belong	0		no checksum
2504b6cee71dSXin LI>24	belong	1		SHA-1 checksum
2505b6cee71dSXin LI>24	belong	2		MD5 checksum
250648c779cdSXin LI>24	belong	3		SHA-256 checksum
250748c779cdSXin LI>24	belong	4		SHA-512 checksum
250843a5ec4eSXin LI>24	belong	>4		unknown %#x checksum
250948c779cdSXin LI#>24	belong	>4		checksum
251048c779cdSXin LI#			For no compression jump 0 bytes
251148c779cdSXin LI>24	belong	0
251248c779cdSXin LI>>0		ubyte	x
251348c779cdSXin LI# jump more bytes forward by header size
251448c779cdSXin LI>>>&(4.S)	ubyte	x
251548c779cdSXin LI# jump more bytes forward by compressed table of contents size
251643a5ec4eSXin LI#>>>>&(8.Q)	ubequad	x	\b, heap data %#llx
251748c779cdSXin LI>>>>&(8.Q)	ubyte	x
251848c779cdSXin LI# look for data by ./compress after message with 1 space at end
251948c779cdSXin LI>>>>>&-3	indirect x	\b, contains
252048c779cdSXin LI#			For SHA-1 jump 20 minus 2 bytes
252148c779cdSXin LI>24	belong	1
252248c779cdSXin LI>>18		ubyte	x
252348c779cdSXin LI# jump more bytes forward by header size
252448c779cdSXin LI>>>&(4.S)	ubyte	x
252548c779cdSXin LI# jump more bytes forward by compressed table of contents size
252648c779cdSXin LI>>>>&(8.Q)	ubyte	x
252748c779cdSXin LI# data compressed by gzip, bzip, lzma or none
252848c779cdSXin LI>>>>>&-1	indirect x	\b, contains
252948c779cdSXin LI#			For SHA-256 jump 32 minus 2 bytes
253048c779cdSXin LI>24	belong	3
253148c779cdSXin LI>>30		ubyte	x
253248c779cdSXin LI# jump more bytes forward by header size
253348c779cdSXin LI>>>&(4.S)	ubyte	x
253448c779cdSXin LI# jump more bytes forward by compressed table of contents size
253548c779cdSXin LI>>>>&(8.Q)	ubyte	x
253648c779cdSXin LI>>>>>&-1	indirect x	\b, contains
253748c779cdSXin LI#			For SHA-512 jump 64 minus 2 bytes
253848c779cdSXin LI>24	belong	4
253948c779cdSXin LI>>62		ubyte	x
254048c779cdSXin LI# jump more bytes forward by header size
254148c779cdSXin LI>>>&(4.S)	ubyte	x
254248c779cdSXin LI# jump more bytes forward by compressed table of contents size
254348c779cdSXin LI>>>>&(8.Q)	ubyte	x
254448c779cdSXin LI>>>>>&-1	indirect x	\b, contains
2545b6cee71dSXin LI
2546b6cee71dSXin LI# Type: Parity Archive
2547b6cee71dSXin LI# From: Daniel van Eeden <daniel_e@dds.nl>
2548b6cee71dSXin LI0	string	PAR2		Parity Archive Volume Set
2549b6cee71dSXin LI
2550b6cee71dSXin LI# Bacula volume format. (Volumes always start with a block header.)
255148c779cdSXin LI# URL: https://bacula.org/3.0.x-manuals/en/developers/developers/Block_Header.html
2552b6cee71dSXin LI# From: Adam Buchbinder <adam.buchbinder@gmail.com>
2553b6cee71dSXin LI12	string	BB02		Bacula volume
2554b6cee71dSXin LI>20	bedate	x		\b, started %s
2555b6cee71dSXin LI
2556b6cee71dSXin LI# ePub is XHTML + XML inside a ZIP archive.  The first member of the
2557b6cee71dSXin LI#   archive must be an uncompressed file called 'mimetype' with contents
2558b6cee71dSXin LI#   'application/epub+zip'
2559b6cee71dSXin LI
2560b6cee71dSXin LI
2561b6cee71dSXin LI# From: "Michael Gorny" <mgorny@gentoo.org>
2562b6cee71dSXin LI# ZPAQ: http://mattmahoney.net/dc/zpaq.html
2563b6cee71dSXin LI0	string	zPQ	ZPAQ stream
2564b6cee71dSXin LI>3	byte	x	\b, level %d
25655f0216bdSXin LI# From: Barry Carter <carter.barry@gmail.com>
256648c779cdSXin LI# https://encode.ru/threads/456-zpaq-updates/page32
25675f0216bdSXin LI0	string	7kSt	ZPAQ file
2568b6cee71dSXin LI
2569b6cee71dSXin LI# BBeB ebook, unencrypted (LRF format)
257048c779cdSXin LI# URL: https://www.sven.de/librie/Librie/LrfFormat
2571b6cee71dSXin LI# From: Adam Buchbinder <adam.buchbinder@gmail.com>
2572b6cee71dSXin LI0	string	L\0R\0F\0\0\0	BBeB ebook data, unencrypted
2573b6cee71dSXin LI>8	beshort	x		\b, version %d
2574b6cee71dSXin LI>36	byte	1		\b, front-to-back
2575b6cee71dSXin LI>36	byte	16		\b, back-to-front
2576b6cee71dSXin LI>42	beshort	x		\b, (%dx,
2577b6cee71dSXin LI>44	beshort	x		%d)
2578b6cee71dSXin LI
2579b6cee71dSXin LI# Symantec GHOST image by Joerg Jenderek at May 2014
258048c779cdSXin LI# https://us.norton.com/ghost/
258148c779cdSXin LI# https://www.garykessler.net/library/file_sigs.html
2582b6cee71dSXin LI0		ubelong&0xFFFFf7f0	0xFEEF0100	Norton GHost image
2583b6cee71dSXin LI# *.GHO
2584b6cee71dSXin LI>2		ubyte&0x08		0x00		\b, first file
2585b6cee71dSXin LI# *.GHS or *.[0-9] with cns program option
2586b6cee71dSXin LI>2		ubyte&0x08		0x08		\b, split file
2587b6cee71dSXin LI# part of split index interesting for *.ghs
258843a5ec4eSXin LI>>4		ubyte			x		id=%#x
2589b6cee71dSXin LI# compression tag minus one equals numeric compression command line switch z[1-9]
2590b6cee71dSXin LI>3		ubyte			0		\b, no compression
2591b6cee71dSXin LI>3		ubyte			2		\b, fast compression (Z1)
2592b6cee71dSXin LI>3		ubyte			3		\b, medium compression (Z2)
2593b6cee71dSXin LI>3		ubyte			>3
2594b6cee71dSXin LI>>3		ubyte			<11		\b, compression (Z%d-1)
2595b6cee71dSXin LI>2		ubyte&0x08		0x00
2596b6cee71dSXin LI# ~ 30 byte password field only for *.gho
2597b6cee71dSXin LI>>12		ubequad			!0		\b, password protected
2598b6cee71dSXin LI>>44		ubyte			!1
2599b6cee71dSXin LI# 1~Image All, sector-by-sector only for *.gho
2600b6cee71dSXin LI>>>10		ubyte			1		\b, sector copy
2601b6cee71dSXin LI# 1~Image Boot track only for *.gho
2602b6cee71dSXin LI>>>43		ubyte			1		\b, boot track
2603b6cee71dSXin LI# 1~Image Disc only for *.gho implies Image Boot track and sector copy
2604b6cee71dSXin LI>>44		ubyte			1		\b, disc sector copy
2605b6cee71dSXin LI# optional image description only *.gho
2606b6cee71dSXin LI>>0xff		string			>\0		"%-.254s"
2607b6cee71dSXin LI# look for DOS sector end sequence
2608b6cee71dSXin LI>0xE08	search/7776		\x55\xAA
2609b6cee71dSXin LI>>&-512	indirect		x		\b; contains
2610b6cee71dSXin LI
26113e41d09dSXin LI# Google Chrome extensions
26123e41d09dSXin LI# https://developer.chrome.com/extensions/crx
26133e41d09dSXin LI# https://developer.chrome.com/extensions/hosting
26143e41d09dSXin LI0	string	Cr24	Google Chrome extension
26153e41d09dSXin LI!:mime	application/x-chrome-extension
26163e41d09dSXin LI>4	ulong	x	\b, version %u
261740427ccaSGordon Tetlow
261840427ccaSGordon Tetlow# SeqBox - Sequenced container
261940427ccaSGordon Tetlow# ext: sbx, seqbox
262040427ccaSGordon Tetlow# Marco Pontello marcopon@gmail.com
262140427ccaSGordon Tetlow# reference: https://github.com/MarcoPon/SeqBox
262240427ccaSGordon Tetlow0	string	SBx	SeqBox,
262340427ccaSGordon Tetlow>3	byte	x	version %d
262458a0f0d0SEitan Adler
262558a0f0d0SEitan Adler# LyNX archive
2626898496eeSXin LI# Update:	Joerg Jenderek
2627898496eeSXin LI# URL:		http://fileformats.archiveteam.org/wiki/Lynx_archive
2628898496eeSXin LI# Reference:	http://ist.uwaterloo.ca/~schepers/formats/LNX.TXT
2629898496eeSXin LI#		http://mark0.net/download/triddefs_xml.7z/defs/a/ark-lnx.trid.xml
2630898496eeSXin LI# Note:		called "Lynx archive" by TrID and "Commodore C64 BASIC program" with "POKE 53280" by ./c64
2631898496eeSXin LI# TODO:		merge and unify with Commodore C64 BASIC program
263258a0f0d0SEitan Adler56	string	USE\040LYNX\040TO\040DISSOLVE\040THIS\040FILE	 LyNX archive
2633898496eeSXin LI# display "Lynx archive" (strength=330) before Commodore C64 BASIC program (strength=50) handled by ./c64
2634898496eeSXin LI#!:strength +0
2635898496eeSXin LI#!:mime	application/octet-stream
2636898496eeSXin LI!:mime	application/x-commodore-lnx
2637898496eeSXin LI!:ext	lnx
2638898496eeSXin LI# afterwards look for BASIC tokenized GOTO (89h) 10, line terminator \0, end of programm tag \0\0 and CarriageReturn
2639898496eeSXin LI>86		search/10	\x8910\0\0\0\r	\b,
2640898496eeSXin LI# for DEBUGGING
2641898496eeSXin LI#>>&0		string		x	STRING="%s"
2642898496eeSXin LI# number in ASCII of directory blocks with spaces on both sides like: 1 2 3 5
2643898496eeSXin LI>>&0		regex		[0-9]{1,5}	%s directory blocks
2644898496eeSXin LI# signature like: "*LYNX XII BY WILL CORLEY" " LYNX IX  BY WILL CORLEY" "*LYNX BY CBMCONVERT 2.0*"
2645898496eeSXin LI>>>&2		regex		[^\r]{1,24}	\b, signature "%s"
2646898496eeSXin LI# number of files in ASCII surrounded by spaces and delimited by CR like: 2 3 6 13 69 144 (maximum?)
2647898496eeSXin LI>>>>&1		regex		[0-9]{1,3}	\b, %s files
264848c779cdSXin LI
264948c779cdSXin LI# From: Joerg Jenderek
265048c779cdSXin LI# URL: https://www.acronis.com/
265148c779cdSXin LI# Reference: https://en.wikipedia.org/wiki/TIB_(file_format)
265248c779cdSXin LI# Note: only tested with True Image 2013 Build 5962 and 2019 Build 14110
265348c779cdSXin LI0	ubequad		0xce24b9a220000000	Acronis True Image backup
265448c779cdSXin LI!:mime	application/x-acronis-tib
265548c779cdSXin LI!:ext	tib
265648c779cdSXin LI# 01000000
265743a5ec4eSXin LI#>20	ubelong		x			\b, at 20 %#x
265848c779cdSXin LI# 20000000
265943a5ec4eSXin LI#>28	ubelong		x			\b, at 28 %#x
266048c779cdSXin LI# strings like "Generic- SD/MMC 1.00" "Unknown Disk" "Msft Virtual Disk 1.0"
266148c779cdSXin LI# ???
266248c779cdSXin LI# strings like "\Device\0000011e" "\Device\0000015a"
266348c779cdSXin LI#>0	search/0x6852300/cs	\\Device\\
266448c779cdSXin LI#>>&-1	pstring		x			\b, %s
266548c779cdSXin LI# "\Device\HarddiskVolume30" "\Device\HarddiskVolume39"
266648c779cdSXin LI#>>>&1	search/180/cs	\\Device\\
266748c779cdSXin LI#>>>>&-1	pstring		x			\b, %s
266848c779cdSXin LI#>>>>>&0	search/29/cs	\0\0\xc8\0
266948c779cdSXin LI# disk label
267048c779cdSXin LI#>>>>>>&10	lestring16	x		\b, disk label %11.11s
267148c779cdSXin LI#>>>>>>&9	plestring16	x		\b, disk label "%11.11s"
267248c779cdSXin LI#>>>>>>&10	ubequad	x			%16.16llx
267348c779cdSXin LI
267448c779cdSXin LI
267548c779cdSXin LI# Gentoo XPAK binary package
267648c779cdSXin LI# by Michal Gorny <mgorny@gentoo.org>
267748c779cdSXin LI# https://gitweb.gentoo.org/proj/portage.git/tree/man/xpak.5
267848c779cdSXin LI-4	string	STOP
267948c779cdSXin LI>-16	string	XPAKSTOP	Gentoo binary package (XPAK)
2680898496eeSXin LI!:mime	application/vnd.gentoo.xpak
268148c779cdSXin LI
268248c779cdSXin LI# From:		Joerg Jenderek
268348c779cdSXin LI# URL:		https://kodi.wiki/view/TexturePacker
268448c779cdSXin LI# Reference:	https://mirrors.kodi.tv/releases/source/17.3-Krypton.tar.gz
268548c779cdSXin LI# /xbmc-Krypton/xbmc/guilib/XBTF.h
268648c779cdSXin LI# /xbmc-Krypton/xbmc/guilib/XBTF.cpp
268748c779cdSXin LI0	string	XBTF
268848c779cdSXin LI# skip ASCII text by looking for terminating \0 of path
268948c779cdSXin LI>264	ubyte	0		XBMC texture package
269048c779cdSXin LI!:mime	application/x-xbmc-xbt
269148c779cdSXin LI!:ext	xbt
269248c779cdSXin LI# XBTF_VERSION 2
269348c779cdSXin LI>>4	string	!2		\b, version %-.1s
269448c779cdSXin LI# nofFiles /xbmc-Krypton/xbmc/guilib/XBTFReader.cpp
269548c779cdSXin LI>>5	ulelong	x		\b, %u file
269648c779cdSXin LI# plural s
269748c779cdSXin LI>>5	ulelong	>1		\bs
269848c779cdSXin LI# path[CXBTFFile[MaximumPathLength=256]
269948c779cdSXin LI>>9	string	x		\b, 1st %s
270048c779cdSXin LI
270143a5ec4eSXin LI# ALZIP archive
270243a5ec4eSXin LI# by Hyungjun Park <hyungjun.park@worksmobile.com>, Hajin Jang <hajin_jang@worksmobile.com>
270343a5ec4eSXin LI# http://kippler.com/win/unalz/
270443a5ec4eSXin LI# https://salsa.debian.org/l10n-korean-team/unalz
270543a5ec4eSXin LI0	string	ALZ\001		ALZ archive data
270643a5ec4eSXin LI!:ext   alz
270743a5ec4eSXin LI
270843a5ec4eSXin LI# https://cf-aldn.altools.co.kr/setup/EGG_Specification.zip
270943a5ec4eSXin LI0	string	EGGA		EGG archive data,
271043a5ec4eSXin LI!:ext   egg
271143a5ec4eSXin LI>5	byte	x		version %u
271243a5ec4eSXin LI>4	byte	x		\b.%u
271343a5ec4eSXin LI>>0x0E	ulelong	=0x08E28222
271443a5ec4eSXin LI>>0x0E	ulelong	=0x24F5A262	\b, split
271543a5ec4eSXin LI>>0x0E	ulelong	=0x24E5A060	\b, solid
271643a5ec4eSXin LI>>0x0E	default	x		\b, unknown
271743a5ec4eSXin LI
271843a5ec4eSXin LI# PAQ9A archive
271943a5ec4eSXin LI# URL: http://mattmahoney.net/dc/#paq9a
272043a5ec4eSXin LI# Note: Line 1186 of paq9a.cpp gives the magic bytes
272143a5ec4eSXin LI0	string	pQ9\001		PAQ9A archive
2722a2dfb722SXin LI
2723a2dfb722SXin LI# From wof (wof@stachelkaktus.net)
2724a2dfb722SXin LI0	string	Unison\ archive\ format	Unison archive format
2725898496eeSXin LI
2726898496eeSXin LI# https://ankiweb.net
2727898496eeSXin LI30	string	collection.anki2	Anki APKG file
2728898496eeSXin LI#!:ext	.apkg
2729898496eeSXin LI
2730898496eeSXin LI# Synology archive (DiskStation Manager 7.0+)
2731898496eeSXin LI# From: Alexandre Iooss <erdnaxe@crans.org>
2732898496eeSXin LI# Note: These archives are signed and encrypted.
2733898496eeSXin LI0		ulelong&0xFFFFFF00	0xEFBEAD00
2734898496eeSXin LI# MessagePack header (fixarray of 5 elements starting with a bin of 32 bytes)
2735898496eeSXin LI>8  	ulelong&0x00FFFFFF	0x20C495	Synology archive
2736898496eeSXin LI!:ext	spk
2737898496eeSXin LI# Extract some properties from MessagePack third item
2738898496eeSXin LI>>43	search/0x10000		package=
2739898496eeSXin LI>>>&0	string				x			\b, package %s
2740898496eeSXin LI>>43	search/0x10000		arch=
2741898496eeSXin LI>>>&0	string				x			%s
2742898496eeSXin LI>>43	search/0x10000		version=
2743898496eeSXin LI>>>&0	string				x			%s
2744898496eeSXin LI>>43	search/0x10000		create_time=
2745898496eeSXin LI>>>&0	string				x			\b, created on %s
2746898496eeSXin LI
2747898496eeSXin LI# MonoGame/XNA processed assets archive
2748898496eeSXin LI# From: Alexandre Iooss <erdnaxe@crans.org>
2749898496eeSXin LI# URL: https://github.com/MonoGame/MonoGame/blob/v3.8.1/MonoGame.Framework/Content/ContentManager.cs
2750898496eeSXin LI0	string	XNB
2751898496eeSXin LI# XNB must be version 4 or 5
2752898496eeSXin LI>4	byte	<6
2753898496eeSXin LI>>4	byte	>3
2754898496eeSXin LI# Size must be positive
2755898496eeSXin LI>>>6	lelong	>0	MonoGame/XNA processed assets
2756898496eeSXin LI!:ext	xnb
2757898496eeSXin LI>>>>3	string	=w	\b, for Windows
2758898496eeSXin LI>>>>3	string	=x	\b, for Xbox360
2759898496eeSXin LI>>>>3	string	=i	\b, for iOS
2760898496eeSXin LI>>>>3	string	=a	\b, for Android
2761898496eeSXin LI>>>>3	string	=d	\b, for DesktopGL
2762898496eeSXin LI>>>>3	string	=X	\b, for MacOSX
2763898496eeSXin LI>>>>3	string	=W	\b, for WindowsStoreApp
2764898496eeSXin LI>>>>3	string	=n	\b, for NativeClient
2765898496eeSXin LI>>>>3	string	=M	\b, for WindowsPhone8
2766898496eeSXin LI>>>>3	string	=r	\b, for RaspberryPi
2767898496eeSXin LI>>>>3	string	=P	\b, for PlayStation4
2768898496eeSXin LI>>>>3	string	=5	\b, for PlayStation5
2769898496eeSXin LI>>>>3	string	=O	\b, for XboxOne
2770898496eeSXin LI>>>>3	string	=S	\b, for Nintendo Switch
2771898496eeSXin LI>>>>3	string	=G	\b, for Google Stadia
2772898496eeSXin LI>>>>3	string	=b	\b, for WebAssembly and Bridge.NET
2773898496eeSXin LI>>>>3	string	=m	\b, for WindowsPhone7.0 (XNA)
2774898496eeSXin LI>>>>3	string	=p	\b, for PlayStationMobile
2775898496eeSXin LI>>>>3	string	=v	\b, for PSVita
2776898496eeSXin LI>>>>3	string	=g	\b, for Windows (OpenGL)
2777898496eeSXin LI>>>>3	string	=l	\b, for Linux
2778898496eeSXin LI>>>>4	byte	x	\b, version %d
2779898496eeSXin LI>>>>5	byte	&0x80	\b, LZX compressed
2780898496eeSXin LI>>>>>10	lelong	x	\b, decompressed size: %d bytes
2781898496eeSXin LI>>>>5	byte	&0x40	\b, LZ4 compressed
2782898496eeSXin LI>>>>>10	lelong	x	\b, decompressed size: %d bytes
2783898496eeSXin LI
2784898496eeSXin LI# Electron ASAR archive
2785898496eeSXin LI# From: Alexandre Iooss <erdnaxe@crans.org>
2786898496eeSXin LI# URL: https://github.com/electron/asar
2787898496eeSXin LI0		ulelong	4
2788898496eeSXin LI# Match JSON header start and end
2789898496eeSXin LI>16		string	{"files":{"
2790898496eeSXin LI>>(12.l+12)	string }}}}		Electron ASAR archive
2791898496eeSXin LI!:ext	asar
2792898496eeSXin LI>>>12		ulelong	x		\b, header length: %d bytes
2793*ae316d1dSXin LI
2794*ae316d1dSXin LI# Wasay ImageIt DataPack
2795*ae316d1dSXin LI# From: Alexandre Iooss <erdnaxe@crans.org>
2796*ae316d1dSXin LI# URL: https://www.neowin.net/forum/topic/615151-anyone-know-what-program-opens-dsi-and-wsi-files/
2797*ae316d1dSXin LI# Note: Used in Acer eRecovery and Lenovo OneKey Recovery (OKR)
2798*ae316d1dSXin LI4	string		WSVD
2799*ae316d1dSXin LI# bytes 3-4 are the checksum or the first 32 bytes of the file
2800*ae316d1dSXin LI>0	uleshort	0x40	Wasay ImageIt DataPack
2801*ae316d1dSXin LI>>8	uleshort	x	v%u
2802*ae316d1dSXin LI>>10	uleshort	x	\b.%u
2803*ae316d1dSXin LI>>16	lestring16/8	x	\b, "%s"
2804*ae316d1dSXin LI>>12	uleshort	x	(%u)
2805*ae316d1dSXin LI>>32	byte		x	\b, created on %02d
2806*ae316d1dSXin LI>>33	byte		x	\b%02d
2807*ae316d1dSXin LI>>34	byte		x	\b/%02d
2808*ae316d1dSXin LI>>35	byte		x	\b/%02d
2809*ae316d1dSXin LI>>36	byte		x	%02d
2810*ae316d1dSXin LI>>37	byte		x	\b:%02d
2811*ae316d1dSXin LI>>38	byte		x	\b:%02d
2812*ae316d1dSXin LI>>56	ulelong		x	\b, size: %u bytes
2813