1 2#------------------------------------------------------------------------------ 3# $File: linux,v 1.52 2013/11/19 23:18:15 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 390 string \01\03\04\20 Minix-386 NSYM/GNU executable 40>28 long !0 not stripped 41# core dump file, from Bill Reynolds <bill@goshawk.lanl.gov> 42216 lelong 0421 Linux/i386 core file 43>220 string >\0 of '%s' 44>200 lelong >0 (signal %d) 45# 46# LILO boot/chain loaders, from Daniel Quinlan <quinlan@yggdrasil.com> 47# this can be overridden by the DOS executable (COM) entry 482 string LILO Linux/i386 LILO boot/chain loader 49# 50# Linux make config build file, from Ole Aamot <oka@oka.no> 5128 string make\ config Linux make config build file 52# 53# PSF fonts, from H. Peter Anvin <hpa@yggdrasil.com> 54# Updated by Adam Buchbinder <adam.buchbinder@gmail.com> 55# See: http://www.win.tue.nl/~aeb/linux/kbd/font-formats-1.html 560 leshort 0x0436 Linux/i386 PC Screen Font v1 data, 57>2 byte&0x01 0 256 characters, 58>2 byte&0x01 !0 512 characters, 59>2 byte&0x02 0 no directory, 60>2 byte&0x02 !0 Unicode directory, 61>3 byte >0 8x%d 620 string \x72\xb5\x4a\x86\x00\x00 Linux/i386 PC Screen Font v2 data, 63>16 lelong x %d characters, 64>12 lelong&0x01 0 no directory, 65>12 lelong&0x01 !0 Unicode directory, 66>24 lelong x %d 67>28 lelong x \bx%d 68 69# Linux swap file, from Daniel Quinlan <quinlan@yggdrasil.com> 704086 string SWAP-SPACE Linux/i386 swap file 71# From: Jeff Bailey <jbailey@ubuntu.com> 72# Linux swap file with swsusp1 image, from Jeff Bailey <jbailey@ubuntu.com> 734076 string SWAPSPACE2S1SUSPEND Linux/i386 swap file (new style) with SWSUSP1 image 74# From: James Hunt <james.hunt@ubuntu.com> 754076 string SWAPSPACE2LINHIB0001 Linux/i386 swap file (new style) (compressed hibernate) 76# according to man page of mkswap (8) March 1999 77# volume label and UUID Russell Coker 78# http://etbe.coker.com.au/2008/07/08/label-vs-uuid-vs-device/ 794086 string SWAPSPACE2 Linux/i386 swap file (new style), 80>0x400 long x version %d (4K pages), 81>0x404 long x size %d pages, 82>1052 string \0 no label, 83>1052 string >\0 LABEL=%s, 84>0x40c belong x UUID=%08x 85>0x410 beshort x \b-%04x 86>0x412 beshort x \b-%04x 87>0x414 beshort x \b-%04x 88>0x416 belong x \b-%08x 89>0x41a beshort x \b%04x 90# From Daniel Novotny <dnovotny@redhat.com> 91# swap file for PowerPC 9265526 string SWAPSPACE2 Linux/ppc swap file 9316374 string SWAPSPACE2 Linux/ia64 swap file 94# 95# Linux kernel boot images, from Albert Cahalan <acahalan@cs.uml.edu> 96# and others such as Axel Kohlmeyer <akohlmey@rincewind.chemie.uni-ulm.de> 97# and Nicolas Lichtmaier <nick@debian.org> 98# All known start with: b8 c0 07 8e d8 b8 00 90 8e c0 b9 00 01 29 f6 29 99# Linux kernel boot images (i386 arch) (Wolfram Kleff) 100514 string HdrS Linux kernel 101!:strength + 55 102>510 leshort 0xAA55 x86 boot executable 103>>518 leshort >0x1ff 104>>>529 byte 0 zImage, 105>>>529 byte 1 bzImage, 106>>>526 lelong >0 107>>>>(526.s+0x200) string >\0 version %s, 108>>498 leshort 1 RO-rootFS, 109>>498 leshort 0 RW-rootFS, 110>>508 leshort >0 root_dev 0x%X, 111>>502 leshort >0 swap_dev 0x%X, 112>>504 leshort >0 RAMdisksize %u KB, 113>>506 leshort 0xFFFF Normal VGA 114>>506 leshort 0xFFFE Extended VGA 115>>506 leshort 0xFFFD Prompt for Videomode 116>>506 leshort >0 Video mode %d 117# This also matches new kernels, which were caught above by "HdrS". 1180 belong 0xb8c0078e Linux kernel 119>0x1e3 string Loading version 1.3.79 or older 120>0x1e9 string Loading from prehistoric times 121 122# System.map files - Nicolas Lichtmaier <nick@debian.org> 1238 search/1 \ A\ _text Linux kernel symbol map text 124 125# LSM entries - Nicolas Lichtmaier <nick@debian.org> 1260 search/1 Begin3 Linux Software Map entry text 1270 search/1 Begin4 Linux Software Map entry text (new format) 128 129# From Matt Zimmerman, enhanced for v3 by Matthew Palmer 1300 belong 0x4f4f4f4d User-mode Linux COW file 131>4 belong <3 \b, version %d 132>>8 string >\0 \b, backing file %s 133>4 belong >2 \b, version %d 134>>32 string >\0 \b, backing file %s 135 136############################################################################ 137# Linux kernel versions 138 1390 string \xb8\xc0\x07\x8e\xd8\xb8\x00\x90 Linux 140>497 leshort 0 x86 boot sector 141>>514 belong 0x8e of a kernel from the dawn of time! 142>>514 belong 0x908ed8b4 version 0.99-1.1.42 143>>514 belong 0x908ed8b8 for memtest86 144 145>497 leshort !0 x86 kernel 146>>504 leshort >0 RAMdisksize=%u KB 147>>502 leshort >0 swap=0x%X 148>>508 leshort >0 root=0x%X 149>>>498 leshort 1 \b-ro 150>>>498 leshort 0 \b-rw 151>>506 leshort 0xFFFF vga=normal 152>>506 leshort 0xFFFE vga=extended 153>>506 leshort 0xFFFD vga=ask 154>>506 leshort >0 vga=%d 155>>514 belong 0x908ed881 version 1.1.43-1.1.45 156>>514 belong 0x15b281cd 157>>>0xa8e belong 0x55AA5a5a version 1.1.46-1.2.13,1.3.0 158>>>0xa99 belong 0x55AA5a5a version 1.3.1,2 159>>>0xaa3 belong 0x55AA5a5a version 1.3.3-1.3.30 160>>>0xaa6 belong 0x55AA5a5a version 1.3.31-1.3.41 161>>>0xb2b belong 0x55AA5a5a version 1.3.42-1.3.45 162>>>0xaf7 belong 0x55AA5a5a version 1.3.46-1.3.72 163>>514 string HdrS 164>>>518 leshort >0x1FF 165>>>>529 byte 0 \b, zImage 166>>>>529 byte 1 \b, bzImage 167>>>>(526.s+0x200) string >\0 \b, version %s 168 169# Linux boot sector thefts. 1700 belong 0xb8c0078e Linux 171>0x1e6 belong 0x454c4b53 ELKS Kernel 172>0x1e6 belong !0x454c4b53 style boot sector 173 174############################################################################ 175# Linux S390 kernel image 176# Created by: Jan Kaluza <jkaluza@redhat.com> 1778 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 178>0x00010000 search/b/4096 \x00\x0a\x00\x00\x8b\xad\xcc\xcc 179# 64bit 180>>&0 string \xc1\x00\xef\xe3\xf0\x68\x00\x00 Z10 64bit kernel 181>>&0 string \xc1\x00\xef\xc3\x00\x00\x00\x00 Z9-109 64bit kernel 182>>&0 string \xc0\x00\x20\x00\x00\x00\x00\x00 Z990 64bit kernel 183>>&0 string \x00\x00\x00\x00\x00\x00\x00\x00 Z900 64bit kernel 184# 32bit 185>>&0 string \x81\x00\xc8\x80\x00\x00\x00\x00 Z10 32bit kernel 186>>&0 string \x81\x00\xc8\x80\x00\x00\x00\x00 Z9-109 32bit kernel 187>>&0 string \x80\x00\x20\x00\x00\x00\x00\x00 Z990 32bit kernel 188>>&0 string \x80\x00\x00\x00\x00\x00\x00\x00 Z900 32bit kernel 189 190# Linux ARM compressed kernel image 191# From: Kevin Cernekee <cernekee@gmail.com> 19236 lelong 0x016f2818 Linux kernel ARM boot executable zImage (little-endian) 19336 belong 0x016f2818 Linux kernel ARM boot executable zImage (big-endian) 194 195############################################################################ 196# Linux 8086 executable 1970 lelong&0xFF0000FF 0xC30000E9 Linux-Dev86 executable, headerless 198>5 string . 199>>4 string >\0 \b, libc version %s 200 2010 lelong&0xFF00FFFF 0x4000301 Linux-8086 executable 202>2 byte&0x01 !0 \b, unmapped zero page 203>2 byte&0x20 0 \b, impure 204>2 byte&0x20 !0 205>>2 byte&0x10 !0 \b, A_EXEC 206>2 byte&0x02 !0 \b, A_PAL 207>2 byte&0x04 !0 \b, A_NSYM 208>2 byte&0x08 !0 \b, A_STAND 209>2 byte&0x40 !0 \b, A_PURE 210>2 byte&0x80 !0 \b, A_TOVLY 211>28 long !0 \b, not stripped 212>37 string . 213>>36 string >\0 \b, libc version %s 214 215# 0 lelong&0xFF00FFFF 0x10000301 ld86 I80386 executable 216# 0 lelong&0xFF00FFFF 0xB000301 ld86 M68K executable 217# 0 lelong&0xFF00FFFF 0xC000301 ld86 NS16K executable 218# 0 lelong&0xFF00FFFF 0x17000301 ld86 SPARC executable 219 220# SYSLINUX boot logo files (from 'ppmtolss16' sources) 221# http://www.syslinux.org/wiki/index.php/SYSLINUX#Display_graphic_from_filename: 222# file extension .lss .16 2230 lelong =0x1413f33d SYSLINUX' LSS16 image data 224# syslinux-4.05/mime/image/x-lss16.xml 225!:mime image/x-lss16 226>4 leshort x \b, width %d 227>6 leshort x \b, height %d 228 2290 string OOOM User-Mode-Linux's Copy-On-Write disk image 230>4 belong x version %d 231 232# SE Linux policy database 233# From: Mike Frysinger <vapier@gentoo.org> 2340 lelong 0xf97cff8c SE Linux policy 235>16 lelong x v%d 236>20 lelong 1 MLS 237>24 lelong x %d symbols 238>28 lelong x %d ocons 239 240# Linux Logical Volume Manager (LVM) 241# Emmanuel VARAGNAT <emmanuel.varagnat@guzu.net> 242# 243# System ID, UUID and volume group name are 128 bytes long 244# but they should never be full and initialized with zeros... 245# 246# LVM1 247# 2480x0 string HM\001 LVM1 (Linux Logical Volume Manager), version 1 249>0x12c string >\0 , System ID: %s 250 2510x0 string HM\002 LVM1 (Linux Logical Volume Manager), version 2 252>0x12c string >\0 , System ID: %s 253 254# LVM2 255# 256# It seems that the label header can be in one the four first sector 257# of the disk... (from _find_labeller in lib/label/label.c of LVM2) 258# 259# 0x200 seems to be the common case 260 2610x218 string LVM2\ 001 LVM2 PV (Linux Logical Volume Manager) 262# read the offset to add to the start of the header, and the header 263# start in 0x200 264>&(&-12.l-0x21) byte x 265# display UUID in LVM format + display all 32 bytes (instead of max string length: 31) 266>>&0x0 string >\x2f \b, UUID: %.6s 267>>&0x6 string >\x2f \b-%.4s 268>>&0xa string >\x2f \b-%.4s 269>>&0xe string >\x2f \b-%.4s 270>>&0x12 string >\x2f \b-%.4s 271>>&0x16 string >\x2f \b-%.4s 272>>&0x1a string >\x2f \b-%.6s 273>>&0x20 lequad x \b, size: %lld 274 2750x018 string LVM2\ 001 LVM2 PV (Linux Logical Volume Manager) 276>&(&-12.l-0x21) byte x 277# display UUID in LVM format + display all 32 bytes (instead of max string length: 31) 278>>&0x0 string >\x2f \b, UUID: %.6s 279>>&0x6 string >\x2f \b-%.4s 280>>&0xa string >\x2f \b-%.4s 281>>&0xe string >\x2f \b-%.4s 282>>&0x12 string >\x2f \b-%.4s 283>>&0x16 string >\x2f \b-%.4s 284>>&0x1a string >\x2f \b-%.6s 285>>&0x20 lequad x \b, size: %lld 286 2870x418 string LVM2\ 001 LVM2 PV (Linux Logical Volume Manager) 288>&(&-12.l-0x21) byte x 289# display UUID in LVM format + display all 32 bytes (instead of max string length: 31) 290>>&0x0 string >\x2f \b, UUID: %.6s 291>>&0x6 string >\x2f \b-%.4s 292>>&0xa string >\x2f \b-%.4s 293>>&0xe string >\x2f \b-%.4s 294>>&0x12 string >\x2f \b-%.4s 295>>&0x16 string >\x2f \b-%.4s 296>>&0x1a string >\x2f \b-%.6s 297>>&0x20 lequad x \b, size: %lld 298 2990x618 string LVM2\ 001 LVM2 PV (Linux Logical Volume Manager) 300>&(&-12.l-0x21) byte x 301# display UUID in LVM format + display all 32 bytes (instead of max string length: 31) 302>>&0x0 string >\x2f \b, UUID: %.6s 303>>&0x6 string >\x2f \b-%.4s 304>>&0xa string >\x2f \b-%.4s 305>>&0xe string >\x2f \b-%.4s 306>>&0x12 string >\x2f \b-%.4s 307>>&0x16 string >\x2f \b-%.4s 308>>&0x1a string >\x2f \b-%.6s 309>>&0x20 lequad x \b, size: %lld 310 311# LVM snapshot 312# from Jason Farrel 3130 string SnAp LVM Snapshot (CopyOnWrite store) 314>4 lelong !0 - valid, 315>4 lelong 0 - invalid, 316>8 lelong x version %d, 317>12 lelong x chunk_size %d 318 319# SE Linux policy database 3200 lelong 0xf97cff8c SE Linux policy 321>16 lelong x v%d 322>20 lelong 1 MLS 323>24 lelong x %d symbols 324>28 lelong x %d ocons 325 326# LUKS: Linux Unified Key Setup, On-Disk Format, http://luks.endorphin.org/spec 327# Anthon van der Neut (anthon@mnt.org) 3280 string LUKS\xba\xbe LUKS encrypted file, 329>6 beshort x ver %d 330>8 string x [%s, 331>40 string x %s, 332>72 string x %s] 333>168 string x UUID: %s 334 335 336# Summary: Xen saved domain file 337# Created by: Radek Vokal <rvokal@redhat.com> 3380 string LinuxGuestRecord Xen saved domain 339>20 search/256 (name 340>>&1 string x (name %s) 341 342# Type: Xen, the virtual machine monitor 343# From: Radek Vokal <rvokal@redhat.com> 3440 string LinuxGuestRecord Xen saved domain 345#>2 regex \(name\ [^)]*\) %s 346>20 search/256 (name (name 347>>&1 string x %s...) 348 349# Systemd journald files 350# See http://www.freedesktop.org/wiki/Software/systemd/journal-files/. 351# From: Zbigniew Jedrzejewski-Szmek <zbyszek@in.waw.pl> 352 353# check magic 3540 string LPKSHHRH 355# check that state is one of known values 356>16 ubyte&252 0 357# check that each half of three unique id128s is non-zero 358>>24 ubequad >0 359>>>32 ubequad >0 360>>>>40 ubequad >0 361>>>>>48 ubequad >0 362>>>>>>56 ubequad >0 363>>>>>>>64 ubequad >0 Journal file 364!:mime application/octet-stream 365# provide more info 366>>>>>>>>184 leqdate 0 empty 367>>>>>>>>16 ubyte 0 \b, offline 368>>>>>>>>16 ubyte 1 \b, online 369>>>>>>>>16 ubyte 2 \b, archived 370>>>>>>>>8 ulelong&1 1 \b, sealed 371>>>>>>>>12 ulelong&1 1 \b, compressed 372 373# BCache backing and cache devices 374# From: Gabriel de Perthuis <g2p.code@gmail.com> 3750x1008 lequad 8 376>0x1018 string \xc6\x85\x73\xf6\x4e\x1a\x45\xca\x82\x65\xf5\x7f\x48\xba\x6d\x81 BCache 377>>0x1010 ulequad 0 cache device 378>>0x1010 ulequad 1 backing device 379>>0x1010 ulequad 3 cache device 380>>0x1010 ulequad 4 backing device 381>>0x1048 string >0 \b, label "%.32s" 382>>0x1028 ubelong x \b, uuid %08x 383>>0x102c ubeshort x \b-%04x 384>>0x102e ubeshort x \b-%04x 385>>0x1030 ubeshort x \b-%04x 386>>0x1032 ubelong x \b-%08x 387>>0x1036 ubeshort x \b%04x 388>>0x1038 ubelong x \b, set uuid %08x 389>>0x103c ubeshort x \b-%04x 390>>0x103e ubeshort x \b-%04x 391>>0x1040 ubeshort x \b-%04x 392>>0x1042 ubelong x \b-%08x 393>>0x1046 ubeshort x \b%04x 394 395