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