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