xref: /freebsd/contrib/file/magic/Magdir/database (revision d38c30c092828f4882ce13b08d0bd3fd6dc7afb5)
1b6cee71dSXin LI
2b6cee71dSXin LI#------------------------------------------------------------------------------
3*d38c30c0SXin LI# $File: database,v 1.56 2019/06/14 20:12:00 christos Exp $
4b6cee71dSXin LI# database:  file(1) magic for various databases
5b6cee71dSXin LI#
6b6cee71dSXin LI# extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk)
7b6cee71dSXin LI#
8b6cee71dSXin LI#
9b6cee71dSXin LI# GDBM magic numbers
10b6cee71dSXin LI#  Will be maintained as part of the GDBM distribution in the future.
11b6cee71dSXin LI#  <downsj@teeny.org>
12c2931133SXin LI0	belong	0x13579acd	GNU dbm 1.x or ndbm database, big endian, 32-bit
13b6cee71dSXin LI!:mime	application/x-gdbm
14c2931133SXin LI0	belong	0x13579ace	GNU dbm 1.x or ndbm database, big endian, old
15c2931133SXin LI!:mime	application/x-gdbm
16c2931133SXin LI0	belong	0x13579acf	GNU dbm 1.x or ndbm database, big endian, 64-bit
17c2931133SXin LI!:mime	application/x-gdbm
18c2931133SXin LI0	lelong	0x13579acd	GNU dbm 1.x or ndbm database, little endian, 32-bit
19c2931133SXin LI!:mime	application/x-gdbm
20c2931133SXin LI0	lelong	0x13579ace	GNU dbm 1.x or ndbm database, little endian, old
21c2931133SXin LI!:mime	application/x-gdbm
22c2931133SXin LI0	lelong	0x13579acf	GNU dbm 1.x or ndbm database, little endian, 64-bit
23b6cee71dSXin LI!:mime	application/x-gdbm
24b6cee71dSXin LI0	string	GDBM		GNU dbm 2.x database
25b6cee71dSXin LI!:mime	application/x-gdbm
26b6cee71dSXin LI#
27b6cee71dSXin LI# Berkeley DB
28b6cee71dSXin LI#
29b6cee71dSXin LI# Ian Darwin's file /etc/magic files: big/little-endian version.
30b6cee71dSXin LI#
31b6cee71dSXin LI# Hash 1.85/1.86 databases store metadata in network byte order.
32b6cee71dSXin LI# Btree 1.85/1.86 databases store the metadata in host byte order.
33b6cee71dSXin LI# Hash and Btree 2.X and later databases store the metadata in host byte order.
34b6cee71dSXin LI
35b6cee71dSXin LI0	long	0x00061561	Berkeley DB
36b6cee71dSXin LI!:mime	application/x-dbm
37b6cee71dSXin LI>8	belong	4321
38b6cee71dSXin LI>>4	belong	>2		1.86
39b6cee71dSXin LI>>4	belong	<3		1.85
40b6cee71dSXin LI>>4	belong	>0		(Hash, version %d, native byte-order)
41b6cee71dSXin LI>8	belong	1234
42b6cee71dSXin LI>>4	belong	>2		1.86
43b6cee71dSXin LI>>4	belong	<3		1.85
44b6cee71dSXin LI>>4	belong	>0		(Hash, version %d, little-endian)
45b6cee71dSXin LI
46b6cee71dSXin LI0	belong	0x00061561	Berkeley DB
47b6cee71dSXin LI>8	belong	4321
48b6cee71dSXin LI>>4	belong	>2		1.86
49b6cee71dSXin LI>>4	belong	<3		1.85
50b6cee71dSXin LI>>4	belong	>0		(Hash, version %d, big-endian)
51b6cee71dSXin LI>8	belong	1234
52b6cee71dSXin LI>>4	belong	>2		1.86
53b6cee71dSXin LI>>4	belong	<3		1.85
54b6cee71dSXin LI>>4	belong	>0		(Hash, version %d, native byte-order)
55b6cee71dSXin LI
56b6cee71dSXin LI0	long	0x00053162	Berkeley DB 1.85/1.86
57b6cee71dSXin LI>4	long	>0		(Btree, version %d, native byte-order)
58b6cee71dSXin LI0	belong	0x00053162	Berkeley DB 1.85/1.86
59b6cee71dSXin LI>4	belong	>0		(Btree, version %d, big-endian)
60b6cee71dSXin LI0	lelong	0x00053162	Berkeley DB 1.85/1.86
61b6cee71dSXin LI>4	lelong	>0		(Btree, version %d, little-endian)
62b6cee71dSXin LI
63b6cee71dSXin LI12	long	0x00061561	Berkeley DB
64b6cee71dSXin LI>16	long	>0		(Hash, version %d, native byte-order)
65b6cee71dSXin LI12	belong	0x00061561	Berkeley DB
66b6cee71dSXin LI>16	belong	>0		(Hash, version %d, big-endian)
67b6cee71dSXin LI12	lelong	0x00061561	Berkeley DB
68b6cee71dSXin LI>16	lelong	>0		(Hash, version %d, little-endian)
69b6cee71dSXin LI
70b6cee71dSXin LI12	long	0x00053162	Berkeley DB
71b6cee71dSXin LI>16	long	>0		(Btree, version %d, native byte-order)
72b6cee71dSXin LI12	belong	0x00053162	Berkeley DB
73b6cee71dSXin LI>16	belong	>0		(Btree, version %d, big-endian)
74b6cee71dSXin LI12	lelong	0x00053162	Berkeley DB
75b6cee71dSXin LI>16	lelong	>0		(Btree, version %d, little-endian)
76b6cee71dSXin LI
77b6cee71dSXin LI12	long	0x00042253	Berkeley DB
78b6cee71dSXin LI>16	long	>0		(Queue, version %d, native byte-order)
79b6cee71dSXin LI12	belong	0x00042253	Berkeley DB
80b6cee71dSXin LI>16	belong	>0		(Queue, version %d, big-endian)
81b6cee71dSXin LI12	lelong	0x00042253	Berkeley DB
82b6cee71dSXin LI>16	lelong	>0		(Queue, version %d, little-endian)
83b6cee71dSXin LI
84b6cee71dSXin LI# From Max Bowsher.
85b6cee71dSXin LI12	long	0x00040988	Berkeley DB
86b6cee71dSXin LI>16	long	>0		(Log, version %d, native byte-order)
87b6cee71dSXin LI12	belong	0x00040988	Berkeley DB
88b6cee71dSXin LI>16	belong	>0		(Log, version %d, big-endian)
89b6cee71dSXin LI12	lelong	0x00040988	Berkeley DB
90b6cee71dSXin LI>16	lelong	>0		(Log, version %d, little-endian)
91b6cee71dSXin LI
92b6cee71dSXin LI#
93b6cee71dSXin LI#
94b6cee71dSXin LI# Round Robin Database Tool by Tobias Oetiker <oetiker@ee.ethz.ch>
95b6cee71dSXin LI0	string/b	RRD\0		RRDTool DB
96b6cee71dSXin LI>4	string/b	x		version %s
97b6cee71dSXin LI
98b6cee71dSXin LI>>10	short		!0		16bit aligned
99b6cee71dSXin LI>>>10	bedouble	8.642135e+130	big-endian
100b6cee71dSXin LI>>>>18	short		x		32bit long (m68k)
101b6cee71dSXin LI
102b6cee71dSXin LI>>10	short		0
103b6cee71dSXin LI>>>12	long		!0		32bit aligned
104b6cee71dSXin LI>>>>12	bedouble	8.642135e+130	big-endian
105b6cee71dSXin LI>>>>>20 long		0		64bit long
106b6cee71dSXin LI>>>>>20 long		!0		32bit long
107b6cee71dSXin LI>>>>12	ledouble	8.642135e+130	little-endian
108b6cee71dSXin LI>>>>>24 long		0		64bit long
109b6cee71dSXin LI>>>>>24 long		!0		32bit long (i386)
110b6cee71dSXin LI>>>>12	string		\x43\x2b\x1f\x5b\x2f\x25\xc0\xc7	middle-endian
111b6cee71dSXin LI>>>>>24 short		!0		32bit long (arm)
112b6cee71dSXin LI
113b6cee71dSXin LI>>8	quad		0		64bit aligned
114b6cee71dSXin LI>>>16	bedouble	8.642135e+130	big-endian
115b6cee71dSXin LI>>>>24	long		0		64bit long (s390x)
116b6cee71dSXin LI>>>>24	long		!0		32bit long (hppa/mips/ppc/s390/SPARC)
117b6cee71dSXin LI>>>16	ledouble	8.642135e+130	little-endian
118b6cee71dSXin LI>>>>28	long		0		64bit long (alpha/amd64/ia64)
119b6cee71dSXin LI>>>>28	long		!0		32bit long (armel/mipsel)
120b6cee71dSXin LI
121b6cee71dSXin LI#----------------------------------------------------------------------
122b6cee71dSXin LI# ROOT: file(1) magic for ROOT databases
123b6cee71dSXin LI#
124b6cee71dSXin LI0       string  root\0  ROOT file
125b6cee71dSXin LI>4      belong  x       Version %d
126b6cee71dSXin LI>33     belong  x       (Compression: %d)
127b6cee71dSXin LI
128b6cee71dSXin LI# XXX: Weak magic.
129b6cee71dSXin LI# Alex Ott <ott@jet.msk.su>
130b6cee71dSXin LI## Paradox file formats
131b6cee71dSXin LI#2	  leshort	0x0800	Paradox
132b6cee71dSXin LI#>0x39	  byte		3	v. 3.0
133b6cee71dSXin LI#>0x39	  byte		4	v. 3.5
134b6cee71dSXin LI#>0x39	  byte		9	v. 4.x
135b6cee71dSXin LI#>0x39	  byte		10	v. 5.x
136b6cee71dSXin LI#>0x39	  byte		11	v. 5.x
137b6cee71dSXin LI#>0x39	  byte		12	v. 7.x
138b6cee71dSXin LI#>>0x04	  byte		0	indexed .DB data file
139b6cee71dSXin LI#>>0x04	  byte		1	primary index .PX file
140b6cee71dSXin LI#>>0x04	  byte		2	non-indexed .DB data file
141b6cee71dSXin LI#>>0x04	  byte		3	non-incrementing secondary index .Xnn file
142b6cee71dSXin LI#>>0x04	  byte		4	secondary index .Ynn file
143b6cee71dSXin LI#>>0x04	  byte		5	incrementing secondary index .Xnn file
144b6cee71dSXin LI#>>0x04	  byte		6	non-incrementing secondary index .XGn file
145b6cee71dSXin LI#>>0x04	  byte		7	secondary index .YGn file
146b6cee71dSXin LI#>>>0x04	  byte		8	incrementing secondary index .XGn file
147b6cee71dSXin LI
148b6cee71dSXin LI## XBase database files
149b6cee71dSXin LI# updated by Joerg Jenderek at Feb 2013
15048c779cdSXin LI# https://www.dbase.com/Knowledgebase/INT/db7_file_fmt.htm
15148c779cdSXin LI# https://www.clicketyclick.dk/databases/xbase/format/dbf.html
152b6cee71dSXin LI# inspect VVYYMMDD , where 1<= MM <= 12 and 1<= DD <= 31
153b6cee71dSXin LI0	ubelong&0x0000FFFF		<0x00000C20
154b6cee71dSXin LI# skip Infocom game Z-machine
155b6cee71dSXin LI>2		ubyte			>0
156b6cee71dSXin LI# skip Androids *.xml
157b6cee71dSXin LI>>3		ubyte			>0
158b6cee71dSXin LI>>>3		ubyte			<32
159b6cee71dSXin LI# 1 < version VV
160b6cee71dSXin LI>>>>0		ubyte			>1
161b6cee71dSXin LI# skip HELP.CA3 by test for reserved byte ( NULL )
162b6cee71dSXin LI>>>>>27		ubyte			0
163b6cee71dSXin LI# reserved bytes not always 0 ; also found 0x3901 (T4.DBF) ,0x7101 (T5.DBF,T6.DBF)
164b6cee71dSXin LI#>>>>>30		ubeshort     		x		30NULL?%x
165b6cee71dSXin LI# possible production flag,tag numbers(<=0x30),tag length(<=0x20), reserved (NULL)
166b6cee71dSXin LI>>>>>>24	ubelong&0xffFFFFff	>0x01302000
167b6cee71dSXin LI# .DBF or .MDX
168b6cee71dSXin LI>>>>>>24	ubelong&0xffFFFFff	<0x01302001
169b6cee71dSXin LI# for Xbase Database file (*.DBF) reserved (NULL) for multi-user
170b6cee71dSXin LI>>>>>>>24	ubelong&0xffFFFFff	=0
171b6cee71dSXin LI# test for 2 reserved NULL bytes,transaction and encryption byte flag
172b6cee71dSXin LI>>>>>>>>12	ubelong&0xFFFFfEfE	0
173b6cee71dSXin LI# test for MDX flag
174b6cee71dSXin LI>>>>>>>>>28	ubyte			x
175b6cee71dSXin LI>>>>>>>>>28	ubyte&0xf8		0
176b6cee71dSXin LI# header size >= 32
177b6cee71dSXin LI>>>>>>>>>>8	uleshort		>31
178b6cee71dSXin LI# skip PIC15736.PCX by test for language driver name or field name
179b6cee71dSXin LI>>>>>>>>>>>32	ubyte			>0
180b6cee71dSXin LI#!:mime	application/x-dbf; charset=unknown-8bit ??
181b6cee71dSXin LI#!:mime	application/x-dbase
182b6cee71dSXin LI>>>>>>>>>>>>0	use			xbase-type
183b6cee71dSXin LI# database file
184b6cee71dSXin LI>>>>>>>>>>>>0	ubyte			x		\b DBF
185b6cee71dSXin LI>>>>>>>>>>>>4	lelong			0		\b, no records
186b6cee71dSXin LI>>>>>>>>>>>>4	lelong			>0		\b, %d record
187b6cee71dSXin LI# plural s appended
188b6cee71dSXin LI>>>>>>>>>>>>>4	lelong			>1		\bs
18948c779cdSXin LI# https://www.clicketyclick.dk/databases/xbase/format/dbf_check.html#CHECK_DBF
190b6cee71dSXin LI# 1 <= record size <= 4000 (dBase 3,4) or 32 * KB (=0x8000)
191b6cee71dSXin LI>>>>>>>>>>>>10	uleshort		x		* %d
192b6cee71dSXin LI# file size = records * record size + header size
193b6cee71dSXin LI>>>>>>>>>>>>1	ubyte			x		\b, update-date
194b6cee71dSXin LI>>>>>>>>>>>>1	use			xbase-date
19548c779cdSXin LI# https://msdn.microsoft.com/de-de/library/cc483186(v=vs.71).aspx
196b6cee71dSXin LI#>>>>>>>>>>>>29	ubyte			=0		\b, codepage ID=0x%x
197b6cee71dSXin LI# 2~cp850 , 3~cp1252 , 0x1b~?? ; what code page is 0x1b ?
198b6cee71dSXin LI>>>>>>>>>>>>29	ubyte			>0		\b, codepage ID=0x%x
199b6cee71dSXin LI#>>>>>>>>>>>>28	ubyte&0x01		0		\b, no index file
200b6cee71dSXin LI>>>>>>>>>>>>28	ubyte&0x01		1		\b, with index file .MDX
201b6cee71dSXin LI>>>>>>>>>>>>28	ubyte&0x02		2		\b, with memo .FPT
202b6cee71dSXin LI>>>>>>>>>>>>28	ubyte&0x04		4		\b, DataBaseContainer
203b6cee71dSXin LI# 1st record offset + 1 = header size
204b6cee71dSXin LI>>>>>>>>>>>>8	uleshort		>0
205b6cee71dSXin LI>>>>>>>>>>>>(8.s+1)	ubyte		>0
206b6cee71dSXin LI>>>>>>>>>>>>>8		uleshort	>0		\b, at offset %d
207b6cee71dSXin LI>>>>>>>>>>>>>(8.s+1)	ubyte		>0
208b6cee71dSXin LI>>>>>>>>>>>>>>&-1	string		>\0		1st record "%s"
20940427ccaSGordon Tetlow# for multiple index files (*.MDX) Production flag,tag numbers(<=0x30),tag length(<=0x20), reserved (NULL)
210b6cee71dSXin LI>>>>>>>24	ubelong&0x0133f7ff	>0
211b6cee71dSXin LI# test for reserved NULL byte
212c2931133SXin LI>>>>>>>>47	ubyte			0
213b6cee71dSXin LI# test for valid TAG key format (0x10 or 0)
214b6cee71dSXin LI>>>>>>>>>559	ubyte&0xeF		0
215b6cee71dSXin LI# test MM <= 12
216c2931133SXin LI>>>>>>>>>>45	ubeshort		<0x0C20
217c2931133SXin LI>>>>>>>>>>>45	ubyte			>0
218c2931133SXin LI>>>>>>>>>>>>46	ubyte			<32
219c2931133SXin LI>>>>>>>>>>>>>46	ubyte			>0
220b6cee71dSXin LI#!:mime	application/x-mdx
221c2931133SXin LI>>>>>>>>>>>>>>0		use		xbase-type
222c2931133SXin LI>>>>>>>>>>>>>>0		ubyte		x		\b MDX
223c2931133SXin LI>>>>>>>>>>>>>>1		ubyte		x		\b, creation-date
224c2931133SXin LI>>>>>>>>>>>>>>1		use		xbase-date
225c2931133SXin LI>>>>>>>>>>>>>>44	ubyte		x		\b, update-date
226c2931133SXin LI>>>>>>>>>>>>>>44	use		xbase-date
227b6cee71dSXin LI# No.of tags in use (1,2,5,12)
228c2931133SXin LI>>>>>>>>>>>>>>28	uleshort	x		\b, %d
229b6cee71dSXin LI# No. of entries in tag (0x30)
230c2931133SXin LI>>>>>>>>>>>>>>25	ubyte		x		\b/%d tags
231b6cee71dSXin LI#  Length of tag
232c2931133SXin LI>>>>>>>>>>>>>>26	ubyte		x		* %d
233b6cee71dSXin LI# 1st tag name_
234b6cee71dSXin LI>>>>>>>>>>>>>548	string		x		\b, 1st tag "%.11s"
235b6cee71dSXin LI# 2nd tag name
236b6cee71dSXin LI#>>>>>>>>>>>>(26.b+548)	string		x		\b, 2nd tag "%.11s"
237b6cee71dSXin LI#
238b6cee71dSXin LI#		Print the xBase names of different version variants
239b6cee71dSXin LI0	name				xbase-type
240b6cee71dSXin LI>0	ubyte		<2
241b6cee71dSXin LI# 1 < version
242b6cee71dSXin LI>0	ubyte		>1
243b6cee71dSXin LI>>0	ubyte		0x02		FoxBase
244b6cee71dSXin LI# FoxBase+/dBaseIII+, no memo
245b6cee71dSXin LI>>0	ubyte		0x03		FoxBase+/dBase III
246b6cee71dSXin LI!:mime	application/x-dbf
247b6cee71dSXin LI# dBASE IV no memo file
248b6cee71dSXin LI>>0	ubyte		0x04		dBase IV
249b6cee71dSXin LI!:mime	application/x-dbf
250b6cee71dSXin LI# dBASE V no memo file
251b6cee71dSXin LI>>0	ubyte		0x05		dBase V
252b6cee71dSXin LI!:mime	application/x-dbf
253b6cee71dSXin LI>>0	ubyte		0x30		Visual FoxPro
254b6cee71dSXin LI!:mime	application/x-dbf
255b6cee71dSXin LI>>0	ubyte		0x31		Visual FoxPro, autoincrement
256b6cee71dSXin LI!:mime	application/x-dbf
257b6cee71dSXin LI# Visual FoxPro, with field type Varchar or Varbinary
258b6cee71dSXin LI>>0	ubyte		0x32		Visual FoxPro, with field type Varchar
259b6cee71dSXin LI!:mime	application/x-dbf
260b6cee71dSXin LI# dBASE IV SQL, no memo;dbv memo var size (Flagship)
261b6cee71dSXin LI>>0	ubyte		0x43		dBase IV, with SQL table
262b6cee71dSXin LI!:mime	application/x-dbf
26348c779cdSXin LI# https://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
264b6cee71dSXin LI#>>0	ubyte		0x62		dBase IV, with SQL table
265b6cee71dSXin LI#!:mime	application/x-dbf
266b6cee71dSXin LI# dBASE IV, with memo!!
267b6cee71dSXin LI>>0	ubyte		0x7b		dBase IV, with memo
268b6cee71dSXin LI!:mime	application/x-dbf
26948c779cdSXin LI# https://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
270b6cee71dSXin LI#>>0	ubyte		0x82		dBase IV, with SQL system
271b6cee71dSXin LI#!:mime	application/x-dbf
272b6cee71dSXin LI# FoxBase+/dBaseIII+ with memo .DBT!
273b6cee71dSXin LI>>0	ubyte		0x83		FoxBase+/dBase III, with memo .DBT
274b6cee71dSXin LI!:mime	application/x-dbf
275b6cee71dSXin LI# VISUAL OBJECTS (first 1.0 versions) for the Dbase III files (NTX clipper driver); memo file
276b6cee71dSXin LI>>0	ubyte		0x87		VISUAL OBJECTS, with memo file
277b6cee71dSXin LI!:mime	application/x-dbf
27848c779cdSXin LI# https://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
279b6cee71dSXin LI#>>0	ubyte		0x8A		FoxBase+/dBase III, with memo .DBT
280b6cee71dSXin LI#!:mime	application/x-dbf
281b6cee71dSXin LI# dBASE IV with memo!
282b6cee71dSXin LI>>0	ubyte		0x8B		dBase IV, with memo .DBT
283b6cee71dSXin LI!:mime	application/x-dbf
284b6cee71dSXin LI# dBase IV with SQL Table,no memo?
285b6cee71dSXin LI>>0	ubyte		0x8E		dBase IV, with SQL table
286b6cee71dSXin LI!:mime	application/x-dbf
287b6cee71dSXin LI# .dbv and .dbt memo (Flagship)?
288b6cee71dSXin LI>>0	ubyte		0xB3		Flagship
28948c779cdSXin LI# https://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
290b6cee71dSXin LI#>>0	ubyte		0xCA		dBase IV with memo .DBT
291b6cee71dSXin LI#!:mime	application/x-dbf
292b6cee71dSXin LI# dBASE IV with SQL table, with memo .DBT
293b6cee71dSXin LI>>0	ubyte		0xCB		dBase IV with SQL table, with memo .DBT
294b6cee71dSXin LI!:mime	application/x-dbf
295b6cee71dSXin LI# HiPer-Six format;Clipper SIX, with SMT memo file
296b6cee71dSXin LI>>0	ubyte		0xE5		Clipper SIX with memo
297b6cee71dSXin LI!:mime	application/x-dbf
29848c779cdSXin LI# https://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
299b6cee71dSXin LI#>>0	ubyte		0xF4		dBase IV, with SQL table, with memo
300b6cee71dSXin LI#!:mime	application/x-dbf
301b6cee71dSXin LI>>0	ubyte		0xF5		FoxPro with memo
302b6cee71dSXin LI!:mime	application/x-dbf
30348c779cdSXin LI# https://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
304b6cee71dSXin LI#>>0	ubyte		0xFA		FoxPro 2.x, with memo
305b6cee71dSXin LI#!:mime	application/x-dbf
306b6cee71dSXin LI# unknown version (should not happen)
307b6cee71dSXin LI>>0	default		x		xBase
308b6cee71dSXin LI!:mime	application/x-dbf
309b6cee71dSXin LI>>>0	ubyte		x		(0x%x)
310b6cee71dSXin LI# flags in version byte
311b6cee71dSXin LI# DBT flag (with dBASE III memo .DBT)!!
312b6cee71dSXin LI# >>0	ubyte&0x80	>0		DBT_FLAG=%x
313b6cee71dSXin LI# memo flag ??
314b6cee71dSXin LI# >>0	ubyte&0x08	>0		MEMO_FLAG=%x
315b6cee71dSXin LI# SQL flag ??
316b6cee71dSXin LI# >>0	ubyte&0x70	>0		SQL_FLAG=%x
317b6cee71dSXin LI#		test and print the date of xBase .DBF .MDX
318b6cee71dSXin LI0	name				xbase-date
319b6cee71dSXin LI# inspect YYMMDD , where 1<= MM <= 12 and 1<= DD <= 31
320b6cee71dSXin LI>0	ubelong		x
321b6cee71dSXin LI>1	ubyte		<13
322b6cee71dSXin LI>>1	ubyte		>0
323b6cee71dSXin LI>>>2	ubyte		>0
324b6cee71dSXin LI>>>>2	ubyte		<32
325b6cee71dSXin LI>>>>>0	ubyte		x
326b6cee71dSXin LI# YY is interpreted as 20YY or 19YY
327b6cee71dSXin LI>>>>>>0	ubyte		<100		\b %.2d
328b6cee71dSXin LI# YY is interpreted 1900+YY; TODO: display yy or 20yy instead 1YY
329b6cee71dSXin LI>>>>>>0	ubyte		>99		\b %d
330b6cee71dSXin LI>>>>>1	ubyte		x		\b-%d
331b6cee71dSXin LI>>>>>2	ubyte		x		\b-%d
332b6cee71dSXin LI
333b6cee71dSXin LI#	dBase memo files .DBT or .FPT
33448c779cdSXin LI# https://msdn.microsoft.com/en-us/library/8599s21w(v=vs.80).aspx
335b6cee71dSXin LI16		ubyte		<4
336b6cee71dSXin LI>16		ubyte		!2
337b6cee71dSXin LI>>16		ubyte		!1
338b6cee71dSXin LI# next free block index is positive
339b6cee71dSXin LI>>>0		ulelong		>0
340b6cee71dSXin LI# skip many JPG. ZIP, BZ2 by test for reserved bytes NULL , 0|2 , 0|1 , low byte of block size
341*d38c30c0SXin LI>>>>17		ubelong&0xFFfdFEff	0x00000000
342b6cee71dSXin LI# skip many RAR by test for low byte 0 ,high byte 0|2|even of block size, 0|a|e|d7 , 0|64h
343b6cee71dSXin LI>>>>>20		ubelong&0xFF01209B	0x00000000
344b6cee71dSXin LI# dBASE III
345b6cee71dSXin LI>>>>>>16	ubyte		3
346b6cee71dSXin LI# dBASE III DBT
347c2931133SXin LI>>>>>>>0	use		dbase3-memo-print
348c2931133SXin LI# dBASE III DBT without version, dBASE IV DBT , FoxPro FPT , or many ZIP , DBF garbage
349b6cee71dSXin LI>>>>>>16	ubyte		0
350c2931133SXin LI# unusual dBASE III DBT like angest.dbt, dBASE IV DBT with block size 0 , FoxPro FPT ,  or garbage PCX DBF
351c2931133SXin LI>>>>>>>20	uleshort	0
352c2931133SXin LI# FoxPro FPT , unusual dBASE III DBT like biblio.dbt or garbage
353c2931133SXin LI>>>>>>>>8	ulong		=0
354c2931133SXin LI>>>>>>>>>6	ubeshort	>0
355c2931133SXin LI# skip emacs.PIF
356c2931133SXin LI>>>>>>>>>>4	ushort		0
357*d38c30c0SXin LI# check for valid FoxPro field type
358*d38c30c0SXin LI>>>>>>>>>>>512	ubelong		<3
359*d38c30c0SXin LI>>>>>>>>>>>>0	use		foxpro-memo-print
360c2931133SXin LI# dBASE III DBT , garbage
361*d38c30c0SXin LI# skip WORD1XW.DOC with improbably high free block index
362*d38c30c0SXin LI>>>>>>>>>0	lelong		<2205083
363c2931133SXin LI# unusual dBASE III DBT like adressen.dbt
364*d38c30c0SXin LI>>>>>>>>>>0	use		dbase3-memo-print
365c2931133SXin LI# dBASE III DBT like angest.dbt, or garbage PCX DBF
366c2931133SXin LI>>>>>>>>8	ubelong		!0
367c2931133SXin LI# skip PCX and some DBF by test for for reserved NULL bytes
368c2931133SXin LI>>>>>>>>>510	ubeshort	0
369*d38c30c0SXin LI# skip AI070GEP.EPS with improbably high free block index
370*d38c30c0SXin LI>>>>>>>>>>0	lelong		<458766
371*d38c30c0SXin LI>>>>>>>>>>>0	use		dbase3-memo-print
372c2931133SXin LI# dBASE IV DBT with positive block size
373c2931133SXin LI>>>>>>>20	uleshort	>0
3743e41d09dSXin LI# dBASE IV DBT with valid block length like 512, 1024
3753e41d09dSXin LI# multiple of 2 in between 16 and 16 K ,implies upper and lower bits are zero
376*d38c30c0SXin LI# skip also 3600h 3E00h size
377*d38c30c0SXin LI>>>>>>>>20	uleshort&0xE00f	0
3783e41d09dSXin LI>>>>>>>>>0	use		dbase4-memo-print
379b6cee71dSXin LI
380c2931133SXin LI#		Print the information of dBase III DBT memo file
381c2931133SXin LI0	name				dbase3-memo-print
382c2931133SXin LI>0	ubyte			x		dBase III DBT
383*d38c30c0SXin LI!:mime	application/x-dbt
384*d38c30c0SXin LI!:ext	dbt
385c2931133SXin LI# instead 3 as version number 0 for unusual examples like biblio.dbt
386c2931133SXin LI>16	ubyte			!3		\b, version number %u
387b6cee71dSXin LI# Number of next available block for appending data
388c2931133SXin LI#>0	lelong			=0		\b, next free block index %u
389c2931133SXin LI>0	lelong			!0		\b, next free block index %u
390c2931133SXin LI# no positiv block length
391c2931133SXin LI#>20	uleshort		=0		\b, block length %u
392c2931133SXin LI>20	uleshort		!0		\b, block length %u
393c2931133SXin LI# dBase III memo field terminated by \032\032
394c2931133SXin LI>512	string			>\0		\b, 1st item "%s"
395*d38c30c0SXin LI# https://www.clicketyclick.dk/databases/xbase/format/dbt.html
396c2931133SXin LI#		Print the information of dBase IV DBT memo file
397c2931133SXin LI0	name				dbase4-memo-print
398c2931133SXin LI>0		lelong		x		dBase IV DBT
3993e41d09dSXin LI!:mime	application/x-dbt
4003e41d09dSXin LI!:ext dbt
401c2931133SXin LI# 8 character shorted main name of coresponding dBASE IV DBF file
402c2931133SXin LI>8		ubelong		>0x20000000
403c2931133SXin LI# skip unusual like for angest.dbt
404c2931133SXin LI>>20		uleshort	>0
405c2931133SXin LI>>>8		string		>\0		\b of %-.8s.DBF
406c2931133SXin LI# value 0 implies 512 as size
407c2931133SXin LI#>4		ulelong		=0		\b, blocks size %u
408c2931133SXin LI# size of blocks not reliable like 0x2020204C in angest.dbt
409c2931133SXin LI>4		ulelong		!0
410c2931133SXin LI>>4		ulelong&0x0000003f	0	\b, blocks size %u
411c2931133SXin LI# dBase IV DBT with positive block length (found 512 , 1024)
412c2931133SXin LI>20		uleshort	>0		\b, block length %u
413c2931133SXin LI# next available block
414c2931133SXin LI#>0		lelong		=0		\b, next free block index %u
415c2931133SXin LI>0		lelong		!0		\b, next free block index %u
416c2931133SXin LI>20		uleshort	>0
417c2931133SXin LI>>(20.s)	ubelong		x
418c2931133SXin LI>>>&-4		use		dbase4-memofield-print
419c2931133SXin LI# unusual dBase IV DBT without block length (implies 512 as length)
420c2931133SXin LI>20		uleshort	=0
421b6cee71dSXin LI>>512		ubelong		x
422c2931133SXin LI>>>&-4		use				dbase4-memofield-print
423c2931133SXin LI#		Print the information of dBase IV memo field
424c2931133SXin LI0	name			dbase4-memofield-print
425c2931133SXin LI# free dBase IV memo field
426c2931133SXin LI>0		ubelong		!0xFFFF0800
427c2931133SXin LI>>0		lelong		x		\b, next free block %u
428c2931133SXin LI>>4		lelong		x		\b, next used block %u
429c2931133SXin LI# used dBase IV memo field
430c2931133SXin LI>0		ubelong		=0xFFFF0800
431c2931133SXin LI# length of memo field
432c2931133SXin LI>>4		lelong		x		\b, field length %d
433c2931133SXin LI>>>8		string		>\0		\b, 1st used item "%s"
434*d38c30c0SXin LI# http://www.dbfree.org/webdocs/1-documentation/0018-developers_stuff_(advanced)/os_related_stuff/xbase_file_format.htm
435c2931133SXin LI#		Print the information of FoxPro FPT memo file
436c2931133SXin LI0	name				foxpro-memo-print
437c2931133SXin LI>0		belong		x		FoxPro FPT
438*d38c30c0SXin LI!:mime	application/x-fpt
439*d38c30c0SXin LI!:ext	fpt
440c2931133SXin LI# Size of blocks for FoxPro ( 64,256 )
441c2931133SXin LI>6		ubeshort	x		\b, blocks size %u
442c2931133SXin LI# next available block
443c2931133SXin LI#>0		belong		=0		\b, next free block index %u
444c2931133SXin LI>0		belong		!0		\b, next free block index %u
445c2931133SXin LI# field type ( 0~picture, 1~memo, 2~object )
446c2931133SXin LI>512		ubelong		<3		\b, field type %u
447c2931133SXin LI# length of memo field
448c2931133SXin LI>512		ubelong		1
449c2931133SXin LI>>516		belong		>0		\b, field length %d
450c2931133SXin LI>>>520		string		>\0		\b, 1st item "%s"
451b6cee71dSXin LI
452b6cee71dSXin LI# TODO:
453b6cee71dSXin LI# DBASE index file *.NDX
454b6cee71dSXin LI# DBASE Compound Index file *.CDX
455b6cee71dSXin LI# dBASE IV Printer Driver *.PRF
456b6cee71dSXin LI## End of XBase database stuff
457b6cee71dSXin LI
458b6cee71dSXin LI# MS Access database
459b6cee71dSXin LI4	string	Standard\ Jet\ DB	Microsoft Access Database
460b6cee71dSXin LI!:mime	application/x-msaccess
461b6cee71dSXin LI4	string	Standard\ ACE\ DB	Microsoft Access Database
462b6cee71dSXin LI!:mime	application/x-msaccess
463b6cee71dSXin LI
4643e41d09dSXin LI# From: Joerg Jenderek
4653e41d09dSXin LI# URL: http://fileformats.archiveteam.org/wiki/Extensible_Storage_Engine
4663e41d09dSXin LI# Reference: https://github.com/libyal/libesedb/archive/master.zip
4673e41d09dSXin LI#	libesedb-master/documentation/
4683e41d09dSXin LI#	Extensible Storage Engine (ESE) Database File (EDB) format.asciidoc
4693e41d09dSXin LI# Note: also known as "JET Blue". Used by numerous Windows components such as
4703e41d09dSXin LI# Windows Search, Mail, Exchange and Active Directory.
4713e41d09dSXin LI4	ubelong		0xefcdab89
4723e41d09dSXin LI# unknown1
4733e41d09dSXin LI>132	ubelong		0		Extensible storage engine
4743e41d09dSXin LI!:mime	application/x-ms-ese
4753e41d09dSXin LI# file_type 0~database 1~stream
4763e41d09dSXin LI>>12	ulelong		0		DataBase
4773e41d09dSXin LI# Security DataBase (sdb)
4783e41d09dSXin LI!:ext	edb/sdb
4793e41d09dSXin LI>>12	ulelong		1		STreaMing
4803e41d09dSXin LI!:ext	stm
4813e41d09dSXin LI# format_version 620h
4823e41d09dSXin LI>>8	uleshort	x		\b, version 0x%x
4833e41d09dSXin LI>>10	uleshort	>0		revision 0x%4.4x
4843e41d09dSXin LI>>0	ubelong		x	 	\b, checksum 0x%8.8x
4853e41d09dSXin LI# Page size 4096 8192 32768
4863e41d09dSXin LI>>236	ulequad		x		\b, page size %lld
4873e41d09dSXin LI# database_state
4883e41d09dSXin LI>>52	ulelong		1		\b, JustCreated
4893e41d09dSXin LI>>52	ulelong		2		\b, DirtyShutdown
4903e41d09dSXin LI#>>52	ulelong		3		\b, CleanShutdown
4913e41d09dSXin LI>>52	ulelong		4		\b, BeingConverted
4923e41d09dSXin LI>>52	ulelong		5		\b, ForceDetach
4933e41d09dSXin LI# Windows�NT major version when the databases indexes were updated.
4943e41d09dSXin LI>>216	ulelong		x		\b, Windows version %d
4953e41d09dSXin LI# Windows�NT minor version
4963e41d09dSXin LI>>220	ulelong		x		\b.%d
4973e41d09dSXin LI
4983e41d09dSXin LI# From: Joerg Jenderek
49948c779cdSXin LI# URL: https://forensicswiki.org/wiki/Windows_Application_Compatibility
5003e41d09dSXin LI# Note: files contain application compatibility fixes, application compatibility modes and application help messages.
5013e41d09dSXin LI8	string		sdbf
5023e41d09dSXin LI>7	ubyte		0
5033e41d09dSXin LI# TAG_TYPE_LIST+TAG_INDEXES
5043e41d09dSXin LI>>12	uleshort	0x7802		Windows application compatibility Shim DataBase
5053e41d09dSXin LI# version? 2 3
5063e41d09dSXin LI#>>>0	ulelong		x		\b, version %d
5073e41d09dSXin LI!:mime	application/x-ms-sdb
5083e41d09dSXin LI!:ext	sdb
5093e41d09dSXin LI
510b6cee71dSXin LI# TDB database from Samba et al - Martin Pool <mbp@samba.org>
511b6cee71dSXin LI0	string	TDB\ file		TDB database
512b6cee71dSXin LI>32	lelong	0x2601196D		version 6, little-endian
513b6cee71dSXin LI>>36	lelong	x			hash size %d bytes
514b6cee71dSXin LI
515b6cee71dSXin LI# SE Linux policy database
516b6cee71dSXin LI0       lelong  0xf97cff8c      SE Linux policy
517b6cee71dSXin LI>16     lelong  x               v%d
518b6cee71dSXin LI>20     lelong  1      MLS
519b6cee71dSXin LI>24     lelong  x       %d symbols
520b6cee71dSXin LI>28     lelong  x       %d ocons
521b6cee71dSXin LI
522b6cee71dSXin LI# ICE authority file data (Wolfram Kleff)
523b6cee71dSXin LI2	string		ICE		ICE authority data
524b6cee71dSXin LI
525b6cee71dSXin LI# X11 Xauthority file (Wolfram Kleff)
526b6cee71dSXin LI10	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
527b6cee71dSXin LI11	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
528b6cee71dSXin LI12	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
529b6cee71dSXin LI13	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
530b6cee71dSXin LI14	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
531b6cee71dSXin LI15	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
532b6cee71dSXin LI16	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
533b6cee71dSXin LI17	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
534b6cee71dSXin LI18	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
535b6cee71dSXin LI
536b6cee71dSXin LI# From: Maxime Henrion <mux@FreeBSD.org>
537b6cee71dSXin LI# PostgreSQL's custom dump format, Maxime Henrion <mux@FreeBSD.org>
538b6cee71dSXin LI0	string		PGDMP		PostgreSQL custom database dump
539b6cee71dSXin LI>5	byte		x		- v%d
540b6cee71dSXin LI>6	byte		x		\b.%d
541b6cee71dSXin LI>5	beshort		<0x101		\b-0
542b6cee71dSXin LI>5	beshort		>0x100
543b6cee71dSXin LI>>7	byte		x		\b-%d
544b6cee71dSXin LI
545b6cee71dSXin LI# Type: Advanced Data Format (ADF) database
54648c779cdSXin LI# URL:  https://www.grc.nasa.gov/WWW/cgns/adf/
547b6cee71dSXin LI# From: Nicolas Chauvat <nicolas.chauvat@logilab.fr>
548b6cee71dSXin LI0	string	@(#)ADF\ Database	CGNS Advanced Data Format
549b6cee71dSXin LI
550b6cee71dSXin LI# Tokyo Cabinet magic data
551b6cee71dSXin LI# http://tokyocabinet.sourceforge.net/index.html
552b6cee71dSXin LI0	string		ToKyO\ CaBiNeT\n	Tokyo Cabinet
553b6cee71dSXin LI>14	string		x			\b (%s)
554b6cee71dSXin LI>32	byte		0			\b, Hash
555b6cee71dSXin LI!:mime	application/x-tokyocabinet-hash
556b6cee71dSXin LI>32	byte		1			\b, B+ tree
557b6cee71dSXin LI!:mime	application/x-tokyocabinet-btree
558b6cee71dSXin LI>32	byte		2			\b, Fixed-length
559b6cee71dSXin LI!:mime	application/x-tokyocabinet-fixed
560b6cee71dSXin LI>32	byte		3			\b, Table
561b6cee71dSXin LI!:mime	application/x-tokyocabinet-table
562b6cee71dSXin LI>33	byte		&1			\b, [open]
563b6cee71dSXin LI>33	byte		&2			\b, [fatal]
564b6cee71dSXin LI>34	byte		x			\b, apow=%d
565b6cee71dSXin LI>35	byte		x			\b, fpow=%d
566b6cee71dSXin LI>36	byte		&0x01			\b, [large]
567b6cee71dSXin LI>36	byte		&0x02			\b, [deflate]
568b6cee71dSXin LI>36	byte		&0x04			\b, [bzip]
569b6cee71dSXin LI>36	byte		&0x08			\b, [tcbs]
570b6cee71dSXin LI>36	byte		&0x10			\b, [excodec]
571b6cee71dSXin LI>40	lequad		x			\b, bnum=%lld
572b6cee71dSXin LI>48	lequad		x			\b, rnum=%lld
573b6cee71dSXin LI>56	lequad		x			\b, fsiz=%lld
574b6cee71dSXin LI
575b6cee71dSXin LI# Type:	QDBM Quick Database Manager
576b6cee71dSXin LI# From:	Benoit Sibaud <bsibaud@april.org>
577b6cee71dSXin LI0	string		\\[depot\\]\n\f		Quick Database Manager, little endian
578b6cee71dSXin LI0	string		\\[DEPOT\\]\n\f		Quick Database Manager, big endian
579b6cee71dSXin LI
580b6cee71dSXin LI# Type:	TokyoCabinet database
581b6cee71dSXin LI# URL:	http://tokyocabinet.sourceforge.net/
582b6cee71dSXin LI# From:	Benoit Sibaud <bsibaud@april.org>
583b6cee71dSXin LI0	string		ToKyO\ CaBiNeT\n	TokyoCabinet database
584b6cee71dSXin LI>14	string		x			(version %s)
585b6cee71dSXin LI
58648c779cdSXin LI# From:  Stephane Blondon https://www.yaal.fr
587b6cee71dSXin LI# Database file for Zope (done by FileStorage)
5889fc5c47fSXin LI0	string	FS21	Zope Object Database File Storage v3 (data)
5899fc5c47fSXin LI0	string	FS30	Zope Object Database File Storage v4 (data)
5909fc5c47fSXin LI
591b6cee71dSXin LI# Cache file for the database of Zope (done by ClientStorage)
592b6cee71dSXin LI0	string		ZEC3	Zope Object Database Client Cache File (data)
593b6cee71dSXin LI
594b6cee71dSXin LI# IDA (Interactive Disassembler) database
595b6cee71dSXin LI0	string		IDA1	IDA (Interactive Disassembler) database
5969ce06829SXin LI
59748c779cdSXin LI# Hopper (reverse engineering tool) https://www.hopperapp.com/
5989ce06829SXin LI0	string		hopperdb	Hopper database
5999ce06829SXin LI
6003e41d09dSXin LI# URL: https://en.wikipedia.org/wiki/Panorama_(database_engine)
6013e41d09dSXin LI# Reference: http://www.provue.com/Panorama/
6023e41d09dSXin LI# From: Joerg Jenderek
6033e41d09dSXin LI# NOTE: test only versions 4 and 6.0 with Windows
6043e41d09dSXin LI# length of Panorama database name
6053e41d09dSXin LI5	ubyte				>0
6063e41d09dSXin LI# look after database name for "some" null bits
6073e41d09dSXin LI>(5.B+7)	ubelong&0xF3ffF000	0
6083e41d09dSXin LI# look for first keyword
6093e41d09dSXin LI>>&1		search/2		DESIGN		Panorama database
6103e41d09dSXin LI#!:mime	application/x-panorama-database
6113e41d09dSXin LI!:apple	KASXZEPD
6123e41d09dSXin LI!:ext	pan
6133e41d09dSXin LI# database name
6143e41d09dSXin LI>>>5	pstring				x		\b, "%s"
615282e23f0SXin LI
616282e23f0SXin LI#
617282e23f0SXin LI#
618282e23f0SXin LI# askSam Database by Stefan A. Haubenthal <polluks@web.de>
619282e23f0SXin LI0	string	askw40\0	askSam DB
620282e23f0SXin LI
621282e23f0SXin LI#
622282e23f0SXin LI#
623282e23f0SXin LI# MUIbase Database Tool by Stefan A. Haubenthal <polluks@web.de>
624282e23f0SXin LI0	string	MBSTV\040	MUIbase DB
625282e23f0SXin LI>6	string	x		version %s
62640427ccaSGordon Tetlow
62740427ccaSGordon Tetlow#
62840427ccaSGordon Tetlow# CDB database
62940427ccaSGordon Tetlow0	string	NBCDB\012	NetBSD Constant Database
63040427ccaSGordon Tetlow>7	byte	x		\b, version %d
63140427ccaSGordon Tetlow>8	string	x		\b, for '%s'
63240427ccaSGordon Tetlow>24	lelong	x		\b, datasize %d
63340427ccaSGordon Tetlow>28	lelong	x		\b, entries %d
63440427ccaSGordon Tetlow>32	lelong	x		\b, index %d
63540427ccaSGordon Tetlow>36	lelong	x		\b, seed %#x
6362dc4dbb9SEitan Adler
6372dc4dbb9SEitan Adler#
6382dc4dbb9SEitan Adler# Redis RDB - https://redis.io/topics/persistence
6392dc4dbb9SEitan Adler0	string	REDIS			Redis RDB file,
6402dc4dbb9SEitan Adler>5	regex	[0-9][0-9][0-9][0-9]	version %s
6412dc4dbb9SEitan Adler
6422dc4dbb9SEitan Adler# Mork database.
6432dc4dbb9SEitan Adler# Used by older versions of Mozilla Suite and Firefox,
6442dc4dbb9SEitan Adler# and current versions of Thunderbird.
6452dc4dbb9SEitan Adler# From: David Korth <gerbilsoft@gerbilsoft.com>
6462dc4dbb9SEitan Adler0	string	//\ <!--\ <mdb:mork:z\ v="	Mozilla Mork database
6472dc4dbb9SEitan Adler>23	string	x		\b, version %.3s
648