1*b6cee71dSXin LI 2*b6cee71dSXin LI#------------------------------------------------------------------------------ 3*b6cee71dSXin LI# $File: apple,v 1.29 2014/04/30 21:41:02 christos Exp $ 4*b6cee71dSXin LI# apple: file(1) magic for Apple file formats 5*b6cee71dSXin LI# 6*b6cee71dSXin LI0 search/1/t FiLeStArTfIlEsTaRt binscii (apple ][) text 7*b6cee71dSXin LI0 string \x0aGL Binary II (apple ][) data 8*b6cee71dSXin LI0 string \x76\xff Squeezed (apple ][) data 9*b6cee71dSXin LI0 string NuFile NuFile archive (apple ][) data 10*b6cee71dSXin LI0 string N\xf5F\xe9l\xe5 NuFile archive (apple ][) data 11*b6cee71dSXin LI0 belong 0x00051600 AppleSingle encoded Macintosh file 12*b6cee71dSXin LI0 belong 0x00051607 AppleDouble encoded Macintosh file 13*b6cee71dSXin LI 14*b6cee71dSXin LI# Type: Apple Emulator 2IMG format 15*b6cee71dSXin LI# From: Radek Vokal <rvokal@redhat.com> 16*b6cee71dSXin LI0 string 2IMG Apple ][ 2IMG Disk Image 17*b6cee71dSXin LI>4 string XGS! \b, XGS 18*b6cee71dSXin LI>4 string CTKG \b, Catakig 19*b6cee71dSXin LI>4 string ShIm \b, Sheppy's ImageMaker 20*b6cee71dSXin LI>4 string WOOF \b, Sweet 16 21*b6cee71dSXin LI>4 string B2TR \b, Bernie ][ the Rescue 22*b6cee71dSXin LI>4 string !nfc \b, ASIMOV2 23*b6cee71dSXin LI>4 string x \b, Unknown Format 24*b6cee71dSXin LI>0xc byte 00 \b, DOS 3.3 sector order 25*b6cee71dSXin LI>>0x10 byte 00 \b, Volume 254 26*b6cee71dSXin LI>>0x10 byte&0x7f x \b, Volume %u 27*b6cee71dSXin LI>0xc byte 01 \b, ProDOS sector order 28*b6cee71dSXin LI>>0x14 short x \b, %u Blocks 29*b6cee71dSXin LI>0xc byte 02 \b, NIB data 30*b6cee71dSXin LI 31*b6cee71dSXin LI# magic for Newton PDA package formats 32*b6cee71dSXin LI# from Ruda Moura <ruda@helllabs.org> 33*b6cee71dSXin LI0 string package0 Newton package, NOS 1.x, 34*b6cee71dSXin LI>12 belong &0x80000000 AutoRemove, 35*b6cee71dSXin LI>12 belong &0x40000000 CopyProtect, 36*b6cee71dSXin LI>12 belong &0x10000000 NoCompression, 37*b6cee71dSXin LI>12 belong &0x04000000 Relocation, 38*b6cee71dSXin LI>12 belong &0x02000000 UseFasterCompression, 39*b6cee71dSXin LI>16 belong x version %d 40*b6cee71dSXin LI 41*b6cee71dSXin LI0 string package1 Newton package, NOS 2.x, 42*b6cee71dSXin LI>12 belong &0x80000000 AutoRemove, 43*b6cee71dSXin LI>12 belong &0x40000000 CopyProtect, 44*b6cee71dSXin LI>12 belong &0x10000000 NoCompression, 45*b6cee71dSXin LI>12 belong &0x04000000 Relocation, 46*b6cee71dSXin LI>12 belong &0x02000000 UseFasterCompression, 47*b6cee71dSXin LI>16 belong x version %d 48*b6cee71dSXin LI 49*b6cee71dSXin LI0 string package4 Newton package, 50*b6cee71dSXin LI>8 byte 8 NOS 1.x, 51*b6cee71dSXin LI>8 byte 9 NOS 2.x, 52*b6cee71dSXin LI>12 belong &0x80000000 AutoRemove, 53*b6cee71dSXin LI>12 belong &0x40000000 CopyProtect, 54*b6cee71dSXin LI>12 belong &0x10000000 NoCompression, 55*b6cee71dSXin LI 56*b6cee71dSXin LI# The following entries for the Apple II are for files that have 57*b6cee71dSXin LI# been transferred as raw binary data from an Apple, without having 58*b6cee71dSXin LI# been encapsulated by any of the above archivers. 59*b6cee71dSXin LI# 60*b6cee71dSXin LI# In general, Apple II formats are hard to identify because Apple DOS 61*b6cee71dSXin LI# and especially Apple ProDOS have strong typing in the file system and 62*b6cee71dSXin LI# therefore programmers never felt much need to include type information 63*b6cee71dSXin LI# in the files themselves. 64*b6cee71dSXin LI# 65*b6cee71dSXin LI# Eric Fischer <enf@pobox.com> 66*b6cee71dSXin LI 67*b6cee71dSXin LI# AppleWorks word processor: 68*b6cee71dSXin LI# 69*b6cee71dSXin LI# This matches the standard tab stops for an AppleWorks file, but if 70*b6cee71dSXin LI# a file has a tab stop set in the first four columns this will fail. 71*b6cee71dSXin LI# 72*b6cee71dSXin LI# The "O" is really the magic number, but that's so common that it's 73*b6cee71dSXin LI# necessary to check the tab stops that follow it to avoid false positives. 74*b6cee71dSXin LI 75*b6cee71dSXin LI4 string O==== AppleWorks word processor data 76*b6cee71dSXin LI>85 byte&0x01 >0 \b, zoomed 77*b6cee71dSXin LI>90 byte&0x01 >0 \b, paginated 78*b6cee71dSXin LI>92 byte&0x01 >0 \b, with mail merge 79*b6cee71dSXin LI#>91 byte x \b, left margin %d 80*b6cee71dSXin LI 81*b6cee71dSXin LI# AppleWorks database: 82*b6cee71dSXin LI# 83*b6cee71dSXin LI# This isn't really a magic number, but it's the closest thing to one 84*b6cee71dSXin LI# that I could find. The 1 and 2 really mean "order in which you defined 85*b6cee71dSXin LI# categories" and "left to right, top to bottom," respectively; the D and R 86*b6cee71dSXin LI# mean that the cursor should move either down or right when you press Return. 87*b6cee71dSXin LI 88*b6cee71dSXin LI#30 string \x01D AppleWorks database data 89*b6cee71dSXin LI#30 string \x02D AppleWorks database data 90*b6cee71dSXin LI#30 string \x01R AppleWorks database data 91*b6cee71dSXin LI#30 string \x02R AppleWorks database data 92*b6cee71dSXin LI 93*b6cee71dSXin LI# AppleWorks spreadsheet: 94*b6cee71dSXin LI# 95*b6cee71dSXin LI# Likewise, this isn't really meant as a magic number. The R or C means 96*b6cee71dSXin LI# row- or column-order recalculation; the A or M means automatic or manual 97*b6cee71dSXin LI# recalculation. 98*b6cee71dSXin LI 99*b6cee71dSXin LI#131 string RA AppleWorks spreadsheet data 100*b6cee71dSXin LI#131 string RM AppleWorks spreadsheet data 101*b6cee71dSXin LI#131 string CA AppleWorks spreadsheet data 102*b6cee71dSXin LI#131 string CM AppleWorks spreadsheet data 103*b6cee71dSXin LI 104*b6cee71dSXin LI# Applesoft BASIC: 105*b6cee71dSXin LI# 106*b6cee71dSXin LI# This is incredibly sloppy, but will be true if the program was 107*b6cee71dSXin LI# written at its usual memory location of 2048 and its first line 108*b6cee71dSXin LI# number is less than 256. Yuck. 109*b6cee71dSXin LI# update by Joerg Jenderek at Feb 2013 110*b6cee71dSXin LI 111*b6cee71dSXin LI# GRR: this test is still too general as it catches also Gujin BOOT144.SYS (0xfa080000) 112*b6cee71dSXin LI#0 belong&0xff00ff 0x80000 Applesoft BASIC program data 113*b6cee71dSXin LI0 belong&0x00ff00ff 0x00080000 114*b6cee71dSXin LI# assuming that line number must be positive 115*b6cee71dSXin LI>2 leshort >0 Applesoft BASIC program data, first line number %d 116*b6cee71dSXin LI#>2 leshort x \b, first line number %d 117*b6cee71dSXin LI 118*b6cee71dSXin LI# ORCA/EZ assembler: 119*b6cee71dSXin LI# 120*b6cee71dSXin LI# This will not identify ORCA/M source files, since those have 121*b6cee71dSXin LI# some sort of date code instead of the two zero bytes at 6 and 7 122*b6cee71dSXin LI# XXX Conflicts with ELF 123*b6cee71dSXin LI#4 belong&0xff00ffff 0x01000000 ORCA/EZ assembler source data 124*b6cee71dSXin LI#>5 byte x \b, build number %d 125*b6cee71dSXin LI 126*b6cee71dSXin LI# Broderbund Fantavision 127*b6cee71dSXin LI# 128*b6cee71dSXin LI# I don't know what these values really mean, but they seem to recur. 129*b6cee71dSXin LI# Will they cause too many conflicts? 130*b6cee71dSXin LI 131*b6cee71dSXin LI# Probably :-) 132*b6cee71dSXin LI#2 belong&0xFF00FF 0x040008 Fantavision movie data 133*b6cee71dSXin LI 134*b6cee71dSXin LI# Some attempts at images. 135*b6cee71dSXin LI# 136*b6cee71dSXin LI# These are actually just bit-for-bit dumps of the frame buffer, so 137*b6cee71dSXin LI# there's really no reasonably way to distinguish them except for their 138*b6cee71dSXin LI# address (if preserved) -- 8192 or 16384 -- and their length -- 8192 139*b6cee71dSXin LI# or, occasionally, 8184. 140*b6cee71dSXin LI# 141*b6cee71dSXin LI# Nevertheless this will manage to catch a lot of images that happen 142*b6cee71dSXin LI# to have a solid-colored line at the bottom of the screen. 143*b6cee71dSXin LI 144*b6cee71dSXin LI# GRR: Magic too weak 145*b6cee71dSXin LI#8144 string \x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F Apple II image with white background 146*b6cee71dSXin LI#8144 string \x55\x2A\x55\x2A\x55\x2A\x55\x2A Apple II image with purple background 147*b6cee71dSXin LI#8144 string \x2A\x55\x2A\x55\x2A\x55\x2A\x55 Apple II image with green background 148*b6cee71dSXin LI#8144 string \xD5\xAA\xD5\xAA\xD5\xAA\xD5\xAA Apple II image with blue background 149*b6cee71dSXin LI#8144 string \xAA\xD5\xAA\xD5\xAA\xD5\xAA\xD5 Apple II image with orange background 150*b6cee71dSXin LI 151*b6cee71dSXin LI# Beagle Bros. Apple Mechanic fonts 152*b6cee71dSXin LI 153*b6cee71dSXin LI0 belong&0xFF00FFFF 0x6400D000 Apple Mechanic font 154*b6cee71dSXin LI 155*b6cee71dSXin LI# Apple Universal Disk Image Format (UDIF) - dmg files. 156*b6cee71dSXin LI# From Johan Gade. 157*b6cee71dSXin LI# These entries are disabled for now until we fix the following issues. 158*b6cee71dSXin LI# 159*b6cee71dSXin LI# Note there might be some problems with the "VAX COFF executable" 160*b6cee71dSXin LI# entry. Note this entry should be placed before the mac filesystem section, 161*b6cee71dSXin LI# particularly the "Apple Partition data" entry. 162*b6cee71dSXin LI# 163*b6cee71dSXin LI# The intended meaning of these tests is, that the file is only of the 164*b6cee71dSXin LI# specified type if both of the lines are correct - i.e. if the first 165*b6cee71dSXin LI# line matches and the second doesn't then it is not of that type. 166*b6cee71dSXin LI# 167*b6cee71dSXin LI#0 long 0x7801730d 168*b6cee71dSXin LI#>4 long 0x62626060 UDIF read-only zlib-compressed image (UDZO) 169*b6cee71dSXin LI# 170*b6cee71dSXin LI# Note that this entry is recognized correctly by the "Apple Partition 171*b6cee71dSXin LI# data" entry - however since this entry is more specific - this 172*b6cee71dSXin LI# information seems to be more useful. 173*b6cee71dSXin LI#0 long 0x45520200 174*b6cee71dSXin LI#>0x410 string disk\ image UDIF read/write image (UDRW) 175*b6cee71dSXin LI 176*b6cee71dSXin LI# From: Toby Peterson <toby@apple.com> 177*b6cee71dSXin LI0 string bplist00 Apple binary property list 178*b6cee71dSXin LI 179*b6cee71dSXin LI# Apple binary property list (bplist) 180*b6cee71dSXin LI# Assumes version bytes are hex. 181*b6cee71dSXin LI# Provides content hints for version 0 files. Assumes that the root 182*b6cee71dSXin LI# object is the first object (true for CoreFoundation implementation). 183*b6cee71dSXin LI# From: David Remahl <dremahl@apple.com> 184*b6cee71dSXin LI0 string bplist 185*b6cee71dSXin LI>6 byte x \bCoreFoundation binary property list data, version 0x%c 186*b6cee71dSXin LI>>7 byte x \b%c 187*b6cee71dSXin LI>6 string 00 \b 188*b6cee71dSXin LI>>8 byte&0xF0 0x00 \b 189*b6cee71dSXin LI>>>8 byte&0x0F 0x00 \b, root type: null 190*b6cee71dSXin LI>>>8 byte&0x0F 0x08 \b, root type: false boolean 191*b6cee71dSXin LI>>>8 byte&0x0F 0x09 \b, root type: true boolean 192*b6cee71dSXin LI>>8 byte&0xF0 0x10 \b, root type: integer 193*b6cee71dSXin LI>>8 byte&0xF0 0x20 \b, root type: real 194*b6cee71dSXin LI>>8 byte&0xF0 0x30 \b, root type: date 195*b6cee71dSXin LI>>8 byte&0xF0 0x40 \b, root type: data 196*b6cee71dSXin LI>>8 byte&0xF0 0x50 \b, root type: ascii string 197*b6cee71dSXin LI>>8 byte&0xF0 0x60 \b, root type: unicode string 198*b6cee71dSXin LI>>8 byte&0xF0 0x80 \b, root type: uid (CORRUPT) 199*b6cee71dSXin LI>>8 byte&0xF0 0xa0 \b, root type: array 200*b6cee71dSXin LI>>8 byte&0xF0 0xd0 \b, root type: dictionary 201*b6cee71dSXin LI 202*b6cee71dSXin LI# Apple/NeXT typedstream data 203*b6cee71dSXin LI# Serialization format used by NeXT and Apple for various 204*b6cee71dSXin LI# purposes in YellowStep/Cocoa, including some nib files. 205*b6cee71dSXin LI# From: David Remahl <dremahl@apple.com> 206*b6cee71dSXin LI2 string typedstream NeXT/Apple typedstream data, big endian 207*b6cee71dSXin LI>0 byte x \b, version %d 208*b6cee71dSXin LI>0 byte <5 \b 209*b6cee71dSXin LI>>13 byte 0x81 \b 210*b6cee71dSXin LI>>>14 ubeshort x \b, system %d 211*b6cee71dSXin LI2 string streamtyped NeXT/Apple typedstream data, little endian 212*b6cee71dSXin LI>0 byte x \b, version %d 213*b6cee71dSXin LI>0 byte <5 \b 214*b6cee71dSXin LI>>13 byte 0x81 \b 215*b6cee71dSXin LI>>>14 uleshort x \b, system %d 216*b6cee71dSXin LI 217*b6cee71dSXin LI#------------------------------------------------------------------------------ 218*b6cee71dSXin LI# CAF: Apple CoreAudio File Format 219*b6cee71dSXin LI# 220*b6cee71dSXin LI# Container format for high-end audio purposes. 221*b6cee71dSXin LI# From: David Remahl <dremahl@apple.com> 222*b6cee71dSXin LI# 223*b6cee71dSXin LI0 string caff CoreAudio Format audio file 224*b6cee71dSXin LI>4 beshort <10 version %d 225*b6cee71dSXin LI>6 beshort x 226*b6cee71dSXin LI 227*b6cee71dSXin LI 228*b6cee71dSXin LI#------------------------------------------------------------------------------ 229*b6cee71dSXin LI# Keychain database files 230*b6cee71dSXin LI0 string kych Mac OS X Keychain File 231*b6cee71dSXin LI 232*b6cee71dSXin LI#------------------------------------------------------------------------------ 233*b6cee71dSXin LI# Code Signing related file types 234*b6cee71dSXin LI0 belong 0xfade0c00 Mac OS X Code Requirement 235*b6cee71dSXin LI>8 belong 1 (opExpr) 236*b6cee71dSXin LI>4 belong x - %d bytes 237*b6cee71dSXin LI 238*b6cee71dSXin LI0 belong 0xfade0c01 Mac OS X Code Requirement Set 239*b6cee71dSXin LI>8 belong >1 containing %d items 240*b6cee71dSXin LI>4 belong x - %d bytes 241*b6cee71dSXin LI 242*b6cee71dSXin LI0 belong 0xfade0c02 Mac OS X Code Directory 243*b6cee71dSXin LI>8 belong x version %x 244*b6cee71dSXin LI>12 belong >0 flags 0x%x 245*b6cee71dSXin LI>4 belong x - %d bytes 246*b6cee71dSXin LI 247*b6cee71dSXin LI0 belong 0xfade0cc0 Mac OS X Detached Code Signature (non-executable) 248*b6cee71dSXin LI>4 belong x - %d bytes 249*b6cee71dSXin LI 250*b6cee71dSXin LI0 belong 0xfade0cc1 Mac OS X Detached Code Signature 251*b6cee71dSXin LI>8 belong >1 (%d elements) 252*b6cee71dSXin LI>4 belong x - %d bytes 253*b6cee71dSXin LI 254*b6cee71dSXin LI# From: "Nelson A. de Oliveira" <naoliv@gmail.com> 255*b6cee71dSXin LI# .vdi 256*b6cee71dSXin LI4 string innotek\ VirtualBox\ Disk\ Image %s 257*b6cee71dSXin LI 258*b6cee71dSXin LI# Apple disk partition stuff, strengthen the magic using byte 4 259*b6cee71dSXin LI0 beshort 0x4552 260*b6cee71dSXin LI>4 byte 0 Apple Driver Map 261*b6cee71dSXin LI>>2 beshort x \b, blocksize %d 262*b6cee71dSXin LI>>4 belong x \b, blockcount %d 263*b6cee71dSXin LI>>10 beshort x \b, devtype %d 264*b6cee71dSXin LI>>12 beshort x \b, devid %d 265*b6cee71dSXin LI>>20 beshort x \b, descriptors %d 266*b6cee71dSXin LI# Assume 8 partitions each at a multiple of the sector size. 267*b6cee71dSXin LI# We could glean this from the partition descriptors, but they are empty!?!? 268*b6cee71dSXin LI>>(2.S*1) indirect \b, contains[@0x%x]: 269*b6cee71dSXin LI>>(2.S*2) indirect \b, contains[@0x%x]: 270*b6cee71dSXin LI>>(2.S*3) indirect \b, contains[@0x%x]: 271*b6cee71dSXin LI>>(2.S*4) indirect \b, contains[@0x%x]: 272*b6cee71dSXin LI>>(2.S*5) indirect \b, contains[@0x%x]: 273*b6cee71dSXin LI>>(2.S*6) indirect \b, contains[@0x%x]: 274*b6cee71dSXin LI>>(2.S*7) indirect \b, contains[@0x%x]: 275*b6cee71dSXin LI>>(2.S*8) indirect \b, contains[@0x%x]: 276*b6cee71dSXin LI 277*b6cee71dSXin LI# Yes, the 3rd and 4th bytes are reserved, but we use them to make the 278*b6cee71dSXin LI# magic stronger. 279*b6cee71dSXin LI0 belong 0x504d0000 Apple Partition Map 280*b6cee71dSXin LI>4 belong x \b, map block count %d 281*b6cee71dSXin LI>8 belong x \b, start block %d 282*b6cee71dSXin LI>12 belong x \b, block count %d 283*b6cee71dSXin LI>16 string >0 \b, name %s 284*b6cee71dSXin LI>48 string >0 \b, type %s 285*b6cee71dSXin LI>124 string >0 \b, processor %s 286*b6cee71dSXin LI>140 string >0 \b, boot arguments %s 287*b6cee71dSXin LI>92 belong & 1 \b, valid 288*b6cee71dSXin LI>92 belong & 2 \b, allocated 289*b6cee71dSXin LI>92 belong & 4 \b, in use 290*b6cee71dSXin LI>92 belong & 8 \b, has boot info 291*b6cee71dSXin LI>92 belong & 16 \b, readable 292*b6cee71dSXin LI>92 belong & 32 \b, writable 293*b6cee71dSXin LI>92 belong & 64 \b, pic boot code 294*b6cee71dSXin LI>92 belong & 128 \b, chain compatible driver 295*b6cee71dSXin LI>92 belong & 256 \b, real driver 296*b6cee71dSXin LI>92 belong & 512 \b, chain driver 297*b6cee71dSXin LI>92 belong & 1024 \b, mount at startup 298*b6cee71dSXin LI>92 belong & 2048 \b, is the startup partition 299*b6cee71dSXin LI 300*b6cee71dSXin LI#http://wiki.mozilla.org/DS_Store_File_Format` 301*b6cee71dSXin LI#http://en.wikipedia.org/wiki/.DS_Store 302*b6cee71dSXin LI0 string \0\0\0\1Bud1\0 Apple Desktop Services Store 303