1 2#------------------------------------------------------------------------------ 3# $File: linux,v 1.40 2011/03/22 12:54:35 christos Exp $ 4# linux: file(1) magic for Linux files 5# 6# Values for Linux/i386 binaries, from Daniel Quinlan <quinlan@yggdrasil.com> 7# The following basic Linux magic is useful for reference, but using 8# "long" magic is a better practice in order to avoid collisions. 9# 10# 2 leshort 100 Linux/i386 11# >0 leshort 0407 impure executable (OMAGIC) 12# >0 leshort 0410 pure executable (NMAGIC) 13# >0 leshort 0413 demand-paged executable (ZMAGIC) 14# >0 leshort 0314 demand-paged executable (QMAGIC) 15# 160 lelong 0x00640107 Linux/i386 impure executable (OMAGIC) 17>16 lelong 0 \b, stripped 180 lelong 0x00640108 Linux/i386 pure executable (NMAGIC) 19>16 lelong 0 \b, stripped 200 lelong 0x0064010b Linux/i386 demand-paged executable (ZMAGIC) 21>16 lelong 0 \b, stripped 220 lelong 0x006400cc Linux/i386 demand-paged executable (QMAGIC) 23>16 lelong 0 \b, stripped 24# 250 string \007\001\000 Linux/i386 object file 26>20 lelong >0x1020 \b, DLL library 27# Linux-8086 stuff: 280 string \01\03\020\04 Linux-8086 impure executable 29>28 long !0 not stripped 300 string \01\03\040\04 Linux-8086 executable 31>28 long !0 not stripped 32# 330 string \243\206\001\0 Linux-8086 object file 34# 350 string \01\03\020\20 Minix-386 impure executable 36>28 long !0 not stripped 370 string \01\03\040\20 Minix-386 executable 38>28 long !0 not stripped 39# core dump file, from Bill Reynolds <bill@goshawk.lanl.gov> 40216 lelong 0421 Linux/i386 core file 41>220 string >\0 of '%s' 42>200 lelong >0 (signal %d) 43# 44# LILO boot/chain loaders, from Daniel Quinlan <quinlan@yggdrasil.com> 45# this can be overridden by the DOS executable (COM) entry 462 string LILO Linux/i386 LILO boot/chain loader 47# 48# Linux make config build file, from Ole Aamot <oka@oka.no> 4928 string make\ config Linux make config build file 50# 51# PSF fonts, from H. Peter Anvin <hpa@yggdrasil.com> 52# Updated by Adam Buchbinder <adam.buchbinder@gmail.com> 53# See: http://www.win.tue.nl/~aeb/linux/kbd/font-formats-1.html 540 leshort 0x0436 Linux/i386 PC Screen Font v1 data, 55>2 byte&0x01 0 256 characters, 56>2 byte&0x01 !0 512 characters, 57>2 byte&0x02 0 no directory, 58>2 byte&0x02 !0 Unicode directory, 59>3 byte >0 8x%d 600 string \x72\xb5\x4a\x86\x00\x00 Linux/i386 PC Screen Font v2 data, 61>16 lelong x %d characters, 62>12 lelong&0x01 0 no directory, 63>12 lelong&0x01 !0 Unicode directory, 64>24 lelong x %d 65>28 lelong x \bx%d 66 67# Linux swap file, from Daniel Quinlan <quinlan@yggdrasil.com> 684086 string SWAP-SPACE Linux/i386 swap file 69# From: Jeff Bailey <jbailey@ubuntu.com> 70# Linux swap file with swsusp1 image, from Jeff Bailey <jbailey@ubuntu.com> 714076 string SWAPSPACE2S1SUSPEND Linux/i386 swap file (new style) with SWSUSP1 image 72# From: James Hunt <james.hunt@ubuntu.com> 734076 string SWAPSPACE2LINHIB0001 Linux/i386 swap file (new style) (compressed hibernate) 74# according to man page of mkswap (8) March 1999 75# volume label and UUID Russell Coker 76# http://etbe.coker.com.au/2008/07/08/label-vs-uuid-vs-device/ 774086 string SWAPSPACE2 Linux/i386 swap file (new style), 78>0x400 long x version %d (4K pages), 79>0x404 long x size %d pages, 80>1052 string \0 no label, 81>1052 string >\0 LABEL=%s, 82>0x40c belong x UUID=%08x 83>0x410 beshort x \b-%04x 84>0x412 beshort x \b-%04x 85>0x414 beshort x \b-%04x 86>0x416 belong x \b-%08x 87>0x41a beshort x \b%04x 88# From Daniel Novotny <dnovotny@redhat.com> 89# swap file for PowerPC 9065526 string SWAPSPACE2 Linux/ppc swap file 91# ECOFF magic for OSF/1 and Linux (only tested under Linux though) 92# 93# from Erik Troan (ewt@redhat.com) examining od dumps, so this 94# could be wrong 95# updated by David Mosberger (davidm@azstarnet.com) based on 96# GNU BFD and MIPS info found below. 97# 980 leshort 0x0183 ECOFF alpha 99>24 leshort 0407 executable 100>24 leshort 0410 pure 101>24 leshort 0413 demand paged 102>8 long >0 not stripped 103>8 long 0 stripped 104>23 leshort >0 - version %ld. 105# 106# Linux kernel boot images, from Albert Cahalan <acahalan@cs.uml.edu> 107# and others such as Axel Kohlmeyer <akohlmey@rincewind.chemie.uni-ulm.de> 108# and Nicol�s Lichtmaier <nick@debian.org> 109# All known start with: b8 c0 07 8e d8 b8 00 90 8e c0 b9 00 01 29 f6 29 110# Linux kernel boot images (i386 arch) (Wolfram Kleff) 111514 string HdrS Linux kernel 112>510 leshort 0xAA55 x86 boot executable 113>>518 leshort >0x1ff 114>>>529 byte 0 zImage, 115>>>529 byte 1 bzImage, 116>>>(526.s+0x200) string >\0 version %s, 117>>498 leshort 1 RO-rootFS, 118>>498 leshort 0 RW-rootFS, 119>>508 leshort >0 root_dev 0x%X, 120>>502 leshort >0 swap_dev 0x%X, 121>>504 leshort >0 RAMdisksize %u KB, 122>>506 leshort 0xFFFF Normal VGA 123>>506 leshort 0xFFFE Extended VGA 124>>506 leshort 0xFFFD Prompt for Videomode 125>>506 leshort >0 Video mode %d 126# This also matches new kernels, which were caught above by "HdrS". 1270 belong 0xb8c0078e Linux kernel 128>0x1e3 string Loading version 1.3.79 or older 129>0x1e9 string Loading from prehistoric times 130 131# System.map files - Nicol�s Lichtmaier <nick@debian.org> 1328 search/1 \ A\ _text Linux kernel symbol map text 133 134# LSM entries - Nicol�s Lichtmaier <nick@debian.org> 1350 search/1 Begin3 Linux Software Map entry text 1360 search/1 Begin4 Linux Software Map entry text (new format) 137 138# From Matt Zimmerman, enhanced for v3 by Matthew Palmer 1390 belong 0x4f4f4f4d User-mode Linux COW file 140>4 belong <3 \b, version %d 141>>8 string >\0 \b, backing file %s 142>4 belong >2 \b, version %d 143>>32 string >\0 \b, backing file %s 144 145############################################################################ 146# Linux kernel versions 147 1480 string \xb8\xc0\x07\x8e\xd8\xb8\x00\x90 Linux 149>497 leshort 0 x86 boot sector 150>>514 belong 0x8e of a kernel from the dawn of time! 151>>514 belong 0x908ed8b4 version 0.99-1.1.42 152>>514 belong 0x908ed8b8 for memtest86 153 154>497 leshort !0 x86 kernel 155>>504 leshort >0 RAMdisksize=%u KB 156>>502 leshort >0 swap=0x%X 157>>508 leshort >0 root=0x%X 158>>>498 leshort 1 \b-ro 159>>>498 leshort 0 \b-rw 160>>506 leshort 0xFFFF vga=normal 161>>506 leshort 0xFFFE vga=extended 162>>506 leshort 0xFFFD vga=ask 163>>506 leshort >0 vga=%d 164>>514 belong 0x908ed881 version 1.1.43-1.1.45 165>>514 belong 0x15b281cd 166>>>0xa8e belong 0x55AA5a5a version 1.1.46-1.2.13,1.3.0 167>>>0xa99 belong 0x55AA5a5a version 1.3.1,2 168>>>0xaa3 belong 0x55AA5a5a version 1.3.3-1.3.30 169>>>0xaa6 belong 0x55AA5a5a version 1.3.31-1.3.41 170>>>0xb2b belong 0x55AA5a5a version 1.3.42-1.3.45 171>>>0xaf7 belong 0x55AA5a5a version 1.3.46-1.3.72 172>>514 string HdrS 173>>>518 leshort >0x1FF 174>>>>529 byte 0 \b, zImage 175>>>>529 byte 1 \b, bzImage 176>>>>(526.s+0x200) string >\0 \b, version %s 177 178# Linux boot sector thefts. 1790 belong 0xb8c0078e Linux 180>0x1e6 belong 0x454c4b53 ELKS Kernel 181>0x1e6 belong !0x454c4b53 style boot sector 182 183############################################################################ 184# Linux S390 kernel image 185# Created by: Jan Kaluza <jkaluza@redhat.com> 1868 string \x02\x00\x00\x18\x60\x00\x00\x50\x02\x00\x00\x68\x60\x00\x00\x50\x40\x40\x40\x40\x40\x40\x40\x40 Linux S390 187>0x00010000 search/b/4096 \x00\x0a\x00\x00\x8b\xad\xcc\xcc 188# 64bit 189>>&0 string \xc1\x00\xef\xe3\xf0\x68\x00\x00 Z10 64bit kernel 190>>&0 string \xc1\x00\xef\xc3\x00\x00\x00\x00 Z9-109 64bit kernel 191>>&0 string \xc0\x00\x20\x00\x00\x00\x00\x00 Z990 64bit kernel 192>>&0 string \x00\x00\x00\x00\x00\x00\x00\x00 Z900 64bit kernel 193# 32bit 194>>&0 string \x81\x00\xc8\x80\x00\x00\x00\x00 Z10 32bit kernel 195>>&0 string \x81\x00\xc8\x80\x00\x00\x00\x00 Z9-109 32bit kernel 196>>&0 string \x80\x00\x20\x00\x00\x00\x00\x00 Z990 32bit kernel 197>>&0 string \x80\x00\x00\x00\x00\x00\x00\x00 Z900 32bit kernel 198 199############################################################################ 200# Linux 8086 executable 2010 lelong&0xFF0000FF 0xC30000E9 Linux-Dev86 executable, headerless 202>5 string . 203>>4 string >\0 \b, libc version %s 204 2050 lelong&0xFF00FFFF 0x4000301 Linux-8086 executable 206>2 byte&0x01 !0 \b, unmapped zero page 207>2 byte&0x20 0 \b, impure 208>2 byte&0x20 !0 209>>2 byte&0x10 !0 \b, A_EXEC 210>2 byte&0x02 !0 \b, A_PAL 211>2 byte&0x04 !0 \b, A_NSYM 212>2 byte&0x08 !0 \b, A_STAND 213>2 byte&0x40 !0 \b, A_PURE 214>2 byte&0x80 !0 \b, A_TOVLY 215>28 long !0 \b, not stripped 216>37 string . 217>>36 string >\0 \b, libc version %s 218 219# 0 lelong&0xFF00FFFF 0x10000301 ld86 I80386 executable 220# 0 lelong&0xFF00FFFF 0xB000301 ld86 M68K executable 221# 0 lelong&0xFF00FFFF 0xC000301 ld86 NS16K executable 222# 0 lelong&0xFF00FFFF 0x17000301 ld86 SPARC executable 223 224# SYSLINUX boot logo files (from 'ppmtolss16' sources) 225# http://syslinux.zytor.com/ 226# 2270 lelong =0x1413f33d SYSLINUX' LSS16 image data 228>4 leshort x \b, width %d 229>6 leshort x \b, height %d 230 2310 string OOOM User-Mode-Linux's Copy-On-Write disk image 232>4 belong x version %d 233 234# SE Linux policy database 235# From: Mike Frysinger <vapier@gentoo.org> 2360 lelong 0xf97cff8c SE Linux policy 237>16 lelong x v%d 238>20 lelong 1 MLS 239>24 lelong x %d symbols 240>28 lelong x %d ocons 241 242# Linux Logical Volume Manager (LVM) 243# Emmanuel VARAGNAT <emmanuel.varagnat@guzu.net> 244# 245# System ID, UUID and volume group name are 128 bytes long 246# but they should never be full and initialized with zeros... 247# 248# LVM1 249# 2500x0 string HM\001 LVM1 (Linux Logical Volume Manager), version 1 251>0x12c string >\0 , System ID: %s 252 2530x0 string HM\002 LVM1 (Linux Logical Volume Manager), version 2 254>0x12c string >\0 , System ID: %s 255 256# LVM2 257# 258# It seems that the label header can be in one the four first sector 259# of the disk... (from _find_labeller in lib/label/label.c of LVM2) 260# 261# 0x200 seems to be the common case 262 2630x218 string LVM2\ 001 LVM2 PV (Linux Logical Volume Manager) 264# read the offset to add to the start of the header, and the header 265# start in 0x200 266>&(&-12.l-0x21) byte x 267# display UUID in LVM format + display all 32 bytes (instead of max string length: 31) 268>>&0x0 string >\x2f \b, UUID: %.6s 269>>&0x6 string >\x2f \b-%.4s 270>>&0xa string >\x2f \b-%.4s 271>>&0xe string >\x2f \b-%.4s 272>>&0x12 string >\x2f \b-%.4s 273>>&0x16 string >\x2f \b-%.4s 274>>&0x1a string >\x2f \b-%.6s 275>>&0x20 lequad x \b, size: %lld 276 2770x018 string LVM2\ 001 LVM2 PV (Linux Logical Volume Manager) 278>&(&-12.l-0x21) byte x 279# display UUID in LVM format + display all 32 bytes (instead of max string length: 31) 280>>&0x0 string >\x2f \b, UUID: %.6s 281>>&0x6 string >\x2f \b-%.4s 282>>&0xa string >\x2f \b-%.4s 283>>&0xe string >\x2f \b-%.4s 284>>&0x12 string >\x2f \b-%.4s 285>>&0x16 string >\x2f \b-%.4s 286>>&0x1a string >\x2f \b-%.6s 287>>&0x20 lequad x \b, size: %lld 288 2890x418 string LVM2\ 001 LVM2 PV (Linux Logical Volume Manager) 290>&(&-12.l-0x21) byte x 291# display UUID in LVM format + display all 32 bytes (instead of max string length: 31) 292>>&0x0 string >\x2f \b, UUID: %.6s 293>>&0x6 string >\x2f \b-%.4s 294>>&0xa string >\x2f \b-%.4s 295>>&0xe string >\x2f \b-%.4s 296>>&0x12 string >\x2f \b-%.4s 297>>&0x16 string >\x2f \b-%.4s 298>>&0x1a string >\x2f \b-%.6s 299>>&0x20 lequad x \b, size: %lld 300 3010x618 string LVM2\ 001 LVM2 PV (Linux Logical Volume Manager) 302>&(&-12.l-0x21) byte x 303# display UUID in LVM format + display all 32 bytes (instead of max string length: 31) 304>>&0x0 string >\x2f \b, UUID: %.6s 305>>&0x6 string >\x2f \b-%.4s 306>>&0xa string >\x2f \b-%.4s 307>>&0xe string >\x2f \b-%.4s 308>>&0x12 string >\x2f \b-%.4s 309>>&0x16 string >\x2f \b-%.4s 310>>&0x1a string >\x2f \b-%.6s 311>>&0x20 lequad x \b, size: %lld 312 313# LVM snapshot 314# from Jason Farrel 3150 string SnAp LVM Snapshot (CopyOnWrite store) 316>4 lelong !0 - valid, 317>4 lelong 0 - invalid, 318>8 lelong x version %d, 319>12 lelong x chunk_size %d 320 321# SE Linux policy database 3220 lelong 0xf97cff8c SE Linux policy 323>16 lelong x v%d 324>20 lelong 1 MLS 325>24 lelong x %d symbols 326>28 lelong x %d ocons 327 328# LUKS: Linux Unified Key Setup, On-Disk Format, http://luks.endorphin.org/spec 329# Anthon van der Neut (anthon@mnt.org) 3300 string LUKS\xba\xbe LUKS encrypted file, 331>6 beshort x ver %d 332>8 string x [%s, 333>40 string x %s, 334>72 string x %s] 335>168 string x UUID: %s 336 337 338# Summary: Xen saved domain file 339# Created by: Radek Vokal <rvokal@redhat.com> 3400 string LinuxGuestRecord Xen saved domain 341>20 search/256 (name 342>>&1 string x (name %s) 343 344# Type: Xen, the virtual machine monitor 345# From: Radek Vokal <rvokal@redhat.com> 3460 string LinuxGuestRecord Xen saved domain 347#>2 regex \(name\ [^)]*\) %s 348>20 search/256 (name (name 349>>&1 string x %s...) 350