apple 16 KB

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