xref: /freebsd/contrib/file/magic/Magdir/database (revision 924226fba12cc9a228c73b956e1b7fa24c60b055)
1
2#------------------------------------------------------------------------------
3# $File: database,v 1.63 2021/10/04 00:44:30 christos Exp $
4# database:  file(1) magic for various databases
5#
6# extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk)
7#
8#
9# GDBM magic numbers
10#  Will be maintained as part of the GDBM distribution in the future.
11#  <downsj@teeny.org>
120	belong	0x13579acd	GNU dbm 1.x or ndbm database, big endian, 32-bit
13!:mime	application/x-gdbm
140	belong	0x13579ace	GNU dbm 1.x or ndbm database, big endian, old
15!:mime	application/x-gdbm
160	belong	0x13579acf	GNU dbm 1.x or ndbm database, big endian, 64-bit
17!:mime	application/x-gdbm
180	lelong	0x13579acd	GNU dbm 1.x or ndbm database, little endian, 32-bit
19!:mime	application/x-gdbm
200	lelong	0x13579ace	GNU dbm 1.x or ndbm database, little endian, old
21!:mime	application/x-gdbm
220	lelong	0x13579acf	GNU dbm 1.x or ndbm database, little endian, 64-bit
23!:mime	application/x-gdbm
240	string	GDBM		GNU dbm 2.x database
25!:mime	application/x-gdbm
26#
27# Berkeley DB
28#
29# Ian Darwin's file /etc/magic files: big/little-endian version.
30#
31# Hash 1.85/1.86 databases store metadata in network byte order.
32# Btree 1.85/1.86 databases store the metadata in host byte order.
33# Hash and Btree 2.X and later databases store the metadata in host byte order.
34
350	long	0x00061561	Berkeley DB
36!:mime	application/x-dbm
37>8	belong	4321
38>>4	belong	>2		1.86
39>>4	belong	<3		1.85
40>>4	belong	>0		(Hash, version %d, native byte-order)
41>8	belong	1234
42>>4	belong	>2		1.86
43>>4	belong	<3		1.85
44>>4	belong	>0		(Hash, version %d, little-endian)
45
460	belong	0x00061561	Berkeley DB
47>8	belong	4321
48>>4	belong	>2		1.86
49>>4	belong	<3		1.85
50>>4	belong	>0		(Hash, version %d, big-endian)
51>8	belong	1234
52>>4	belong	>2		1.86
53>>4	belong	<3		1.85
54>>4	belong	>0		(Hash, version %d, native byte-order)
55
560	long	0x00053162	Berkeley DB 1.85/1.86
57>4	long	>0		(Btree, version %d, native byte-order)
580	belong	0x00053162	Berkeley DB 1.85/1.86
59>4	belong	>0		(Btree, version %d, big-endian)
600	lelong	0x00053162	Berkeley DB 1.85/1.86
61>4	lelong	>0		(Btree, version %d, little-endian)
62
6312	long	0x00061561	Berkeley DB
64>16	long	>0		(Hash, version %d, native byte-order)
6512	belong	0x00061561	Berkeley DB
66>16	belong	>0		(Hash, version %d, big-endian)
6712	lelong	0x00061561	Berkeley DB
68>16	lelong	>0		(Hash, version %d, little-endian)
69
7012	long	0x00053162	Berkeley DB
71>16	long	>0		(Btree, version %d, native byte-order)
7212	belong	0x00053162	Berkeley DB
73>16	belong	>0		(Btree, version %d, big-endian)
7412	lelong	0x00053162	Berkeley DB
75>16	lelong	>0		(Btree, version %d, little-endian)
76
7712	long	0x00042253	Berkeley DB
78>16	long	>0		(Queue, version %d, native byte-order)
7912	belong	0x00042253	Berkeley DB
80>16	belong	>0		(Queue, version %d, big-endian)
8112	lelong	0x00042253	Berkeley DB
82>16	lelong	>0		(Queue, version %d, little-endian)
83
84# From Max Bowsher.
8512	long	0x00040988	Berkeley DB
86>16	long	>0		(Log, version %d, native byte-order)
8712	belong	0x00040988	Berkeley DB
88>16	belong	>0		(Log, version %d, big-endian)
8912	lelong	0x00040988	Berkeley DB
90>16	lelong	>0		(Log, version %d, little-endian)
91
92#
93#
94# Round Robin Database Tool by Tobias Oetiker <oetiker@ee.ethz.ch>
950	string/b	RRD\0		RRDTool DB
96>4	string/b	x		version %s
97
98>>10	short		!0		16bit aligned
99>>>10	bedouble	8.642135e+130	big-endian
100>>>>18	short		x		32bit long (m68k)
101
102>>10	short		0
103>>>12	long		!0		32bit aligned
104>>>>12	bedouble	8.642135e+130	big-endian
105>>>>>20 long		0		64bit long
106>>>>>20 long		!0		32bit long
107>>>>12	ledouble	8.642135e+130	little-endian
108>>>>>24 long		0		64bit long
109>>>>>24 long		!0		32bit long (i386)
110>>>>12	string		\x43\x2b\x1f\x5b\x2f\x25\xc0\xc7	middle-endian
111>>>>>24 short		!0		32bit long (arm)
112
113>>8	quad		0		64bit aligned
114>>>16	bedouble	8.642135e+130	big-endian
115>>>>24	long		0		64bit long (s390x)
116>>>>24	long		!0		32bit long (hppa/mips/ppc/s390/SPARC)
117>>>16	ledouble	8.642135e+130	little-endian
118>>>>28	long		0		64bit long (alpha/amd64/ia64)
119>>>>28	long		!0		32bit long (armel/mipsel)
120
121#----------------------------------------------------------------------
122# ROOT: file(1) magic for ROOT databases
123#
1240       string  root\0  ROOT file
125>4      belong  x       Version %d
126>33     belong  x       (Compression: %d)
127
128# XXX: Weak magic.
129# Alex Ott <ott@jet.msk.su>
130## Paradox file formats
131#2	  leshort	0x0800	Paradox
132#>0x39	  byte		3	v. 3.0
133#>0x39	  byte		4	v. 3.5
134#>0x39	  byte		9	v. 4.x
135#>0x39	  byte		10	v. 5.x
136#>0x39	  byte		11	v. 5.x
137#>0x39	  byte		12	v. 7.x
138#>>0x04	  byte		0	indexed .DB data file
139#>>0x04	  byte		1	primary index .PX file
140#>>0x04	  byte		2	non-indexed .DB data file
141#>>0x04	  byte		3	non-incrementing secondary index .Xnn file
142#>>0x04	  byte		4	secondary index .Ynn file
143#>>0x04	  byte		5	incrementing secondary index .Xnn file
144#>>0x04	  byte		6	non-incrementing secondary index .XGn file
145#>>0x04	  byte		7	secondary index .YGn file
146#>>>0x04	  byte		8	incrementing secondary index .XGn file
147
148## XBase database files
149# updated by Joerg Jenderek at Feb 2013
150# https://www.dbase.com/Knowledgebase/INT/db7_file_fmt.htm
151# https://www.clicketyclick.dk/databases/xbase/format/dbf.html
152# inspect VVYYMMDD , where 1<= MM <= 12 and 1<= DD <= 31
1530	ubelong&0x0000FFFF		<0x00000C20
154# skip Infocom game Z-machine
155>2		ubyte			>0
156# skip Androids *.xml
157>>3		ubyte			>0
158>>>3		ubyte			<32
159# 1 < version VV
160>>>>0		ubyte			>1
161# skip HELP.CA3 by test for reserved byte ( NULL )
162>>>>>27		ubyte			0
163# reserved bytes not always 0 ; also found 0x3901 (T4.DBF) ,0x7101 (T5.DBF,T6.DBF)
164#>>>>>30		ubeshort     		x		30NULL?%x
165# possible production flag,tag numbers(<=0x30),tag length(<=0x20), reserved (NULL)
166>>>>>>24	ubelong&0xffFFFFff	>0x01302000
167# .DBF or .MDX
168>>>>>>24	ubelong&0xffFFFFff	<0x01302001
169# for Xbase Database file (*.DBF) reserved (NULL) for multi-user
170>>>>>>>24	ubelong&0xffFFFFff	=0
171# test for 2 reserved NULL bytes,transaction and encryption byte flag
172>>>>>>>>12	ubelong&0xFFFFfEfE	0
173# test for MDX flag
174>>>>>>>>>28	ubyte			x
175>>>>>>>>>28	ubyte&0xf8		0
176# header size >= 32
177>>>>>>>>>>8	uleshort		>31
178# skip PIC15736.PCX by test for language driver name or field name
179>>>>>>>>>>>32	ubyte			>0
180#!:mime	application/x-dbf; charset=unknown-8bit ??
181#!:mime	application/x-dbase
182>>>>>>>>>>>>0	use			xbase-type
183# database file
184>>>>>>>>>>>>28	ubyte&0x04		=0		\b DBF
185!:ext	dbf
186>>>>>>>>>>>>28	ubyte&0x04		=4		\b DataBaseContainer
187!:ext	dbc
188>>>>>>>>>>>>4	lelong			0		\b, no records
189>>>>>>>>>>>>4	lelong			>0		\b, %d record
190# plural s appended
191>>>>>>>>>>>>>4	lelong			>1		\bs
192# https://www.clicketyclick.dk/databases/xbase/format/dbf_check.html#CHECK_DBF
193# 1 <= record size <= 4000 (dBase 3,4) or 32 * KB (=0x8000)
194>>>>>>>>>>>>10	uleshort		x		* %d
195# file size = records * record size + header size
196>>>>>>>>>>>>1	ubyte			x		\b, update-date
197>>>>>>>>>>>>1	use			xbase-date
198# https://msdn.microsoft.com/de-de/library/cc483186(v=vs.71).aspx
199#>>>>>>>>>>>>29	ubyte			=0		\b, codepage ID=%#x
200# 2~cp850 , 3~cp1252 , 0x1b~?? ; what code page is 0x1b ?
201>>>>>>>>>>>>29	ubyte			>0		\b, codepage ID=%#x
202#>>>>>>>>>>>>28	ubyte&0x01		0		\b, no index file
203# MDX or CDX index
204>>>>>>>>>>>>28	ubyte&0x01		1		\b, with index file .MDX
205>>>>>>>>>>>>28	ubyte&0x02		2		\b, with memo .FPT
206#>>>>>>>>>>>>28	ubyte&0x04		4		\b, DataBaseContainer
207# 1st record offset + 1 = header size
208>>>>>>>>>>>>8	uleshort		>0
209>>>>>>>>>>>>(8.s+1)	ubyte		>0
210>>>>>>>>>>>>>8		uleshort	>0		\b, at offset %d
211>>>>>>>>>>>>>(8.s+1)	ubyte		>0
212>>>>>>>>>>>>>>&-1	string		>\0		1st record "%s"
213# for multiple index files (*.MDX) Production flag,tag numbers(<=0x30),tag length(<=0x20), reserved (NULL)
214>>>>>>>24	ubelong&0x0133f7ff	>0
215# test for reserved NULL byte
216>>>>>>>>47	ubyte			0
217# test for valid TAG key format (0x10 or 0)
218>>>>>>>>>559	ubyte&0xeF		0
219# test MM <= 12
220>>>>>>>>>>45	ubeshort		<0x0C20
221>>>>>>>>>>>45	ubyte			>0
222>>>>>>>>>>>>46	ubyte			<32
223>>>>>>>>>>>>>46	ubyte			>0
224#!:mime	application/x-mdx
225>>>>>>>>>>>>>>0		use		xbase-type
226>>>>>>>>>>>>>>0		ubyte		x		\b MDX
227>>>>>>>>>>>>>>1		ubyte		x		\b, creation-date
228>>>>>>>>>>>>>>1		use		xbase-date
229>>>>>>>>>>>>>>44	ubyte		x		\b, update-date
230>>>>>>>>>>>>>>44	use		xbase-date
231# No.of tags in use (1,2,5,12)
232>>>>>>>>>>>>>>28	uleshort	x		\b, %d
233# No. of entries in tag (0x30)
234>>>>>>>>>>>>>>25	ubyte		x		\b/%d tags
235#  Length of tag
236>>>>>>>>>>>>>>26	ubyte		x		* %d
237# 1st tag name_
238>>>>>>>>>>>>>548	string		x		\b, 1st tag "%.11s"
239# 2nd tag name
240#>>>>>>>>>>>>(26.b+548)	string		x		\b, 2nd tag "%.11s"
241#
242#		Print the xBase names of different version variants
2430	name				xbase-type
244>0	ubyte		<2
245# 1 < version
246>0	ubyte		>1
247>>0	ubyte		0x02		FoxBase
248!:mime	application/x-dbf
249# like: ACCESS.DBF USER.DBF dbase3date.dbf mitarbei.dbf produkte.dbf umlaut-test-v2.dbf
250# FoxBase+/dBaseIII+, no memo
251>>0	ubyte		0x03		FoxBase+/dBase III
252!:mime	application/x-dbf
253# like: 92DATA.DBF MSCATLOG.DBF SYLLABI2.DBF SYLLABUS.DBF T4.DBF Teleadr.dbf us_city.dbf
254# dBASE IV no memo file
255>>0	ubyte		0x04		dBase IV
256!:mime	application/x-dbf
257# like: Quattro-test11.dbf umlaut-test-v4.dbf
258# dBASE V no memo file
259>>0	ubyte		0x05		dBase V
260!:mime	application/x-dbf
261# like: dbase4double.dbf Quattro-test2.dbf umlaut-test7.dbf
262!:ext	dbf
263# probably Apollo Database Server 9.7? xBase (0x6)
264>>0	ubyte		0x06		Apollo
265!:mime	application/x-dbf
266# like: ALIAS.DBF CRYPT.DBF PROCS.DBF USERS.DBF
267# https://docs.microsoft.com/en-us/previous-versions/visualstudio/foxpro/st4a0s68(v=vs.80)
268>>0	ubyte		0x2F		FoxBase+/Dbase III plus, no memo
269!:mime	application/x-dbf
270# no example
271>>0	ubyte		0x30		Visual FoxPro
272!:mime	application/x-dbf
273# like: 26FRX.DBF 30DBC.DBF 30DBCPRO.DBF BEHINDSC.DBF USER_LEV.DBF
274# Microsoft Visual FoxPro Database Container File like: FOXPRO-DB-TEST.DBC TESTDATA.DBC TASTRADE.DBC
275>>0	ubyte		0x31		Visual FoxPro, autoincrement
276!:mime	application/x-dbf
277# like: AI_Table.DBF dbase_31.dbf w_cityFoxpro.dbf
278# Visual FoxPro, with field type Varchar or Varbinary
279>>0	ubyte		0x32		Visual FoxPro, with field type Varchar
280!:mime	application/x-dbf
281# like: dbase_32.dbf
282# dBASE IV SQL, no memo;dbv memo var size (Flagship)
283>>0	ubyte		0x43		dBase IV, with SQL table
284!:mime	application/x-dbf
285# like: ASSEMBLY.DBF INVENTRY.DBF STAFF.DBF
286# https://docs.microsoft.com/en-us/previous-versions/visualstudio/foxpro/st4a0s68(v=vs.80)
287>>0	ubyte		0x62		dBase IV, with SQL table
288#!:mime	application/x-dbf
289# no example
290# dBASE IV, with memo!!
291>>0	ubyte		0x7b		dBase IV, with memo
292!:mime	application/x-dbf
293# like: test3memo.DBF dbase5.DBF
294# https://docs.microsoft.com/en-us/previous-versions/visualstudio/foxpro/st4a0s68(v=vs.80)
295>>0	ubyte		0x82		dBase IV, with SQL system
296#!:mime	application/x-dbf
297# no example
298# FoxBase+/dBaseIII+ with memo .DBT!
299>>0	ubyte		0x83		FoxBase+/dBase III, with memo .DBT
300!:mime	application/x-dbf
301# like: T2.DBF t3.DBF biblio.dbf dbase_83.dbf dbase3dbt0_4.dbf fsadress.dbf stop.dbf
302# VISUAL OBJECTS (first 1.0 versions) for the Dbase III files (NTX clipper driver); memo file
303>>0	ubyte		0x87		VISUAL OBJECTS, with memo file
304!:mime	application/x-dbf
305# like: ACCESS.DBF dbase3date.dbf dbase3float.dbf holdings.dbf mitarbei.dbf
306# https://docs.microsoft.com/en-us/previous-versions/visualstudio/foxpro/st4a0s68(v=vs.80)
307>>0	ubyte		0x8A		FoxBase+/dBase III, with memo .DBT
308#!:mime	application/x-dbf
309# no example
310# dBASE IV with memo!
311>>0	ubyte		0x8B		dBase IV, with memo .DBT
312!:mime	application/x-dbf
313# like: animals.dbf archive.dbf callin.dbf dbase_8b.dbf phnebook.dbf t6.dbf
314# dBase IV with SQL Table,no memo?
315>>0	ubyte		0x8E		dBase IV, with SQL table
316!:mime	application/x-dbf
317# like: dbase5.DBF test3memo.DBF test-memo.DBF
318# .dbv and .dbt memo (Flagship)?
319>>0	ubyte		0xB3		Flagship
320!:mime	application/x-dbf
321# no example
322# https://docs.microsoft.com/en-us/previous-versions/visualstudio/foxpro/st4a0s68(v=vs.80)
323>>0	ubyte		0xCA		dBase IV with memo .DBT
324#!:mime	application/x-dbf
325# no example
326# dBASE IV with SQL table, with memo .DBT
327>>0	ubyte		0xCB		dBase IV with SQL table, with memo .DBT
328!:mime	application/x-dbf
329# like: dbase5.DBF test3memo.DBF test-memo.DBF
330# HiPer-Six format;Clipper SIX, with SMT memo file
331>>0	ubyte		0xE5		Clipper SIX with memo
332!:mime	application/x-dbf
333# like: dbase5.DBF test3memo.DBF test-memo.DBF testClipper.dbf DATA.DBF
334# https://docs.microsoft.com/en-us/previous-versions/visualstudio/foxpro/st4a0s68(v=vs.80)
335>>0	ubyte		0xF4		dBase IV, with SQL table, with memo
336#!:mime	application/x-dbf
337# no example
338>>0	ubyte		0xF5		FoxPro with memo
339!:mime	application/x-dbf
340# like: CUSTOMER.DBF FOXUSER1.DBF Invoice.DBF NG.DBF OBJSAMP.DBF dbase_f5.dbf kunde.dbf
341# probably Apollo Database Server 9.7 with SQL and memo mask? xBase (0xF6)
342>>0	ubyte		0xF6		Apollo, with SQL table with memo
343!:mime	application/x-dbf
344# like: SCRIPTS.DBF
345# https://docs.microsoft.com/en-us/previous-versions/visualstudio/foxpro/st4a0s68(v=vs.80)
346#>>0	ubyte		0xFA		FoxPro 2.x, with memo
347#!:mime	application/x-dbf
348# no example
349# unknown version (should not happen)
350>>0	default		x		xBase
351!:mime	application/x-dbf
352>>>0	ubyte		x		(%#x)
353# flags in version byte
354# DBT flag (with dBASE III memo .DBT)!!
355# >>0	ubyte&0x80	>0		DBT_FLAG=%x
356# memo flag ??
357# >>0	ubyte&0x08	>0		MEMO_FLAG=%x
358# SQL flag ??
359# >>0	ubyte&0x70	>0		SQL_FLAG=%x
360#		test and print the date of xBase .DBF .MDX
3610	name				xbase-date
362# inspect YYMMDD , where 1<= MM <= 12 and 1<= DD <= 31
363>0	ubelong		x
364>1	ubyte		<13
365>>1	ubyte		>0
366>>>2	ubyte		>0
367>>>>2	ubyte		<32
368>>>>>0	ubyte		x
369# YY is interpreted as 20YY or 19YY
370>>>>>>0	ubyte		<100		\b %.2d
371# YY is interpreted 1900+YY; TODO: display yy or 20yy instead 1YY
372>>>>>>0	ubyte		>99		\b %d
373>>>>>1	ubyte		x		\b-%d
374>>>>>2	ubyte		x		\b-%d
375
376#	dBase memo files .DBT or .FPT
377# https://msdn.microsoft.com/en-us/library/8599s21w(v=vs.80).aspx
37816		ubyte		<4
379>16		ubyte		!2
380>>16		ubyte		!1
381# next free block index is positive
382>>>0		ulelong		>0
383# skip many JPG. ZIP, BZ2 by test for reserved bytes NULL , 0|2 , 0|1 , low byte of block size
384>>>>17		ubelong&0xFFfdFEff	0x00000000
385# skip many RAR by test for low byte 0 ,high byte 0|2|even of block size, 0|a|e|d7 , 0|64h
386>>>>>20		ubelong&0xFF01209B	0x00000000
387# dBASE III
388>>>>>>16	ubyte		3
389# dBASE III DBT
390>>>>>>>0	use		dbase3-memo-print
391# dBASE III DBT without version, dBASE IV DBT , FoxPro FPT , or many ZIP , DBF garbage
392>>>>>>16	ubyte		0
393# unusual dBASE III DBT like angest.dbt, dBASE IV DBT with block size 0 , FoxPro FPT ,  or garbage PCX DBF
394>>>>>>>20	uleshort	0
395# FoxPro FPT , unusual dBASE III DBT like biblio.dbt or garbage
396>>>>>>>>8	ulong		=0
397>>>>>>>>>6	ubeshort	>0
398# skip emacs.PIF
399>>>>>>>>>>4	ushort		0
400# check for valid FoxPro field type
401>>>>>>>>>>>512	ubelong		<3
402>>>>>>>>>>>>0	use		foxpro-memo-print
403# dBASE III DBT , garbage
404# skip WORD1XW.DOC with improbably high free block index
405>>>>>>>>>0	ulelong		<0x400000
406# skip WinStore.App.exe by looking for printable 2nd character of 1st memo item
407>>>>>>>>>>513	ubyte		>037
408# unusual dBASE III DBT like adressen.dbt
409>>>>>>>>>>>0	use		dbase3-memo-print
410# dBASE III DBT like angest.dbt, or garbage PCX DBF
411>>>>>>>>8	ubelong		!0
412# skip PCX and some DBF by test for for reserved NULL bytes
413>>>>>>>>>510	ubeshort	0
414# skip bad symples with improbably high free block index above 2 GiB file limit
415>>>>>>>>>>0	ulelong		<0x400000
416# skip AI070GEP.EPS by printable 1st character of 1st memo item
417>>>>>>>>>>>512	ubyte		>037
418# skip gluon-ffhat-1.0-tp-link-tl-wr1043n-nd-v2-sysupgrade.bin by printable 2nd character
419>>>>>>>>>>>>513	ubyte		>037
420>>>>>>>>>>>>>0	use		dbase3-memo-print
421# dBASE IV DBT with positive block size
422>>>>>>>20	uleshort	>0
423# dBASE IV DBT with valid block length like 512, 1024
424# multiple of 2 in between 16 and 16 K ,implies upper and lower bits are zero
425# skip also 3600h 3E00h size
426>>>>>>>>20	uleshort&0xE00f	0
427>>>>>>>>>0	use		dbase4-memo-print
428
429#		Print the information of dBase III DBT memo file
4300	name				dbase3-memo-print
431>0	ubyte			x		dBase III DBT
432!:mime	application/x-dbt
433!:ext	dbt
434# instead 3 as version number 0 for unusual examples like biblio.dbt
435>16	ubyte			!3		\b, version number %u
436# Number of next available block for appending data
437#>0	lelong			=0		\b, next free block index %u
438>0	lelong			!0		\b, next free block index %u
439# no positive block length
440#>20	uleshort		=0		\b, block length %u
441>20	uleshort		!0		\b, block length %u
442# dBase III memo field terminated by \032\032
443>512	string			>\0		\b, 1st item "%s"
444# https://www.clicketyclick.dk/databases/xbase/format/dbt.html
445#		Print the information of dBase IV DBT memo file
4460	name				dbase4-memo-print
447>0		lelong		x		dBase IV DBT
448!:mime	application/x-dbt
449!:ext dbt
450# 8 character shorted main name of corresponding dBASE IV DBF file
451>8		ubelong		>0x20000000
452# skip unusual like for angest.dbt
453>>20		uleshort	>0
454>>>8		string		>\0		\b of %-.8s.DBF
455# value 0 implies 512 as size
456#>4		ulelong		=0		\b, blocks size %u
457# size of blocks not reliable like 0x2020204C in angest.dbt
458>4		ulelong		!0
459>>4		ulelong&0x0000003f	0	\b, blocks size %u
460# dBase IV DBT with positive block length (found 512 , 1024)
461>20		uleshort	>0		\b, block length %u
462# next available block
463#>0		lelong		=0		\b, next free block index %u
464>0		lelong		!0		\b, next free block index %u
465>20		uleshort	>0
466>>(20.s)	ubelong		x
467>>>&-4		use		dbase4-memofield-print
468# unusual dBase IV DBT without block length (implies 512 as length)
469>20		uleshort	=0
470>>512		ubelong		x
471>>>&-4		use				dbase4-memofield-print
472#		Print the information of dBase IV memo field
4730	name			dbase4-memofield-print
474# free dBase IV memo field
475>0		ubelong		!0xFFFF0800
476>>0		lelong		x		\b, next free block %u
477>>4		lelong		x		\b, next used block %u
478# used dBase IV memo field
479>0		ubelong		=0xFFFF0800
480# length of memo field
481>>4		lelong		x		\b, field length %d
482>>>8		string		>\0		\b, 1st used item "%s"
483# http://www.dbfree.org/webdocs/1-documentation/0018-developers_stuff_(advanced)/os_related_stuff/xbase_file_format.htm
484#		Print the information of FoxPro FPT memo file
4850	name				foxpro-memo-print
486>0		belong		x		FoxPro FPT
487!:mime	application/x-fpt
488!:ext	fpt
489# Size of blocks for FoxPro ( 64,256 )
490>6		ubeshort	x		\b, blocks size %u
491# next available block
492#>0		belong		=0		\b, next free block index %u
493>0		belong		!0		\b, next free block index %u
494# field type ( 0~picture, 1~memo, 2~object )
495>512		ubelong		<3		\b, field type %u
496# length of memo field
497>512		ubelong		1
498>>516		belong		>0		\b, field length %d
499>>>520		string		>\0		\b, 1st item "%s"
500
501# Summary:	DBASE Compound Index file *.CDX and FoxPro index *.IDX
502# From:		Joerg Jenderek
503# URL:		https://www.clicketyclick.dk/databases/xbase/format/cdx.html
504#		https://www.clicketyclick.dk/databases/xbase/format/idx.html
505#		https://www.clicketyclick.dk/databases/xbase/format/idx_comp.html
506# Reference:	https://mark0.net/download/triddefs_xml.7z/defs/s/sybase-ianywhere-cdx.trid.xml
507#		https://mark0.net/download/triddefs_xml.7z/defs/c/cdx-vfp7.trid.xml
508# like: kunde.cdx
5090	ulelong		0x1C00
510>0	use			xbase-index
511# like: SYLLABI2.CDX SYLLABUS.CDX
5120	ulelong		0x0800
513>0	use			xbase-index
514# often in xBase index pointer to root node 400h
5150	ulelong		0x0400
516# skip most Maple help database *.hdb with version tag handled by ./maple
517>1028	string		!version
518# skip Maple help database hsum.hdb checking for valid reserved area
519>>492	quad		=0
520# skip remaining Maple help database *.hdb by checking key length
521#>>>12	uleshort	!0x000F			KEY_LENGTHVALID
522>>>0	use			xbase-index
523#	display information about dBase/FoxPro index
5240	name			xbase-index
525>0	ulelong		x			xBase
526!:mime	application/x-dbase-index
527>14	ubyte		&0x40			compound index
528# DCX for FoxPro database index like: TESTDATA.DCX
529!:ext	cdx/dcx
530>14	ubyte		^0x40			index
531# only 1 example like: TEST.IDX
532!:ext	idx
533# pointer to root node like: 1C00h 800h often 400h
534>0	ulelong		!0x400			\b, root pointer %#x
535# Pointer to free node list: often 0 but -1 if not present
536>4	ulelong		!0			\b, free node pointer %#x
537# MAYBE number of pages in file (Foxbase, FoxPro 1.x) or
538# http://www.foxpert.com/foxpro/knowlbits/files/knowlbits_200708_1.HTM
539# Whenever Visual FoxPro updates the index file it increments this reserved field
540# Reserved for internal use like: 02000000h 03000000h 460c0000h 780f0000h 89000000h 9fdc0100h often 0
541>8	ulelong		!0			\b, reserved counter %#x
542# length of key like: mostly 000Ah 0028h (TEST.IDX)
543>12	uleshort	!0x000A			\b, key length %#x
544# index options like: 24h E0h E8h
545# 1~a unique index 8~index has FOR clause 32~compact index format 64~compound index header
546# 16~Bit vector (SoftC) 128~Structure index (FoxPro)
547>14	ubyte		x			\b, index options (%#x
548>14	ubyte		&0x01			\b, unique
549>14	ubyte		&0x08			\b, has FOR clause
550>14	ubyte		&0x10			\b, bit vector (SoftC)
551>14	ubyte		&0x20			\b, compact format
552#>14	ubyte		&0x40			\b, compound header
553>14	ubyte		&0x80			\b, structure
554>14	ubyte		x			\b)
555# WHAT EXACTLY IS THAT? index signature like: 0 (sybase-ianywhere-cdx.trid.xml) 1 (cdx-vfp7.trid.xml)
556>15	ubyte		!0			\b, index signature %u
557# reserved area (0-bytes) til about 500, but not for uncompressed Index files *.idx
558>16	quad		!0			\b, at 16 reserved %#llx
559>492	quad		!0			\b, at 492 reserved %#llx
560# for IDX variant
561#>14	ubyte		^0x40			IDX
562# for CDX variant
563>14	ubyte		&0x40
564# Ascending or descending: 0~ascending 1~descending
565>>502	uleshort	x			\b, sort order %u
566# Total expression length (FoxPro 2) like: 0 1
567>>504	uleshort	!0			\b, expression length %u
568# FOR expression pool length like: 1
569>>506	uleshort	!1			\b, FOR expression pool length %#x
570# reserved for internal use like: 0
571>>508	uleshort	!0			\b, at 0x508 reserved %#x
572# Key expression pool length like: 1
573>>510	uleshort	!1			\b, key expression pool length %#x
574# 512 - 1023 Key & FOR expression pool (uncompiled)
575>>512	quad		!0			\b, key expression pool %#llx
576#>>520	quad		!0			\b, key expression pool %#llx
577
578# Summary:	dBASE IV Printer Form *.PRF
579# From:		Joerg Jenderek
580# URL:		https://en.wikipedia.org/wiki/.dbf#Other_file_types_found_in_dBASE
581# Reference:	https://mark0.net/download/triddefs_xml.7z/defs/p/prf-dbase.trid.xml
5820	ubeshort	0x0400
583# skip some Xbase Index files *.ndx and Infocom (Z-machine 4) *.z4 handled by ./adventure
584# by looking for valid printer driver name extension
585>0x58	search/8	.PR2
586>>0	use			xbase-prf
587#	display information of dbase print form like printer driver *.PR2
5880	name			xbase-prf	dBase Printer Form
589!:mime	application/x-dbase-prf
590!:ext	prf
591# MAYBE version? like: 4~DBASE IV
592#>0	ubyte		x			\b, version %u
593# MAYBE flag like: 1~with output file name 0~not
594#>2	ubyte		!0			\b, flag %u
595# optional printer text output file name like E:\DBASE\IV\T6.txt
596>3	string		>\0			\b, output file %s
597# probably padding with nils til 0x53
598#>0x48	 uquad		!0			\b, at 0x48 padding %#llx
599# dBASE IV printer driver name like: Generic.PR2 ASCII.PR2
600>0x56	string		>\0			\b, using printer driver %s
601# 2 is probably last character of previous dBASE printer driver name
602#>0x60	ubyte		!0x32			\b, at 0x60 %#x
603# probably padding with nils til 0xa8
604#>0x61	uquad		!0			\b, at 0x61 padding %#llx
605# unknown 0x03020300 0x03020100 at 0xa8
606>0xa8	ubelong 	x			\b, at 0xa8 unknown %#8.8x
607# probably padding with nils til 0x2aa
608#>0x2a0	uquad		!0			\b, at 0x2a0 padding %#llx
609# unknown 0x100ff7f01000001 at 0x2AB
610>0x2ab	ubequad		!0x100ff7f01000001	\b, at 0x2ab unknown %#llx
611# unknown 0x0042 at 0x2b3
612>0x2b3	ubeshort 	!0x0042			\b, at 0x2b3 unknown %#4.4x
613# unknown last 4 bytes at 0x2b6 like: 0 0x23
614>0x2b6	ubelong		!0			\b, at 0x2b6 unknown %#8.8x
615
616# TODO:
617# DBASE index file *.NDX
618# dBASE compiled Format *.FMO
619# FoxPro Database memo file *.DCT
620# FoxPro Forms Memo *.SCT
621# FoxPro Generated Menu Program *.MPR
622# FoxPro Report *.FRX
623# FoxPro Report Memo *.FRT
624# Foxpro Generated Screen Program *.SPR
625# Foxpro memo *.PJT
626## End of XBase database stuff
627
628# MS Access database
6294	string	Standard\ Jet\ DB	Microsoft Access Database
630!:mime	application/x-msaccess
6314	string	Standard\ ACE\ DB	Microsoft Access Database
632!:mime	application/x-msaccess
633
634# From: Joerg Jenderek
635# URL: http://fileformats.archiveteam.org/wiki/Extensible_Storage_Engine
636# Reference: https://github.com/libyal/libesedb/archive/master.zip
637#	libesedb-master/documentation/
638#	Extensible Storage Engine (ESE) Database File (EDB) format.asciidoc
639# Note: also known as "JET Blue". Used by numerous Windows components such as
640# Windows Search, Mail, Exchange and Active Directory.
6414	ubelong		0xefcdab89
642# unknown1
643>132	ubelong		0		Extensible storage engine
644!:mime	application/x-ms-ese
645# file_type 0~database 1~stream
646>>12	ulelong		0		DataBase
647# Security DataBase (sdb)
648!:ext	edb/sdb
649>>12	ulelong		1		STreaMing
650!:ext	stm
651# format_version 620h
652>>8	uleshort	x		\b, version %#x
653>>10	uleshort	>0		revision %#4.4x
654>>0	ubelong		x	 	\b, checksum %#8.8x
655# Page size 4096 8192 32768
656>>236	ulequad		x		\b, page size %lld
657# database_state
658>>52	ulelong		1		\b, JustCreated
659>>52	ulelong		2		\b, DirtyShutdown
660#>>52	ulelong		3		\b, CleanShutdown
661>>52	ulelong		4		\b, BeingConverted
662>>52	ulelong		5		\b, ForceDetach
663# Windows NT major version when the databases indexes were updated.
664>>216	ulelong		x		\b, Windows version %d
665# Windows NT minor version
666>>220	ulelong		x		\b.%d
667
668# From: Joerg Jenderek
669# URL: https://forensicswiki.org/wiki/Windows_Application_Compatibility
670# Note: files contain application compatibility fixes, application compatibility modes and application help messages.
6718	string		sdbf
672>7	ubyte		0
673# TAG_TYPE_LIST+TAG_INDEXES
674>>12	uleshort	0x7802		Windows application compatibility Shim DataBase
675# version? 2 3
676#>>>0	ulelong		x		\b, version %d
677!:mime	application/x-ms-sdb
678!:ext	sdb
679
680# TDB database from Samba et al - Martin Pool <mbp@samba.org>
6810	string	TDB\ file		TDB database
682>32	lelong	0x2601196D		version 6, little-endian
683>>36	lelong	x			hash size %d bytes
684
685# SE Linux policy database
6860       lelong  0xf97cff8c      SE Linux policy
687>16     lelong  x               v%d
688>20     lelong  1      MLS
689>24     lelong  x       %d symbols
690>28     lelong  x       %d ocons
691
692# ICE authority file data (Wolfram Kleff)
6932	string		ICE		ICE authority data
694
695# X11 Xauthority file (Wolfram Kleff)
69610	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
69711	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
69812	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
69913	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
70014	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
70115	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
70216	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
70317	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
70418	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
705
706# From: Maxime Henrion <mux@FreeBSD.org>
707# PostgreSQL's custom dump format, Maxime Henrion <mux@FreeBSD.org>
7080	string		PGDMP		PostgreSQL custom database dump
709>5	byte		x		- v%d
710>6	byte		x		\b.%d
711>5	beshort		<0x101		\b-0
712>5	beshort		>0x100
713>>7	byte		x		\b-%d
714
715# Type: Advanced Data Format (ADF) database
716# URL:  https://www.grc.nasa.gov/WWW/cgns/adf/
717# From: Nicolas Chauvat <nicolas.chauvat@logilab.fr>
7180	string	@(#)ADF\ Database	CGNS Advanced Data Format
719
720# Tokyo Cabinet magic data
721# http://tokyocabinet.sourceforge.net/index.html
7220	string		ToKyO\ CaBiNeT\n	Tokyo Cabinet
723>14	string		x			\b (%s)
724>32	byte		0			\b, Hash
725!:mime	application/x-tokyocabinet-hash
726>32	byte		1			\b, B+ tree
727!:mime	application/x-tokyocabinet-btree
728>32	byte		2			\b, Fixed-length
729!:mime	application/x-tokyocabinet-fixed
730>32	byte		3			\b, Table
731!:mime	application/x-tokyocabinet-table
732>33	byte		&1			\b, [open]
733>33	byte		&2			\b, [fatal]
734>34	byte		x			\b, apow=%d
735>35	byte		x			\b, fpow=%d
736>36	byte		&0x01			\b, [large]
737>36	byte		&0x02			\b, [deflate]
738>36	byte		&0x04			\b, [bzip]
739>36	byte		&0x08			\b, [tcbs]
740>36	byte		&0x10			\b, [excodec]
741>40	lequad		x			\b, bnum=%lld
742>48	lequad		x			\b, rnum=%lld
743>56	lequad		x			\b, fsiz=%lld
744
745# Type:	QDBM Quick Database Manager
746# From:	Benoit Sibaud <bsibaud@april.org>
7470	string		\\[depot\\]\n\f		Quick Database Manager, little endian
7480	string		\\[DEPOT\\]\n\f		Quick Database Manager, big endian
749
750# Type:	TokyoCabinet database
751# URL:	http://tokyocabinet.sourceforge.net/
752# From:	Benoit Sibaud <bsibaud@april.org>
7530	string		ToKyO\ CaBiNeT\n	TokyoCabinet database
754>14	string		x			(version %s)
755
756# From:  Stephane Blondon https://www.yaal.fr
757# Database file for Zope (done by FileStorage)
7580	string	FS21	Zope Object Database File Storage v3 (data)
7590	string	FS30	Zope Object Database File Storage v4 (data)
760
761# Cache file for the database of Zope (done by ClientStorage)
7620	string		ZEC3	Zope Object Database Client Cache File (data)
763
764# IDA (Interactive Disassembler) database
7650	string		IDA1	IDA (Interactive Disassembler) database
766
767# Hopper (reverse engineering tool) https://www.hopperapp.com/
7680	string		hopperdb	Hopper database
769
770# URL: https://en.wikipedia.org/wiki/Panorama_(database_engine)
771# Reference: http://www.provue.com/Panorama/
772# From: Joerg Jenderek
773# NOTE: test only versions 4 and 6.0 with Windows
774# length of Panorama database name
7755	ubyte				>0
776# look after database name for "some" null bits
777>(5.B+7)	ubelong&0xF3ffF000	0
778# look for first keyword
779>>&1		search/2		DESIGN		Panorama database
780#!:mime	application/x-panorama-database
781!:apple	KASXZEPD
782!:ext	pan
783# database name
784>>>5	pstring				x		\b, "%s"
785
786#
787#
788# askSam Database by Stefan A. Haubenthal <polluks@web.de>
7890	string	askw40\0	askSam DB
790
791#
792#
793# MUIbase Database Tool by Stefan A. Haubenthal <polluks@web.de>
7940	string	MBSTV\040	MUIbase DB
795>6	string	x		version %s
796
797#
798# CDB database
7990	string	NBCDB\012	NetBSD Constant Database
800>7	byte	x		\b, version %d
801>8	string	x		\b, for '%s'
802>24	lelong	x		\b, datasize %d
803>28	lelong	x		\b, entries %d
804>32	lelong	x		\b, index %d
805>36	lelong	x		\b, seed %#x
806
807#
808# Redis RDB - https://redis.io/topics/persistence
8090	string	REDIS			Redis RDB file,
810>5	regex	[0-9][0-9][0-9][0-9]	version %s
811
812# Mork database.
813# Used by older versions of Mozilla Suite and Firefox,
814# and current versions of Thunderbird.
815# From: David Korth <gerbilsoft@gerbilsoft.com>
8160	string	//\ <!--\ <mdb:mork:z\ v="	Mozilla Mork database
817>23	string	x		\b, version %.3s
818
819# URL:		https://en.wikipedia.org/wiki/Management_Information_Format
820# Reference:	https://www.dmtf.org/sites/default/files/standards/documents/DSP0005.pdf
821# From:		Joerg Jenderek
822# Note:		only tested with monitor asset reports of Dell Display Manager
823#		skip start like Language=fr|CA|iso8859-1
8240	search/27/C	Start\040Component	DMI Management Information Format
825#!:mime	text/plain
826!:mime	text/x-dmtf-mif
827!:ext	mif
828
829