xref: /titanic_41/usr/src/cmd/file/magic (revision 69bb4bb45c98da60d21839c4dc3c01ea1be60585)
1#
2# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3# Use is subject to license terms.
4#
5# CDDL HEADER START
6#
7# The contents of this file are subject to the terms of the
8# Common Development and Distribution License, Version 1.0 only
9# (the "License").  You may not use this file except in compliance
10# with the License.
11#
12# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
13# or http://www.opensolaris.org/os/licensing.
14# See the License for the specific language governing permissions
15# and limitations under the License.
16#
17# When distributing Covered Code, include this CDDL HEADER in each
18# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
19# If applicable, add the following below this CDDL HEADER, with the
20# fields enclosed by brackets "[]" replaced with your own identifying
21# information: Portions Copyright [yyyy] [name of copyright owner]
22#
23# CDDL HEADER END
24#
25#ident	"%Z%%M%	%I%	%E% SMI"
26#
27# This file contains the dictionary of file format identifiers (magic strings)
28# used by file(1).  The fields of this file are as follows:
29#
30# (1) byte offset
31# (2) value type
32# (3) optional operator (= by default)
33# (4) value to match (numeric or string)
34# (5) string to be printed
35#
36# Numeric values may be decimal, octal, or hex.  Also note that the last string
37# may have one printf format specifier.  The '>' in occassional column 1's is
38# magic: it forces file(1) to continue scanning and matching additional lines.
39# The first line afterwards not so marked terminates the search.
40#
41# The entries for ELF are not needed anymore, as file(1) now uses the elf(3ELF)
42# routines to look at ELF files.  They remain, commented out, for reference.
43#
44#0	string		\177ELF		ELF
45#>4	byte		1		32-bit
46#>5	byte		1		LSB
47#>5	byte		2		MSB
48#>16	short		0		unknown type
49#>16	short		1		relocatable
50#>16	short		2		executable
51#>16	short		3		dynamic lib
52#>16	short		4		core file
53#>18	short		0		unknown machine
54#>18	short		1		WE32100
55#>18	short		2		SPARC
56#>18	short		3		80386
57#>18	short		4		M68000
58#>18	short		5		M88000
59#>18	short		6		i80486
60#>18	short		7		i860
61#>18	short		8		RS3000_BE
62#>18	short		9		UNKNOWN
63#>18	short		10		RS3000_LE
64#>18	short		11		RS6000
65#>18	short		12		UNKNOWN
66#>18	short		13		UNKNOWN
67#>18	short		14		UNKNOWN
68#>18	short		15		PA_RISC
69#>18	short		16		nCUBE
70#>18	short		17		VPP500
71#>18	short		18		SPARC32PLUS
72#>18	short		19		UNKNOWN
73#>18	short		20		PowerPC
74#>20	long		1		Version 1
75#>36	long		1		MAU Required
76257	string		ustar		USTAR tar archive
77>156	byte		88		extended format
780	short		070701		cpio archive
790	string		070701		ASCII cpio archive
800	short		070702		cpio archive - CRC header
810	string		070702		ASCII cpio archive - CRC header
820	short		070707		cpio archive - CHR (-c) header
830	string		070707		ASCII cpio archive - CHR (-c) header
840	long		0177555		obsolete ar archive
850	short		0177545		pdp11/pre System V ar archive
860	long		0100554		apl workspace
870	short		017037		packed data
880	string		<ar>		System V Release 1 ar archive
890	string		!<arch>		current ar archive
900	short		0407		pdp11/pre System V vax executable
91>8	ushort		>0		not stripped
92>15	ubyte		>0		- version %ld
930	short		0401		unix-rt ldp
940	short		0405		pdp11 overlay
950	short		0410		pdp11/pre System V vax pure executable
96>8	ushort		>0		not stripped
97>15	ubyte		>0		- version %ld
980	short		0411		pdp11 separate I&D
99>8	ushort		>0		not stripped
100>15	ubyte		>0		- version %ld
1010	short		015001		Compiled Terminfo Entry
102# little-endian entry
1030	short		0432		Compiled Terminfo Entry
1040	short		0433		Curses screen image
1050	short		0434		Curses screen image
1060	short		0437		pdp11 kernel overlay
1070	short		0570		vax executable
108>12	long		>0		not stripped
109>22	ushort		>0		- version %ld
1100	short		0575		vax pure executable
111>12	long		>0		not stripped
112>22	ushort		>0		- version %ld
1130	short		0502		basic-16 executable
114>12	long		>0		not stripped
115>22	ushort		>0		- version %ld
1160	short		0503		basic-16 executable (TV)
117>12	long		>0		not stripped
118>22	ushort		>0		- version %ld
1190	short		0510		x86 executable
120>12	long		>0		not stripped
1210	short		0511		x86 executable (TV)
122>12	long		>0		not stripped
1230	short		0550		3b20 executable
124>12	long		>0		not stripped
125>22	ushort		>0		- version %ld
1260	short		0551		3b20 executable (TV)
127>12	long		>0		not stripped
128>22	ushort		>0		- version %ld
1290	short		0560		WE32000 executable
130>12	long		>0		not stripped
131>18	short		^00010000	- N/A on 3b2/300 w/paging
132>18	short		&00020000	- 32100 required
133>18	short		&00040000	and mau hardware required
134>20	short		0443		(target shared library)
135>20	short		0410		(swapped)
136>20	short		0413		(paged)
137>22	ushort		>0		- version %ld
1380	short		0561		WE32000 executable (TV)
139>12	long		>0		not stripped
140>18	short		&00020000	- 32100 required
141>18	short		&00040000	and mau hardware required
142>22	ushort		>0		- version %ld
1430	short		=0512		iAPX 286 executable small model (COFF)
144>12	long		>0		not stripped
145>22	ushort		>0		- version %ld
1460	short		=0522		iAPX 286 executable large model (COFF)
147>12	long		>0		not stripped
148>22	ushort		>0		- version %ld
1490	short		0514		iAPX 386 executable (COFF) (deprecated)
150>12	long		>0		not stripped
151>22	ushort		>0		- version %ld
1520	short		0520		mc68k executable
153>12	long		>0		not stripped
1540	short		0521		mc68k executable (shared)
155>12	long		>0		not stripped
1560	short		0522		mc68k executable (shared demand paged)
157>12	long		>0		not stripped
158# big-endian entries for pure executables
1592	short		0410		pure
160>1	byte		0		sun2 executable
161>1	byte		1		mc68010 executable
162>1	byte		2		mc68020 executable
163>1	byte		3		SPARC executable
164>0	ubyte		>077		dynamically linked
165# little-endian entries for pure executables
1662	short		04001		pure
167>1	byte		0		sun2 executable
168>1	byte		1		mc68010 executable
169>1	byte		2		mc68020 executable
170>1	byte		3		SPARC executable
171>0	ubyte		>077		dynamically linked
172# big-endian entries for impure executables
1732	short		0407		impure
174>1	byte		0		sun2 executable
175>1	byte		1		mc68010 executable
176>1	byte		2		mc68020 executable
177>1	byte		3		SPARC executable
178>0	ubyte		>077		dynamically linked
179# little-endian entries for impure executables
1802	short		03401		impure
181>1	byte		0		sun2 executable
182>1	byte		1		mc68010 executable
183>1	byte		2		mc68020 executable
184>1	byte		3		SPARC executable
185>0	ubyte		>077		dynamically linked
186# big-endian entries for Sun demand paged executables
1872	short		0413		Sun demand paged
188>1	byte		0		sun2 executable
189>1	byte		1		mc68010 executable
190>1	byte		2		mc68020 executable
191>1	byte		3		SPARC executable
192>0	ubyte		>077		dynamically linked
193# little-endian entries for Sun demand paged executables
1942	short		05401		Sun demand paged
195>1	byte		0		sun2 executable
196>1	byte		1		mc68010 executable
197>1	byte		2		mc68020 executable
198>1	byte		3		SPARC executable
199>0	ubyte		>077		dynamically linked
2000	short		0x8001		Adobe PostScript Type 1 binary font (PFB)
2010	short		0x0180		Adobe PostScript Type 1 binary font (PFB)
2020	long		0x00010000	TrueType font file version 1.0 (TTF)
2030	long		0x00000100	TrueType font file version 1.0 (TTF)
2040	long		0xf00000ff	extended accounting file
205# little-endian entry
2060	long		0xff0000f0	extended accounting file
2070	byte		0x80		8086 relocatable (Microsoft)
2080	byte		0xf0		MS-DOS library
2090	short		0xff65		x.out
210>2	string		__.SYMDEF	randomized
211>0	byte		x		archive
2120	short		0x206		Microsoft a.out
213>0x1e	short		&0x10		overlay
214>0x1e	short		&0x2		separate
215>0x1e	short		&0x4		pure
216>0x1e	short		&0x800		segmented
217>0x1e	short		&0x400		standalone
218>0x1e	short		&0x8		fixed-stack
219>0x1c	byte		&0x80		byte-swapped
220>0x1c	byte		&0x40		word-swapped
221>0x10	long		>0		not-stripped
222>0x1e	short		^0xc000		pre-SysV
223>0x1c	byte		&0x4		86
224>0x1c	byte		&0x9		286
225>0x1c	byte		&0xa		386
226>0x1e	short		&0x1		executable
227>0x1e	short		^0x1		object file
228>0x1e	short		&0x40		Large Text
229>0x1e	short		&0x20		Large Data
230>0x1e	short		&0x120		Huge Objects Enabled
2310	short		0x10b		VAX demand load format a.out object file
232>0x10	long		>0		not stripped
2330	short		0x140		old Microsoft 8086 x.out
234>0x3	byte		&0x4		separate
235>0x3	byte		&0x2		pure
236>0	byte		&0x1		executable
237>0	byte		^0x1		relocatable
238>0x14	long		>0		not stripped
2390	long		0x10b		VAX demand load format a.out object file
240>0x10	long		>0		not stripped
2410	long		0x140		old Microsoft 8086 x.out
242>0x3	byte		&0x4		separate
243>0x3	byte		&0x2		pure
244>0	byte		&0x1		executable
245>0	byte		^0x1		relocatable
246>0x14	long		>0		not stripped
2470	long		0xe807		object file (z8000 a.out)
2480	long		0xe808		pure object file (z8000 a.out)
2490	long		0xe809		separate object file (z8000 a.out)
2500	long		0xe805		overlay object file (z8000 a.out)
2510	long		0x178		Bell 5.0 executable
2522	short		0410		Sun read-only text executable
253>2	short		0407		Sun old executable
254>1	byte		3		(SPARC)
255>1	byte		2		(68020)
256>1	byte		1		(68010)
257>1	byte		0		(Sun2)
2580	short		0143561		byte-swapped cpio archive
2590	long		0101555		PDP-11 single precision APL workspace
2600	long		0101554		PDP-11 double precision APL workspace
2610	long		0101557		VAX single precision APL workspace
2620	long		0101556		VAX double precision APL workspace
2630	short		017437		old packed data
2640	string		\037\036	packed data
2650	string		\377\037	compacted data
2660	string		\037\235	compressed data
267>2	byte&0x80	>0		block compressed
268>2	byte&0x1f	x		%d bits
2690	string		\037\213	gzip compressed data
270>2	byte		8		- deflate method
271>3	byte		&0x1		, ascii
272>3	byte		&0x2		, continuation
273>3	byte		&0x4		, extra field
274>3	byte		&0x8		, original file name
275>3	byte		&0x10		, comment
276>3	byte		&0x20		, encrypted
277>8	byte		2		, max compression
278>8	byte		4		, max speed
2790	string		!<arch>\n__.SYMDEF	archive random library
2800	long		0x1010101	MMDF mailbox
2810	string		<!OPS		Interleaf ASCII document
28224	string		SunGKS		SunGKS
283# version number follows, in the form m.n
284>0	string		GKSM		Metafile
2850	string		GKSM		GKS Metafile
286# version number follows, in the form <!OPS, Version n.n>
2870	string		%!PS-AdobeFont	Adobe PostScript ASCII font (PFA)
2880	string		%!		PostScript document
289>2	string		PS-Adobe	 conforming to level
290>10	string		-1.0		 1.0
291>10	string		-2.0		 2.0
292>10	string		-3.0		 3.0
293# version ID follows, in the form PS-Adobe-nn
2940	string		Interpress/Xerox	Interpress document
295# version ID follows, in the form /n.n
2960	string		StartFontMetrics	Adobe font metrics
2970	string		StartFont	Adobe font bits
2980	long		0x137A2944	NeWS bitmap font
2990	long		0x137A2947	NeWS font family
3008	long		0x137A2B45	X11/NeWS bitmap font
3018	long		0x137A2B48	X11/NeWS font family
302# snoop files are always big-endian
303# big-endian entries, with ullong equivalent of string "snoop"
3040	ullong		0x736e6f6f70000000	Snoop capture file
305>8	long		>0		- version %ld
306# little-endian entries, with ullong equivalent of string "snoop"
3070	ullong		0x000000706f6f6e73	Snoop capture file
308>11	long		>0		- version %ld
3090	short		0436		vfont definition
3100	string		<MakerFile	Frame Maker document
3110	string		<MIFFile	Frame Maker MIF file
3120	string		<MML		Frame Maker MML file
3130	string		<BookFile	Frame Maker book file
314# Audio files are always big-endian so there are two sets of tables here.
315# The CPU endian architecture is determined via the ordering of the first 4 bytes
316# (the string ".snd"). The tables below have this value represented as a single
317# 4 byte long. If the architecture is big-endian the %d token can be used for
318# interpreting the sampling rate.
319# Since %d can't be done on the data for little endian machines the limitation
320# is that sampling rates not included in the x86 entries will not be recognized.
321#
322# big-endian entries
323#
3240	long		0x2e736e64	audio data:
325>12	long		1		8-bit u-law,
326>12	long		2		8-bit linear PCM,
327>12	long		3		16-bit linear PCM,
328>12	long		4		24-bit linear PCM,
329>12	long		5		32-bit linear PCM,
330>12	long		6		32-bit floating point,
331>12	long		7		64-bit floating point,
332>12	long		23		compressed (4-bit G.721 ADPCM),
333>12	long		24		compressed (8-bit G.722 ADPCM),
334>12	long		25		compressed (3-bit G.723 ADPCM),
335>12	long		26		compressed (5-bit G.723 ADPCM),
336>12	long		27		8-bit A-law,
337>20	long		1		mono,
338>20	long		2		stereo,
339>20	long		4		quad,
340>16	long		x		%d Hz
341#
342# little-endian entries
343#
3440	long		0x646e732e	audio data:
345>12	long		0x01000000	8-bit u-law,
346>12	long		0x02000000	8-bit linear PCM,
347>12	long		0x03000000	16-bit linear PCM,
348>12	long		0x04000000	24-bit linear PCM,
349>12	long		0x05000000	32-bit linear PCM,
350>12	long		0x06000000	32-bit floating point,
351>12	long		0x07000000	64-bit floating point,
352>12	long		0x17000000	compressed (4-bit G.721 ADPCM),
353>12	long		0x18000000	compressed (8-bit G.722 ADPCM),
354>12	long		0x19000000	compressed (3-bit G.723 ADPCM),
355>12	long		0x1a000000	compressed (5-bit G.723 ADPCM),
356>12	long		0x1b000000	8-bit A-law,
357>20	long		0x01000000	mono,
358>20	long		0x02000000	stereo,
359>20	long		0x04000000	quad,
360>16	long		0x401f0000	8000 Hz
361>16	long		0x80250000	9600 Hz
362>16	long		0x112b0000	11025 Hz
363>16	long		0x803e0000	16000 Hz
364>16	long		0xd4490000	18900 Hz
365>16	long		0x22560000	22050 Hz
366>16	long		0x007d0000	32000 Hz
367>16	long		0xa8930000	37800 Hz
368>16	long		0x44ac0000	44100 Hz
369>16	long		0x80bb0000	48000 Hz
370# .wav files are always little-endian
371# .wav big-endian entries, starting with long value for the string "RIFF"
3720	long		0x52494646	audio data:
373>34	short		0x0800		8-bit
374>34	short		0x1000		16-bit
375>20	short		0x0100		linear PCM,
376>20	short		0x0200		MS ADPCM,
377>20	short		0x0600		A-law,
378>20	short		0x0700		u-law,
379>20	short		0x1100		DVI ADPCM,
380>22	short		0x0100		mono
381>22	short		0x0200		stereo
382# .wav little-endian entries, starting with long value for the string "RIFF"
3830	long		0x46464952	audio data:
384>34	short		0x0008		8-bit
385>34	short		0x0010		16-bit
386>20	short		0x0001		linear PCM,
387>20	short		0x0002		MS ADPCM,
388>20	short		0x0006		A-law,
389>20	short		0x0007		u-law,
390>20	short		0x0011		DVI ADPCM,
391>22	short		0x0001		mono
392>22	short		0x0002		stereo
393# .aiff files are always big-endian
394# .aiff big-endian entries, starting with long value for the string "FORM"
3950	long		0x464f524d	audio data:
396>26	short		0x0008		8-bit linear PCM,
397>26	short		0x0010		16-bit linear PCM,
398>20	short		0x0001		mono
399>20	short		0x0002		stereo
400# .aiff little-endian entries, starting with long value for the string "FORM"
4010	long		0x4d524f46	audio data:
402>26	short		0x0800		8-bit linear PCM,
403>26	short		0x1000		16-bit linear PCM,
404>20	short		0x0100		mono
405>20	short		0x0200		stereo
406# .mid files are always big-endian
407# .mid big-endian entries, starting with long value for the string "MThd"
4080	long		0x4d546864	MIDI data:
409>8	short		x		type %u,
410>10	short		x		%u track(s)
411# .mid little-endian entry (the string "MThd")
412# can't translate big-endian type and track information
4130	long		0x6468544d	MIDI data
414#
4150	short		0x1010		PEX Binary Archive
416# rasterfiles are big-endian
417# big-endian rasterfile entries
4180	long		0x59a66a95	rasterfile,
419>4	long		>0		%ld x
420>8	long		>0		%ld x
421>12	long		>0		%ld
422>20	long		0		old format image
423>20	long		1		standard format image
424>20	long		2		run-length byte encoded image
425>20	long		3		XRGB or RGB format image
426>20	long		4		tiff format image
427>20	long		5		iff (TAAC format) image
428>20	long		0xffff		experimental format image
429# little-endian rasterfile entries
430# cannot translate resolution stored as big-endian longs
4310	long		0x956aa659	rasterfile,
432>23	long		0		old format image
433>23	long		1		standard format image
434>23	long		2		run-length byte encoded image
435>23	long		3		XRGB or RGB format image
436>23	long		4		tiff format image
437>23	long		5		iff (TAAC format) image
438>20	long		0xffff		experimental format image
4390	long		0x884f5053	Interleaf fast-saved document
4400	long		0x2a535441	Aster*x
441>7	long		0x574f5244		Words Document
442>7	long		0x47524150		Graphic
443>7	long		0x53505245		Spreadsheet
444>7	long		0x4d414352		Macro
4450	long		0x32323738	Aster*x Version 2
446>29	byte		0x36			Words Document
447>29	byte		0x35			Graphic
448>29	byte		0x32			Spreadsheet
449>29	byte		0x38			Macro
4504	string		pgscriptver	IslandWrite document
45113	string		DrawFile	IslandDraw document
4520	string		P1		PBM ascii file
4530	string		P2		PGM ascii file
4540	string		P3		PPM ascii file
4550	string		P4		PBM raw file
4560	string		P5		PGM raw file
4570	string		P6		PPM raw file
4580	string		\115\115	TIFF file, big-endian
4590	string		\111\111	TIFF file, little-endian
4600	string		GIF87a		GIF file, v87
4610	string		GIF89a		GIF file, v89
4620	string		\377\330\377\340	JPEG file
4630	string		\377\330\377\341	JPEG file
4640	string		\377\330\377\356	JPG file
4658	string		ILBM		IFF ILBM file
4660	string		\312\376\272\276	java class file
46736	string		acsp	Kodak Color Management System, ICC Profile
4680	string		%PDF		Adobe Portable Document Format (PDF)
469>4	string		-1.0		v1.0
470>4	string		-1.1		v1.1
471>4	string		-1.2		v1.2
472>4	string		-1.3		v1.3
473>4	string		-1.4		v1.4
474>4	string		-1.5		v1.5
4750	string		<html		html document
4760	string		<HTML		html document
4770	string		<Html		html document
4780	string		<!doctype HTML	html document
4790	string		<!doctype Html	html document
4800	string		<!doctype html	html document
4810	string		<!DOCTYPE HTML	html document
4820	string		<!DOCTYPE Html	html document
4830	string		<!DOCTYPE html	html document
4840	string		<!Doctype HTML	html document
4850	string		<!Doctype Html	html document
4860	string		<!Doctype html	html document
4870	string		<head		html document
4880	string		<HEAD		html document
4890	string		<Head		html document
4900	string		<title		html document
4910	string		<TITLE		html document
4920	string		<Title		html document
4930	string		<?xml		XML document
4940	string		<?XML		XML document
4950	string		<?Xml		XML document
4960	string		\0211PNG	PNG image data
4970	string		.RMF		RealMedia file
4980	string		FlAsH-aRcHiVe	Flash Archive
499>13	string		-1.0		 1.0
500>13	string		-2.0		 2.0
50138	string		application/vnd.sun.xml.writer	StarOffice 7 Text Document
50238	string		application/vnd.sun.xml.calc	StarOffice 7 Spreadsheet
50338	string		application/vnd.sun.xml.draw	StarOffice 7 Drawing
50438	string		application/vnd.sun.xml.impress	StarOffice 7 Presentation
50538	string		application/vnd.sun.xml.math	StarOffice 7 Formula
50638	string		application/vnd.oasis.opendocument.chart	OpenDocument Chart
50738	string		application/vnd.oasis.opendocument.database	OpenDocument Database
50838	string		application/vnd.sun.xml.base			OpenDocument Database
50938	string		application/vnd.oasis.opendocument.formula	OpenDocument Formula
51038	string		application/vnd.oasis.opendocument.image	OpenDocument Image
51138	string		application/vnd.oasis.opendocument.text-web	HTML Document Template
51238	string		application/vnd.oasis.opendocument.text-	OpenDocument
513>78	string		template						Text Template
514>78	string		master							Master Document
51538	string		application/vnd.oasis.opendocument.text		OpenDocument Text
51638	string		application/vnd.oasis.opendocument.graphics	OpenDocument Drawing
517>81	string		-template						Template
51838	string		application/vnd.oasis.opendocument.presentation	OpenDocument Presentation
519>85	string		-template						Template
52038	string		application/vnd.oasis.opendocument.spreadsheet	OpenDocument Spreadsheet
521>84	string		-template						Template
5220	string		PK\003\004	ZIP archive
5230	string		MZ		DOS executable (EXE)
5240	string		LZ		DOS built-in
5250	byte		0xe9		DOS executable (COM)
5260	byte		0xeb		DOS executable (COM)
52724	long		60012		ufsdump archive file
5280	string		TZif		zoneinfo timezone data file
5290	string		BZh		bzip2 compressed data
530>3	byte		>47		, block size = %c00k
5310	string		SUNWcpch	Sun C compiler precompiled header
5320	string		SUNWCpch	Sun C++ compiler precompiled header
5330	string		\043\040PaCkAgE\040DaTaStReAm	package datastream
5340	short		0xcff1		CTF data file
5350	string		\177DOF		DTrace DOF data file
5360	string		\177FCF		fmd(1M) checkpoint file
5370	string		EFT\0		Fault tree file,
538>4	ushort		x		v%u
539>6	ushort		x		rev %u,
540>8	ushort		x		from esc v%u
541>10	ushort		x		rev %u
5420	string		_SM_		DMTF SMBIOS image
543>6	byte		x		version %u
544>7	byte		x		.%u
545