database 29 KB

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