@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: clipper,v 1.7 2014/04/30 21:41:02 christos Exp $
# clipper: file(1) magic for Intergraph (formerly Fairchild) Clipper.
#
# XXX - what byte order does the Clipper use?
@@ -34,7 +35,7 @@
>20 short 0413 (demand paged)
>20 short 0443 (target shared library)
>12 long >0 not stripped
>22 short >0 - version %ld
>22 short >0 - version %d
0 short 0577 CLIPPER COFF executable
>18 short&074000 000000 C1 R1
>18 short&074000 004000 C2 R1
@@ -46,7 +47,7 @@
>20 short 0413 (paged)
>20 short 0443 (target shared library)
>12 long >0 not stripped
>22 short >0 - version %ld
>22 short >0 - version %d
>48 long&01 01 alignment trap enabled
>52 byte 1 -Ctnc
>52 byte 2 -Ctsw
@@ -0,0 +1,110 @@

#------------------------------------------------------------------------------
# $File: commands,v 1.51 2014/09/27 00:12:55 christos Exp $
# commands: file(1) magic for various shells and interpreters
#
#0 string/w : shell archive or script for antique kernel text
0 string/wt #!\ /bin/sh POSIX shell script text executable
!:mime text/x-shellscript
0 string/wb #!\ /bin/sh POSIX shell script executable (binary data)
!:mime text/x-shellscript

0 string/wt #!\ /bin/csh C shell script text executable
!:mime text/x-shellscript

# korn shell magic, sent by George Wu, gwu@clyde.att.com
0 string/wt #!\ /bin/ksh Korn shell script text executable
!:mime text/x-shellscript
0 string/wb #!\ /bin/ksh Korn shell script executable (binary data)
!:mime text/x-shellscript

0 string/wt #!\ /bin/tcsh Tenex C shell script text executable
!:mime text/x-shellscript
0 string/wt #!\ /usr/bin/tcsh Tenex C shell script text executable
!:mime text/x-shellscript
0 string/wt #!\ /usr/local/tcsh Tenex C shell script text executable
!:mime text/x-shellscript
0 string/wt #!\ /usr/local/bin/tcsh Tenex C shell script text executable
!:mime text/x-shellscript

#
# zsh/ash/ae/nawk/gawk magic from cameron@cs.unsw.oz.au (Cameron Simpson)
0 string/wt #!\ /bin/zsh Paul Falstad's zsh script text executable
!:mime text/x-shellscript
0 string/wt #!\ /usr/bin/zsh Paul Falstad's zsh script text executable
!:mime text/x-shellscript
0 string/wt #!\ /usr/local/bin/zsh Paul Falstad's zsh script text executable
!:mime text/x-shellscript
0 string/wt #!\ /usr/local/bin/ash Neil Brown's ash script text executable
!:mime text/x-shellscript
0 string/wt #!\ /usr/local/bin/ae Neil Brown's ae script text executable
!:mime text/x-shellscript
0 string/wt #!\ /bin/nawk new awk script text executable
!:mime text/x-nawk
0 string/wt #!\ /usr/bin/nawk new awk script text executable
!:mime text/x-nawk
0 string/wt #!\ /usr/local/bin/nawk new awk script text executable
!:mime text/x-nawk
0 string/wt #!\ /bin/gawk GNU awk script text executable
!:mime text/x-gawk
0 string/wt #!\ /usr/bin/gawk GNU awk script text executable
!:mime text/x-gawk
0 string/wt #!\ /usr/local/bin/gawk GNU awk script text executable
!:mime text/x-gawk
#
0 string/wt #!\ /bin/awk awk script text executable
!:mime text/x-awk
0 string/wt #!\ /usr/bin/awk awk script text executable
!:mime text/x-awk
0 regex/4096 =^\\s{0,100}BEGIN\\s{0,100}[{] awk or perl script text

# AT&T Bell Labs' Plan 9 shell
0 string/wt #!\ /bin/rc Plan 9 rc shell script text executable

# bash shell magic, from Peter Tobias (tobias@server.et-inf.fho-emden.de)
0 string/wt #!\ /bin/bash Bourne-Again shell script text executable
!:mime text/x-shellscript
0 string/wb #!\ /bin/bash Bourne-Again shell script executable (binary data)
!:mime text/x-shellscript
0 string/wt #!\ /usr/bin/bash Bourne-Again shell script text executable
!:mime text/x-shellscript
0 string/wb #!\ /usr/bin/bash Bourne-Again shell script executable (binary data)
!:mime text/x-shellscript
0 string/wt #!\ /usr/local/bash Bourne-Again shell script text executable
!:mime text/x-shellscript
0 string/wb #!\ /usr/local/bash Bourne-Again shell script executable (binary data)
!:mime text/x-shellscript
0 string/wt #!\ /usr/local/bin/bash Bourne-Again shell script text executable
!:mime text/x-shellscript
0 string/wb #!\ /usr/local/bin/bash Bourne-Again shell script executable (binary data)
!:mime text/x-shellscript

# PHP scripts
# Ulf Harnhammar <ulfh@update.uu.se>
0 search/1/c =<?php PHP script text
!:strength + 10
!:mime text/x-php
0 search/1 =<?\n PHP script text
!:mime text/x-php
0 search/1 =<?\r PHP script text
!:mime text/x-php
0 search/1/w #!\ /usr/local/bin/php PHP script text executable
!:strength + 10
!:mime text/x-php
0 search/1/w #!\ /usr/bin/php PHP script text executable
!:strength + 10
!:mime text/x-php
# Smarty compiled template, http://www.smarty.net/
# Elan Ruusamae <glen@delfi.ee>
0 string =<?php\ /*\ Smarty\ version Smarty compiled template
>24 regex [0-9.]+ \b, version %s
!:mime text/x-php

0 string Zend\x00 PHP script Zend Optimizer data

0 string/t $! DCL command file

# Type: Pdmenu
# URL: http://packages.debian.org/pdmenu
# From: Edward Betts <edward@debian.org>
0 string #!/usr/bin/pdmenu Pdmenu configuration file text
@@ -1,5 +1,6 @@

#----------------------------------------------------------------------------
# $File: communications,v 1.5 2009/09/19 16:28:08 christos Exp $
# communication

# TTCN is the Tree and Tabular Combined Notation described in ISO 9646-3.
@@ -1,5 +1,5 @@

#------------------------------------------------------------------------------
# $File: compress,v 1.62 2014/09/13 14:27:12 christos Exp $
# compress: file(1) magic for pure-compression formats (no archives)
#
# compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
@@ -19,9 +19,10 @@
# Edited by Chris Chittleborough <cchittleborough@yahoo.com.au>, March 2002
# * Original filename is only at offset 10 if "extra field" absent
# * Produce shorter output - notably, only report compression methods
# other than 8 ("deflate", the only method defined in RFC 1952).
# other than 8 ("deflate", the only method defined in RFC 1952).
0 string \037\213 gzip compressed data
!:mime application/x-gzip
!:strength * 2
>2 byte <8 \b, reserved method
>2 byte >8 \b, unknown method
>3 byte &0x01 \b, ASCII
@@ -30,6 +31,10 @@
>3 byte&0xC =0x08
>>10 string x \b, was "%s"
>3 byte &0x10 \b, has comment
>3 byte &0x20 \b, encrypted
>4 ledate >0 \b, last modified: %s
>8 byte 2 \b, max compression
>8 byte 4 \b, max speed
>9 byte =0x00 \b, from FAT filesystem (MS-DOS, OS/2, NT)
>9 byte =0x01 \b, from Amiga
>9 byte =0x02 \b, from VMS
@@ -44,11 +49,6 @@
>9 byte =0x0B \b, from NTFS filesystem (NT)
>9 byte =0x0C \b, from QDOS
>9 byte =0x0D \b, from Acorn RISCOS
>3 byte &0x10 \b, comment
>3 byte &0x20 \b, encrypted
>4 ledate >0 \b, last modified: %s
>8 byte 2 \b, max compression
>8 byte 4 \b, max speed

# packed data, Huffman (minimum redundancy) codes on a byte-by-byte basis
0 string \037\036 packed data
@@ -182,23 +182,42 @@
>4 belong 0x090A0C0D best compression

# 7-zip archiver, from Thomas Klausner (wiz@danbala.tuwien.ac.at)
# http://www.7-zip.org or DOC/7zFormat.txt
# http://www.7-zip.org or DOC/7zFormat.txt
#
0 string 7z\274\257\047\034 7-zip archive data,
>6 byte x version %d
>7 byte x \b.%d
!:mime application/x-7z-compressed

# Type: LZMA
# URL: http://www.7-zip.org/sdk.html
# From: Robert Millan <rmh@aybabtu.com> and Reuben Thomas <rrt@sc3d.org>
# Commented out because apparently not reliable (according to Debian
# bug #364260)
#0 string ]\000\000\200\000 LZMA compressed data
0 lelong&0xffffff =0x5d
>12 leshort 0xff LZMA compressed data,
!:mime application/x-lzma
>>5 lequad =0xffffffffffffffff streamed
>>5 lequad !0xffffffffffffffff non-streamed, size %lld
>12 leshort 0 LZMA compressed data,
>>5 lequad =0xffffffffffffffff streamed
>>5 lequad !0xffffffffffffffff non-streamed, size %lld

# http://tukaani.org/xz/xz-file-format.txt
0 ustring \xFD7zXZ\x00 xz compressed data
0 ustring \xFD7zXZ\x00 XZ compressed data
!:mime application/x-xz

# https://github.com/ckolivas/lrzip/blob/master/doc/magic.header.txt
0 string LRZI LRZIP compressed data
>4 byte x - version %d
>5 byte x \b.%d
!:mime application/x-lrzip

# http://fastcompression.blogspot.fi/2013/04/lz4-streaming-format-final.html
0 lelong 0x184d2204 LZ4 compressed data (v1.4+)
!:mime application/x-lz4
# Added by osm0sis@xda-developers.com
0 lelong 0x184c2103 LZ4 compressed data (v1.0-v1.3)
!:mime application/x-lz4
0 lelong 0x184c2102 LZ4 compressed data (v0.1-v0.9)
!:mime application/x-lz4

# AFX compressed files (Wolfram Kleff)
2 string -afx- AFX compressed file data

@@ -213,7 +232,32 @@
>5 byte x \b.%d
>6 belong x (%d bytes)

# Type: XZ
# URL: http://tukaani.org/xz/
0 string \xfd\x37\x7a\x58\x5a\x00 XZ compressed data
!:mime application/x-xz
0 string ArC\x01 FreeArc archive <http://freearc.org>

# Type: DACT compressed files
0 long 0x444354C3 DACT compressed data
>4 byte >-1 (version %i.
>5 byte >-1 %i.
>6 byte >-1 %i)
>7 long >0 , original size: %i bytes
>15 long >30 , block size: %i bytes

# Valve Pack (VPK) files
0 lelong 0x55aa1234 Valve Pak file
>0x4 lelong x \b, version %u
>0x8 lelong x \b, %u entries

# Snappy framing format
# http://code.google.com/p/snappy/source/browse/trunk/framing_format.txt
0 string \377\006\0\0sNaPpY snappy framed data
!:mime application/x-snappy-framed

# qpress, http://www.quicklz.com/
0 string qpress10 qpress compressed data
!:mime application/x-qpress

# Zlib https://www.ietf.org/rfc/rfc6713.txt
0 beshort%31 =0
>0 byte&0xf =8
>>0 byte&0x80 =0 zlib compressed data
!:mime application/zlib
@@ -1,4 +1,6 @@

#------------------------------------------------------------------------------
# $File: console,v 1.19 2013/02/06 14:18:52 christos Exp $
# Console game magic
# Toby Deshane <hac@shoelace.digivill.net>
# ines: file(1) magic for Marat's iNES Nintendo Entertainment System
@@ -135,7 +137,7 @@
>113 string x (%s)

#------------------------------------------------------------------------------
# Microsoft Xbox executables .xbe (Esa Hyytiä <ehyytia@cc.hut.fi>)
# Microsoft Xbox executables .xbe (Esa Hyytia <ehyytia@cc.hut.fi>)
0 string XBEH XBE, Microsoft Xbox executable
# probabilistic checks whether signed or not
>0x0004 ulelong =0x0
@@ -163,15 +165,19 @@
# Atari Lynx cartridge dump (EXE/BLL header)
# From: "Stefan A. Haubenthal" <polluks@web.de>

0 beshort 0x8008 Lynx cartridge,
>2 beshort x RAM start $%04x
>6 string BS93
# Double-check that the image type matches too, 0x8008 conflicts with
# 8 character OMF-86 object file headers.
0 beshort 0x8008
>6 string BS93 Lynx homebrew cartridge
>>2 beshort x \b, RAM start $%04x
>6 string LYNX Lynx cartridge
>>2 beshort x \b, RAM start $%04x

# Opera file system that is used on the 3DO console
# From: Serge van den Boom <svdb@stack.nl>
0 string \x01ZZZZZ\x01 3DO "Opera" file system

# From Gürkan Sengün <gurkan@linuks.mine.nu>, www.linuks.mine.nu
# From Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu
0 string GBS Nintendo Gameboy Music/Audio Data
12 string GameBoy\ Music\ Module Nintendo Gameboy Music Module

@@ -252,3 +258,7 @@
>>>(0x18.l-26) lelong x CRC32 0x%08x
>>>(0x18.l-23) string x "%s"

# Type: scummVM savegame files
# From: Sven Hartge <debian@ds9.argh.org>
0 string SCVM ScummVM savegame
>12 string >\0 "%s"
@@ -1,4 +1,6 @@

#------------------------------------------------------------------------------
# $File: convex,v 1.8 2012/10/03 23:44:43 christos Exp $
# convex: file(1) magic for Convex boxes
#
# Convexes are big-endian.
@@ -28,8 +30,6 @@
# The restore program uses these number to determine how the data is
# to be extracted.
#
24 belong =60011 dump format, 4.1 BSD or earlier
24 belong =60012 dump format, 4.2 or 4.3 BSD without IDC
24 belong =60013 dump format, 4.2 or 4.3 BSD (IDC compatible)
24 belong =60014 dump format, Convex Storage Manager by-reference dump
#
@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: cracklib,v 1.7 2009/09/19 16:28:08 christos Exp $
# cracklib: file (1) magic for cracklib v2.7

0 lelong 0x70775631 Cracklib password index, little endian
@@ -1,4 +1,6 @@

# ----------------------------------------------------------------------------
# $File: ctags,v 1.6 2009/09/19 16:28:08 christos Exp $
# ctags: file (1) magic for Exuberant Ctags files
# From: Alexander Mai <mai@migdal.ikp.physik.tu-darmstadt.de>
0 search/1 =!_TAG Exuberant Ctags tag file text
@@ -0,0 +1,23 @@

#--------------------------------------------------------------
# ctf: file(1) magic for CTF (Common Trace Format) trace files
#
# Specs. available here: <http://www.efficios.com/ctf>
#--------------------------------------------------------------

# CTF trace data
0 lelong 0xc1fc1fc1 Common Trace Format (CTF) trace data (LE)
0 belong 0xc1fc1fc1 Common Trace Format (CTF) trace data (BE)

# CTF metadata (packetized)
0 lelong 0x75d11d57 Common Trace Format (CTF) packetized metadata (LE)
>35 byte x \b, v%d
>36 byte x \b.%d
0 belong 0x75d11d57 Common Trace Format (CTF) packetized metadata (BE)
>35 byte x \b, v%d
>36 byte x \b.%d

# CTF metadata (plain text)
0 string /*\x20CTF\x20 Common Trace Format (CTF) plain text metadata
!:strength + 5 # this is to make sure we beat C
>&0 regex [0-9]+\.[0-9]+ \b, v%s
@@ -0,0 +1,8 @@

#------------------------------------------------------------------------------
# $File: cubemap,v 1.1 2012/06/06 13:03:20 christos Exp $
# file(1) magic(5) data for cubemaps Martin Erik Werner <martinerikwerner@gmail.com>
#
0 string ACMP Map file for the AssaultCube FPS game
0 string CUBE Map file for cube and cube2 engine games
0 string MAPZ) Map file for the Blood Frontier/Red Eclipse FPS games
@@ -0,0 +1,56 @@

#------------------------------------------------------------------------------
# $File: cups,v 1.3 2014/05/28 19:50:41 christos Exp $
# Cups: file(1) magic for the cups raster file format
# From: Laurent Martelli <martellilaurent@gmail.com>
# http://www.cups.org/documentation.php/spec-raster.html
#

0 name cups-le
>280 lelong x \b, %d
>284 lelong x \bx%d dpi
>376 lelong x \b, %dx
>380 lelong x \b%d pixels
>388 lelong x %d bits/color
>392 lelong x %d bits/pixel
>400 lelong 0 ColorOrder=Chunky
>400 lelong 1 ColorOrder=Banded
>400 lelong 2 ColorOrder=Planar
>404 lelong 0 ColorSpace=gray
>404 lelong 1 ColorSpace=RGB
>404 lelong 2 ColorSpace=RGBA
>404 lelong 3 ColorSpace=black
>404 lelong 4 ColorSpace=CMY
>404 lelong 5 ColorSpace=YMC
>404 lelong 6 ColorSpace=CMYK
>404 lelong 7 ColorSpace=YMCK
>404 lelong 8 ColorSpace=KCMY
>404 lelong 9 ColorSpace=KCMYcm
>404 lelong 10 ColorSpace=GMCK
>404 lelong 11 ColorSpace=GMCS
>404 lelong 12 ColorSpace=WHITE
>404 lelong 13 ColorSpace=GOLD
>404 lelong 14 ColorSpace=SILVER
>404 lelong 15 ColorSpace=CIE XYZ
>404 lelong 16 ColorSpace=CIE Lab
>404 lelong 17 ColorSpace=RGBW
>404 lelong 18 ColorSpace=sGray
>404 lelong 19 ColorSpace=sRGB
>404 lelong 20 ColorSpace=AdobeRGB

# Cups Raster image format, Big Endian
0 string RaS
>3 string t Cups Raster version 1, Big Endian
>3 string 2 Cups Raster version 2, Big Endian
>3 string 3 Cups Raster version 3, Big Endian
!:mime application/vnd.cups-raster
>0 use ^cups-le


# Cups Raster image format, Little Endian
1 string SaR
>0 string t Cups Raster version 1, Little Endian
>0 string 2 Cups Raster version 2, Little Endian
>0 string 3 Cups Raster version 3, Little Endian
!:mime application/vnd.cups-raster
>0 use cups-le
@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: dact,v 1.4 2009/09/19 16:28:08 christos Exp $
# dact: file(1) magic for DACT compressed files
#
0 long 0x444354C3 DACT compressed data

Large diffs are not rendered by default.

@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: diamond,v 1.7 2009/09/19 16:28:08 christos Exp $
# diamond: file(1) magic for Diamond system
#
# ... diamond is a multi-media mail and electronic conferencing system....
@@ -0,0 +1,40 @@

#------------------------------------------------------------------------------
# $File: diff,v 1.14 2012/09/16 23:08:54 christos Exp $
# diff: file(1) magic for diff(1) output
#
0 search/1 diff\ diff output text
!:mime text/x-diff
0 search/1 ***\ diff output text
!:mime text/x-diff
0 search/1 Only\ in\ diff output text
!:mime text/x-diff
0 search/1 Common\ subdirectories:\ diff output text
!:mime text/x-diff

0 search/1 Index: RCS/CVS diff output text
!:mime text/x-diff

# bsdiff: file(1) magic for bsdiff(1) output
0 string/b BSDIFF40 bsdiff(1) patch file


# unified diff
0 search/4096 ---\
>&0 search/1024 \n
>>&0 search/1 +++\
>>>&0 search/1024 \n
>>>>&0 search/1 @@ unified diff output text
!:mime text/x-diff
!:strength + 90

# librsync -- the library for network deltas
#
# Copyright (C) 2001 by Martin Pool. You may do whatever you want with
# this file.
#
0 belong 0x72730236 rdiff network-delta data

0 belong 0x72730136 rdiff network-delta signature data
>4 belong x (block length=%d,
>8 belong x signature strength=%d)
@@ -0,0 +1,58 @@

#------------------------------------------------------------------------------
# $File: digital,v 1.11 2013/01/11 16:45:23 christos Exp $
# Digital UNIX - Info
#
0 string =!<arch>\n________64E Alpha archive
>22 string X -- out of date
#

0 leshort 0603
>24 leshort 0410 COFF format alpha pure
>24 leshort 0413 COFF format alpha demand paged
>>22 leshort&030000 !020000 executable
>>22 leshort&020000 !0 dynamically linked
>>16 lelong !0 not stripped
>>16 lelong 0 stripped
>>27 byte x - version %d
>>26 byte x \b.%d
>>28 byte x \b-%d
>24 leshort 0407 COFF format alpha object
>>22 leshort&030000 020000 shared library
>>27 byte x - version %d
>>26 byte x \b.%d
>>28 byte x \b-%d

# Basic recognition of Digital UNIX core dumps - Mike Bremford <mike@opac.bl.uk>
#
# The actual magic number is just "Core", followed by a 2-byte version
# number; however, treating any file that begins with "Core" as a Digital
# UNIX core dump file may produce too many false hits, so we include one
# byte of the version number as well; DU 5.0 appears only to be up to
# version 2.
#
0 string Core\001 Alpha COFF format core dump (Digital UNIX)
>24 string >\0 \b, from '%s'
0 string Core\002 Alpha COFF format core dump (Digital UNIX)
>24 string >\0 \b, from '%s'
#
# The next is incomplete, we could tell more about this format,
# but its not worth it.
0 leshort 0x188 Alpha compressed COFF
0 leshort 0x18f Alpha u-code object
#
#
# Some other interesting Digital formats,
0 string \377\377\177 ddis/ddif
0 string \377\377\174 ddis/dots archive
0 string \377\377\176 ddis/dtif table data
0 string \033c\033 LN03 output
0 long 04553207 X image
#
0 string =!<PDF>!\n profiling data file
#
# Locale data tables (MIPS and Alpha).
#
0 short 0x0501 locale data table
>6 short 0x24 for MIPS
>6 short 0x40 for Alpha
@@ -0,0 +1,69 @@

#------------------------------------------------------------------------------
# $File: dolby,v 1.7 2014/01/08 22:37:23 christos Exp $
# ATSC A/53 aka AC-3 aka Dolby Digital <ashitaka@gmx.at>
# from http://www.atsc.org/standards/a_52a.pdf
# corrections, additions, etc. are always welcome!
#
# syncword
0 beshort 0x0b77 ATSC A/52 aka AC-3 aka Dolby Digital stream,
# Proposed audio/ac3 RFC/4184
!:mime audio/vnd.dolby.dd-raw
# fscod
>4 byte&0xc0 = 0x00 48 kHz,
>4 byte&0xc0 = 0x40 44.1 kHz,
>4 byte&0xc0 = 0x80 32 kHz,
# is this one used for 96 kHz?
>4 byte&0xc0 = 0xc0 reserved frequency,
#
>5 byte&0x07 = 0x00 \b, complete main (CM)
>5 byte&0x07 = 0x01 \b, music and effects (ME)
>5 byte&0x07 = 0x02 \b, visually impaired (VI)
>5 byte&0x07 = 0x03 \b, hearing impaired (HI)
>5 byte&0x07 = 0x04 \b, dialogue (D)
>5 byte&0x07 = 0x05 \b, commentary (C)
>5 byte&0x07 = 0x06 \b, emergency (E)
>5 beshort&0x07e0 0x0720 \b, voiceover (VO)
>5 beshort&0x07e0 >0x0720 \b, karaoke
# acmod
>6 byte&0xe0 = 0x00 1+1 front,
>>6 byte&0x10 = 0x10 LFE on,
>6 byte&0xe0 = 0x20 1 front/0 rear,
>>6 byte&0x10 = 0x10 LFE on,
>6 byte&0xe0 = 0x40 2 front/0 rear,
# dsurmod (for stereo only)
>>6 byte&0x18 = 0x00 Dolby Surround not indicated
>>6 byte&0x18 = 0x08 not Dolby Surround encoded
>>6 byte&0x18 = 0x10 Dolby Surround encoded
>>6 byte&0x18 = 0x18 reserved Dolby Surround mode
>>6 byte&0x04 = 0x04 LFE on,
>6 byte&0xe0 = 0x60 3 front/0 rear,
>>6 byte&0x04 = 0x04 LFE on,
>6 byte&0xe0 = 0x80 2 front/1 rear,
>>6 byte&0x04 = 0x04 LFE on,
>6 byte&0xe0 = 0xa0 3 front/1 rear,
>>6 byte&0x01 = 0x01 LFE on,
>6 byte&0xe0 = 0xc0 2 front/2 rear,
>>6 byte&0x04 = 0x04 LFE on,
>6 byte&0xe0 = 0xe0 3 front/2 rear,
>>6 byte&0x01 = 0x01 LFE on,
#
>4 byte&0x3e = 0x00 \b, 32 kbit/s
>4 byte&0x3e = 0x02 \b, 40 kbit/s
>4 byte&0x3e = 0x04 \b, 48 kbit/s
>4 byte&0x3e = 0x06 \b, 56 kbit/s
>4 byte&0x3e = 0x08 \b, 64 kbit/s
>4 byte&0x3e = 0x0a \b, 80 kbit/s
>4 byte&0x3e = 0x0c \b, 96 kbit/s
>4 byte&0x3e = 0x0e \b, 112 kbit/s
>4 byte&0x3e = 0x10 \b, 128 kbit/s
>4 byte&0x3e = 0x12 \b, 160 kbit/s
>4 byte&0x3e = 0x14 \b, 192 kbit/s
>4 byte&0x3e = 0x16 \b, 224 kbit/s
>4 byte&0x3e = 0x18 \b, 256 kbit/s
>4 byte&0x3e = 0x1a \b, 320 kbit/s
>4 byte&0x3e = 0x1c \b, 384 kbit/s
>4 byte&0x3e = 0x1e \b, 448 kbit/s
>4 byte&0x3e = 0x20 \b, 512 kbit/s
>4 byte&0x3e = 0x22 \b, 576 kbit/s
>4 byte&0x3e = 0x24 \b, 640 kbit/s
@@ -1,13 +1,14 @@

#------------------------------------------------------------------------------
# $File: dump,v 1.13 2014/04/30 21:41:02 christos Exp $
# dump: file(1) magic for dump file format--for new and old dump filesystems
#
# We specify both byte orders in order to recognize byte-swapped dumps.
#
24 belong 60012 new-fs dump file (big endian),
0 name new-dump-be
>4 bedate x Previous dump %s,
>8 bedate x This dump %s,
>12 belong >0 Volume %ld,
>12 belong >0 Volume %d,
>692 belong 0 Level zero, type:
>692 belong >0 Level %d, type:
>0 belong 1 tape header,
@@ -23,10 +24,10 @@
>824 string >\0 Host %s,
>888 belong >0 Flags %x

24 belong 60011 old-fs dump file (big endian),
0 name old-dump-be
#>4 bedate x Previous dump %s,
#>8 bedate x This dump %s,
>12 belong >0 Volume %ld,
>12 belong >0 Volume %d,
>692 belong 0 Level zero, type:
>692 belong >0 Level %d, type:
>0 belong 1 tape header,
@@ -42,60 +43,10 @@
>824 string >\0 Host %s,
>888 belong >0 Flags %x

24 lelong 60012 new-fs dump file (little endian),
>4 ledate x This dump %s,
>8 ledate x Previous dump %s,
>12 lelong >0 Volume %ld,
>692 lelong 0 Level zero, type:
>692 lelong >0 Level %d, type:
>0 lelong 1 tape header,
>0 lelong 2 beginning of file record,
>0 lelong 3 map of inodes on tape,
>0 lelong 4 continuation of file record,
>0 lelong 5 end of volume,
>0 lelong 6 map of inodes deleted,
>0 lelong 7 end of medium (for floppy),
>676 string >\0 Label %s,
>696 string >\0 Filesystem %s,
>760 string >\0 Device %s,
>824 string >\0 Host %s,
>888 lelong >0 Flags %x

24 lelong 60011 old-fs dump file (little endian),
#>4 ledate x Previous dump %s,
#>8 ledate x This dump %s,
>12 lelong >0 Volume %ld,
>692 lelong 0 Level zero, type:
>692 lelong >0 Level %d, type:
>0 lelong 1 tape header,
>0 lelong 2 beginning of file record,
>0 lelong 3 map of inodes on tape,
>0 lelong 4 continuation of file record,
>0 lelong 5 end of volume,
>0 lelong 6 map of inodes deleted,
>0 lelong 7 end of medium (for floppy),
>676 string >\0 Label %s,
>696 string >\0 Filesystem %s,
>760 string >\0 Device %s,
>824 string >\0 Host %s,
>888 lelong >0 Flags %x

18 leshort 60011 old-fs dump file (16-bit, assuming PDP-11 endianness),
>2 medate x Previous dump %s,
>6 medate x This dump %s,
>10 leshort >0 Volume %ld,
>0 leshort 1 tape header.
>0 leshort 2 beginning of file record.
>0 leshort 3 map of inodes on tape.
>0 leshort 4 continuation of file record.
>0 leshort 5 end of volume.
>0 leshort 6 map of inodes deleted.
>0 leshort 7 end of medium (for floppy).

24 belong 0x19540119 new-fs dump file (ufs2, big endian),
0 name ufs2-dump-be
>896 beqdate x Previous dump %s,
>904 beqdate x This dump %s,
>12 belong >0 Volume %ld,
>12 belong >0 Volume %d,
>692 belong 0 Level zero, type:
>692 belong >0 Level %d, type:
>0 belong 1 tape header,
@@ -111,21 +62,33 @@
>824 string >\0 Host %s,
>888 belong >0 Flags %x

24 lelong 0x19540119 new-fs dump file (ufs2, little endian),
>896 leqdate x This dump %s,
>904 leqdate x Previous dump %s,
>12 lelong >0 Volume %ld,
>692 lelong 0 Level zero, type:
>692 lelong >0 Level %d, type:
>0 lelong 1 tape header,
>0 lelong 2 beginning of file record,
>0 lelong 3 map of inodes on tape,
>0 lelong 4 continuation of file record,
>0 lelong 5 end of volume,
>0 lelong 6 map of inodes deleted,
>0 lelong 7 end of medium (for floppy),
>676 string >\0 Label %s,
>696 string >\0 Filesystem %s,
>760 string >\0 Device %s,
>824 string >\0 Host %s,
>888 lelong >0 Flags %x
24 belong 60012 new-fs dump file (big endian),
>0 use new-dump-be

24 belong 60011 old-fs dump file (big endian),
>0 use old-dump-be

24 lelong 60012 new-fs dump file (little endian),
>0 use \^new-dump-be

24 lelong 60011 old-fs dump file (little endian),
>0 use \^old-dump-be


24 belong 0x19540119 new-fs dump file (ufs2, big endian),
>0 use ufs2-dump-be

24 lelong 0x19540119 new-fs dump file (ufs2, little endian),
>0 use \^ufs2-dump-be

18 leshort 60011 old-fs dump file (16-bit, assuming PDP-11 endianness),
>2 medate x Previous dump %s,
>6 medate x This dump %s,
>10 leshort >0 Volume %d,
>0 leshort 1 tape header.
>0 leshort 2 beginning of file record.
>0 leshort 3 map of inodes on tape.
>0 leshort 4 continuation of file record.
>0 leshort 5 end of volume.
>0 leshort 6 map of inodes deleted.
>0 leshort 7 end of medium (for floppy).
@@ -0,0 +1,56 @@

#------------------------------------------------------------------------------
# $File: dyadic,v 1.6 2014/06/01 19:14:42 christos Exp $
# Dyadic: file(1) magic for Dyalog APL.
#
# updated by Joerg Jenderek at Oct 2013
# http://en.wikipedia.org/wiki/Dyalog_APL
# http://www.dyalog.com/
# .DXV Dyalog APL External Variable
# .DIN Dyalog APL Input Table
# .DOT Dyalog APL Output Table
# .DFT Dyalog APL Format File
0 ubeshort&0xFF60 0xaa00
# skip biblio.dbt
>1 byte !4
# real Dyalog APL have non zero version numbers like 7.3 or 13.4
>>2 ubeshort >0x0000 Dyalog APL
>>>1 byte 0x00 aplcore
#>>>1 byte 0x00 incomplete workspace
# *.DCF Dyalog APL Component File
>>>1 byte 0x01 component file 32-bit non-journaled non-checksummed
#>>>1 byte 0x01 component file
>>>1 byte 0x02 external variable exclusive
#>>>1 byte 0x02 external variable
# *.DWS Dyalog APL Workspace
>>>1 byte 0x03 workspace
>>>>7 byte&0x28 0x00 32-bit
>>>>7 byte&0x28 0x20 64-bit
>>>>7 byte&0x0c 0x00 classic
>>>>7 byte&0x0c 0x04 unicode
>>>>7 byte&0x88 0x00 big-endian
>>>>7 byte&0x88 0x80 little-endian
>>>1 byte 0x06 external variable shared
# *.DSE Dyalog APL Session , *.DLF Dyalog APL Session Log File
>>>1 byte 0x07 session
>>>1 byte 0x08 mapped file 32-bit
>>>1 byte 0x09 component file 64-bit non-journaled non-checksummed
>>>1 byte 0x0a mapped file 64-bit
>>>1 byte 0x0b component file 32-bit level 1 journaled non-checksummed
>>>1 byte 0x0c component file 64-bit level 1 journaled non-checksummed
>>>1 byte 0x0d component file 32-bit level 1 journaled checksummed
>>>1 byte 0x0e component file 64-bit level 1 journaled checksummed
>>>1 byte 0x0f component file 32-bit level 2 journaled checksummed
>>>1 byte 0x10 component file 64-bit level 2 journaled checksummed
>>>1 byte 0x11 component file 32-bit level 3 journaled checksummed
>>>1 byte 0x12 component file 64-bit level 3 journaled checksummed
>>>1 byte 0x13 component file 32-bit non-journaled checksummed
>>>1 byte 0x14 component file 64-bit non-journaled checksummed
>>>1 byte 0x80 DDB
>>>2 byte x version %d
>>>3 byte x \b.%d
#>>>2 byte x type %d
#>>>3 byte x subtype %d

# *.DXF Dyalog APL Transfer File
0 short 0x6060 Dyalog APL transfer
@@ -0,0 +1,8 @@

#------------------------------------------------------------------------------
# $File: ebml,v 1.1 2010/07/02 00:07:03 christos Exp $
# ebml: file(1) magic for various Extensible Binary Meta Language
# http://www.matroska.org/technical/specs/index.html#track
0 belong 0x1a45dfa3 EBML file
>4 search/b/100 \102\202
>>&1 string x \b, creator %.8s
@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: editors,v 1.8 2009/09/19 16:28:09 christos Exp $
# T602 editor documents
# by David Necas <yeti@physics.muni.cz>
0 string @CT\ T602 document data,
@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: efi,v 1.5 2014/04/30 21:41:02 christos Exp $
# efi: file(1) magic for Universal EFI binaries

0 lelong 0x0ef1fab9
@@ -11,4 +12,4 @@
>>&0 lelong 0x01000007 \b, x86_64
>>&20 lelong 7 \b, i386
>>&20 lelong 0x01000007 \b, x86_64
>4 lelong >2 Universal EFI binary with %ld architectures
>4 lelong >2 Universal EFI binary with %d architectures
@@ -0,0 +1,325 @@

#------------------------------------------------------------------------------
# $File: elf,v 1.68 2014/09/19 19:05:57 christos Exp $
# elf: file(1) magic for ELF executables
#
# We have to check the byte order flag to see what byte order all the
# other stuff in the header is in.
#
# What're the correct byte orders for the nCUBE and the Fujitsu VPP500?
#
# Created by: unknown
# Modified by (1): Daniel Quinlan <quinlan@yggdrasil.com>
# Modified by (2): Peter Tobias <tobias@server.et-inf.fho-emden.de> (core support)
# Modified by (3): Christian 'Dr. Disk' Hechelmann <drdisk@ds9.au.s.shuttle.de> (fix of core support)
# Modified by (4): <gerardo.cacciari@gmail.com> (VMS Itanium)
# Modified by (5): Matthias Urlichs <smurf@debian.org> (Listing of many architectures)

0 name elf-le
>16 leshort 0 no file type,
!:mime application/octet-stream
>16 leshort 1 relocatable,
!:mime application/x-object
>16 leshort 2 executable,
!:mime application/x-executable
>16 leshort 3 shared object,
!:mime application/x-sharedlib
>16 leshort 4 core file
!:mime application/x-coredump
# Core file detection is not reliable.
#>>>(0x38+0xcc) string >\0 of '%s'
#>>>(0x38+0x10) lelong >0 (signal %d),
>16 leshort &0xff00 processor-specific,
>18 clear x
>18 leshort 0 no machine,
>18 leshort 1 AT&T WE32100,
>18 leshort 2 SPARC,
>18 leshort 3 Intel 80386,
>18 leshort 4 Motorola m68k,
>>4 byte 1
>>>36 lelong &0x01000000 68000,
>>>36 lelong &0x00810000 CPU32,
>>>36 lelong 0 68020,
>18 leshort 5 Motorola m88k,
>18 leshort 6 Intel 80486,
>18 leshort 7 Intel 80860,
# The official e_machine number for MIPS is now #8, regardless of endianness.
# The second number (#10) will be deprecated later. For now, we still
# say something if #10 is encountered, but only gory details for #8.
>18 leshort 8 MIPS,
>>4 byte 1
>>>36 lelong &0x20 N32
>18 leshort 10 MIPS,
>>4 byte 1
>>>36 lelong &0x20 N32
>18 leshort 8
# only for 32-bit
>>4 byte 1
>>>36 lelong&0xf0000000 0x00000000 MIPS-I
>>>36 lelong&0xf0000000 0x10000000 MIPS-II
>>>36 lelong&0xf0000000 0x20000000 MIPS-III
>>>36 lelong&0xf0000000 0x30000000 MIPS-IV
>>>36 lelong&0xf0000000 0x40000000 MIPS-V
>>>36 lelong&0xf0000000 0x50000000 MIPS32
>>>36 lelong&0xf0000000 0x60000000 MIPS64
>>>36 lelong&0xf0000000 0x70000000 MIPS32 rel2
>>>36 lelong&0xf0000000 0x80000000 MIPS64 rel2
# only for 64-bit
>>4 byte 2
>>>48 lelong&0xf0000000 0x00000000 MIPS-I
>>>48 lelong&0xf0000000 0x10000000 MIPS-II
>>>48 lelong&0xf0000000 0x20000000 MIPS-III
>>>48 lelong&0xf0000000 0x30000000 MIPS-IV
>>>48 lelong&0xf0000000 0x40000000 MIPS-V
>>>48 lelong&0xf0000000 0x50000000 MIPS32
>>>48 lelong&0xf0000000 0x60000000 MIPS64
>>>48 lelong&0xf0000000 0x70000000 MIPS32 rel2
>>>48 lelong&0xf0000000 0x80000000 MIPS64 rel2
>18 leshort 9 Amdahl,
>18 leshort 10 MIPS (deprecated),
>18 leshort 11 RS6000,
>18 leshort 15 PA-RISC,
# only for 32-bit
>>4 byte 1
>>>38 leshort 0x0214 2.0
>>>36 leshort &0x0008 (LP64)
# only for 64-bit
>>4 byte 2
>>>50 leshort 0x0214 2.0
>>>48 leshort &0x0008 (LP64)
>18 leshort 16 nCUBE,
>18 leshort 17 Fujitsu VPP500,
>18 leshort 18 SPARC32PLUS,
# only for 32-bit
>>4 byte 1
>>>36 lelong&0xffff00 0x000100 V8+ Required,
>>>36 lelong&0xffff00 0x000200 Sun UltraSPARC1 Extensions Required,
>>>36 lelong&0xffff00 0x000400 HaL R1 Extensions Required,
>>>36 lelong&0xffff00 0x000800 Sun UltraSPARC3 Extensions Required,
>18 leshort 19 Intel 80960,
>18 leshort 20 PowerPC or cisco 4500,
>18 leshort 21 64-bit PowerPC or cisco 7500,
>18 leshort 22 IBM S/390,
>18 leshort 23 Cell SPU,
>18 leshort 24 cisco SVIP,
>18 leshort 25 cisco 7200,
>18 leshort 36 NEC V800 or cisco 12000,
>18 leshort 37 Fujitsu FR20,
>18 leshort 38 TRW RH-32,
>18 leshort 39 Motorola RCE,
>18 leshort 40 ARM,
>>4 byte 1
>>>36 lelong&0xff000000 0x04000000 EABI4
>>>36 lelong&0xff000000 0x05000000 EABI5
>>>36 lelong &0x00800000 BE8
>>>36 lelong &0x00400000 LE8
>18 leshort 41 Alpha,
>18 leshort 42 Renesas SH,
>18 leshort 43 SPARC V9,
>>4 byte 2
>>>48 lelong&0xffff00 0x000200 Sun UltraSPARC1 Extensions Required,
>>>48 lelong&0xffff00 0x000400 HaL R1 Extensions Required,
>>>48 lelong&0xffff00 0x000800 Sun UltraSPARC3 Extensions Required,
>>>48 lelong&0x3 0 total store ordering,
>>>48 lelong&0x3 1 partial store ordering,
>>>48 lelong&0x3 2 relaxed memory ordering,
>18 leshort 44 Siemens Tricore Embedded Processor,
>18 leshort 45 Argonaut RISC Core, Argonaut Technologies Inc.,
>18 leshort 46 Renesas H8/300,
>18 leshort 47 Renesas H8/300H,
>18 leshort 48 Renesas H8S,
>18 leshort 49 Renesas H8/500,
>18 leshort 50 IA-64,
>18 leshort 51 Stanford MIPS-X,
>18 leshort 52 Motorola Coldfire,
>18 leshort 53 Motorola M68HC12,
>18 leshort 54 Fujitsu MMA,
>18 leshort 55 Siemens PCP,
>18 leshort 56 Sony nCPU,
>18 leshort 57 Denso NDR1,
>18 leshort 58 Start*Core,
>18 leshort 59 Toyota ME16,
>18 leshort 60 ST100,
>18 leshort 61 Tinyj emb.,
>18 leshort 62 x86-64,
>18 leshort 63 Sony DSP,
>18 leshort 64 DEC PDP-10,
>18 leshort 65 DEC PDP-11,
>18 leshort 66 FX66,
>18 leshort 67 ST9+ 8/16 bit,
>18 leshort 68 ST7 8 bit,
>18 leshort 69 MC68HC16,
>18 leshort 70 MC68HC11,
>18 leshort 71 MC68HC08,
>18 leshort 72 MC68HC05,
>18 leshort 73 SGI SVx or Cray NV1,
>18 leshort 74 ST19 8 bit,
>18 leshort 75 Digital VAX,
>18 leshort 76 Axis cris,
>18 leshort 77 Infineon 32-bit embedded,
>18 leshort 78 Element 14 64-bit DSP,
>18 leshort 79 LSI Logic 16-bit DSP,
>18 leshort 80 MMIX,
>18 leshort 81 Harvard machine-independent,
>18 leshort 82 SiTera Prism,
>18 leshort 83 Atmel AVR 8-bit,
>18 leshort 84 Fujitsu FR30,
>18 leshort 85 Mitsubishi D10V,
>18 leshort 86 Mitsubishi D30V,
>18 leshort 87 NEC v850,
>18 leshort 88 Renesas M32R,
>18 leshort 89 Matsushita MN10300,
>18 leshort 90 Matsushita MN10200,
>18 leshort 91 picoJava,
>18 leshort 92 OpenRISC,
>18 leshort 93 ARC Cores Tangent-A5,
>18 leshort 94 Tensilica Xtensa,
>18 leshort 95 Alphamosaic VideoCore,
>18 leshort 96 Thompson Multimedia,
>18 leshort 97 NatSemi 32k,
>18 leshort 98 Tenor Network TPC,
>18 leshort 99 Trebia SNP 1000,
>18 leshort 100 STMicroelectronics ST200,
>18 leshort 101 Ubicom IP2022,
>18 leshort 102 MAX Processor,
>18 leshort 103 NatSemi CompactRISC,
>18 leshort 104 Fujitsu F2MC16,
>18 leshort 105 TI msp430,
>18 leshort 106 Analog Devices Blackfin,
>18 leshort 107 S1C33 Family of Seiko Epson,
>18 leshort 108 Sharp embedded,
>18 leshort 109 Arca RISC,
>18 leshort 110 PKU-Unity Ltd.,
>18 leshort 111 eXcess: 16/32/64-bit,
>18 leshort 112 Icera Deep Execution Processor,
>18 leshort 113 Altera Nios II,
>18 leshort 114 NatSemi CRX,
>18 leshort 115 Motorola XGATE,
>18 leshort 116 Infineon C16x/XC16x,
>18 leshort 117 Renesas M16C series,
>18 leshort 118 Microchip dsPIC30F,
>18 leshort 119 Freescale RISC core,
>18 leshort 120 Renesas M32C series,
>18 leshort 131 Altium TSK3000 core,
>18 leshort 132 Freescale RS08,
>18 leshort 134 Cyan Technology eCOG2,
>18 leshort 135 Sunplus S+core7 RISC,
>18 leshort 136 New Japan Radio (NJR) 24-bit DSP,
>18 leshort 137 Broadcom VideoCore III,
>18 leshort 138 LatticeMico32,
>18 leshort 139 Seiko Epson C17 family,
>18 leshort 140 TI TMS320C6000 DSP family,
>18 leshort 141 TI TMS320C2000 DSP family,
>18 leshort 142 TI TMS320C55x DSP family,
>18 leshort 160 STMicroelectronics 64bit VLIW DSP,
>18 leshort 161 Cypress M8C,
>18 leshort 162 Renesas R32C series,
>18 leshort 163 NXP TriMedia family,
>18 leshort 164 QUALCOMM DSP6,
>18 leshort 165 Intel 8051 and variants,
>18 leshort 166 STMicroelectronics STxP7x family,
>18 leshort 167 Andes embedded RISC,
>18 leshort 168 Cyan eCOG1X family,
>18 leshort 169 Dallas MAXQ30,
>18 leshort 170 New Japan Radio (NJR) 16-bit DSP,
>18 leshort 171 M2000 Reconfigurable RISC,
>18 leshort 172 Cray NV2 vector architecture,
>18 leshort 173 Renesas RX family,
>18 leshort 174 META,
>18 leshort 175 MCST Elbrus,
>18 leshort 176 Cyan Technology eCOG16 family,
>18 leshort 177 NatSemi CompactRISC,
>18 leshort 178 Freescale Extended Time Processing Unit,
>18 leshort 179 Infineon SLE9X,
>18 leshort 180 Intel L1OM,
>18 leshort 181 Intel K1OM,
>18 leshort 183 ARM aarch64,
>18 leshort 185 Atmel 32-bit family,
>18 leshort 186 STMicroeletronics STM8 8-bit,
>18 leshort 187 Tilera TILE64,
>18 leshort 188 Tilera TILEPro,
>18 leshort 189 Xilinx MicroBlaze 32-bit RISC,
>18 leshort 190 NVIDIA CUDA architecture,
>18 leshort 191 Tilera TILE-Gx,
>18 leshort 197 Renesas RL78 family,
>18 leshort 199 Renesas 78K0R,
>18 leshort 200 Freescale 56800EX,
>18 leshort 201 Beyond BA1,
>18 leshort 202 Beyond BA2,
>18 leshort 203 XMOS xCORE,
>18 leshort 204 Microchip 8-bit PIC(r),
>18 leshort 210 KM211 KM32,
>18 leshort 211 KM211 KMX32,
>18 leshort 212 KM211 KMX16,
>18 leshort 213 KM211 KMX8,
>18 leshort 214 KM211 KVARC,
>18 leshort 215 Paneve CDP,
>18 leshort 216 Cognitive Smart Memory,
>18 leshort 217 iCelero CoolEngine,
>18 leshort 218 Nanoradio Optimized RISC,
>18 leshort 243 UCB RISC-V,
>18 leshort 0x1057 AVR (unofficial),
>18 leshort 0x1059 MSP430 (unofficial),
>18 leshort 0x1223 Adapteva Epiphany (unofficial),
>18 leshort 0x2530 Morpho MT (unofficial),
>18 leshort 0x3330 FR30 (unofficial),
>18 leshort 0x3426 OpenRISC (obsolete),
>18 leshort 0x4688 Infineon C166 (unofficial),
>18 leshort 0x5441 Cygnus FRV (unofficial),
>18 leshort 0x5aa5 DLX (unofficial),
>18 leshort 0x7650 Cygnus D10V (unofficial),
>18 leshort 0x7676 Cygnus D30V (unofficial),
>18 leshort 0x8217 Ubicom IP2xxx (unofficial),
>18 leshort 0x8472 OpenRISC (obsolete),
>18 leshort 0x9025 Cygnus PowerPC (unofficial),
>18 leshort 0x9026 Alpha (unofficial),
>18 leshort 0x9041 Cygnus M32R (unofficial),
>18 leshort 0x9080 Cygnus V850 (unofficial),
>18 leshort 0xa390 IBM S/390 (obsolete),
>18 leshort 0xabc7 Old Xtensa (unofficial),
>18 leshort 0xad45 xstormy16 (unofficial),
>18 leshort 0xbaab Old MicroBlaze (unofficial),,
>18 leshort 0xbeef Cygnus MN10300 (unofficial),
>18 leshort 0xdead Cygnus MN10200 (unofficial),
>18 leshort 0xf00d Toshiba MeP (unofficial),
>18 leshort 0xfeb0 Renesas M32C (unofficial),
>18 leshort 0xfeba Vitesse IQ2000 (unofficial),
>18 leshort 0xfebb NIOS (unofficial),
>18 leshort 0xfeed Moxie (unofficial),
>18 default x
>>18 leshort x *unknown arch 0x%x*
>20 lelong 0 invalid version
>20 lelong 1 version 1

0 string \177ELF ELF
!:strength *2
>4 byte 0 invalid class
>4 byte 1 32-bit
>4 byte 2 64-bit
>5 byte 0 invalid byte order
>5 byte 1 LSB
>>0 use elf-le
>5 byte 2 MSB
>>0 use \^elf-le
# Up to now only 0, 1 and 2 are defined; I've seen a file with 0x83, it seemed
# like proper ELF, but extracting the string had bad results.
>4 byte <0x80
>>8 string >\0 (%s)
>8 string \0
>>7 byte 0 (SYSV)
>>7 byte 1 (HP-UX)
>>7 byte 2 (NetBSD)
>>7 byte 3 (GNU/Linux)
>>7 byte 4 (GNU/Hurd)
>>7 byte 5 (86Open)
>>7 byte 6 (Solaris)
>>7 byte 7 (Monterey)
>>7 byte 8 (IRIX)
>>7 byte 9 (FreeBSD)
>>7 byte 10 (Tru64)
>>7 byte 11 (Novell Modesto)
>>7 byte 12 (OpenBSD)
>8 string \2
>>7 byte 13 (OpenVMS)
>>7 byte 97 (ARM)
>>7 byte 255 (embedded)
@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: encore,v 1.7 2014/04/30 21:41:02 christos Exp $
# encore: file(1) magic for Encore machines
#
# XXX - needs to have the byte order specified (NS32K was little-endian,
@@ -11,11 +12,11 @@
>20 short 0x10b demand-paged executable
>20 short 0x10f unsupported executable
>12 long >0 not stripped
>22 short >0 - version %ld
>22 short >0 - version %d
>22 short 0 -
#>4 date x stamp %s
0 short 0x155 Encore unsupported executable
>12 long >0 not stripped
>22 short >0 - version %ld
>22 short >0 - version %d
>22 short 0 -
#>4 date x stamp %s
@@ -1,29 +1,48 @@

#------------------------------------------------------------------------------
# $File: epoc,v 1.9 2013/12/21 14:28:15 christos Exp $
# EPOC : file(1) magic for EPOC documents [Psion Series 5/Osaris/Geofox 1]
# Stefan Praszalowicz <hpicollo@worldnet.fr> and Peter Breitenlohner <peb@mppmu.mpg.de>
# Useful information for improving this file can be found at:
# http://software.frodo.looijaard.name/psiconv/formats/Index.html
#------------------------------------------------------------------------------
# psion: file(1) magic for Psion handhelds data
# from: Peter Breitenlohner <peb@mppmu.mpg.de>
#
0 lelong 0x10000037 Psion Series 5
>4 lelong 0x10000039 font file
>4 lelong 0x1000003A printer driver
>4 lelong 0x1000003B clipboard
>4 lelong 0x10000042 multi-bitmap image
!:mime image/x-epoc-mbm
>4 lelong 0x1000006A application information file
>4 lelong 0x1000006D
>>8 lelong 0x1000007D sketch image
!:mime image/x-psion-sketch
>>8 lelong 0x1000007D Sketch image
!:mime image/x-epoc-sketch
>>8 lelong 0x1000007E voice note
>>8 lelong 0x1000007F word file
>>8 lelong 0x10000085 OPL program
>>8 lelong 0x10000088 sheet file
>>8 lelong 0x1000007F Word file
!:mime application/x-epoc-word
>>8 lelong 0x10000085 OPL program (TextEd)
!:mime application/x-epoc-opl
>>8 lelong 0x10000087 Comms settings
>>8 lelong 0x10000088 Sheet file
!:mime application/x-epoc-sheet
>>8 lelong 0x100001C4 EasyFax initialisation file
>4 lelong 0x10000073 OPO module
!:mime application/x-epoc-opo
>4 lelong 0x10000074 OPL application
!:mime application/x-epoc-app
>4 lelong 0x1000008A exported multi-bitmap image
>4 lelong 0x1000016D
>>8 lelong 0x10000087 Comms names

0 lelong 0x10000041 Psion Series 5 ROM multi-bitmap image

0 lelong 0x10000050 Psion Series 5
>4 lelong 0x1000006D database
>>8 lelong 0x10000084 Agenda file
!:mime application/x-epoc-agenda
>>8 lelong 0x10000086 Data file
!:mime application/x-epoc-data
>>8 lelong 0x10000CEA Jotter file
!:mime application/x-epoc-jotter
>4 lelong 0x100000E4 ini file

0 lelong 0x10000079 Psion Series 5 binary:
@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: erlang,v 1.6 2010/09/20 19:19:17 rrt Exp $
# erlang: file(1) magic for Erlang JAM and BEAM files
# URL: http://www.erlang.org/faq/x779.html#AEN812

@@ -16,3 +17,5 @@
79 string Tue\ Jan\ 22\ 14:32:44\ MET\ 1991 Erlang JAM file - version 4.2

4 string 1.0\ Fri\ Feb\ 3\ 09:55:56\ MET\ 1995 Erlang JAM file - version 4.3

0 bequad 0x0000000000ABCDEF Erlang DETS file
@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: esri,v 1.4 2009/09/19 16:28:09 christos Exp $
# ESRI Shapefile format (.shp .shx .dbf=DBaseIII)
# Based on info from
# <URL:http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf>
@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: fcs,v 1.4 2009/09/19 16:28:09 christos Exp $
# fcs: file(1) magic for FCS (Flow Cytometry Standard) data files
# From Roger Leigh <roger@whinlatter.uklinux.net>
0 string FCS1.0 Flow Cytometry Standard (FCS) data, version 1.0

Large diffs are not rendered by default.

@@ -0,0 +1,40 @@

#------------------------------------------------------------------------------
# $File: flash,v 1.11 2014/05/02 00:26:49 christos Exp $
# flash: file(1) magic for Macromedia Flash file format
#
# See
#
# http://www.macromedia.com/software/flash/open/
# http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/\
# en/devnet/swf/pdf/swf-file-format-spec.pdf page 27
#

0 name swf-details
>0 string F Macromedia Flash data
!:mime application/x-shockwave-flash
>0 string C Macromedia Flash data (compressed)
!:mime application/x-shockwave-flash
>0 string Z Macromedia Flash data (lzma compressed)
!:mime application/x-shockwave-flash
>3 byte x \b, version %d

1 string WS
>4 lelong !0
>>3 byte 255 Suspicious
>>>0 use swf-details

>>3 ubyte <32
>>>3 ubyte !0
>>>>0 use swf-details

# From: Cal Peake <cp@absolutedigital.net>
0 string FLV\x01 Macromedia Flash Video
!:mime video/x-flv

#
# Yosu Gomez
0 string AGD2\xbe\xb8\xbb\xcd\x00 Macromedia Freehand 7 Document
0 string AGD3\xbe\xb8\xbb\xcc\x00 Macromedia Freehand 8 Document
# From Dave Wilson
0 string AGD4\xbe\xb8\xbb\xcb\x00 Macromedia Freehand 9 Document
@@ -1,4 +1,6 @@

#------------------------------------------------------------------------------
# $File: fonts,v 1.27 2014/04/30 21:41:02 christos Exp $
# fonts: file(1) magic for font data
#
0 search/1 FONT ASCII vfont text
@@ -9,10 +11,20 @@
0 string %!PS-AdobeFont-1. PostScript Type 1 font text
>20 string >\0 (%s)
6 string %!PS-AdobeFont-1. PostScript Type 1 font program data
0 string %!FontType1 PostScript Type 1 font program data
6 string %!FontType1 PostScript Type 1 font program data
0 string %!PS-Adobe-3.0\ Resource-Font PostScript Type 1 font text

# X11 font files in SNF (Server Natural Format) format
# updated by Joerg Jenderek at Feb 2013
# http://computer-programming-forum.com/51-perl/8f22fb96d2e34bab.htm
0 belong 00000004 X11 SNF font data, MSB first
0 lelong 00000004 X11 SNF font data, LSB first
#>104 belong 00000004 X11 SNF font data, MSB first
!:mime application/x-font-sfn
# GRR: line below too general as it catches also Xbase index file t3-CHAR.NDX
0 lelong 00000004
>104 lelong 00000004 X11 SNF font data, LSB first
!:mime application/x-font-sfn

# X11 Bitmap Distribution Format, from Daniel Quinlan (quinlan@yggdrasil.com)
0 search/1 STARTFONT\ X11 BDF font text
@@ -51,15 +63,38 @@

# True Type fonts
0 string \000\001\000\000\000 TrueType font data
!:mime application/x-font-ttf

0 string \007\001\001\000Copyright\ (c)\ 199 Adobe Multiple Master font
0 string \012\001\001\000Copyright\ (c)\ 199 Adobe Multiple Master font

# TrueType/OpenType font collections (.ttc)
# http://www.microsoft.com/typography/otspec/otff.htm
0 string ttcf TrueType font collection data
>4 belong 0x00010000 \b, 1.0
>>8 belong >0 \b, %d fonts
>4 belong 0x00020000 \b, 2.0
>>8 belong >0 \b, %d fonts
# 0x44454947 = 'DSIG'
>>>16 belong 0x44534947 \b, digitally signed

# Opentype font data from Avi Bercovich
0 string OTTO OpenType font data
0 string OTTO OpenType font data
!:mime application/vnd.ms-opentype

# Gürkan Sengün <gurkan@linuks.mine.nu>, www.linuks.mine.nu
# Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu
0 string SplineFontDB: Spline Font Database
!:mime application/vnd.font-fontforge-sfd
>14 string x version %s

# EOT
34 string LP Embedded OpenType (EOT)
!:mime application/vnd.ms-fontobject

# Web Open Font Format (.woff)
# http://www.w3.org/TR/WOFF/
0 string wOFF Web Open Font Format
>4 belong x \b, flavor %d
>8 belong x \b, length %d
>20 beshort x \b, version %d
>22 beshort x \b.%d
@@ -0,0 +1,7 @@

#------------------------------------------------------------------------------
# $File: fortran,v 1.8 2014/06/03 19:01:34 christos Exp $
# FORTRAN source
0 regex/100l \^[Cc][\ \t] FORTRAN program
!:mime text/x-fortran
!:strength - 5
@@ -1,4 +1,6 @@

#------------------------------------------------------------------------------
# $File: frame,v 1.12 2009/09/19 16:28:09 christos Exp $
# frame: file(1) magic for FrameMaker files
#
# This stuff came on a FrameMaker demo tape, most of which is
@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: freebsd,v 1.7 2009/09/19 16:28:09 christos Exp $
# freebsd: file(1) magic for FreeBSD objects
#
# All new-style FreeBSD magic numbers are in host byte order (i.e.,
@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: fsav,v 1.13 2013/03/25 17:18:47 christos Exp $
# fsav: file(1) magic for datafellows fsav virus definition files
# Anthon van der Neut (anthon@mnt.org)

@@ -60,3 +61,6 @@
# Type: Grisoft AVG AntiVirus
# From: David Newgas <david@newgas.net>
0 string AVG7_ANTIVIRUS_VAULT_FILE AVG 7 Antivirus vault file data

0 string X5O!P%@AP[4\\PZX54(P^)7CC)7}$EICAR
>33 string -STANDARD-ANTIVIRUS-TEST-FILE!$H+H* EICAR virus test files
@@ -0,0 +1,12 @@

#------------------------------------------------------------------------------
# $File: fusecompress,v 1.2 2011/08/08 09:05:55 christos Exp $
# fusecompress: file(1) magic for fusecompress
0 string \037\135\211 FuseCompress(ed) data
>3 byte 0x00 (none format)
>3 byte 0x01 (bz2 format)
>3 byte 0x02 (gz format)
>3 byte 0x03 (lzo format)
>3 byte 0x04 (xor format)
>3 byte >0x04 (unknown format)
>4 long x uncompressed size: %d
@@ -1,17 +1,19 @@

#------------------------------------------------------------------------------
# $File: games,v 1.14 2014/04/30 21:41:02 christos Exp $
# games: file(1) for games

# Fabio Bonelli <fabiobonelli@libero.it>
# Quake II - III data files
0 string IDP2 Quake II 3D Model file,
>20 long x %lu skin(s),
>8 long x (%lu x
>12 long x %lu),
>40 long x %lu frame(s),
>16 long x Frame size %lu bytes,
>24 long x %lu vertices/frame,
>28 long x %lu texture coordinates,
>32 long x %lu triangles/frame
>20 long x %u skin(s),
>8 long x (%u x
>12 long x %u),
>40 long x %u frame(s),
>16 long x Frame size %u bytes,
>24 long x %u vertices/frame,
>28 long x %u texture coordinates,
>32 long x %u triangles/frame

0 string IBSP Quake
>4 long 0x26 II Map file (BSP)
@@ -33,6 +35,7 @@
# Quake

0 string PACK Quake I or II world or extension
>8 lelong >0 \b, %d entries

#0 string -1\x0a Quake I demo
#>30 string x version %.4s
@@ -143,7 +146,7 @@


0 string MComprHD MAME CHD compressed hard disk image,
>12 belong x version %lu
>12 belong x version %u

# doom - submitted by Jon Dowland

@@ -152,6 +155,11 @@
0 string =PWAD doom patch PWAD data
>4 lelong x containing %d lumps

# Build engine group files (Duke Nukem, Shadow Warrior, ...)
# Extension: .grp
# Created by: "Ganael Laplanche" <ganael.laplanche@martymac.org>
0 string KenSilverman Build engine group file
>12 lelong x containing %d files

# Summary: Warcraft 3 save
# Extension: .w3g
@@ -172,7 +180,7 @@
# Modified by (1): Abel Cheung (regex, more game format)
# FIXME: Some games don't have GM (game type)
0 regex \\(;.*GM\\[[0-9]{1,2}\\] Smart Game Format
>2 search/0x200 GM[
>2 search/0x200/b GM[
>>&0 string 1] (Go)
>>&0 string 2] (Othello)
>>&0 string 3] (chess)
@@ -214,13 +222,6 @@
>>&0 string 39] (Gipf)
>>&0 string 40] (Kropki)


# Summary: Civilization 4 video
# Extension: .bik
# Created by: Abel Cheung <abelcheung@gmail.com>
0 string BIKi Civilization 4 Video


##############################################
# NetImmerse/Gamebryo game engine entries

@@ -243,3 +244,22 @@
>&0 string n\ NetImmerse game engine file
>>&0 regex [0-9a-z.]+ \b, version %s

# Type: SGF Smart Game Format
# URL: http://www.red-bean.com/sgf/
# From: Eduardo Sabbatella <eduardo_sabbatella@yahoo.com.ar>
2 regex/c \\(;.*GM\\[[0-9]{1,2}\\] Smart Game Format
>2 regex/c GM\\[1\\] - Go Game
>2 regex/c GM\\[6\\] - BackGammon Game
>2 regex/c GM\\[11\\] - Hex Game
>2 regex/c GM\\[18\\] - Amazons Game
>2 regex/c GM\\[19\\] - Octi Game
>2 regex/c GM\\[20\\] - Gess Game
>2 regex/c GM\\[21\\] - twix Game

# Epic Games/Unreal Engine Package
#
0 lelong 0x9E2A83C1 Unreal Engine Package,
>4 leshort x version: %i
>12 lelong !0 \b, names: %i
>28 lelong !0 \b, imports: %i
>20 lelong !0 \b, exports: %i
@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: gcc,v 1.4 2009/09/19 16:28:09 christos Exp $
# gcc: file(1) magic for GCC special files
#
0 string gpch GCC precompiled header
@@ -0,0 +1,117 @@

#------------------------------------------------------------------------------
# $File: geo,v 1.3 2013/01/04 00:47:02 christos Exp $
# Geo- files from Kurt Schwehr <schwehr@ccom.unh.edu>

######################################################################
#
# Acoustic Doppler Current Profilers (ADCP)
#
######################################################################

0 beshort 0x7f7f RDI Acoustic Doppler Current Profiler (ADCP)

######################################################################
#
# Metadata
#
######################################################################

0 string Identification_Information FGDC ASCII metadata

######################################################################
#
# Seimsic / Subbottom
#
######################################################################

# Knudsen subbottom chirp profiler - Binary File Format: B9
# KEB D409-03167 V1.75 Huffman
0 string KEB\ Knudsen seismic KEL binary (KEB) -
>4 regex [-A-Z0-9]* Software: %s
>>&1 regex V[0-9]*\.[0-9]* version %s

######################################################################
#
# LIDAR - Laser altimetry or bathy
#
######################################################################


# Caris LIDAR format for LADS comes as two parts... ascii location file and binary waveform data
0 string HCA LADS Caris Ascii Format (CAF) bathymetric lidar
>4 regex [0-9]*\.[0-9]* version %s

0 string HCB LADS Caris Binary Format (CBF) bathymetric lidar waveform data
>3 byte x version %d .
>4 byte x %d


######################################################################
#
# MULTIBEAM SONARS http://www.ldeo.columbia.edu/res/pi/MB-System/formatdoc/
#
######################################################################

# GeoAcoustics - GeoSwath Plus
4 beshort 0x2002 GeoSwath RDF
0 string Start:- GeoSwatch auf text file

# Seabeam 2100
# mbsystem code mb41
0 string SB2100 SeaBeam 2100 multibeam sonar
0 string SB2100DR SeaBeam 2100 DR multibeam sonar
0 string SB2100PR SeaBeam 2100 PR multibeam sonar

# This corresponds to MB-System format 94, L-3/ELAC/SeaBeam XSE vendor
# format. It is the format of our upgraded SeaBeam 2112 on R/V KNORR.
0 string $HSF XSE multibeam

# mb121 http://www.saic.com/maritime/gsf/
8 string GSF-v SAIC generic sensor format (GSF) sonar data,
>&0 regex [0-9]*\.[0-9]* version %s

# MGD77 - http://www.ngdc.noaa.gov/mgg/dat/geodas/docs/mgd77.htm
# mb161
9 string MGD77 MGD77 Header, Marine Geophysical Data Exchange Format

# MBSystem processing caches the mbinfo output
1 string Swath\ Data\ File: mbsystem info cache

# Caris John Hughes Clark format
0 string HDCS Caris multibeam sonar related data
1 string Start/Stop\ parameter\ header: Caris ASCII project summary

######################################################################
#
# Visualization and 3D modeling
#
######################################################################

# IVS - IVS3d.com Tagged Data Represetation
0 string %%\ TDR\ 2.0 IVS Fledermaus TDR file

# http://www.ecma-international.org/publications/standards/Ecma-363.htm
# 3D in PDFs
0 string U3D ECMA-363, Universal 3D

######################################################################
#
# Support files
#
######################################################################

# https://midas.psi.ch/elog/
0 string $@MID@$ elog journal entry

# Geospatial Designs http://www.geospatialdesigns.com/surfer6_format.htm
0 string DSBB Surfer 6 binary grid file
>4 leshort x \b, %d
>6 leshort x \bx%d
>8 ledouble x \b, minx=%g
>16 ledouble x \b, maxx=%g
>24 ledouble x \b, miny=%g
>32 ledouble x \b, maxy=%g
>40 ledouble x \b, minz=%g
>48 ledouble x \b, maxz=%g

@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: geos,v 1.4 2009/09/19 16:28:09 christos Exp $
# GEOS files (Vidar Madsen, vidar@gimp.org)
# semi-commonly used in embedded and handheld systems.
0 belong 0xc745c153 GEOS
@@ -1,35 +1,42 @@

#------------------------------------------------------------------------------
# GIMP Gradient: file(1) magic for the GIMP's gradient data files
# $File: gimp,v 1.9 2014/04/30 21:41:02 christos Exp $
# GIMP Gradient: file(1) magic for the GIMP's gradient data files (.ggr)
# by Federico Mena <federico@nuclecu.unam.mx>

0 string GIMP\ Gradient GIMP gradient data
0 string/t GIMP\ Gradient GIMP gradient data

# GIMP palette (.gpl)
# From: Markus Heidelberg <markus.heidelberg@web.de>
0 string/t GIMP\ Palette GIMP palette data

#------------------------------------------------------------------------------
# XCF: file(1) magic for the XCF image format used in the GIMP developed
# XCF: file(1) magic for the XCF image format used in the GIMP (.xcf) developed
# by Spencer Kimball and Peter Mattis
# ('Bucky' LaDieu, nega@vt.edu)

0 string gimp\ xcf GIMP XCF image data,
!:mime image/x-xcf
>9 string file version 0,
>9 string v version
>>10 string >\0 %s,
>14 belong x %lu x
>18 belong x %lu,
>14 belong x %u x
>18 belong x %u,
>22 belong 0 RGB Color
>22 belong 1 Greyscale
>22 belong 2 Indexed Color
>22 belong >2 Unknown Image Type.

#------------------------------------------------------------------------------
# XCF: file(1) magic for the patterns used in the GIMP, developed
# XCF: file(1) magic for the patterns used in the GIMP (.pat), developed
# by Spencer Kimball and Peter Mattis
# ('Bucky' LaDieu, nega@vt.edu)

20 string GPAT GIMP pattern data,
>24 string x %s

#------------------------------------------------------------------------------
# XCF: file(1) magic for the brushes used in the GIMP, developed
# XCF: file(1) magic for the brushes used in the GIMP (.gbr), developed
# by Spencer Kimball and Peter Mattis
# ('Bucky' LaDieu, nega@vt.edu)

@@ -0,0 +1,59 @@

#------------------------------------------------------------------------------
# $File: gnome,v 1.5 2014/04/30 21:41:02 christos Exp $
# GNOME related files

# Contributed by Josh Triplett
# FIXME: Could be simplified if pstring supported two-byte counts
0 string GnomeKeyring\n\r\0\n GNOME keyring
>&0 ubyte 0 \b, major version 0
>>&0 ubyte 0 \b, minor version 0
>>>&0 ubyte 0 \b, crypto type 0 (AES)
>>>&0 ubyte >0 \b, crypto type %u (unknown)
>>>&1 ubyte 0 \b, hash type 0 (MD5)
>>>&1 ubyte >0 \b, hash type %u (unknown)
>>>&2 ubelong 0xFFFFFFFF \b, name NULL
>>>&2 ubelong !0xFFFFFFFF
>>>>&-4 ubelong >255 \b, name too long for file's pstring type
>>>>&-4 ubelong <256
>>>>>&-1 pstring x \b, name "%s"
>>>>>>&0 ubeqdate x \b, last modified %s
>>>>>>&8 ubeqdate x \b, created %s
>>>>>>&16 ubelong &1
>>>>>>>&0 ubelong x \b, locked if idle for %u seconds
>>>>>>&16 ubelong ^1 \b, not locked if idle
>>>>>>&24 ubelong x \b, hash iterations %u
>>>>>>&28 ubequad x \b, salt %llu
>>>>>>&52 ubelong x \b, %u item(s)

# From: Alex Beregszaszi <alex@fsn.hu>
4 string gtktalog GNOME Catalogue (gtktalog)
>13 string >\0 version %s

# Summary: GStreamer binary registry
# Extension: .bin
# Submitted by: Josh Triplett <josh@joshtriplett.org>
0 belong 0xc0def00d GStreamer binary registry
>4 string x \b, version %s

# GVariant Database file
# By Elan Ruusamae <glen@delfi.ee>
# https://github.com/GNOME/gvdb/blob/master/gvdb-format.h
# It's always "GVariant", it's byte swapped on incompatible archs
# See https://github.com/GNOME/gvdb/blob/master/gvdb-builder.c
# file_builder_serialise()
# http://developer.gnome.org/glib/2.34/glib-GVariant.html#GVariant
0 string GVariant GVariant Database file,
# version is never filled. probably future extension
>8 lelong x version %d
# not sure are these usable, so commented out
#>>16 lelong x start %d,
#>>>20 lelong x end %d

# G-IR database made by gobject-introspect toolset,
# http://live.gnome.org/GObjectIntrospection
0 string GOBJ\nMETADATA\r\n\032 G-IR binary database
>16 byte x \b, v%d
>17 byte x \b.%d
>20 leshort x \b, %d entries
>22 leshort x \b/%d local
@@ -0,0 +1,83 @@

#------------------------------------------------------------------------------
# $File: gnu,v 1.15 2014/02/06 14:21:02 christos Exp $
# gnu: file(1) magic for various GNU tools
#
# GNU nlsutils message catalog file format
#
# GNU message catalog (.mo and .gmo files)

0 string \336\22\4\225 GNU message catalog (little endian),
>6 leshort x revision %d.
>4 leshort >0 \b%d,
>>8 lelong x %d messages,
>>36 lelong x %d sysdep messages
>4 leshort =0 \b%d,
>>8 lelong x %d messages

0 string \225\4\22\336 GNU message catalog (big endian),
>4 beshort x revision %d.
>6 beshort >0 \b%d,
>>8 belong x %d messages,
>>36 belong x %d sysdep messages
>6 beshort =0 \b%d,
>>8 belong x %d messages


# GnuPG
# The format is very similar to pgp
0 string \001gpg GPG key trust database
>4 byte x version %d
# Note: magic.mime had 0x8501 for the next line instead of 0x8502
0 beshort 0x8502 GPG encrypted data
!:mime text/PGP # encoding: data

# This magic is not particularly good, as the keyrings don't have true
# magic. Nevertheless, it covers many keyrings.
0 beshort 0x9901 GPG key public ring
!:mime application/x-gnupg-keyring

# Symmetric encryption
0 leshort 0x0d8c
>4 leshort 0x0203
>>2 leshort 0x0204 GPG symmetrically encrypted data (3DES cipher)
>>2 leshort 0x0304 GPG symmetrically encrypted data (CAST5 cipher)
>>2 leshort 0x0404 GPG symmetrically encrypted data (BLOWFISH cipher)
>>2 leshort 0x0704 GPG symmetrically encrypted data (AES cipher)
>>2 leshort 0x0804 GPG symmetrically encrypted data (AES192 cipher)
>>2 leshort 0x0904 GPG symmetrically encrypted data (AES256 cipher)
>>2 leshort 0x0a04 GPG symmetrically encrypted data (TWOFISH cipher)
>>2 leshort 0x0b04 GPG symmetrically encrypted data (CAMELLIA128 cipher)
>>2 leshort 0x0c04 GPG symmetrically encrypted data (CAMELLIA192 cipher)
>>2 leshort 0x0d04 GPG symmetrically encrypted data (CAMELLIA256 cipher)


# GnuPG Keybox file
# <http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob;f=kbx/keybox-blob.c;hb=HEAD>
# From: Philipp Hahn <hahn@univention.de>
0 belong 32
>4 byte 1
>>8 string KBXf GPG keybox database
>>>5 byte 1 version %d
>>>16 bedate x \b, created-at %s
>>>20 bedate x \b, last-maintained %s


# Gnumeric spreadsheet
# This entry is only semi-helpful, as Gnumeric compresses its files, so
# they will ordinarily reported as "compressed", but at least -z helps
39 string =<gmr:Workbook Gnumeric spreadsheet

# From: James Youngman <jay@gnu.org>
# gnu find magic
0 string \0LOCATE GNU findutils locate database data
>7 string >\0 \b, format %s
>7 string 02 \b (frcode)

# Files produced by GNU gettext
0 long 0xDE120495 GNU-format message catalog data
0 long 0x950412DE GNU-format message catalog data

# gettext message catalogue
0 regex \^msgid\ GNU gettext message catalogue text
!:mime text/x-po
@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: gnumeric,v 1.4 2009/09/19 16:28:09 christos Exp $
# gnumeric: file(1) magic for Gnumeric spreadsheet
# This entry is only semi-helpful, as Gnumeric compresses its files, so
# they will ordinarily reported as "compressed", but at least -z helps
@@ -0,0 +1,240 @@

#------------------------------------------------------------------------------
# $File: gpt,v 1.3 2014/04/30 21:41:02 christos Exp $
#
# GPT Partition table patterns.
# Author: Rogier Goossens (goossens.rogier@gmail.com)
# Note that a GPT-formatted disk must contain an MBR as well.
#

# The initial segment (up to >>>>>>>>422) was copied from the X86
# partition table code (aka MBR).
# This is kept separate, so that MBR partitions are not reported as well.
# (use -k if you do want them as well)

# First, detect the MBR partiton table
# If more than one GPT protective MBR partition exists, don't print anything
# (the other MBR detection code will then just print the MBR partition table)
0x1FE leshort 0xAA55
>3 string !MS
>>3 string !SYSLINUX
>>>3 string !MTOOL
>>>>3 string !NEWLDR
>>>>>5 string !DOS
# not FAT (32 bit)
>>>>>>82 string !FAT32
#not Linux kernel
>>>>>>>514 string !HdrS
#not BeOS
>>>>>>>>422 string !Be\ Boot\ Loader
# GPT with protective MBR entry in partition 1 (only)
>>>>>>>>>450 ubyte 0xee
>>>>>>>>>>466 ubyte !0xee
>>>>>>>>>>>482 ubyte !0xee
>>>>>>>>>>>>498 ubyte !0xee
#>>>>>>>>>>>>>446 use gpt-mbr-partition
>>>>>>>>>>>>>(454.l*8192) string EFI\ PART GPT partition table
>>>>>>>>>>>>>>0 use gpt-mbr-type
>>>>>>>>>>>>>>&-8 use gpt-table
>>>>>>>>>>>>>>0 ubyte x of 8192 bytes
>>>>>>>>>>>>>(454.l*8192) string !EFI\ PART
>>>>>>>>>>>>>>(454.l*4096) string EFI\ PART GPT partition table
>>>>>>>>>>>>>>>0 use gpt-mbr-type
>>>>>>>>>>>>>>>&-8 use gpt-table
>>>>>>>>>>>>>>>0 ubyte x of 4096 bytes
>>>>>>>>>>>>>>(454.l*4096) string !EFI\ PART
>>>>>>>>>>>>>>>(454.l*2048) string EFI\ PART GPT partition table
>>>>>>>>>>>>>>>>0 use gpt-mbr-type
>>>>>>>>>>>>>>>>&-8 use gpt-table
>>>>>>>>>>>>>>>>0 ubyte x of 2048 bytes
>>>>>>>>>>>>>>>(454.l*2048) string !EFI\ PART
>>>>>>>>>>>>>>>>(454.l*1024) string EFI\ PART GPT partition table
>>>>>>>>>>>>>>>>>0 use gpt-mbr-type
>>>>>>>>>>>>>>>>>&-8 use gpt-table
>>>>>>>>>>>>>>>>>0 ubyte x of 1024 bytes
>>>>>>>>>>>>>>>>(454.l*1024) string !EFI\ PART
>>>>>>>>>>>>>>>>>(454.l*512) string EFI\ PART GPT partition table
>>>>>>>>>>>>>>>>>>0 use gpt-mbr-type
>>>>>>>>>>>>>>>>>>&-8 use gpt-table
>>>>>>>>>>>>>>>>>>0 ubyte x of 512 bytes
# GPT with protective MBR entry in partition 2 (only)
>>>>>>>>>450 ubyte !0xee
>>>>>>>>>>466 ubyte 0xee
>>>>>>>>>>>482 ubyte !0xee
>>>>>>>>>>>>498 ubyte !0xee
#>>>>>>>>>>>>>462 use gpt-mbr-partition
>>>>>>>>>>>>>(470.l*8192) string EFI\ PART GPT partition table
>>>>>>>>>>>>>>0 use gpt-mbr-type
>>>>>>>>>>>>>>&-8 use gpt-table
>>>>>>>>>>>>>>0 ubyte x of 8192 bytes
>>>>>>>>>>>>>(470.l*8192) string !EFI\ PART
>>>>>>>>>>>>>>(470.l*4096) string EFI\ PART GPT partition table
>>>>>>>>>>>>>>>0 use gpt-mbr-type
>>>>>>>>>>>>>>>&-8 use gpt-table
>>>>>>>>>>>>>>>0 ubyte x of 4096 bytes
>>>>>>>>>>>>>>(470.l*4096) string !EFI\ PART
>>>>>>>>>>>>>>>(470.l*2048) string EFI\ PART GPT partition table
>>>>>>>>>>>>>>>>0 use gpt-mbr-type
>>>>>>>>>>>>>>>>&-8 use gpt-table
>>>>>>>>>>>>>>>>0 ubyte x of 2048 bytes
>>>>>>>>>>>>>>>(470.l*2048) string !EFI\ PART
>>>>>>>>>>>>>>>>(470.l*1024) string EFI\ PART GPT partition table
>>>>>>>>>>>>>>>>>0 use gpt-mbr-type
>>>>>>>>>>>>>>>>>&-8 use gpt-table
>>>>>>>>>>>>>>>>>0 ubyte x of 1024 bytes
>>>>>>>>>>>>>>>>(470.l*1024) string !EFI\ PART
>>>>>>>>>>>>>>>>>(470.l*512) string EFI\ PART GPT partition table
>>>>>>>>>>>>>>>>>>0 use gpt-mbr-type
>>>>>>>>>>>>>>>>>>&-8 use gpt-table
>>>>>>>>>>>>>>>>>>0 ubyte x of 512 bytes
# GPT with protective MBR entry in partition 3 (only)
>>>>>>>>>450 ubyte !0xee
>>>>>>>>>>466 ubyte !0xee
>>>>>>>>>>>482 ubyte 0xee
>>>>>>>>>>>>498 ubyte !0xee
#>>>>>>>>>>>>>478 use gpt-mbr-partition
>>>>>>>>>>>>>(486.l*8192) string EFI\ PART GPT partition table
>>>>>>>>>>>>>>0 use gpt-mbr-type
>>>>>>>>>>>>>>&-8 use gpt-table
>>>>>>>>>>>>>>0 ubyte x of 8192 bytes
>>>>>>>>>>>>>(486.l*8192) string !EFI\ PART
>>>>>>>>>>>>>>(486.l*4096) string EFI\ PART GPT partition table
>>>>>>>>>>>>>>>0 use gpt-mbr-type
>>>>>>>>>>>>>>>&-8 use gpt-table
>>>>>>>>>>>>>>>0 ubyte x of 4096 bytes
>>>>>>>>>>>>>>(486.l*4096) string !EFI\ PART
>>>>>>>>>>>>>>>(486.l*2048) string EFI\ PART GPT partition table
>>>>>>>>>>>>>>>>0 use gpt-mbr-type
>>>>>>>>>>>>>>>>&-8 use gpt-table
>>>>>>>>>>>>>>>>0 ubyte x of 2048 bytes
>>>>>>>>>>>>>>>(486.l*2048) string !EFI\ PART
>>>>>>>>>>>>>>>>(486.l*1024) string EFI\ PART GPT partition table
>>>>>>>>>>>>>>>>>0 use gpt-mbr-type
>>>>>>>>>>>>>>>>>&-8 use gpt-table
>>>>>>>>>>>>>>>>>0 ubyte x of 1024 bytes
>>>>>>>>>>>>>>>>(486.l*1024) string !EFI\ PART
>>>>>>>>>>>>>>>>>(486.l*512) string EFI\ PART GPT partition table
>>>>>>>>>>>>>>>>>>0 use gpt-mbr-type
>>>>>>>>>>>>>>>>>>&-8 use gpt-table
>>>>>>>>>>>>>>>>>>0 ubyte x of 512 bytes
# GPT with protective MBR entry in partition 4 (only)
>>>>>>>>>450 ubyte !0xee
>>>>>>>>>>466 ubyte !0xee
>>>>>>>>>>>482 ubyte !0xee
>>>>>>>>>>>>498 ubyte 0xee
#>>>>>>>>>>>>>494 use gpt-mbr-partition
>>>>>>>>>>>>>(502.l*8192) string EFI\ PART GPT partition table
>>>>>>>>>>>>>>0 use gpt-mbr-type
>>>>>>>>>>>>>>&-8 use gpt-table
>>>>>>>>>>>>>>0 ubyte x of 8192 bytes
>>>>>>>>>>>>>(502.l*8192) string !EFI\ PART
>>>>>>>>>>>>>>(502.l*4096) string EFI\ PART GPT partition table
>>>>>>>>>>>>>>>0 use gpt-mbr-type
>>>>>>>>>>>>>>>&-8 use gpt-table
>>>>>>>>>>>>>>>0 ubyte x of 4096 bytes
>>>>>>>>>>>>>>(502.l*4096) string !EFI\ PART
>>>>>>>>>>>>>>>(502.l*2048) string EFI\ PART GPT partition table
>>>>>>>>>>>>>>>>0 use gpt-mbr-type
>>>>>>>>>>>>>>>>&-8 use gpt-table
>>>>>>>>>>>>>>>>0 ubyte x of 2048 bytes
>>>>>>>>>>>>>>>(502.l*2048) string !EFI\ PART
>>>>>>>>>>>>>>>>(502.l*1024) string EFI\ PART GPT partition table
>>>>>>>>>>>>>>>>>0 use gpt-mbr-type
>>>>>>>>>>>>>>>>>&-8 use gpt-table
>>>>>>>>>>>>>>>>>0 ubyte x of 1024 bytes
>>>>>>>>>>>>>>>>(502.l*1024) string !EFI\ PART
>>>>>>>>>>>>>>>>>(502.l*512) string EFI\ PART GPT partition table
>>>>>>>>>>>>>>>>>>0 use gpt-mbr-type
>>>>>>>>>>>>>>>>>>&-8 use gpt-table
>>>>>>>>>>>>>>>>>>0 ubyte x of 512 bytes

# The following code does GPT detection and processing, including
# sector size detection.
# It has to be duplicated above because the top-level pattern
# (i.e. not called using 'use') must print *something* for file
# to count it as a match. Text only printed in named patterns is
# not counted, and causes file to continue, and try and match
# other patterns.
#
# Unfortunately, when assuming sector sizes >=16k, if the sector size
# happens to be 512 instead, we may find confusing data after the GPT
# table... If the GPT table has less than 128 entries, this may even
# happen for assumed sector sizes as small as 4k
# This could be solved by checking for the presence of the backup GPT
# header as well, but that makes the logic extremely complex
##0 name gpt-mbr-partition
##>(8.l*8192) string EFI\ PART
##>>(8.l*8192) use gpt-mbr-type
##>>&-8 use gpt-table
##>>0 ubyte x of 8192 bytes
##>(8.l*8192) string !EFI\ PART
##>>(8.l*4096) string EFI\ PART GPT partition table
##>>>0 use gpt-mbr-type
##>>>&-8 use gpt-table
##>>>0 ubyte x of 4096 bytes
##>>(8.l*4096) string !EFI\ PART
##>>>(8.l*2048) string EFI\ PART GPT partition table
##>>>>0 use gpt-mbr-type
##>>>>&-8 use gpt-table
##>>>>0 ubyte x of 2048 bytes
##>>>(8.l*2048) string !EFI\ PART
##>>>>(8.l*1024) string EFI\ PART GPT partition table
##>>>>>0 use gpt-mbr-type
##>>>>>&-8 use gpt-table
##>>>>>0 ubyte x of 1024 bytes
##>>>>(8.l*1024) string !EFI\ PART
##>>>>>(8.l*512) string EFI\ PART GPT partition table
##>>>>>>0 use gpt-mbr-type
##>>>>>>&-8 use gpt-table
##>>>>>>0 ubyte x of 512 bytes

# Print details of MBR type for a GPT-disk
# Calling code ensures that there is only one 0xee partition.
0 name gpt-mbr-type
# GPT with protective MBR entry in partition 1
>450 ubyte 0xee
>>454 ulelong 1
>>>462 string !\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \b (with hybrid MBR)
>>454 ulelong !1 \b (nonstandard: not at LBA 1)
# GPT with protective MBR entry in partition 2
>466 ubyte 0xee
>>470 ulelong 1
>>>478 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
>>>>446 string !\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \b (with hybrid MBR)
>>>478 string !\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \b (with hybrid MBR)
>>470 ulelong !1 \b (nonstandard: not at LBA 1)
# GPT with protective MBR entry in partition 3
>482 ubyte 0xee
>>486 ulelong 1
>>>494 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
>>>>446 string !\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \b (with hybrid MBR)
>>>494 string !\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \b (with hybrid MBR)
>>486 ulelong !1 \b (nonstandard: not at LBA 1)
# GPT with protective MBR entry in partition 4
>498 ubyte 0xee
>>502 ulelong 1
>>>446 string !\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \b (with hybrid MBR)
>>502 ulelong !1 \b (nonstandard: not at LBA 1)

# Print the information from a GPT partition table structure
0 name gpt-table
>10 uleshort x \b, version %u
>8 uleshort x \b.%u
>56 ulelong x \b, GUID: %08x
>60 uleshort x \b-%04x
>62 uleshort x \b-%04x
>64 ubeshort x \b-%04x
>66 ubeshort x \b-%04x
>68 ubelong x \b%08x
#>80 uleshort x \b, %d partition entries
>32 ulequad+1 x \b, disk size: %lld sectors

# In case a GPT data-structure is at LBA 0, report it as well
# This covers systems which are not GPT-aware, and which show
# and allow access to the protective partition. This code will
# detect the contents of such a partition.
0 string EFI\ PART GPT data structure (nonstandard: at LBA 0)
>0 use gpt-table
>0 ubyte x (sector size unknown)


@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: grace,v 1.4 2009/09/19 16:28:09 christos Exp $
# ACE/gr and Grace type files - PLEASE DO NOT REMOVE THIS LINE
#
# ACE/gr binary
@@ -1,10 +1,12 @@

#------------------------------------------------------------------------------
# $File: graphviz,v 1.8 2014/06/03 19:01:34 christos Exp $
# graphviz: file(1) magic for http://www.graphviz.org/

# FIXME: These patterns match too generally. For example, the first
# line matches a LaTeX file containing the word "graph" (with a {
# following later) and the second line matches this file.
#0 regex/100 [\r\n\t\ ]*graph[\r\n\t\ ]+.*\\{ graphviz graph text
#0 regex/100l [\r\n\t\ ]*graph[\r\n\t\ ]+.*\\{ graphviz graph text
#!:mime text/vnd.graphviz
#0 regex/100 [\r\n\t\ ]*digraph[\r\n\t\ ]+.*\\{ graphviz digraph text
#0 regex/100l [\r\n\t\ ]*digraph[\r\n\t\ ]+.*\\{ graphviz digraph text
#!:mime text/vnd.graphviz
@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: gringotts,v 1.5 2009/09/19 16:28:09 christos Exp $
# gringotts: file(1) magic for Gringotts
# http://devel.pluto.linux.it/projects/Gringotts/
# author: Germano Rizzo <mano@pluto.linux.it>
@@ -0,0 +1,13 @@

#------------------------------------------------------------------------------
# $File: guile,v 1.1 2011/12/16 17:44:33 christos Exp $
# Guile file magic from <dalepsmith@gmail.com>
# http://www.gnu.org/s/guile/
# http://git.savannah.gnu.org/gitweb/?p=guile.git;f=libguile/_scm.h;hb=HEAD#l250

0 string GOOF---- Guile Object
>8 string LE \b, little endian
>8 string BE \b, big endian
>11 string 4 \b, 32bit
>11 string 8 \b, 64bit
>13 regex .\.. \b, bytecode v%s
@@ -1,10 +1,14 @@

#------------------------------------------------------------------------------
# $File: hitachi-sh,v 1.6 2013/01/29 19:31:33 christos Exp $
# hitach-sh: file(1) magic for Hitachi Super-H
#
# Super-H COFF
#
# below test line conflicts with 2nd NTFS filesystem sector
0 beshort 0x0500 Hitachi SH big-endian COFF
# 2nd NTFS filesystem sector often starts with 0x05004e00 for unicode string 5 NTLDR
#0 ubelong&0xFFFFNMPQ 0x0500NMPQ Hitachi SH big-endian COFF
>18 beshort&0x0002 =0x0000 object
>18 beshort&0x0002 =0x0002 executable
>18 beshort&0x0008 =0x0008 \b, stripped
@@ -1,4 +1,6 @@

#------------------------------------------------------------------------------
# $File: hp,v 1.24 2014/04/30 21:41:02 christos Exp $
# hp: file(1) magic for Hewlett Packard machines (see also "printer")
#
# XXX - somebody should figure out whether any byte order needs to be
@@ -39,10 +41,10 @@
#### Old Apollo stuff
0 beshort 0627 Apollo m68k COFF executable
>18 beshort ^040000 not stripped
>22 beshort >0 - version %ld
>22 beshort >0 - version %d
0 beshort 0624 apollo a88k COFF executable
>18 beshort ^040000 not stripped
>22 beshort >0 - version %ld
>22 beshort >0 - version %d
0 long 01203604016 TML 0123 byte-order format
0 long 01702407010 TML 1032 byte-order format
0 long 01003405017 TML 2301 byte-order format
@@ -126,58 +128,58 @@

#### 500
0 long 0x02080106 HP s500 relocatable executable
>16 long >0 - version %ld
>16 long >0 - version %d

0 long 0x02080107 HP s500 executable
>16 long >0 - version %ld
>16 long >0 - version %d

0 long 0x02080108 HP s500 pure executable
>16 long >0 - version %ld
>16 long >0 - version %d

#### 200
0 belong 0x020c0108 HP s200 pure executable
>4 beshort >0 - version %ld
>4 beshort >0 - version %d
>8 belong &0x80000000 save fp regs
>8 belong &0x40000000 dynamically linked
>8 belong &0x20000000 debuggable
>36 belong >0 not stripped

0 belong 0x020c0107 HP s200 executable
>4 beshort >0 - version %ld
>4 beshort >0 - version %d
>8 belong &0x80000000 save fp regs
>8 belong &0x40000000 dynamically linked
>8 belong &0x20000000 debuggable
>36 belong >0 not stripped

0 belong 0x020c010b HP s200 demand-load executable
>4 beshort >0 - version %ld
>4 beshort >0 - version %d
>8 belong &0x80000000 save fp regs
>8 belong &0x40000000 dynamically linked
>8 belong &0x20000000 debuggable
>36 belong >0 not stripped

0 belong 0x020c0106 HP s200 relocatable executable
>4 beshort >0 - version %ld
>4 beshort >0 - version %d
>6 beshort >0 - highwater %d
>8 belong &0x80000000 save fp regs
>8 belong &0x20000000 debuggable
>8 belong &0x10000000 PIC

0 belong 0x020a0108 HP s200 (2.x release) pure executable
>4 beshort >0 - version %ld
>4 beshort >0 - version %d
>36 belong >0 not stripped

0 belong 0x020a0107 HP s200 (2.x release) executable
>4 beshort >0 - version %ld
>4 beshort >0 - version %d
>36 belong >0 not stripped

0 belong 0x020c010e HP s200 shared library
>4 beshort >0 - version %ld
>4 beshort >0 - version %d
>6 beshort >0 - highwater %d
>36 belong >0 not stripped

0 belong 0x020c010d HP s200 dynamic load library
>4 beshort >0 - version %ld
>4 beshort >0 - version %d
>6 beshort >0 - highwater %d
>36 belong >0 not stripped

@@ -190,7 +192,7 @@
0 long 0x015821a6 HP core file

0 long 0x4da7eee8 HP-WINDOWS font
>8 byte >0 - version %ld
>8 byte >0 - version %d
0 string Bitmapfile HP Bitmapfile

0 string IMGfile CIS compimg HP Bitmapfile
@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: human68k,v 1.5 2009/09/19 16:28:09 christos Exp $
# human68k: file(1) magic for Human68k (X680x0 DOS) binary formats
# Magic too short!
#0 string HU Human68k
@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: ibm370,v 1.9 2014/04/30 21:41:02 christos Exp $
# ibm370: file(1) magic for IBM 370 and compatibles.
#
# "ibm370" said that 0x15d == 0535 was "ibm 370 pure executable".
@@ -35,13 +36,13 @@
>12 belong >0 not stripped
0 beshort 0531 SVR2 executable (Amdahl-UTS)
>12 belong >0 not stripped
>24 belong >0 - version %ld
>24 belong >0 - version %d
0 beshort 0534 SVR2 pure executable (Amdahl-UTS)
>12 belong >0 not stripped
>24 belong >0 - version %ld
>24 belong >0 - version %d
0 beshort 0530 SVR2 pure executable (USS/370)
>12 belong >0 not stripped
>24 belong >0 - version %ld
>24 belong >0 - version %d
0 beshort 0535 SVR2 executable (USS/370)
>12 belong >0 not stripped
>24 belong >0 - version %ld
>24 belong >0 - version %d
@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: ibm6000,v 1.12 2013/09/16 15:12:42 christos Exp $
# ibm6000: file(1) magic for RS/6000 and the RT PC.
#
0 beshort 0x01df executable (RISC System/6000 V3.1) or obj module
@@ -17,3 +18,14 @@
0 string \<aiaff> archive
0 string \<bigaf> archive (big format)

0 beshort 0x01f7 64-bit XCOFF executable or object module
>20 belong 0 not stripped
# GRR: this test is still too general as it catches also many FATs of DOS filesystems
4 belong &0x0feeddb0
# real core dump could not be 32-bit and 64-bit together
>7 byte&0x03 !3 AIX core file
>>1 byte &0x01 fulldump
>>7 byte &0x01 32-bit
>>>0x6e0 string >\0 \b, %s
>>7 byte &0x02 64-bit
>>>0x524 string >\0 \b, %s
@@ -0,0 +1,51 @@

#------------------------------------------------------------------------------
# $File: icc,v 1.1 2013/01/08 01:43:18 christos Exp $
# icc: file(1) magic for International Color Consortium file formats

#
# Color profiles as per the ICC's "Image technology colour management -
# Architecture, profile format, and data structure" specification.
# See
#
# http://www.color.org/specification/ICC1v43_2010-12.pdf
#
# for Specification ICC.1:2010 (Profile version 4.3.0.0).
#
# Bytes 36 to 39 contain a generic profile file signature of "acsp";
# bytes 40 to 43 "may be used to identify the primary platform/operating
# system framework for which the profile was created".
#
# There are other fields that might be worth dumping as well.
#

# This appears to be what's used for Apple ColorSync profiles.
# Instead of adding that, Apple just changed the generic "acsp" entry
# to be for "ColorSync ICC Color Profile" rather than "Kodak Color
# Management System, ICC Profile".
# Yes, it's "APPL", not "AAPL"; see the spec.
36 string acspAPPL ColorSync ICC Profile
!:mime application/vnd.iccprofile

# Microsoft ICM color profile
36 string acspMSFT Microsoft ICM Color Profile
!:mime application/vnd.iccprofile

# Yes, that's a blank after "SGI".
36 string acspSGI\ SGI ICC Profile
!:mime application/vnd.iccprofile

# XXX - is this what's used for the Sun KCMS or not? The standard file
# uses just "acsp" for that, but Apple's file uses it for "ColorSync",
# and there *is* an identified "primary platform" value of SUNW.
36 string acspSUNW Sun KCMS ICC Profile
!:mime application/vnd.iccprofile

# Any other profile.
# XXX - should we use "acsp\0\0\0\0" for "no primary platform" profiles,
# and use "acsp" for everything else and dump the "primary platform"
# string in those cases?
36 string acsp ICC Profile
!:mime application/vnd.iccprofile


@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: iff,v 1.13 2011/09/06 11:00:06 christos Exp $
# iff: file(1) magic for Interchange File Format (see also "audio" & "images")
#
# Daniel Quinlan (quinlan@yggdrasil.com) -- IFF was designed by Electronic
@@ -51,6 +52,13 @@
>8 string AMFF \b, AMFF AmigaMetaFile format
>8 string WZRD \b, WZRD StormWIZARD resource
>8 string DOC\ \b, DOC desktop publishing document
>8 string WVQA \b, Westwood Studios VQA Multimedia,
>>24 leshort x %d video frames,
>>26 leshort x %d x
>>28 leshort x %d
>8 string MOVE \b, Wing Commander III Video
>>12 string _PC_ \b, PC version
>>12 string 3DO_ \b, 3DO version

# These go at the end of the iff rules
#

Large diffs are not rendered by default.

@@ -1,8 +1,9 @@

#------------------------------------------------------------------------------
# $File: inform,v 1.5 2009/09/19 16:28:09 christos Exp $
# inform: file(1) magic for Inform interactive fiction language

# URL: http://www.inform-fiction.org/
# From: Reuben Thomas <rrt@sc3d.org>

0 search/cB/100 constant\ story Inform source text
0 search/100/cW constant\ story Inform source text
@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: intel,v 1.12 2014/04/30 21:41:02 christos Exp $
# intel: file(1) magic for x86 Unix
#
# Various flavors of x86 UNIX executable/object (other than Xenix, which
@@ -15,28 +16,28 @@
#
0 leshort 0502 basic-16 executable
>12 lelong >0 not stripped
#>22 leshort >0 - version %ld
#>22 leshort >0 - version %d
0 leshort 0503 basic-16 executable (TV)
>12 lelong >0 not stripped
#>22 leshort >0 - version %ld
#>22 leshort >0 - version %d
0 leshort 0510 x86 executable
>12 lelong >0 not stripped
0 leshort 0511 x86 executable (TV)
>12 lelong >0 not stripped
0 leshort =0512 iAPX 286 executable small model (COFF)
>12 lelong >0 not stripped
#>22 leshort >0 - version %ld
#>22 leshort >0 - version %d
0 leshort =0522 iAPX 286 executable large model (COFF)
>12 lelong >0 not stripped
#>22 leshort >0 - version %ld
#>22 leshort >0 - version %d
# SGI labeled the next entry as "iAPX 386 executable" --Dan Quinlan
0 leshort =0514 80386 COFF executable
>12 lelong >0 not stripped
>22 leshort >0 - version %ld
>22 leshort >0 - version %d

# rom: file(1) magic for BIOS ROM Extensions found in intel machines
# mapped into memory between 0xC0000 and 0xFFFFF
# From Gürkan Sengün <gurkan@linuks.mine.nu>, www.linuks.mine.nu
# From Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu
0 beshort 0x55AA BIOS (ia32) ROM Ext.
>5 string USB USB
>7 string LDR UNDI image
@@ -45,3 +46,8 @@
>28 string Adaptec Adaptec
>42 string PROMISE Promise
>2 byte x (%d*512)

# Flash descriptors for Intel SPI flash roms.
# From Dr. Jesus <j@hug.gs>
0 lelong 0x0ff0a55a Intel serial flash for ICH/PCH ROM <= 5 or 3400 series A-step
16 lelong 0x0ff0a55a Intel serial flash for PCH ROM
@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: interleaf,v 1.10 2009/09/19 16:28:10 christos Exp $
# interleaf: file(1) magic for InterLeaf TPS:
#
0 string =\210OPS Interleaf saved data
@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: island,v 1.5 2009/09/19 16:28:10 christos Exp $
# island: file(1) magic for IslandWite/IslandDraw, from SunOS 5.5.1
# "/etc/magic":
# From: guy@netapp.com (Guy Harris)
@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: ispell,v 1.8 2009/09/19 16:28:10 christos Exp $
# ispell: file(1) magic for ispell
#
# Ispell 3.0 has a magic of 0x9601 and ispell 3.1 has 0x9602. This magic
@@ -0,0 +1,15 @@

#------------------------------------------------------------------------------
# $File: isz,v 1.3 2014/04/30 21:41:02 christos Exp $
# ISO Zipped file format
# http://www.ezbsystems.com/isz/iszspec.txt
0 string IsZ! ISO Zipped file
>4 byte x \b, header size %u
>5 byte x \b, version %u
>8 lelong x \b, serial %u
#12 leshort x \b, sector size %u
#>16 lelong x \b, total sectors %u
>17 byte >0 \b, password protected
#>24 lequad x \b, segment size %llu
#>32 lelong x \b, blocks %u
#>36 lelong x \b, block size %u
@@ -1,4 +1,6 @@

#------------------------------------------------------------
# $File: java,v 1.16 2013/09/24 20:22:03 christos Exp $
# Java ByteCode and Mach-O binaries (e.g., Mac OS X) use the
# same magic number, 0xcafebabe, so they are both handled
# in the entry called "cafebabe".
@@ -13,12 +15,6 @@
0 belong 0xcececece Java JCE KeyStore
!:mime application/x-java-jce-keystore

# Dalvik .dex format. http://retrodev.com/android/dexformat.html
# From <mkf@google.com> "Mike Fleming"
0 string dex\n
>0 regex dex\n[0-9][0-9][0-9]\0 Dalvik dex file
>4 string >000 version %s
0 string dey\n
>0 regex dey\n[0-9][0-9][0-9]\0 Dalvik dex file (optimized for host)
>4 string >000 version %s

# Java source
0 regex ^import.*;$ Java source
!:mime text/x-java
@@ -0,0 +1,17 @@

#------------------------------------------------------------------------------
# $File: javascript,v 1.1 2012/06/16 13:30:36 christos Exp $
# javascript: magic for javascript and node.js scripts.
#
0 search/1/w #!/bin/node Node.js script text executable
!:mime application/javascript
0 search/1/w #!/usr/bin/node Node.js script text executable
!:mime application/javascript
0 search/1/w #!/bin/nodejs Node.js script text executable
!:mime application/javascript
0 search/1/w #!/usr/bin/nodejs Node.js script text executable
!:mime application/javascript
0 search/1 #!/usr/bin/env\ node Node.js script text executable
!:mime application/javascript
0 search/1 #!/usr/bin/env\ nodejs Node.js script text executable
!:mime application/javascript
@@ -0,0 +1,115 @@

#------------------------------------------------------------------------------
# $File: jpeg,v 1.25 2015/01/02 16:56:50 christos Exp $
# JPEG images
# SunOS 5.5.1 had
#
# 0 string \377\330\377\340 JPEG file
# 0 string \377\330\377\356 JPG file
#
# both of which turn into "JPEG image data" here.
#
0 beshort 0xffd8 JPEG image data
!:mime image/jpeg
!:apple 8BIMJPEG
!:strength +2
>6 string JFIF \b, JFIF standard
# The following added by Erik Rossen <rossen@freesurf.ch> 1999-09-06
# in a vain attempt to add image size reporting for JFIF. Note that these
# tests are not fool-proof since some perfectly valid JPEGs are currently
# impossible to specify in magic(4) format.
# First, a little JFIF version info:
>>11 byte x \b %d.
>>12 byte x \b%02d
# Next, the resolution or aspect ratio of the image:
>>13 byte 0 \b, aspect ratio
>>13 byte 1 \b, resolution (DPI)
>>13 byte 2 \b, resolution (DPCM)
>>14 beshort x \b, density %dx
>>16 beshort x \b%d
>>4 beshort x \b, segment length %d
# Next, show thumbnail info, if it exists:
>>18 byte !0 \b, thumbnail %dx
>>>19 byte x \b%d
>6 string Exif \b, Exif standard: [
>>12 indirect/r x
>>12 string x \b]

# Jump to the first segment
>(4.S+4) use jpeg_segment

# This uses recursion...
0 name jpeg_segment
>0 beshort 0xFFFE
>>(2.S+2) use jpeg_segment
>>2 pstring/HJ x \b, comment: "%s"

>0 beshort 0xFFC0
>>(2.S+2) use jpeg_segment
>>4 byte x \b, baseline, precision %d
>>7 beshort x \b, %dx
>>5 beshort x \b%d
>>9 byte x \b, frames %d

>0 beshort 0xFFC1
>>(2.S+2) use jpeg_segment
>>4 byte x \b, extended sequential, precision %d
>>7 beshort x \b, %dx
>>5 beshort x \b%d
>>9 byte x \b, frames %d

>0 beshort 0xFFC2
>>(2.S+2) use jpeg_segment
>>4 byte x \b, progressive, precision %d
>>7 beshort x \b, %dx
>>5 beshort x \b%d
>>9 byte x \b, frames %d

# Define Huffman Tables
>0 beshort 0xFFC4
>>(2.S+2) use jpeg_segment

>0 beshort 0xFFE1
#>>(2.S+2) use jpeg_segment
>>4 string Exif \b, Exif Standard: [
>>>10 indirect/r x
>>>10 string x \b]

# Application specific markers
>0 beshort&0xFFE0 =0xFFE0
>>(2.S+2) use jpeg_segment

# DB: Define Quantization tables
# DD: Define Restart interval [XXX: wrong here, it is 4 bytes]
# D8: Start of image
# D9: End of image
# Dn: Restart
>0 beshort&0xFFD0 =0xFFD0
>>(2.S+2) use jpeg_segment

#>0 beshort x unknown 0x%x
#>>(2.S+2) use jpeg_segment

# HSI is Handmade Software's proprietary JPEG encoding scheme
0 string hsi1 JPEG image data, HSI proprietary

# From: David Santinoli <david@santinoli.com>
0 string \x00\x00\x00\x0C\x6A\x50\x20\x20\x0D\x0A\x87\x0A JPEG 2000
# From: Johan van der Knijff <johan.vanderknijff@kb.nl>
# Added sub-entries for JP2, JPX, JPM and MJ2 formats; added mimetypes
# https://github.com/bitsgalore/jp2kMagic
#
# Now read value of 'Brand' field, which yields a few possibilities:
>20 string \x6a\x70\x32\x20 Part 1 (JP2)
!:mime image/jp2
>20 string \x6a\x70\x78\x20 Part 2 (JPX)
!:mime image/jpx
>20 string \x6a\x70\x6d\x20 Part 6 (JPM)
!:mime image/jpm
>20 string \x6d\x6a\x70\x32 Part 3 (MJ2)
!:mime video/mj2

# Type: JPEG 2000 codesream
# From: Mathieu Malaterre <mathieu.malaterre@gmail.com>
0 belong 0xff4fff51 JPEG 2000 codestream
45 beshort 0xff52
@@ -1,8 +1,9 @@

#------------------------------------------------------------------------------
# $File: karma,v 1.7 2014/04/30 21:41:02 christos Exp $
# karma: file(1) magic for Karma data files
#
# From <rgooch@atnf.csiro.au>

0 string KarmaRHD Version Karma Data Structure Version
>16 belong x %lu
>16 belong x %u
@@ -0,0 +1,11 @@

#------------------------------------------------------------------------------
# $File: kde,v 1.5 2010/11/25 15:00:12 christos Exp $
# kde: file(1) magic for KDE

0 string/t [KDE\ Desktop\ Entry] KDE desktop entry
!:mime application/x-kdelnk
0 string/t #\ KDE\ Config\ File KDE config file
!:mime application/x-kdelnk
0 string/t #\ xmcd xmcd database file for kscd
!:mime text/x-xmcd
@@ -0,0 +1,20 @@

#------------------------------------------------------------------------------
# $File: keepass,v 1.1 2012/12/24 22:14:56 christos Exp $
# keepass: file(1) magic for KeePass file
#
# Keepass Password Safe:
# * original one: http://keepass.info/
# * *nix port: http://www.keepassx.org/
# * android port: http://code.google.com/p/keepassdroid/

0 lelong 0x9AA2D903 Keepass password database
>4 lelong 0xB54BFB65 1.x KDB
>>48 lelong >0 \b, %d groups
>>52 lelong >0 \b, %d entries
>>8 lelong&0x0f 1 \b, SHA-256
>>8 lelong&0x0f 2 \b, AES
>>8 lelong&0x0f 4 \b, RC4
>>8 lelong&0x0f 8 \b, Twofish
>>120 lelong >0 \b, %d key transformation rounds
>4 lelong 0xB54BFB67 2.x KDBX
@@ -0,0 +1,45 @@

#------------------------------------------------------------------------------
# $File: kerberos,v 1.1 2014/12/10 18:45:43 christos Exp $
# kerberos: MIT kerberos file binary formats
#

# This magic entry is for demonstration purposes and could be improved
# if the following features were implemented in file:
#
# Strings inside [[ .. ]] in the descriptions have special meanings and
# are not printed.
#
# - Provide some form of iteration in number of components
# [[${counter}=%d]] in the description
# then append
# [${counter}--] in the offset of the entries
# - Provide a way to round the next offset
# Add [R:4] after the offset?
# - Provide a way to have optional entries
# XXX: Syntax:
# - Provide a way to "save" entries to print them later.
# if the description is [[${name}=%s]], then nothing is
# printed and a subsequent entry in the same magic file
# can refer to ${name}
# - Provide a way to format strings as hex values
#
# http://www.gnu.org/software/shishi/manual/html_node/\
# The-Keytab-Binary-File-Format.html
#

0 name keytab_entry
#>0 beshort x \b, size=%d
#>2 beshort x \b, components=%d
>4 pstring/H x \b, realm=%s
>>&0 pstring/H x \b, principal=%s/
>>>&0 pstring/H x \b%s
>>>>&0 belong x \b, type=%d
>>>>>&0 bedate x \b, date=%s
>>>>>>&0 byte x \b, kvno=%u
#>>>>>>>&0 pstring/H x
#>>>>>>>>&0 belong x
#>>>>>>>>>>&0 use keytab_entry

0 belong 0x05020000 Kerberos Keytab file
>4 use keytab_entry
@@ -1,10 +1,12 @@

#------------------------------------------------------------------------------
# $File: kml,v 1.3 2010/11/25 15:00:12 christos Exp $
# Type: Google KML, formerly Keyhole Markup Language
# Future development of this format has been handed
# over to the Open Geospatial Consortium.
# http://www.opengeospatial.org/standards/kml/
# From: Asbjoern Sloth Toennesen <asbjorn@lila.io>
0 string \<?xml
0 string/t \<?xml
>20 search/400 \ xmlns=
>>&0 regex ['"]http://earth.google.com/kml Google KML document
!:mime application/vnd.google-earth.kml+xml
@@ -20,7 +22,7 @@
# From: Asbjoern Sloth Toennesen <asbjorn@lila.io>
>>&0 regex ['"]http://www.opengis.net/kml OpenGIS KML document
!:mime application/vnd.google-earth.kml+xml
>>>&1 string 2.2 \b, version 2.2
>>>&1 string/t 2.2 \b, version 2.2

#------------------------------------------------------------------------------
# Type: Google KML Archive (ZIP based)
@@ -1,4 +1,6 @@

#------------------------------------------------------------------------------
# $File: lecter,v 1.4 2009/09/19 16:28:10 christos Exp $
# DEC SRC Virtual Paper: Lectern files
# Karl M. Hegbloom <karlheg@inetarena.com>
0 string lect DEC SRC Virtual Paper Lectern file
@@ -1,4 +1,6 @@

#------------------------------------------------------------------------------
# $File: lex,v 1.6 2009/09/19 16:28:10 christos Exp $
# lex: file(1) magic for lex
#
# derived empirically, your offsets may vary!
@@ -1,5 +1,6 @@

#------------------------------------------------------------------------------
# $File: lif,v 1.8 2009/09/19 16:28:10 christos Exp $
# lif: file(1) magic for lif
#
# (Daniel Quinlan <quinlan@yggdrasil.com>)