xref: /netbsd-src/external/bsd/file/dist/magic/magdir/database (revision 6a493d6bc668897c91594964a732d38505b70cbb)
1
2#------------------------------------------------------------------------------
3# $File: database,v 1.35 2013/11/20 00:00:14 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	0x13579ace	GNU dbm 1.x or ndbm database, big endian
13!:mime	application/x-gdbm
140	lelong	0x13579ace	GNU dbm 1.x or ndbm database, little endian
15!:mime	application/x-gdbm
160	string	GDBM		GNU dbm 2.x database
17!:mime	application/x-gdbm
18#
19# Berkeley DB
20#
21# Ian Darwin's file /etc/magic files: big/little-endian version.
22#
23# Hash 1.85/1.86 databases store metadata in network byte order.
24# Btree 1.85/1.86 databases store the metadata in host byte order.
25# Hash and Btree 2.X and later databases store the metadata in host byte order.
26
270	long	0x00061561	Berkeley DB
28!:mime	application/x-dbm
29>8	belong	4321
30>>4	belong	>2		1.86
31>>4	belong	<3		1.85
32>>4	belong	>0		(Hash, version %d, native byte-order)
33>8	belong	1234
34>>4	belong	>2		1.86
35>>4	belong	<3		1.85
36>>4	belong	>0		(Hash, version %d, little-endian)
37
380	belong	0x00061561	Berkeley DB
39>8	belong	4321
40>>4	belong	>2		1.86
41>>4	belong	<3		1.85
42>>4	belong	>0		(Hash, version %d, big-endian)
43>8	belong	1234
44>>4	belong	>2		1.86
45>>4	belong	<3		1.85
46>>4	belong	>0		(Hash, version %d, native byte-order)
47
480	long	0x00053162	Berkeley DB 1.85/1.86
49>4	long	>0		(Btree, version %d, native byte-order)
500	belong	0x00053162	Berkeley DB 1.85/1.86
51>4	belong	>0		(Btree, version %d, big-endian)
520	lelong	0x00053162	Berkeley DB 1.85/1.86
53>4	lelong	>0		(Btree, version %d, little-endian)
54
5512	long	0x00061561	Berkeley DB
56>16	long	>0		(Hash, version %d, native byte-order)
5712	belong	0x00061561	Berkeley DB
58>16	belong	>0		(Hash, version %d, big-endian)
5912	lelong	0x00061561	Berkeley DB
60>16	lelong	>0		(Hash, version %d, little-endian)
61
6212	long	0x00053162	Berkeley DB
63>16	long	>0		(Btree, version %d, native byte-order)
6412	belong	0x00053162	Berkeley DB
65>16	belong	>0		(Btree, version %d, big-endian)
6612	lelong	0x00053162	Berkeley DB
67>16	lelong	>0		(Btree, version %d, little-endian)
68
6912	long	0x00042253	Berkeley DB
70>16	long	>0		(Queue, version %d, native byte-order)
7112	belong	0x00042253	Berkeley DB
72>16	belong	>0		(Queue, version %d, big-endian)
7312	lelong	0x00042253	Berkeley DB
74>16	lelong	>0		(Queue, version %d, little-endian)
75
76# From Max Bowsher.
7712	long	0x00040988	Berkeley DB
78>16	long	>0		(Log, version %d, native byte-order)
7912	belong	0x00040988	Berkeley DB
80>16	belong	>0		(Log, version %d, big-endian)
8112	lelong	0x00040988	Berkeley DB
82>16	lelong	>0		(Log, version %d, little-endian)
83
84#
85#
86# Round Robin Database Tool by Tobias Oetiker <oetiker@ee.ethz.ch>
870	string/b	RRD\0		RRDTool DB
88>4	string/b	x		version %s
89#----------------------------------------------------------------------
90# ROOT: file(1) magic for ROOT databases
91#
920       string  root\0  ROOT file
93>4      belong  x       Version %d
94>33     belong  x       (Compression: %d)
95
96# XXX: Weak magic.
97# Alex Ott <ott@jet.msk.su>
98## Paradox file formats
99#2	  leshort	0x0800	Paradox
100#>0x39	  byte		3	v. 3.0
101#>0x39	  byte		4	v. 3.5
102#>0x39	  byte		9	v. 4.x
103#>0x39	  byte		10	v. 5.x
104#>0x39	  byte		11	v. 5.x
105#>0x39	  byte		12	v. 7.x
106#>>0x04	  byte		0	indexed .DB data file
107#>>0x04	  byte		1	primary index .PX file
108#>>0x04	  byte		2	non-indexed .DB data file
109#>>0x04	  byte		3	non-incrementing secondary index .Xnn file
110#>>0x04	  byte		4	secondary index .Ynn file
111#>>0x04	  byte		5	incrementing secondary index .Xnn file
112#>>0x04	  byte		6	non-incrementing secondary index .XGn file
113#>>0x04	  byte		7	secondary index .YGn file
114#>>>0x04	  byte		8	incrementing secondary index .XGn file
115
116## XBase database files
117# updated by Joerg Jenderek at Feb 2013
118# http://www.dbase.com/Knowledgebase/INT/db7_file_fmt.htm
119# http://www.clicketyclick.dk/databases/xbase/format/dbf.html
120# http://home.f1.htw-berlin.de/scheibl/db/intern/dBase.htm
121# inspect VVYYMMDD , where 1<= MM <= 12 and 1<= DD <= 31
1220	ubelong&0x0000FFFF		<0x00000C20
123# skip Infocom game Z-machine
124>2		ubyte			>0
125# skip Androids *.xml
126>>3		ubyte			>0
127>>>3		ubyte			<32
128# 1 < version VV
129>>>>0		ubyte			>1
130# skip HELP.CA3 by test for reserved byte ( NULL )
131>>>>>27		ubyte			0
132# reserved bytes not always 0 ; also found 0x3901 (T4.DBF) ,0x7101 (T5.DBF,T6.DBF)
133#>>>>>30		ubeshort     		x		30NULL?%x
134# possible production flag,tag numbers(<=0x30),tag length(<=0x20), reserved (NULL)
135>>>>>>24	ubelong&0xffFFFFff	>0x01302000
136# .DBF or .MDX
137>>>>>>24	ubelong&0xffFFFFff	<0x01302001
138# for Xbase Database file (*.DBF) reserved (NULL) for multi-user
139>>>>>>>24	ubelong&0xffFFFFff	=0
140# test for 2 reserved NULL bytes,transaction and encryption byte flag
141>>>>>>>>12	ubelong&0xFFFFfEfE	0
142# test for MDX flag
143>>>>>>>>>28	ubyte			x
144>>>>>>>>>28	ubyte&0xf8		0
145# header size >= 32
146>>>>>>>>>>8	uleshort		>31
147# skip PIC15736.PCX by test for language driver name or field name
148>>>>>>>>>>>32	ubyte			>0
149!:mime	application/x-dbf
150#!:mime	application/x-dbf; charset=unknown-8bit ??
151#!:mime	application/x-dbase
152>>>>>>>>>>>>0	use			xbase-type
153# database file
154>>>>>>>>>>>>0	ubyte			x		\b DBF
155>>>>>>>>>>>>4	lelong			0		\b, no records
156>>>>>>>>>>>>4	lelong			>0		\b, %ld record
157# plural s appended
158>>>>>>>>>>>>>4	lelong			>1		\bs
159# http://www.clicketyclick.dk/databases/xbase/format/dbf_check.html#CHECK_DBF
160# 1 <= record size <= 4000 (dBase 3,4) or 32 * KB (=0x8000)
161>>>>>>>>>>>>10	uleshort		x		* %d
162# file size = records * record size + header size
163>>>>>>>>>>>>1	ubyte			x		\b, update-date
164>>>>>>>>>>>>1	use			xbase-date
165# http://msdn.microsoft.com/de-de/library/cc483186(v=vs.71).aspx
166#>>>>>>>>>>>>29	ubyte			=0		\b, codepage ID=0x%x
167# 2~cp850 , 3~cp1252 , 0x1b~?? ; what code page is 0x1b ?
168>>>>>>>>>>>>29	ubyte			>0		\b, codepage ID=0x%x
169#>>>>>>>>>>>>28	ubyte&0x01		0		\b, no index file
170>>>>>>>>>>>>28	ubyte&0x01		1		\b, with index file .MDX
171>>>>>>>>>>>>28	ubyte&0x02		2		\b, with memo .FPT
172>>>>>>>>>>>>28	ubyte&0x04		4		\b, DataBaseContainer
173# 1st record offset + 1 = header size
174>>>>>>>>>>>>8	uleshort		>0
175>>>>>>>>>>>>(8.s+1)	ubyte		>0
176>>>>>>>>>>>>>8		uleshort	>0		\b, at offset %d
177>>>>>>>>>>>>>(8.s+1)	ubyte		>0
178>>>>>>>>>>>>>>&-1	string		>\0		1st record "%s"
179# for multiple index files (*.MDX) Production flag,tag numbers(<=0x30),tag length(<=0x20), reserverd (NULL)
180>>>>>>>24	ubelong&0x0133f7ff	>0
181# test for reserved NULL byte
182>>>>>>>>47	ubyte			x
183# test for valid TAG key format (0x10 or 0)
184>>>>>>>>>559	ubyte&0xeF		0
185# test MM <= 12
186>>>>>>>>>45	ubeshort		<0x0C20
187>>>>>>>>>>45	ubyte			>0
188>>>>>>>>>>>46	ubyte			<32
189>>>>>>>>>>>>46	ubyte			>0
190#!:mime	application/x-mdx
191>>>>>>>>>>>>>0	use			xbase-type
192>>>>>>>>>>>>>0	ubyte			x		\b MDX
193>>>>>>>>>>>>>1	ubyte			x		\b, creation-date
194>>>>>>>>>>>>>1	use			xbase-date
195>>>>>>>>>>>>>44	ubyte			x		\b, update-date
196>>>>>>>>>>>>>44	use			xbase-date
197# No.of tags in use (1,2,5,12)
198>>>>>>>>>>>>>28	uleshort		x		\b, %d
199# No. of entries in tag (0x30)
200>>>>>>>>>>>>>25	ubyte			x		\b/%d tags
201#  Length of tag
202>>>>>>>>>>>>>26	ubyte			x		* %d
203# 1st tag name_
204>>>>>>>>>>>>>548	string		x		\b, 1st tag "%.11s"
205# 2nd tag name
206#>>>>>>>>>>>>(26.b+548)	string		x		\b, 2nd tag "%.11s"
207#
208#		Print the xBase names of different version variants
2090	name				xbase-type
210>0	ubyte		<2
211# 1 < version
212>0	ubyte		>1
213>>0	ubyte		0x02		FoxBase
214# FoxBase+/dBaseIII+, no memo
215>>0	ubyte		0x03		FoxBase+/dBase III
216# dBASE IV no memo file
217>>0	ubyte		0x04		dBase IV
218# dBASE V no memo file
219>>0	ubyte		0x05		dBase V
220>>0	ubyte		0x30		Visual FoxPro
221>>0	ubyte		0x31		Visual FoxPro, autoincrement
222# Visual FoxPro, with field type Varchar or Varbinary
223>>0	ubyte		0x32		Visual FoxPro, with field type Varchar
224# dBASE IV SQL, no memo;dbv memo var size (Flagship)
225>>0	ubyte		0x43		dBase IV, with SQL table
226# http://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
227#>>0	ubyte		0x62		dBase IV, with SQL table
228# dBASE IV, with memo!!
229>>0	ubyte		0x7b		dBase IV, with memo
230# http://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
231#>>0	ubyte		0x82		dBase IV, with SQL system
232# FoxBase+/dBaseIII+ with memo .DBT!
233>>0	ubyte		0x83		FoxBase+/dBase III, with memo .DBT
234# VISUAL OBJECTS (first 1.0 versions) for the Dbase III files (NTX clipper driver); memo file
235>>0	ubyte		0x87		VISUAL OBJECTS, with memo file
236# http://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
237#>>0	ubyte		0x8A		FoxBase+/dBase III, with memo .DBT
238# dBASE IV with memo!
239>>0	ubyte		0x8B		dBase IV, with memo .DBT
240# dBase IV with SQL Table,no memo?
241>>0	ubyte		0x8E		dBase IV, with SQL table
242# .dbv and .dbt memo (Flagship)?
243>>0	ubyte		0xB3		Flagship
244# http://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
245#>>0	ubyte		0xCA		dBase IV with memo .DBT
246# dBASE IV with SQL table, with memo .DBT
247>>0	ubyte		0xCB		dBase IV with SQL table, with memo .DBT
248# HiPer-Six format;Clipper SIX, with SMT memo file
249>>0	ubyte		0xE5		Clipper SIX with memo
250# http://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
251#>>0	ubyte		0xF4		dBase IV, with SQL table, with memo
252>>0	ubyte		0xF5		FoxPro with memo
253# http://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
254#>>0	ubyte		0xFA		FoxPro 2.x, with memo
255# unkown version (should not happen)
256>>0	default		x		xBase
257>>>0	ubyte		x		(0x%x)
258# flags in version byte
259# DBT flag (with dBASE III memo .DBT)!!
260# >>0	ubyte&0x80	>0		DBT_FLAG=%x
261# memo flag ??
262# >>0	ubyte&0x08	>0		MEMO_FLAG=%x
263# SQL flag ??
264# >>0	ubyte&0x70	>0		SQL_FLAG=%x
265#		test and print the date of xBase .DBF .MDX
2660	name				xbase-date
267# inspect YYMMDD , where 1<= MM <= 12 and 1<= DD <= 31
268>0	ubelong		x
269>1	ubyte		<13
270>>1	ubyte		>0
271>>>2	ubyte		>0
272>>>>2	ubyte		<32
273>>>>>0	ubyte		x
274# YY is interpreted as 20YY or 19YY
275>>>>>>0	ubyte		<100		\b %.2d
276# YY is interpreted 1900+YY; TODO: display yy or 20yy instead 1YY
277>>>>>>0	ubyte		>99		\b %d
278>>>>>1	ubyte		x		\b-%d
279>>>>>2	ubyte		x		\b-%d
280
281#	dBase memo files .DBT or .FPT
282# http://msdn.microsoft.com/en-us/library/8599s21w(v=vs.80).aspx
28316		ubyte		<4
284>16		ubyte		!2
285>>16		ubyte		!1
286# next free block index is positive
287>>>0		ulelong		>0
288# skip many JPG. ZIP, BZ2 by test for reserved bytes NULL , 0|2 , 0|1 , low byte of block size
289>>>>17		ubelong&0xFFfdFE00	0x00000000
290# skip many RAR by test for low byte 0 ,high byte 0|2|even of block size, 0|a|e|d7 , 0|64h
291>>>>>20		ubelong&0xFF01209B	0x00000000
292# dBASE III
293>>>>>>16	ubyte		3
294# dBASE III DBT
295>>>>>>>0	use		xbase-memo-print
296# dBASE IV DBT , FoxPro FPT or many PNG , ZIP , DBF garbage
297>>>>>>16	ubyte		0
298# dBASE IV DBT with DBF name or DBF garbage
299>>>>>>>8	ubelong		>0x40000000
300# skip DBF and catch dBASE IV DBT with DBF name and with non big index of next free block
301>>>>>>>>0	ulelong		<0x01010002
302>>>>>>>>>0	use		xbase-memo-print
303>>>>>>>8	ubelong		0
304# skip MM*DD*.bin by test for for reserved NULL byte
305>>>>>>>>508	ubelong		0
306# real memo files should contain text here
307>>>>>>>>>520	ubelong		>0x20202019
308>>>>>>>>>>520	ubelong		<0xFEFEFEFF
309>>>>>>>>>>>0	use		xbase-memo-print
310# garbage PCX , ZIP , JAR , XPI
311>>>>>>>8	default		x
312
313#		Print the information of dBase DBT or FoxPro FPT memo files
3140	name				xbase-memo-print
315>0	ubyte			x
316# test version
317# memo file
318>>16	ubyte			3		dBase III DBT
319>>16	ubyte			0
320>>>512	ubelong			<0x00000003	FoxPro FPT
321# Size of blocks for FoxPro
322>>>>6	ubeshort		x		\b, blocks size %lu
323# Number of next available block for appending data for FoxPro
324>>>>0	ubelong			=0		\b, next free block index %lu
325>>>>0	ubelong			!0		\b, next free block index %lu
326>>>512	default			x		dBase IV DBT
327# DBF file name without extention
328>>>>8	string			>\0		\b of %-.8s.DBF
329# size of blocks  ; not reliable 0x2020204C
330#>>>>4	ulelong			=0		\b, blocks size %lu
331>>>>4	ulelong			!0		\b, blocks size %lu
332# Block length found 0 , 512
333#>>>>20	uleshort		=0		\b, block length %u
334>>>>20	uleshort		!0		\b, block length %u
335# Number of next available block for appending data
336>>>>0	ulelong			=0		\b, next free block index %lu
337>>>>0	ulelong			!0		\b, next free block index %lu
338>>512	ubelong			x
339>>>512	ubelong			=0xFFFF0800
340>>>>520	string			>\0		\b, 1st used item "%s"
341# FoxPro
342>>>512	ubelong			<3
343# FoxPro memo
344>>>>512	ubelong			=1
345>>>>520	string			>\0		\b, 1st used item "%s"
346>>>512	default			x
347# may be deleted memo field
348>>>>512	string			>\0		\b, 1st item "%s"
349
350# TODO:
351# DBASE index file *.NDX
352# DBASE Compound Index file *.CDX
353# dBASE IV Printer Driver *.PRF
354## End of XBase database stuff
355
356# MS Access database
3574	string	Standard\ Jet\ DB	Microsoft Access Database
358!:mime	application/x-msaccess
3594	string	Standard\ ACE\ DB	Microsoft Access Database
360!:mime	application/x-msaccess
361
362# TDB database from Samba et al - Martin Pool <mbp@samba.org>
3630	string	TDB\ file		TDB database
364>32	lelong	0x2601196D		version 6, little-endian
365>>36	lelong	x			hash size %d bytes
366
367# SE Linux policy database
3680       lelong  0xf97cff8c      SE Linux policy
369>16     lelong  x               v%d
370>20     lelong  1      MLS
371>24     lelong  x       %d symbols
372>28     lelong  x       %d ocons
373
374# ICE authority file data (Wolfram Kleff)
3752	string		ICE		ICE authority data
376
377# X11 Xauthority file (Wolfram Kleff)
37810	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
37911	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
38012	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
38113	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
38214	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
38315	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
38416	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
38517	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
38618	string		MIT-MAGIC-COOKIE-1	X11 Xauthority data
387
388# From: Maxime Henrion <mux@FreeBSD.org>
389# PostgreSQL's custom dump format, Maxime Henrion <mux@FreeBSD.org>
3900	string		PGDMP		PostgreSQL custom database dump
391>5	byte		x		- v%d
392>6	byte		x		\b.%d
393>5	beshort		<0x101		\b-0
394>5	beshort		>0x100
395>>7	byte		x		\b-%d
396
397# Type: Advanced Data Format (ADF) database
398# URL:  http://www.grc.nasa.gov/WWW/cgns/adf/
399# From: Nicolas Chauvat <nicolas.chauvat@logilab.fr>
4000	string	@(#)ADF\ Database	CGNS Advanced Data Format
401
402# Tokyo Cabinet magic data
403# http://tokyocabinet.sourceforge.net/index.html
4040	string		ToKyO\ CaBiNeT\n	Tokyo Cabinet
405>14	string		x			\b (%s)
406>32	byte		0			\b, Hash
407!:mime	application/x-tokyocabinet-hash
408>32	byte		1			\b, B+ tree
409!:mime	application/x-tokyocabinet-btree
410>32	byte		2			\b, Fixed-length
411!:mime	application/x-tokyocabinet-fixed
412>32	byte		3			\b, Table
413!:mime	application/x-tokyocabinet-table
414>33	byte		&1			\b, [open]
415>33	byte		&2			\b, [fatal]
416>34	byte		x			\b, apow=%d
417>35	byte		x			\b, fpow=%d
418>36	byte		&0x01			\b, [large]
419>36	byte		&0x02			\b, [deflate]
420>36	byte		&0x04			\b, [bzip]
421>36	byte		&0x08			\b, [tcbs]
422>36	byte		&0x10			\b, [excodec]
423>40	lequad		x			\b, bnum=%lld
424>48	lequad		x			\b, rnum=%lld
425>56	lequad		x			\b, fsiz=%lld
426
427# Type:	QDBM Quick Database Manager
428# From:	Benoit Sibaud <bsibaud@april.org>
4290	string		\\[depot\\]\n\f		Quick Database Manager, little endian
4300	string		\\[DEPOT\\]\n\f		Quick Database Manager, big endian
431
432# Type:	TokyoCabinet database
433# URL:	http://tokyocabinet.sourceforge.net/
434# From:	Benoit Sibaud <bsibaud@april.org>
4350	string		ToKyO\ CaBiNeT\n	TokyoCabinet database
436>14	string		x			(version %s)
437
438# From:  Stephane Blondon http://www.yaal.fr
439# Database file for Zope (done by FileStorage)
4400	string		FS21	Zope Object Database File Storage (data)
441# Cache file for the database of Zope (done by ClientStorage)
4420	string		ZEC3	Zope Object Database Client Cache File (data)
443
444# IDA (Interactive Disassembler) database
4450	string		IDA1	IDA (Interactive Disassembler) database
446