archive 93 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607
  1. #------------------------------------------------------------------------------
  2. # $File: archive,v 1.193 2023/07/27 17:55:58 christos Exp $
  3. # archive: file(1) magic for archive formats (see also "msdos" for self-
  4. # extracting compressed archives)
  5. #
  6. # cpio, ar, arc, arj, hpack, lha/lharc, rar, squish, uc2, zip, zoo, etc.
  7. # pre-POSIX "tar" archives are also handled in the C code ../../src/is_tar.c.
  8. # POSIX tar archives
  9. # URL: https://en.wikipedia.org/wiki/Tar_(computing)
  10. # Reference: https://www.freebsd.org/cgi/man.cgi?query=tar&sektion=5&manpath=FreeBSD+8-current
  11. # header mainly padded with nul bytes
  12. 500 quad 0
  13. !:strength /2
  14. # filename or extended attribute printable strings in range space null til umlaut ue
  15. >0 ubeshort >0x1F00
  16. >>0 ubeshort <0xFCFD
  17. # last 4 header bytes often null but tar\0 in gtarfail2.tar gtarfail.tar-bad
  18. # at https://sourceforge.net/projects/s-tar/files/testscripts/
  19. >>>508 ubelong&0x8B9E8DFF 0
  20. # nul, space or ascii digit 0-7 at start of mode
  21. >>>>100 ubyte&0xC8 =0
  22. >>>>>101 ubyte&0xC8 =0
  23. # nul, space at end of check sum
  24. >>>>>>155 ubyte&0xDF =0
  25. # space or ascii digit 0 at start of check sum
  26. >>>>>>>148 ubyte&0xEF =0x20
  27. # FOR DEBUGGING:
  28. #>>>>>>>>0 regex \^[0-9]{2,4}[.](png|jpg|jpeg|tif|tiff|gif|bmp) NAME "%s"
  29. # check for 1st image main name with digits used for sorting
  30. # and for name extension case insensitive like: PNG JPG JPEG TIF TIFF GIF BMP
  31. >>>>>>>>0 regex \^[0-9]{2,4}[.](png|jpg|jpeg|tif|tiff|gif|bmp)
  32. >>>>>>>>>0 use tar-cbt
  33. # check for 1st member name with ovf suffix
  34. >>>>>>>>0 regex \^.{1,96}[.](ovf)
  35. >>>>>>>>>0 use tar-ova
  36. # if 1st member name without digits and without used image suffix and without *.ovf then it is a TAR archive
  37. >>>>>>>>0 default x
  38. >>>>>>>>>0 use tar-file
  39. # minimal check and then display tar archive information which can also be
  40. # embedded inside others like Android Backup, Clam AntiVirus database
  41. 0 name tar-file
  42. >257 string !ustar
  43. # header padded with nuls
  44. >>257 ulong =0
  45. # GNU tar version 1.29 with non pax format option without refusing
  46. # creates misleading V7 header for Long path, Multi-volume, Volume type
  47. >>>156 ubyte 0x4c GNU tar archive
  48. !:mime application/x-gtar
  49. !:ext tar/gtar
  50. >>>156 ubyte 0x4d GNU tar archive
  51. !:mime application/x-gtar
  52. !:ext tar/gtar
  53. >>>156 ubyte 0x56 GNU tar archive
  54. !:mime application/x-gtar
  55. !:ext tar/gtar
  56. >>>156 default x tar archive (V7)
  57. !:mime application/x-tar
  58. !:ext tar
  59. # other stuff in padding
  60. # some implementations add new fields to the blank area at the end of the header record
  61. # created for example by DOS TAR 3.20g 1994 Tim V.Shapore with -j option
  62. >>257 ulong !0 tar archive (old)
  63. !:mime application/x-tar
  64. !:ext tar
  65. # magic in newer, GNU, posix variants
  66. >257 string =ustar
  67. # 2 last char of magic and UStar version because string expression does not work
  68. # 2 space characters followed by a null for GNU variant
  69. >>261 ubelong =0x72202000 POSIX tar archive (GNU)
  70. !:mime application/x-gtar
  71. !:ext tar/gtar
  72. # UStar version with ASCII "00"
  73. >>261 ubelong 0x72003030 POSIX
  74. # gLOBAL and ExTENSION type only found in POSIX.1-2001 format
  75. >>>156 ubyte 0x67 \b.1-2001
  76. >>>156 ubyte 0x78 \b.1-2001
  77. >>>156 ubyte x tar archive
  78. !:mime application/x-ustar
  79. !:ext tar/ustar
  80. # version with 2 binary nuls embedded in Android Backup like com.android.settings.ab
  81. >>261 ubelong 0x72000000 tar archive (ustar)
  82. !:mime application/x-ustar
  83. !:ext tar/ustar
  84. # not seen ustar variant with garbish version
  85. >>261 default x tar archive (unknown ustar)
  86. !:mime application/x-ustar
  87. !:ext tar/ustar
  88. # type flag of 1st tar archive member
  89. #>156 ubyte x \b, %c-type
  90. >156 ubyte x
  91. >>156 ubyte 0 \b, file
  92. >>156 ubyte 0x30 \b, file
  93. >>156 ubyte 0x31 \b, hard link
  94. >>156 ubyte 0x32 \b, symlink
  95. >>156 ubyte 0x33 \b, char device
  96. >>156 ubyte 0x34 \b, block device
  97. >>156 ubyte 0x35 \b, directory
  98. >>156 ubyte 0x36 \b, fifo
  99. >>156 ubyte 0x37 \b, reserved
  100. >>156 ubyte 0x4c \b, long path
  101. >>156 ubyte 0x4d \b, multi volume
  102. >>156 ubyte 0x56 \b, volume
  103. >>156 ubyte 0x67 \b, global
  104. >>156 ubyte 0x78 \b, extension
  105. >>156 default x \b, type
  106. >>>156 ubyte x '%c'
  107. # name[100]
  108. >0 string >\0 %-.60s
  109. # mode mainly stored as an octal number in ASCII null or space terminated
  110. >100 string >\0 \b, mode %-.7s
  111. # user id mainly as octal numbers in ASCII null or space terminated
  112. >108 string >\0 \b, uid %-.7s
  113. # group id mainly as octal numbers in ASCII null or space terminated
  114. >116 string >\0 \b, gid %-.7s
  115. # size mainly as octal number in ASCII
  116. >124 ubyte <0x38
  117. >>124 string >\0 \b, size %-.12s
  118. # coding indicated by setting the high-order bit of the leftmost byte
  119. >124 ubyte >0xEF \b, size 0x
  120. >>124 ubyte !0xff \b%2.2x
  121. >>125 ubyte !0xff \b%2.2x
  122. >>126 ubyte !0xff \b%2.2x
  123. >>127 ubyte !0xff \b%2.2x
  124. >>128 ubyte !0xff \b%2.2x
  125. >>129 ubyte !0xff \b%2.2x
  126. >>130 ubyte !0xff \b%2.2x
  127. >>131 ubyte !0xff \b%2.2x
  128. >>132 ubyte !0xff \b%2.2x
  129. >>133 ubyte !0xff \b%2.2x
  130. >>134 ubyte !0xff \b%2.2x
  131. >>135 ubyte !0xff \b%2.2x
  132. # seconds since 0:0:0 1 jan 1970 UTC as octal number mainly in ASCII null or space terminated
  133. >136 string >\0 \b, seconds %-.11s
  134. # header checksum stored as an octal number in ASCII null or space terminated
  135. #>148 string x \b, cksum %.7s
  136. # linkname[100]
  137. >157 string >\0 \b, linkname %-.40s
  138. # additional fields for ustar
  139. >257 string =ustar
  140. # owner user name null terminated
  141. >>265 string >\0 \b, user %-.32s
  142. # group name null terminated
  143. >>297 string >\0 \b, group %-.32s
  144. # device major minor if not zero
  145. >>329 ubequad&0xCFCFCFCFcFcFcFdf !0
  146. >>>329 string x \b, devmaj %-.7s
  147. >>337 ubequad&0xCFCFCFCFcFcFcFdf !0
  148. >>>337 string x \b, devmin %-.7s
  149. # prefix[155]
  150. >>345 string >\0 \b, prefix %-.155s
  151. # old non ustar/POSIX tar
  152. >257 string !ustar
  153. >>508 string =tar\0
  154. # padding[255] in old star
  155. >>>257 string >\0 \b, padding: %-.40s
  156. >>508 default x
  157. # padding[255] in old tar sometimes comment field
  158. >>>257 string >\0 \b, comment: %-.40s
  159. # Summary: Comic Book Archive *.CBT with TAR format
  160. # URL: https://en.wikipedia.org/wiki/Comic_book_archive
  161. # http://fileformats.archiveteam.org/wiki/Comic_Book_Archive
  162. # Note: there exist also RAR, ZIP, ACE and 7Z packed variants
  163. 0 name tar-cbt
  164. >0 string x Comic Book archive, tar archive
  165. #!:mime application/x-tar
  166. !:mime application/vnd.comicbook
  167. #!:mime application/vnd.comicbook+tar
  168. !:ext cbt
  169. # name[100] probably like: 19.jpg 0001.png 0002.png
  170. # or maybe like ComicInfo.xml
  171. >0 string >\0 \b, 1st image %-.60s
  172. # Summary: Open Virtualization Format *.OVF with disk images and more packed as TAR archive *.OVA
  173. # From: Joerg Jenderek
  174. # URL: https://en.wikipedia.org/wiki/Open_Virtualization_Format
  175. # http://fileformats.archiveteam.org/wiki/OVF_(Open_Virtualization_Format)
  176. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/o/ova.trid.xml
  177. # Note: called "Open Virtualization Format package" by TrID
  178. # assuming *.ovf comes first
  179. 0 name tar-ova
  180. >0 string x Open Virtualization Format Archive
  181. #!:mime application/x-ustar
  182. # http://extension.nirsoft.net/ova
  183. !:mime application/x-virtualbox-ova
  184. !:ext ova
  185. # assuming name[100] like: DOS-0.9.ovf FreeDOS_1.ovf Win98SE_DE.ovf
  186. >0 string >\0 \b, with %-.60s
  187. # Incremental snapshot gnu-tar format from:
  188. # https://www.gnu.org/software/tar/manual/html_node/Snapshot-Files.html
  189. 0 string GNU\ tar- GNU tar incremental snapshot data
  190. >&0 regex [0-9]\\.[0-9]+-[0-9]+ version %s
  191. # cpio archives
  192. #
  193. # Yes, the top two "cpio archive" formats *are* supposed to just be "short".
  194. # The idea is to indicate archives produced on machines with the same
  195. # byte order as the machine running "file" with "cpio archive", and
  196. # to indicate archives produced on machines with the opposite byte order
  197. # from the machine running "file" with "byte-swapped cpio archive".
  198. #
  199. # The SVR4 "cpio(4)" hints that there are additional formats, but they
  200. # are defined as "short"s; I think all the new formats are
  201. # character-header formats and thus are strings, not numbers.
  202. # URL: http://fileformats.archiveteam.org/wiki/Cpio
  203. # https://en.wikipedia.org/wiki/Cpio
  204. # Reference: https://people.freebsd.org/~kientzle/libarchive/man/cpio.5.txt
  205. # Update: Joerg Jenderek
  206. #
  207. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/a/ark-cpio-bin.trid.xml
  208. # Note: called "CPIO archive (binary)" by TrID, "cpio/Binary LE" by 7-Zip and "CPIO" by DROID via PUID fmt/635
  209. 0 short 070707
  210. # skip DROID fmt-635-signature-id-960.cpio by looking for pathname of 1st entry
  211. >26 string >\0 cpio archive
  212. !:mime application/x-cpio
  213. # https://download.opensuse.org/distribution/leap/15.4/iso/openSUSE-Leap-15.4-NET-x86_64-Media.iso
  214. # boot/x86_64/loader/bootlogo
  215. # message.cpi
  216. !:ext /cpio/cpi
  217. >>0 use cpio-bin
  218. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/a/ark-cpio-bin-sw.trid.xml
  219. # Note: called "CPIO archive (byte swapped binary)" by TrID and "Cpio/Binary BE" by 7-Zip
  220. 0 short 0143561 byte-swapped cpio archive
  221. !:mime application/x-cpio # encoding: swapped
  222. # https://telparia.com/fileFormatSamples/archive/cpio/skeleton2.cpio
  223. !:ext cpio
  224. >0 use cpio-bin-be
  225. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/a/ark-cpio.trid.xml
  226. # Note: called "CPIO archive (portable)" by TrID, "cpio/Portable ASCII" by 7-Zip and "cpio/odc" by GNU cpio
  227. 0 string 070707 ASCII cpio archive (pre-SVR4 or odc)
  228. !:mime application/x-cpio
  229. # https://telparia.com/fileFormatSamples/archive/cpio/ pthreads-1.60B5.osr5src.cpio cinema.cpi VOL.000.008 VOL.000.012
  230. !:ext cpio/cpi/008/012
  231. # Note: called "CPIO archive (portable)" by TrID, "cpio/New ASCII" by 7-Zip and "cpio/newc" by GNU cpio
  232. 0 string 070701 ASCII cpio archive (SVR4 with no CRC)
  233. !:mime application/x-cpio
  234. # https://telparia.com/fileFormatSamples/archive/cpio/MainActor-2.06.3.cpio
  235. !:ext cpio
  236. # Note: called "CPIO archive (portable)" by TrID, "cpio/New CRC" by 7-Zip and "cpio/crc" by GNU cpio
  237. 0 string 070702 ASCII cpio archive (SVR4 with CRC)
  238. !:mime application/x-cpio
  239. # http://ftp.gnu.org/gnu/tar/tar-1.27.cpio.gz
  240. # https://telparia.com/fileFormatSamples/archive/cpio/pcmcia
  241. !:ext /cpio
  242. # display information of old binary cpio archive
  243. # Note: verfied by 7-Zip `7z l -tcpio -slt *.cpio` and
  244. # `cpio -ivt --numeric-uid-gid --file=clam.bin-le.cpio`
  245. 0 name cpio-bin
  246. # c_dev; device number; WHAT IS THAT?
  247. >2 uleshort x \b; device %u
  248. # c_ino; truncated inode number; use `ls --inode`
  249. >4 uleshort x \b, inode %u
  250. # c_mode; mode specifies permissions and file type like: ?622~?rw-r--r-- by `ls -l`
  251. >6 uleshort x \b, mode %o
  252. # c_uid; numeric user id; use `ls --numeric-uid-gid`
  253. >8 uleshort x \b, uid %u
  254. # c_gid; numeric group id
  255. >10 uleshort x \b, gid %u
  256. # c_nlink; links to this file; directories at least 2
  257. >12 uleshort >1 \b, %u links
  258. # c_rdev; device number for block and character entries; zero for all other entries by writers
  259. # like 0x0440 for /dev/ttyS0
  260. >14 uleshort >0 \b, device %#4.4x
  261. # c_mtime[2]; modification time in seconds since 1 January 1970; most-significant 16 bits first
  262. >16 medate x \b, modified %s
  263. # c_filesize[2]; size of pathname; most-significant 16 bits first like: 544
  264. >22 melong x \b, %u bytes
  265. # c_namesize; bytes in the pathname that follows the header like: 9
  266. #>20 uleshort x \b, namesize %u
  267. # pathname of entry like: "clam.exe"
  268. >26 string x "%s"
  269. # display information of old binary byte swapped cpio archive
  270. # Note: verfied by 7-Zip `7z l -tcpio -slt *.cpio` and
  271. # `LANGUAGE=C cpio -ivt --numeric-uid-gid --file=clam.bin-be.cpio`
  272. 0 name cpio-bin-be
  273. >2 ubeshort x \b; device %u
  274. >4 ubeshort x \b, inode %u
  275. >6 ubeshort x \b, mode %o
  276. >8 ubeshort x \b, uid %u
  277. >10 ubeshort x \b, gid %u
  278. >12 ubeshort >1 \b, %u links
  279. >14 ubeshort >0 \b, device %#4.4x
  280. >16 bedate x \b, modified %s
  281. >22 ubelong x \b, %u bytes
  282. #>20 ubeshort x \b, namesize %u
  283. >26 string x "%s"
  284. #
  285. # Various archive formats used by various versions of the "ar"
  286. # command.
  287. #
  288. #
  289. # Original UNIX archive formats.
  290. # They were written with binary values in host byte order, and
  291. # the magic number was a host "int", which might have been 16 bits
  292. # or 32 bits. We don't say "PDP-11" or "VAX", as there might have
  293. # been ports to little-endian 16-bit-int or 32-bit-int platforms
  294. # (x86?) using some of those formats; if none existed, feel free
  295. # to use "PDP-11" for little-endian 16-bit and "VAX" for little-endian
  296. # 32-bit. There might have been big-endian ports of that sort as
  297. # well.
  298. #
  299. 0 leshort 0177555 very old 16-bit-int little-endian archive
  300. 0 beshort 0177555 very old 16-bit-int big-endian archive
  301. 0 lelong 0177555 very old 32-bit-int little-endian archive
  302. 0 belong 0177555 very old 32-bit-int big-endian archive
  303. 0 leshort 0177545 old 16-bit-int little-endian archive
  304. >2 string __.SYMDEF random library
  305. 0 beshort 0177545 old 16-bit-int big-endian archive
  306. >2 string __.SYMDEF random library
  307. 0 lelong 0177545 old 32-bit-int little-endian archive
  308. >4 string __.SYMDEF random library
  309. 0 belong 0177545 old 32-bit-int big-endian archive
  310. >4 string __.SYMDEF random library
  311. #
  312. # From "pdp" (but why a 4-byte quantity?)
  313. #
  314. 0 lelong 0x39bed PDP-11 old archive
  315. 0 lelong 0x39bee PDP-11 4.0 archive
  316. #
  317. # XXX - what flavor of APL used this, and was it a variant of
  318. # some ar archive format? It's similar to, but not the same
  319. # as, the APL workspace magic numbers in pdp.
  320. #
  321. 0 long 0100554 apl workspace
  322. #
  323. # System V Release 1 portable(?) archive format.
  324. #
  325. 0 string =<ar> System V Release 1 ar archive
  326. !:mime application/x-archive
  327. #
  328. # Debian package; it's in the portable archive format, and needs to go
  329. # before the entry for regular portable archives, as it's recognized as
  330. # a portable archive whose first member has a name beginning with
  331. # "debian".
  332. #
  333. # Update: Joerg Jenderek
  334. # URL: https://en.wikipedia.org/wiki/Deb_(file_format)
  335. 0 string =!<arch>\ndebian
  336. # https://manpages.debian.org/testing/dpkg/dpkg-split.1.en.html
  337. >14 string -split part of multipart Debian package
  338. !:mime application/vnd.debian.binary-package
  339. # udeb is used for stripped down deb file
  340. !:ext deb/udeb
  341. >14 string -binary Debian binary package
  342. !:mime application/vnd.debian.binary-package
  343. # For ipk packager see also https://en.wikipedia.org/wiki/Opkg
  344. !:ext deb/udeb/ipk
  345. # This should not happen
  346. >14 default x Unknown Debian package
  347. # NL terminated version; for most Debian cases this is 2.0 or 2.1 for split
  348. >68 string >\0 (format %s)
  349. #>68 string !2.0\n
  350. #>>68 string x (format %.3s)
  351. >68 string =2.0\n
  352. # 2nd archive name=control archive name like control.tar.gz or control.tar.xz
  353. # or control.tar.zst
  354. >>72 string >\0 \b, with %.15s
  355. # look for 3rd archive name=data archive name like data.tar.{gz,xz,bz2,lzma}
  356. >>0 search/0x93e4f data.tar. \b, data compression
  357. # the above line only works if FILE_BYTES_MAX in ../../src/file.h is raised
  358. # for example like libreoffice-dev-doc_1%3a5.2.7-1+rpi1+deb9u3_all.deb
  359. >>>&0 string x %.2s
  360. # skip space (0x20 BSD) and slash (0x2f System V) character marking end of name
  361. >>>&2 ubyte !0x20
  362. >>>>&-1 ubyte !0x2f
  363. # display 3rd character of file name extension like 2 of bz2 or m of lzma
  364. >>>>>&-1 ubyte x \b%c
  365. >>>>>>&0 ubyte !0x20
  366. >>>>>>>&-1 ubyte !0x2f
  367. # display 4th character of file name extension like a of lzma
  368. >>>>>>>>&-1 ubyte x \b%c
  369. # split debian package case
  370. >68 string =2.1\n
  371. # dpkg-1.18.25/dpkg-split/info.c
  372. # NL terminated ASCII package name like ckermit
  373. >>&0 string x \b, %s
  374. # NL terminated package version like 302-5.3
  375. >>>&1 string x %s
  376. # NL terminated MD5 checksum
  377. >>>>&1 string x \b, MD5 %s
  378. # NL terminated original package length
  379. >>>>>&1 string x \b, unsplitted size %s
  380. # NL terminated part length
  381. >>>>>>&1 string x \b, part length %s
  382. # NL terminated package part like n/m
  383. >>>>>>>&1 string x \b, part %s
  384. # NL terminated package architecture like armhf since dpkg 1.16.1 or later
  385. >>>>>>>>&1 string x \b, %s
  386. #
  387. # MIPS archive; they're in the portable archive format, and need to go
  388. # before the entry for regular portable archives, as it's recognized as
  389. # a portable archive whose first member has a name beginning with
  390. # "__________E".
  391. #
  392. 0 string =!<arch>\n__________E MIPS archive
  393. !:mime application/x-archive
  394. >20 string U with MIPS Ucode members
  395. >21 string L with MIPSEL members
  396. >21 string B with MIPSEB members
  397. >19 string L and an EL hash table
  398. >19 string B and an EB hash table
  399. >22 string X -- out of date
  400. #
  401. # BSD/SVR2-and-later portable archive formats.
  402. #
  403. # Update: Joerg Jenderek
  404. # URL: http://fileformats.archiveteam.org/wiki/AR
  405. # Reference: https://www.unix.com/man-page/opensolaris/3HEAD/ar.h/
  406. # Note: Mach-O universal binary in ./cafebabe is dependent
  407. # TODO: unify current ar archive, MIPS archive, Debian package
  408. # distinguish BSD, SVR; 32, 64 bit; HP from other 32-bit SVR;
  409. # *.ar packages from *.a libraries. handle empty archive
  410. 0 string =!<arch>\n current ar archive
  411. # print first and possibly second ar_name[16] for debugging purpose
  412. #>8 string x \b, 1st "%.16s"
  413. #>68 string x \b, 2nd "%.16s"
  414. !:mime application/x-archive
  415. # a in most case for libraries; lib for Microsoft libraries; ar else cases
  416. !:ext a/lib/ar
  417. >8 string __.SYMDEF random library
  418. # first member with long marked name __.SYMDEF SORTED implies BSD library
  419. >68 string __.SYMDEF\ SORTED random library
  420. # Reference: https://parisc.wiki.kernel.org/images-parisc/b/b2/Rad_11_0_32.pdf
  421. # "archive file" entry moved from ./hp
  422. # LST header system_id 0210h~PA-RISC 1.1,... identifies the target architecture
  423. # LST header a_magic 0619h~relocatable library
  424. >68 belong 0x020b0619 - PA-RISC1.0 relocatable library
  425. >68 belong 0x02100619 - PA-RISC1.1 relocatable library
  426. >68 belong 0x02110619 - PA-RISC1.2 relocatable library
  427. >68 belong 0x02140619 - PA-RISC2.0 relocatable library
  428. #EOF for common ar archives
  429. #
  430. # "Thin" archive, as can be produced by GNU ar.
  431. #
  432. 0 string =!<thin>\n thin archive with
  433. >68 belong 0 no symbol entries
  434. >68 belong 1 %d symbol entry
  435. >68 belong >1 %d symbol entries
  436. 0 search/1 -h- Software Tools format archive text
  437. # ARC archiver, from Daniel Quinlan (quinlan@yggdrasil.com)
  438. #
  439. # The first byte is the magic (0x1a), byte 2 is the compression type for
  440. # the first file (0x01 through 0x09), and bytes 3 to 15 are the MS-DOS
  441. # filename of the first file (null terminated). Since some types collide
  442. # we only test some types on basis of frequency: 0x08 (83%), 0x09 (5%),
  443. # 0x02 (5%), 0x03 (3%), 0x04 (2%), 0x06 (2%). 0x01 collides with terminfo.
  444. 0 lelong&0x8080ffff 0x0000081a ARC archive data, dynamic LZW
  445. !:mime application/x-arc
  446. 0 lelong&0x8080ffff 0x0000091a ARC archive data, squashed
  447. !:mime application/x-arc
  448. 0 lelong&0x8080ffff 0x0000021a ARC archive data, uncompressed
  449. !:mime application/x-arc
  450. 0 lelong&0x8080ffff 0x0000031a ARC archive data, packed
  451. !:mime application/x-arc
  452. 0 lelong&0x8080ffff 0x0000041a ARC archive data, squeezed
  453. !:mime application/x-arc
  454. 0 lelong&0x8080ffff 0x0000061a ARC archive data, crunched
  455. !:mime application/x-arc
  456. # [JW] stuff taken from idarc, obviously ARC successors:
  457. 0 lelong&0x8080ffff 0x00000a1a PAK archive data
  458. !:mime application/x-arc
  459. 0 lelong&0x8080ffff 0x0000141a ARC+ archive data
  460. !:mime application/x-arc
  461. 0 lelong&0x8080ffff 0x0000481a HYP archive data
  462. !:mime application/x-arc
  463. # Acorn archive formats (Disaster prone simpleton, m91dps@ecs.ox.ac.uk)
  464. # I can't create either SPARK or ArcFS archives so I have not tested this stuff
  465. # [GRR: the original entries collide with ARC, above; replaced with combined
  466. # version (not tested)]
  467. #0 byte 0x1a RISC OS archive (spark format)
  468. 0 string \032archive RISC OS archive (ArcFS format)
  469. 0 string Archive\000 RISC OS archive (ArcFS format)
  470. # All these were taken from idarc, many could not be verified. Unfortunately,
  471. # there were many low-quality sigs, i.e. easy to trigger false positives.
  472. # Please notify me of any real-world fishy/ambiguous signatures and I'll try
  473. # to get my hands on the actual archiver and see if I find something better. [JW]
  474. # probably many can be enhanced by finding some 0-byte or control char near the start
  475. # idarc calls this Crush/Uncompressed... *shrug*
  476. 0 string CRUSH Crush archive data
  477. # Squeeze It (.sqz)
  478. 0 string HLSQZ Squeeze It archive data
  479. # SQWEZ
  480. 0 string SQWEZ SQWEZ archive data
  481. # HPack (.hpk)
  482. 0 string HPAK HPack archive data
  483. # HAP
  484. 0 string \x91\x33HF HAP archive data
  485. # MD/MDCD
  486. 0 string MDmd MDCD archive data
  487. # LIM
  488. 0 string LIM\x1a LIM archive data
  489. # SAR
  490. 3 string LH5 SAR archive data
  491. # BSArc/BS2
  492. 0 string \212\3SB\020\0 BSArc/BS2 archive data
  493. # Bethesda Softworks Archive (Oblivion)
  494. 0 string BSA\0 BSArc archive data
  495. >4 lelong x version %d
  496. # MAR
  497. 2 string =-ah MAR archive data
  498. # ACB
  499. #0 belong&0x00f800ff 0x00800000 ACB archive data
  500. # CPZ
  501. # TODO, this is what idarc says: 0 string \0\0\0 CPZ archive data
  502. # JRC
  503. 0 string JRchive JRC archive data
  504. # Quantum
  505. 0 string DS\0 Quantum archive data
  506. # ReSOF
  507. 0 string PK\3\6 ReSOF archive data
  508. # QuArk
  509. 0 string 7\4 QuArk archive data
  510. # YAC
  511. 14 string YC YAC archive data
  512. # X1
  513. 0 string X1 X1 archive data
  514. 0 string XhDr X1 archive data
  515. # CDC Codec (.dqt)
  516. 0 belong&0xffffe000 0x76ff2000 CDC Codec archive data
  517. # AMGC
  518. 0 string \xad6" AMGC archive data
  519. # NuLIB
  520. 0 string N\xc3\xb5F\xc3\xa9lx\xc3\xa5 NuLIB archive data
  521. # PakLeo
  522. 0 string LEOLZW PAKLeo archive data
  523. # ChArc
  524. 0 string SChF ChArc archive data
  525. # PSA
  526. 0 string PSA PSA archive data
  527. # CrossePAC
  528. 0 string DSIGDCC CrossePAC archive data
  529. # Freeze
  530. 0 string \x1f\x9f\x4a\x10\x0a Freeze archive data
  531. # KBoom
  532. 0 string \xc2\xa8MP\xc2\xa8 KBoom archive data
  533. # NSQ, must go after CDC Codec
  534. 0 string \x76\xff NSQ archive data
  535. # DPA
  536. 0 string Dirk\ Paehl DPA archive data
  537. # BA
  538. # TODO: idarc says "bytes 0-2 == bytes 3-5"
  539. # TTComp
  540. # URL: http://fileformats.archiveteam.org/wiki/TTComp_archive
  541. # Update: Joerg Jenderek
  542. # GRR: line below is too general as it matches also Panorama database "TCDB 2003-10 demo.pan", others
  543. 0 string \0\6
  544. # look for first keyword of Panorama database *.pan
  545. >12 search/261 DESIGN
  546. # skip keyword with low entropy
  547. >12 default x
  548. # skip DOS 2.0 backup id file, sequence 6 with many nils like BACKUPID_xx6.@@@ handled by ./msdos
  549. >>8 quad !0
  550. >>>0 use ttcomp
  551. # variant ASCII, 4K dictionary (strength=48=50-2). With strength=49 wrong order! WHY?
  552. 0 string \1\6
  553. # TODO:
  554. # skip VAX-order 68k Blit mpx/mux executable (strength=50) handled by ./blit
  555. !:strength -2
  556. >0 use ttcomp
  557. 0 string \0\5
  558. # skip some DOS 2.0 backup id file, sequence 5 with many nils like BACKUPID_075.@@@ handled by ./msdos
  559. >8 quad !0
  560. >>0 use ttcomp
  561. 0 string \1\5
  562. # TODO:
  563. # variant ASCII, 2K dictionary (strength=48=50-2). With strength=49 wrong order! WHY?
  564. # skip ctab data (strength=50) handled by ./ibm6000
  565. # skip locale data table (strength=50) handled by ./digital
  566. !:strength -2
  567. >0 use ttcomp
  568. 0 string \0\4
  569. # skip many Maple help database *.hdb with version tag handled by ./maple
  570. >1028 string !version
  571. # skip veclib maple.hdb by looking for Mable keyword
  572. >>4 search/1091 Maple\040
  573. #>4 search/34090 Maple\040
  574. >>4 default x
  575. # skip DOS 2.0-3.2 backed up sequence 4 with many nils like LOTUS5.RAR handled by ./msdos
  576. # skip xBASE Compound Index file *.CDX with many nils
  577. >>>0x54 quad !0
  578. >>>>0 use ttcomp
  579. 0 string \1\4
  580. # TODO:
  581. # skip shared library (strength=50) handled by ./ibm6000
  582. !:strength -2
  583. # skip Commodore PET BASIC programs (Mastermind.prg) with last 3 nil bytes (\0~end of line followed by 0000h line offset)
  584. #>-4 ubelong x LAST_BYTES=%8.8x
  585. >-4 ubelong&0x00FFffFF !0
  586. >>0 use ttcomp
  587. # display information of TTComp archive
  588. 0 name ttcomp
  589. # (version 5.25) labeled the entry as "TTComp archive data"
  590. >0 ubyte x TTComp archive data
  591. !:mime application/x-compress-ttcomp
  592. # PBACKSCR.PI1
  593. !:ext $xe/$ts/pi1/__d
  594. # compression type: 0~binary compression 1~ASCII compression
  595. >0 ubyte 0 \b, binary
  596. >0 ubyte 1 \b, ASCII
  597. # size of the dictionary: 4~1024 bytes 5~2048 bytes 6~4096 bytes
  598. >1 ubyte 4 \b, 1K
  599. >1 ubyte 5 \b, 2K
  600. >1 ubyte 6 \b, 4K
  601. >1 ubyte x dictionary
  602. # https://mark0.net/forum/index.php?topic=848
  603. # last 3 bytes probably have only 8 possible bit sequences
  604. # xxxxxxxx 0000000x 11111111 ____FFh
  605. # xxxxxxxx 10000000 01111111 __807Fh
  606. # 0xxxxxxx 11000000 00111111 __C03Fh
  607. # 00xxxxxx 11100000 00011111 __E01Fh
  608. # 000xxxxx 11110000 00001111 __F00Fh
  609. # 0000xxxx 11111000 00000111 __F807h
  610. # 00000xxx 11111100 00000011 __FC03h
  611. # 000000xx 11111110 00000001 __FE01h
  612. # but for quickgif.__d 0A7DD4h
  613. #>-3 ubyte x \b, last 3 bytes 0x%2.2x
  614. #>-2 ubeshort x \b%4.4x
  615. # From: Joerg Jenderek
  616. # URL: https://en.wikipedia.org/wiki/Disk_Copy
  617. # reference: http://nulib.com/library/FTN.e00005.htm
  618. 0x52 ubeshort 0x0100
  619. # test for disk image size equal or above 400k
  620. >0x40 ubelong >409599
  621. # test also for disk image size equal or below 1440k to skip
  622. # windows7en.mbr UNICODE.DAT
  623. #>>0x40 ubelong <1474561
  624. # test now for "low" disk image size equal or below 64 MiB to skip
  625. # windows7en.mbr (B441BBAAh) UNICODE.DAT (0400AF05h)
  626. >>0x40 ubelong <0x04000001
  627. # To skip Flags$StringJoiner.class with size 00106A61h test also for valid disk image sizes
  628. # 00064000 for 400k GCR disks dc42-400k-gcr.trid.xml
  629. # 000c8000 for 800k GCR disks dc42-800k-gcr.trid.xml
  630. # 000b4000 for 720k MFM disks dc42-720k-mfm.trid.xml
  631. # 00168000 for 1440k MFM disks dc42-1440k-mfm.trid.xml
  632. # https://lisaem.sunder.net/LisaProjectDocs.txt
  633. # 00500000 05M available
  634. # 00A00000 10M available
  635. # 01800000 24M possible
  636. # 02000000 32M uncertain
  637. # 04000000 64M uncertain
  638. >>>0x40 ubelong&0xf8003fFF 0
  639. # skip samples with invalid disk name length like:
  640. # 181 (biosmd80.rom) 202 (Flags$StringJoiner.class) 90 (UNICODE.DAT)
  641. >>>>0x0 ubyte <64
  642. >>>>>0 use dc42-floppy
  643. # display information of Apple DiskCopy 4.2 floppy image
  644. 0 name dc42-floppy
  645. # disk name length; maximal 63
  646. #>0 ubyte x DISK NAME LENGTH %u
  647. # ASCII image pascal (maximal 63 bytes) name padded with NULs like:
  648. # "Microsoft Mail" "Disquette 2" "IIe Installer Disk"
  649. # "-lisaem.sunder.net hd-" (dc42-lisaem.trid.xml) "-not a Macintosh disk" (dc42-nonmac.trid.xml)
  650. >00 pstring/B x Apple DiskCopy 4.2 image %s
  651. #!:mime application/octet-stream
  652. !:mime application/x-dc42-floppy-image
  653. !:apple dCpydImg
  654. # probably also img like: "Utilitaires 2.img" "Installation 7.img"
  655. !:ext image/dc42/img
  656. # data size in bytes like: 409600 737280 819200 1474560
  657. >0x40 ubelong x \b, %u bytes
  658. # for debugging purpose size in hexadecimal
  659. #>0x40 ubelong x (%#8.8x)
  660. # tag size in bytes like: 0 (often) 2580h (PUID fmt/625) 4B00h (Microsoft Mail.image)
  661. >0x44 ubelong >0 \b, %#x tag size
  662. # data checksum
  663. #>0x48 ubelong x \b, %#x checksum
  664. # tag checksum
  665. #>0x4c ubelong x \b, %#x tag checksum
  666. # disk encoding like: 0 1 2 3 (PUID: fmt/625)
  667. >0x50 ubyte 0 \b, GCR CLV ssdd (400k)
  668. >0x50 ubyte 1 \b, GCR CLV dsdd (800k)
  669. >0x50 ubyte 2 \b, MFM CAV dsdd (720k)
  670. >0x50 ubyte 3 \b, MFM CAV dshd (1440k)
  671. >0x50 ubyte >3 \b, %#x encoding
  672. # format byte like: 12h (Lisa 400K) 24h (400K Macintosh) 96h (800K Apple II disk)
  673. # 2 (Mac 400k "Disquette Installation 13.image")
  674. # 22h (double-sided MFM or Mac 800k "Disco 12.image" "IIe Installer Disk.image")
  675. >0x51 ubyte x \b, %#x format
  676. #>0x54 ubequad x \b, data %#16.16llx
  677. # ESP, could this conflict with Easy Software Products' (e.g.ESP ghostscript) documentation?
  678. 0 string ESP ESP archive data
  679. # ZPack
  680. 0 string \1ZPK\1 ZPack archive data
  681. # Sky
  682. 0 string \xbc\x40 Sky archive data
  683. # UFA
  684. 0 string UFA UFA archive data
  685. # Dry
  686. 0 string =-H2O DRY archive data
  687. # FoxSQZ
  688. 0 string FOXSQZ FoxSQZ archive data
  689. # AR7
  690. 0 string ,AR7 AR7 archive data
  691. # PPMZ
  692. 0 string PPMZ PPMZ archive data
  693. # MS Compress
  694. # Update: Joerg Jenderek
  695. # URL: http://fileformats.archiveteam.org/wiki/MS-DOS_installation_compression
  696. # Reference: https://hwiegman.home.xs4all.nl/fileformats/compress/szdd_kwaj_format.html
  697. # Note: use correct version of extracting tool like EXPAND, UNPACK, DECOMP or 7Z
  698. 4 string \x88\xf0\x27
  699. # KWAJ variant
  700. >0 string KWAJ MS Compress archive data, KWAJ variant
  701. !:mime application/x-ms-compress-kwaj
  702. # extension not working in version 5.32
  703. # magic/Magdir/archive, 284: Warning: EXTENSION type ` ??_' has bad char '?'
  704. # file: line 284: Bad magic entry ' ??_'
  705. !:ext ??_
  706. # compression method (0-4)
  707. >>8 uleshort x \b, %u method
  708. # offset of compressed data
  709. >>10 uleshort x \b, %#x offset
  710. #>>(10.s) uleshort x
  711. #>>>&-6 string x \b, TEST extension %-.3s
  712. # header flags to mark header extensions
  713. >>12 uleshort >0 \b, %#x flags
  714. # 4 bytes: decompressed length of file
  715. >>12 uleshort &0x01
  716. >>>14 ulelong x \b, original size: %u bytes
  717. # 2 bytes: unknown purpose
  718. # 2 bytes: length of unknown data + mentioned bytes
  719. # 1-9 bytes: null-terminated file name
  720. # 1-4 bytes: null-terminated file extension
  721. >>12 uleshort &0x08
  722. >>>12 uleshort ^0x01
  723. >>>>12 uleshort ^0x02
  724. >>>>>12 uleshort ^0x04
  725. >>>>>>12 uleshort ^0x10
  726. >>>>>>>14 string x \b, %-.8s
  727. >>>>>>12 uleshort &0x10
  728. >>>>>>>14 string x \b, %-.8s
  729. >>>>>>>>&1 string x \b.%-.3s
  730. >>>>>12 uleshort &0x04
  731. >>>>>>12 uleshort ^0x10
  732. >>>>>>>(14.s) uleshort x
  733. >>>>>>>>&14 string x \b, %-.8s
  734. >>>>>>12 uleshort &0x10
  735. >>>>>>>(14.s) uleshort x
  736. >>>>>>>>&14 string x \b, %-.8s
  737. >>>>>>>>>&1 string x \b.%-.3s
  738. >>>>12 uleshort &0x02
  739. >>>>>12 uleshort ^0x04
  740. >>>>>>12 uleshort ^0x10
  741. >>>>>>>16 string x \b, %-.8s
  742. >>>>>>12 uleshort &0x10
  743. >>>>>>>16 string x \b, %-.8s
  744. >>>>>>>>&1 string x \b.%-.3s
  745. >>>>>12 uleshort &0x04
  746. >>>>>>12 uleshort ^0x10
  747. >>>>>>>(16.s) uleshort x
  748. >>>>>>>>&16 string x \b, %-.8s
  749. >>>>>>12 uleshort &0x10
  750. >>>>>>>(16.s) uleshort x
  751. >>>>>>>&16 string x %-.8s
  752. >>>>>>>>&1 string x \b.%-.3s
  753. >>>12 uleshort &0x01
  754. >>>>12 uleshort ^0x02
  755. >>>>>12 uleshort ^0x04
  756. >>>>>>12 uleshort ^0x10
  757. >>>>>>>18 string x \b, %-.8s
  758. >>>>>>12 uleshort &0x10
  759. >>>>>>>18 string x \b, %-.8s
  760. >>>>>>>>&1 string x \b.%-.3s
  761. >>>>>12 uleshort &0x04
  762. >>>>>>12 uleshort ^0x10
  763. >>>>>>>(18.s) uleshort x
  764. >>>>>>>>&18 string x \b, %-.8s
  765. >>>>>>12 uleshort &0x10
  766. >>>>>>>(18.s) uleshort x
  767. >>>>>>>>&18 string x \b, %-.8s
  768. >>>>>>>>>&1 string x \b.%-.3s
  769. >>>>12 uleshort &0x02
  770. >>>>>12 uleshort ^0x04
  771. >>>>>>12 uleshort ^0x10
  772. >>>>>>>20 string x \b, %-.8s
  773. >>>>>>12 uleshort &0x10
  774. >>>>>>>20 string x \b, %-.8s
  775. >>>>>>>>&1 string x \b.%-.3s
  776. >>>>>12 uleshort &0x04
  777. >>>>>>12 uleshort ^0x10
  778. >>>>>>>(20.s) uleshort x
  779. >>>>>>>>&20 string x \b, %-.8s
  780. >>>>>>12 uleshort &0x10
  781. >>>>>>>(20.s) uleshort x
  782. >>>>>>>>&20 string x \b, %-.8s
  783. >>>>>>>>>&1 string x \b.%-.3s
  784. # 2 bytes: length of data + mentioned bytes
  785. #
  786. # SZDD variant Haruhiko Okumura's LZSS or 7z type MsLZ
  787. # URL: http://fileformats.archiveteam.org/wiki/MS-DOS_installation_compression
  788. # Reference: http://www.cabextract.org.uk/libmspack/doc/szdd_kwaj_format.html
  789. # http://mark0.net/download/triddefs_xml.7z/defs/s/szdd.trid.xml
  790. # Note: called "Microsoft SZDD compressed (Haruhiko Okumura's LZSS)" by TrID
  791. # verfied by 7-Zip `7z l -tMsLZ -slt *.??_` as MsLZ
  792. # `deark -l -m lzss_oku -d2 setup-1-41.bin` as "LZSS.C by Haruhiko Okumura"
  793. >0 string SZDD MS Compress archive data, SZDD variant
  794. # 2nd part of signature
  795. #>>4 ubelong 0x88F02733 \b, SIGNATURE OK
  796. !:mime application/x-ms-compress-szdd
  797. !:ext ??_
  798. # The character missing from the end of the filename (0=unknown)
  799. >>9 string >\0 \b, %-.1s is last character of original name
  800. # https://www.betaarchive.com/forum/viewtopic.php?t=26161
  801. # Compression mode: "A" (0x41) found but sometimes "B" in Windows 3.1 builds 026 and 034e
  802. >>8 string !A \b, %-.1s method
  803. >>10 ulelong >0 \b, original size: %u bytes
  804. # Summary: InstallShield archive with SZDD compressed
  805. # URL: https://community.flexera.com/t5/InstallShield-Knowledge-Base/InstallShield-Redistributable-Files/ta-p/5647
  806. # From: Joerg Jenderek
  807. 1 search/48/bs SZDD\x88\xF0\x27\x33 InstallShield archive
  808. #!:mime application/octet-stream
  809. !:mime application/x-installshield-compress-szdd
  810. !:ext ibt
  811. # name of compressed archive member like: setup.dl_ _setup7int.dl_ _setup2k.dl_ _igdi.dl_ cabinet.dl_
  812. >0 string x %s
  813. # name of uncompressed archive member like: setup.dll _Setup.dll IGdi.dll CABINET.DLL
  814. >>&1 string x (%s)
  815. # probably version like: 9.0.0.333 9.1.0.429 11.50.0.42618
  816. >>>&1 string x \b, version %s
  817. # SZDD member length like: 168048 169333 181842
  818. >>>>&1 string x \b, %s bytes
  819. # MS Compress archive data
  820. #>&0 string SZDD \b, SIGNATURE FOUND
  821. >&0 indirect x
  822. # QBasic SZDD variant
  823. 3 string \x88\xf0\x27
  824. >0 string SZ\x20 MS Compress archive data, QBasic variant
  825. !:mime application/x-ms-compress-sz
  826. !:ext ??$
  827. >>8 ulelong >0 \b, original size: %u bytes
  828. # Summary: lzss compressed/EDI Pack
  829. # From: Joerg Jenderek
  830. # URL: http://fileformats.archiveteam.org/wiki/EDI_Install_packed_file
  831. # Note: called "EDI Install LZS compressed data" by TrID and verified by
  832. # command like `deark -l -m edi_pack -d2 BOOK01A.IC$` as "EDI Pack LZSS1"
  833. 0 string EDILZSS
  834. >7 string 1
  835. # look for point character before orginal file name extension
  836. >>8 search/9/b .
  837. # check suffix of possible orginal file anme
  838. #>>>&0 ubelong x SUFFIX=%8.8x
  839. # samples without valid character after point in original file name field like: FENNEL.LZS PLANTAIN.LZS
  840. >>>&0 ubyte <0x20
  841. >>>>0 use edi-lzs
  842. # samples with valid character after point in original file name field
  843. >>>&0 ubyte >0x1F
  844. # check 2nd charcter of suffix
  845. #>>>>&0 ubyte x 2ND_SUFFIX=%x
  846. # sample with one valid character after point followed by \0 in original file name field like: SPELMATE.H$
  847. >>>>&0 ubyte =0
  848. >>>>>0 use edi-pack
  849. >>>>&0 ubyte >0x1F
  850. # check 3rd charcter of suffix
  851. #>>>>>&0 ubyte x 3RD_SUFFIX=%x
  852. # no sample with 2 valid characters after point followed by \0 in original file name field
  853. >>>>>&0 ubyte =0
  854. >>>>>>0 use edi-pack
  855. # samples with valid 3rd character after point in original file name field
  856. >>>>>&0 ubyte >0x1F
  857. # sample with 3 valid character after point followed by \0 in original file name field like: BOOK01A.IC$ CTL3D.DL$
  858. >>>>>>&0 ubyte =0
  859. >>>>>>>0 use edi-pack
  860. # sample with 3 valid character after point followed by no \0 in original file name field like: HERBTEXT.LZS
  861. >>>>>>&0 ubyte !0
  862. >>>>>>>0 use edi-lzs
  863. # no sample with invalid 3rd character after point in original file name field
  864. >>>>>&0 default x
  865. >>>>>>0 use edi-lzs
  866. # sample with invalid 2nd character after point in original file name field like: LACERATE.LZS SPLINTER.LZS
  867. >>>>&0 default x
  868. >>>>>0 use edi-lzs
  869. # sample without point character in original file name field like GUNSHOT.LZS
  870. >>8 default x
  871. >>>0 use edi-lzs
  872. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/e/edi-lzss2.trid.xml
  873. # Note: called "EDI Install Pro LZSS2 compressed data" by TrID and verified by
  874. # command like `deark -l -m edi_pack -d2 4WAY.WA$` as "EDI Pack LZSS2"
  875. >7 string 2 EDI LZSS2 packed
  876. #!:mime application/octet-stream
  877. !:mime application/x-edi-pack-lzss
  878. # the name of a compressed file often ends in character '$' or '_'
  879. !:ext ??$/??_
  880. # original filename, NUL-terminated, padded to 13 bytes like: mci.vbx 4way.wav skymap.exe cmdialog.vbx
  881. >>8 string x "%-0.13s"
  882. # original file size, as a 4-byte integer.
  883. >>21 ulelong x \b, %u bytes
  884. # compressed data like: ff5249464606ec00 ff4d5aa601010000
  885. >>>25 ubequad x \b, data %#16.16llx...
  886. 0 name edi-pack
  887. # Note: verified by command like `deark -l -d2 SPELMATE.H$` as "EDI Pack LZSS1"
  888. # original filename, NUL-terminated, padded to 13 bytes like: ctl3d.dll spelmate.h filemenu.rc owl.def index-it.exe
  889. # but not like \377Aloe.lzs\273 (HERBTEXT.LZS)
  890. >8 string x EDI LZSS packed "%-.13s"
  891. #!:mime application/octet-stream
  892. !:mime application/x-edi-pack-lzss
  893. # the name of a compressed file often ends in character '$' or '_'
  894. !:ext ??$/?$
  895. # compressed data like: f7000001eff02020 ff4d5aa900020000 ff2f2a207370656c
  896. >21 ubequad x \b, data %#16.16llx...
  897. # URL: http://fileformats.archiveteam.org/wiki/EDI_LZSSLib
  898. # Note: verified partly by command like `deark -l -m edi_pack -d2 GUNSHOT.LZS` as "EDI LZSSLib"
  899. 0 name edi-lzs
  900. # Note: verified by command like `deark -l -d2 GUNSHOT.LZS` as "EDI LZSSLib"
  901. # no original filename looks like: \277BM\226.\0 \277BM.n\001 \277BM\226.\0 \277BM.g\001 \377Aloe.lzs\273
  902. >8 string x EDI LZSSLib packed
  903. #!:mime application/octet-stream
  904. !:mime application/x-edi-pack-lzss
  905. # The name of a compressed file ends with LZS suffix
  906. !:ext lzs
  907. # compressed data like: bf424df6e10100f3 ff416c6f652e6c7a ff416c6f652e6c7a
  908. >8 ubequad x \b, data %#16.16llx...
  909. # Summary: CAZIP compressed file
  910. # From: Joerg Jenderek
  911. # URL: http://fileformats.archiveteam.org/wiki/CAZIP
  912. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/c/caz.trid.xml
  913. # Note: Format is distinct from CAZIPXP compressed
  914. 0 string \x0D\x0A\x1ACAZIP CAZIP compressed file
  915. #!:mime application/octet-stream
  916. !:mime application/x-compress-cazip
  917. # like: BLINKER.WR_ CLIPDEFS._ CAOSETUP.EX_ CLIPPER.EX_ FILEIO.C_
  918. !:ext ??_/?_/_
  919. # Summary: FTCOMP compressed archive
  920. # From: Joerg Jenderek
  921. # URL: http://fileformats.archiveteam.org/wiki/FTCOMP
  922. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/a/ark-ftcomp.trid.xml
  923. # Note: called by TrID "FTCOMP compressed archive"
  924. # extracted by `unpack seahelp.hl_`
  925. 24 string/b FTCOMP FTCOMP compressed archive
  926. #!:mime application/octet-stream
  927. !:mime application/x-compress-ftcomp
  928. !:ext ??_/??@/dll/drv/pk2/
  929. # probably A596FDFF magic at the beginning
  930. >0 ubelong !0xA596FDFF \b, at beginning %#x
  931. # probably original file name with directory like: \OS2\unpack.exe \SYSTEM\8514.DRV MAHJONGG.EXE
  932. >41 string x "%s"
  933. # MP3 (archiver, not lossy audio compression)
  934. 0 string MP3\x1a MP3-Archiver archive data
  935. # ZET
  936. 0 string OZ\xc3\x9d ZET archive data
  937. # TSComp
  938. 0 string \x65\x5d\x13\x8c\x08\x01\x03\x00 TSComp archive data
  939. # ARQ
  940. 0 string gW\4\1 ARQ archive data
  941. # Squash
  942. 3 string OctSqu Squash archive data
  943. # Terse
  944. 0 string \5\1\1\0 Terse archive data
  945. # UHarc
  946. 0 string UHA UHarc archive data
  947. # ABComp
  948. 0 string \2AB ABComp archive data
  949. 0 string \3AB2 ABComp archive data
  950. # CMP
  951. 0 string CO\0 CMP archive data
  952. # Splint
  953. 0 string \x93\xb9\x06 Splint archive data
  954. # InstallShield
  955. 0 string \x13\x5d\x65\x8c InstallShield Z archive Data
  956. # Gather
  957. 1 string GTH Gather archive data
  958. # BOA
  959. 0 string BOA BOA archive data
  960. # RAX
  961. 0 string ULEB\xa RAX archive data
  962. # Xtreme
  963. 0 string ULEB\0 Xtreme archive data
  964. # Pack Magic
  965. 0 string @\xc3\xa2\1\0 Pack Magic archive data
  966. # BTS
  967. 0 belong&0xfeffffff 0x1a034465 BTS archive data
  968. # ELI 5750
  969. 0 string Ora\ ELI 5750 archive data
  970. # QFC
  971. 0 string \x1aFC\x1a QFC archive data
  972. 0 string \x1aQF\x1a QFC archive data
  973. # PRO-PACK https://www.segaretro.org/Rob_Northen_compression
  974. 0 string RNC
  975. >3 byte 1 PRO-PACK archive data (compression 1)
  976. >3 byte 2 PRO-PACK archive data (compression 2)
  977. # 777
  978. 0 string 777 777 archive data
  979. # LZS221
  980. 0 string sTaC LZS221 archive data
  981. # HPA
  982. 0 string HPA HPA archive data
  983. # Arhangel
  984. 0 string LG Arhangel archive data
  985. # EXP1, uses bzip2
  986. 0 string 0123456789012345BZh EXP1 archive data
  987. # IMP
  988. 0 string IMP\xa IMP archive data
  989. # NRV
  990. 0 string \x00\x9E\x6E\x72\x76\xFF NRV archive data
  991. # Squish
  992. 0 string \x73\xb2\x90\xf4 Squish archive data
  993. # Par
  994. 0 string PHILIPP Par archive data
  995. 0 string PAR Par archive data
  996. # HIT
  997. 0 string UB HIT archive data
  998. # SBX
  999. 0 belong&0xfffff000 0x53423000 SBX archive data
  1000. # NaShrink
  1001. 0 string NSK NaShrink archive data
  1002. # SAPCAR
  1003. 0 string #\ CAR\ archive\ header SAPCAR archive data
  1004. 0 string CAR\ 2.00 SAPCAR archive data
  1005. 0 string CAR\ 2.01 SAPCAR archive data
  1006. #!:mime application/octet-stream
  1007. !:mime application/vnd.sar
  1008. !:ext sar
  1009. # Disintegrator
  1010. 0 string DST Disintegrator archive data
  1011. # ASD
  1012. 0 string ASD ASD archive data
  1013. # InstallShield CAB
  1014. # Update: Joerg Jenderek at Nov 2021
  1015. # URL: https://en.wikipedia.org/wiki/InstallShield
  1016. # Reference: https://github.com/twogood/unshield/blob/master/lib/cabfile.h
  1017. # Note: Not compatible with Microsoft CAB files
  1018. # http://mark0.net/download/triddefs_xml.7z/defs/a/ark-cab-ishield.trid.xml
  1019. # CAB_SIGNATURE 0x28635349
  1020. 0 string ISc( InstallShield
  1021. #!:mime application/octet-stream
  1022. !:mime application/x-installshield
  1023. # http://mark0.net/download/triddefs_xml.7z/defs/a/ark-cab-ishield-hdr.trid.xml
  1024. >16 ulelong !0 setup header
  1025. # like: _SYS1.HDR _USER1.HDR data1.hdr
  1026. !:ext hdr
  1027. >16 ulelong =0 CAB
  1028. # like: _SYS1.CAB _USER1.CAB DATA1.CAB data2.cab
  1029. !:ext cab
  1030. # https://github.com/twogood/unshield/blob/master/lib/helper.c
  1031. # version like: 0x1005201 0x100600c 0x1007000 0x1009500
  1032. # 0x2000578 0x20005dc 0x2000640 0x40007d0 0x4000834
  1033. >4 ulelong x \b, version %#x
  1034. # volume_info like: 0
  1035. >8 ulelong !0 \b, volume_info %#x
  1036. # cab_descriptor_offset like: 0x200
  1037. >12 ulelong !0x200 \b, offset %#x
  1038. #>0x200 ubequad x \b, at 0x200 %#16.16llx
  1039. # cab_descriptor_size like: 0 (*.cab) BD5 C8B DA5 E2A E36 116C 251D 4DA9 56F0 5CC2 6E4B 777D 779E 1F7C2
  1040. >16 ulelong !0 \b, descriptor size %#x
  1041. # TOP4
  1042. 0 string T4\x1a TOP4 archive data
  1043. # BatComp left out: sig looks like COM executable
  1044. # so TODO: get real 4dos batcomp file and find sig
  1045. # BlakHole
  1046. 0 string BH\5\7 BlakHole archive data
  1047. # BIX
  1048. 0 string BIX0 BIX archive data
  1049. # ChiefLZA
  1050. 0 string ChfLZ ChiefLZA archive data
  1051. # Blink
  1052. 0 string Blink Blink archive data
  1053. # Logitech Compress
  1054. 0 string \xda\xfa Logitech Compress archive data
  1055. # ARS-Sfx (FIXME: really a SFX? then goto COM/EXE)
  1056. 1 string (C)\ STEPANYUK ARS-Sfx archive data
  1057. # AKT/AKT32
  1058. 0 string AKT32 AKT32 archive data
  1059. 0 string AKT AKT archive data
  1060. # NPack
  1061. 0 string MSTSM NPack archive data
  1062. # PFT
  1063. 0 string \0\x50\0\x14 PFT archive data
  1064. # SemOne
  1065. 0 string SEM SemOne archive data
  1066. # PPMD
  1067. 0 string \x8f\xaf\xac\x84 PPMD archive data
  1068. # FIZ
  1069. 0 string FIZ FIZ archive data
  1070. # MSXiE
  1071. 0 belong&0xfffff0f0 0x4d530000 MSXiE archive data
  1072. # DeepFreezer
  1073. 0 belong&0xfffffff0 0x797a3030 DeepFreezer archive data
  1074. # DC
  1075. 0 string =<DC- DC archive data
  1076. # TPac
  1077. 0 string \4TPAC\3 TPac archive data
  1078. # Ai
  1079. # Update: Joerg Jenderek
  1080. # URL: http://fileformats.archiveteam.org/wiki/Ai_Archiver
  1081. 0 string Ai\1\1\0 Ai archive data
  1082. #!:mime application/octet-stream
  1083. !:mime application/x-compress-ai
  1084. !:ext ai
  1085. 0 string Ai\1\0\0 Ai archive data
  1086. #!:mime application/octet-stream
  1087. !:mime application/x-compress-ai
  1088. !:ext ai
  1089. # Ai32
  1090. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/a/ark-ai.trid.xml
  1091. # Note: called "Ai Archivator compressed archive" by TrID
  1092. 0 string Ai\2\0 Ai32 archive data
  1093. #!:mime application/octet-stream
  1094. !:mime application/x-compress-ai
  1095. !:ext ai
  1096. # original file name
  1097. >8 pstring/h x "%s"
  1098. # according to TrID the next 3 bytes are nil
  1099. >5 ubyte !0 \b, at 5 %#x
  1100. >6 ubyte !0 \b, at 6 %#x
  1101. >7 ubyte !0 \b, at 7 %#x
  1102. # the fourth byte with value 0 is probably a flag for "non solid" mode
  1103. #>3 ubyte =0x00 \b, unsolid mode
  1104. 0 string Ai\2\1 Ai32 archive data
  1105. #!:mime application/octet-stream
  1106. !:mime application/x-compress-ai
  1107. !:ext ai
  1108. # original file name
  1109. >8 pstring/h x "%s"
  1110. # the fourth byte with value 0x01 is probably a flag for "solid" mode; this is not the default
  1111. >3 ubyte =0x01 \b, solid mode
  1112. # SBC
  1113. 0 string SBC SBC archive data
  1114. # Ybs
  1115. 0 string YBS Ybs archive data
  1116. # DitPack
  1117. 0 string \x9e\0\0 DitPack archive data
  1118. # DMS
  1119. 0 string DMS! DMS archive data
  1120. # EPC
  1121. 0 string \x8f\xaf\xac\x8c EPC archive data
  1122. # VSARC
  1123. 0 string VS\x1a VSARC archive data
  1124. # PDZ
  1125. 0 string PDZ PDZ archive data
  1126. # ReDuq
  1127. 0 string rdqx ReDuq archive data
  1128. # GCA
  1129. 0 string GCAX GCA archive data
  1130. # PPMN
  1131. 0 string pN PPMN archive data
  1132. # WinImage
  1133. 3 string WINIMAGE WinImage archive data
  1134. # Compressia
  1135. 0 string CMP0CMP Compressia archive data
  1136. # UHBC
  1137. 0 string UHB UHBC archive data
  1138. # WinHKI
  1139. 0 string \x61\x5C\x04\x05 WinHKI archive data
  1140. # WWPack data file
  1141. 0 string WWP WWPack archive data
  1142. # BSN (BSA, PTS-DOS)
  1143. 0 string \xffBSG BSN archive data
  1144. 1 string \xffBSG BSN archive data
  1145. 3 string \xffBSG BSN archive data
  1146. 1 string \0\xae\2 BSN archive data
  1147. 1 string \0\xae\3 BSN archive data
  1148. 1 string \0\xae\7 BSN archive data
  1149. # AIN
  1150. 0 string \x33\x18 AIN archive data
  1151. 0 string \x33\x17 AIN archive data
  1152. # XPA32 test moved and merged with XPA by Joerg Jenderek at Sep 2015
  1153. # SZip (TODO: doesn't catch all versions)
  1154. 0 string SZ\x0a\4 SZip archive data
  1155. # XPack DiskImage
  1156. # *.XDI updated by Joerg Jenderek Sep 2015
  1157. # ftp://ftp.sac.sk/pub/sac/pack/0index.txt
  1158. # GRR: this test is still too general as it catches also text files starting with jm
  1159. 0 string jm
  1160. # only found examples with this additional characteristic 2 bytes
  1161. >2 string \x2\x4 Xpack DiskImage archive data
  1162. #!:ext xdi
  1163. # XPack Data
  1164. # *.xpa updated by Joerg Jenderek Sep 2015
  1165. # ftp://ftp.elf.stuba.sk/pub/pc/pack/
  1166. 0 string xpa XPA
  1167. !:ext xpa
  1168. # XPA32
  1169. # ftp://ftp.elf.stuba.sk/pub/pc/pack/xpa32.zip
  1170. # created by XPA32.EXE version 1.0.2 for Windows
  1171. >0 string xpa\0\1 \b32 archive data
  1172. # created by XPACK.COM version 1.67m or 1.67r with short 0x1800
  1173. >3 ubeshort !0x0001 \bck archive data
  1174. # XPack Single Data
  1175. # changed by Joerg Jenderek Sep 2015 back to like in version 5.12
  1176. # letter 'I'+ acute accent is equivalent to \xcd
  1177. 0 string \xcd\ jm Xpack single archive data
  1178. #!:mime application/x-xpa-compressed
  1179. !:ext xpa
  1180. # TODO: missing due to unknown magic/magic at end of file:
  1181. #DWC
  1182. #ARG
  1183. #ZAR
  1184. #PC/3270
  1185. #InstallIt
  1186. #RKive
  1187. #RK
  1188. #XPack Diskimage
  1189. # These were inspired by idarc, but actually verified
  1190. # Dzip archiver (.dz)
  1191. # Update: Joerg Jenderek
  1192. # URL: http://speeddemosarchive.com/dzip/
  1193. # reference: http://speeddemosarchive.com/dzip/dz29src.zip/main.c
  1194. # GRR: line below is too general as it matches also ASCII texts like Doszip commander help dz.txt
  1195. 0 string DZ
  1196. # latest version is 2.9 dated 7 may 2003
  1197. >2 byte <4 Dzip archive data
  1198. !:mime application/x-dzip
  1199. !:ext dz
  1200. >>2 byte x \b, version %i
  1201. >>3 byte x \b.%i
  1202. >>4 ulelong x \b, offset %#x
  1203. >>8 ulelong x \b, %u files
  1204. # ZZip archiver (.zz)
  1205. 0 string ZZ\ \0\0 ZZip archive data
  1206. 0 string ZZ0 ZZip archive data
  1207. # PAQ archiver (.paq)
  1208. 0 string \xaa\x40\x5f\x77\x1f\xe5\x82\x0d PAQ archive data
  1209. 0 string PAQ PAQ archive data
  1210. >3 byte&0xf0 0x30
  1211. >>3 byte x (v%c)
  1212. # JAR archiver (.j), this is the successor to ARJ, not Java's JAR (which is essentially ZIP)
  1213. # Update: Joerg Jenderek
  1214. # URL: http://fileformats.archiveteam.org/wiki/JAR_(ARJ_Software)
  1215. # reference: http://mark0.net/download/triddefs_xml.7z/defs/a/ark-jar.trid.xml
  1216. # https://www.sac.sk/download/pack/jar102x.exe/TECHNOTE.DOC
  1217. # Note: called "JAR compressed archive" by TrID
  1218. 0xe string \x1aJar\x1b JAR (ARJ Software, Inc.) archive data
  1219. #!:mime application/octet-stream
  1220. !:mime application/x-compress-j
  1221. >0 ulelong x \b, CRC32 %#x
  1222. # standard suffix is ".j"; for multi volumes following order j01 j02 ... j99 100 ... 990
  1223. !:ext j/j01/j02
  1224. # URL: http://fileformats.archiveteam.org/wiki/JARCS
  1225. # reference: http://mark0.net/download/triddefs_xml.7z/defs/a/ark-jarcs.trid.xml
  1226. # Note: called "JARCS compressed archive" by TrID
  1227. 0 string JARCS JAR (ARJ Software, Inc.) archive data
  1228. #!:mime application/octet-stream
  1229. !:mime application/x-compress-jar
  1230. !:ext jar
  1231. # ARJ archiver (jason@jarthur.Claremont.EDU)
  1232. # URL: http://fileformats.archiveteam.org/wiki/ARJ
  1233. # reference: http://mark0.net/download/triddefs_xml.7z/defs/a/ark-arj.trid.xml
  1234. # https://github.com/FarGroup/FarManager/
  1235. # blob/master/plugins/multiarc/arc.doc/arj.txt
  1236. # Note: called "ARJ compressed archive" by TrID and
  1237. # "ARJ File Format" by DROID via PUID fmt/610
  1238. # verified by `7z l -tarj PHRACK1.ARJ` and
  1239. # `arj.exe l TEST-hk9.ARJ`
  1240. 0 leshort 0xea60
  1241. # skip DROID fmt-610-signature-id-946.arj by check for valid file type of main header
  1242. >0xA ubyte 2
  1243. >>0 use arj-archive
  1244. 0 name arj-archive
  1245. >0 leshort x ARJ archive
  1246. !:mime application/x-arj
  1247. # look for terminating 0-character of filename
  1248. >0x26 search/1024 \0
  1249. # file name extension is normally .arj but not for parts of multi volume
  1250. #>>&-5 string x extension %.4s
  1251. >>&-5 string/c .arj data
  1252. !:ext arj
  1253. >>&-5 default x
  1254. # for multi volume first name is archive.arj then following parts archive.a01 archive.a02 ...
  1255. >>>8 byte &0x04 data
  1256. !:ext a01/a02
  1257. # for SFX first name is archive.exe then following parts archive.e01 archive.e02 ...
  1258. >>>8 byte ^0x04 data, SFX multi-volume
  1259. !:ext e01/e02
  1260. # basic header size like: 0x002b 0x002c 0x04e0 0x04e3 0x04e7
  1261. #>2 uleshort x basic header size %#4.4x
  1262. # next fragment content like: 0x0a200a003a8fc713 0x524a000010bb3471 0x524a0000c73c70f9
  1263. #>(2.s) ubequad x NEXT FRAGMENT CONTENT %#16.16llx
  1264. # first_hdr_size; seems to be same as basic header size
  1265. #>2 uleshort x 1st header size %#x
  1266. # archiver version number like: 3 4 6 11 102
  1267. >5 byte x \b, v%d
  1268. # minimum archiver version to extract like: 1
  1269. >6 ubyte !1 \b, minimum %u to extract
  1270. # FOR DEBUGGING
  1271. #>8 byte x \b, FLAGS %#x
  1272. # GARBLED_FLAG1; garble with password; g switch
  1273. >8 byte &0x01 \b, password-protected
  1274. # encryption version: 0~old 1~old 2~new 3~reserved 4~40 bit key GOST
  1275. >>0x20 ubyte x (v%u)
  1276. #>8 byte &0x02 \b, secured
  1277. # ANSIPAGE_FLAG; indicates ANSI codepage used by ARJ32; hy switch
  1278. >8 byte &0x02 \b, ANSI codepage
  1279. # VOLUME_FLAG indicates presence of succeeding volume; but apparently not for SFX
  1280. >8 byte &0x04 \b, multi-volume
  1281. #>8 byte &0x08 \b, file-offset
  1282. # ARJPROT_FLAG; build with data protection record; hk switch
  1283. >8 byte &0x08 \b, recoverable
  1284. # arj protection factor; maximal 10; switch hky -> factor=y+1
  1285. >>0x22 byte x (factor %u)
  1286. >8 byte &0x10 \b, slash-switched
  1287. # BACKUP_FLAG; obsolete
  1288. >8 byte &0x20 \b, backup
  1289. # SECURED_FLAG;
  1290. >8 byte &0x40 \b, secured,
  1291. # ALTNAME_FLAG; indicates dual-name archive
  1292. >8 byte &0x80 \b, dual-name
  1293. # security version; 0~old 2~current
  1294. >9 ubyte !0
  1295. >>9 ubyte !2 \b, security version %u
  1296. # file type; 2 in main header; 0~binary 1~7-bitText 2~comment 3~directory 4~VolumeLabel 5=ChapterLabel
  1297. >0xA ubyte !2 \b, file type %u
  1298. # date+time when original archive was created in MS-DOS format via ./msdos
  1299. >0xC ulelong x \b, created
  1300. >0xC use dos-date
  1301. # or date and time by new internal function
  1302. #>0xE lemsdosdate x %s
  1303. #>0xC lemsdostime x %s
  1304. # FOR DEBUGGING
  1305. #>0x12 uleshort x RAW DATE %#4.4x
  1306. #>0x10 uleshort x RAW TIME %#4.4x
  1307. # date+time when archive was last modified; sometimes nil or
  1308. # maybe wrong like in HP4DRVR.ARJ
  1309. #>0x10 ulelong >0 \b, modified
  1310. #>>0x10 use dos-date
  1311. # or date and time by new internal function
  1312. #>>0x12 lemsdosdate x %s
  1313. #>>0x10 lemsdostime x %s
  1314. # archive size (currently used only for secured archives); MAYBE?
  1315. #>0x14 ulelong !0 \b, file size %u
  1316. # security envelope file position; MAYBE?
  1317. #>0x18 ulelong !0 \b, at %#x security envelope
  1318. # filespec position in filename; WHAT IS THAT?
  1319. #>0x1C uleshort >0 \b, filespec position %#x
  1320. # length in bytes of security envelope data like: 2CAh 301h 364h 471h
  1321. >0x1E uleshort !0 \b, security envelope length %#x
  1322. # last chapter like: 0 1
  1323. >0x21 ubyte !0 \b, last chapter %u
  1324. # filename (null-terminated string); sometimes at 0x26 when 4 bytes for extra data
  1325. >34 byte x \b, original name:
  1326. # with extras data
  1327. >34 byte <0x0B
  1328. >>38 string x %s
  1329. # without extras data
  1330. >34 byte >0x0A
  1331. >>34 string x %s
  1332. # host OS: 0~MSDOS ... 11~WIN32
  1333. >7 byte 0 \b, os: MS-DOS
  1334. >7 byte 1 \b, os: PRIMOS
  1335. >7 byte 2 \b, os: Unix
  1336. >7 byte 3 \b, os: Amiga
  1337. >7 byte 4 \b, os: Macintosh
  1338. >7 byte 5 \b, os: OS/2
  1339. >7 byte 6 \b, os: Apple ][ GS
  1340. >7 byte 7 \b, os: Atari ST
  1341. >7 byte 8 \b, os: NeXT
  1342. >7 byte 9 \b, os: VAX/VMS
  1343. >7 byte 10 \b, os: WIN95
  1344. >7 byte 11 \b, os: WIN32
  1345. # [JW] idarc says this is also possible
  1346. 2 leshort 0xea60 ARJ archive data
  1347. #2 leshort 0xea60
  1348. #>2 use arj-archive
  1349. # HA archiver (Greg Roelofs, newt@uchicago.edu)
  1350. # This is a really bad format. A file containing HAWAII will match this...
  1351. #0 string HA HA archive data,
  1352. #>2 leshort =1 1 file,
  1353. #>2 leshort >1 %hu files,
  1354. #>4 byte&0x0f =0 first is type CPY
  1355. #>4 byte&0x0f =1 first is type ASC
  1356. #>4 byte&0x0f =2 first is type HSC
  1357. #>4 byte&0x0f =0x0e first is type DIR
  1358. #>4 byte&0x0f =0x0f first is type SPECIAL
  1359. # suggestion: at least identify small archives (<1024 files)
  1360. 0 belong&0xffff00fc 0x48410000 HA archive data
  1361. >2 leshort =1 1 file,
  1362. >2 leshort >1 %u files,
  1363. >4 byte&0x0f =0 first is type CPY
  1364. >4 byte&0x0f =1 first is type ASC
  1365. >4 byte&0x0f =2 first is type HSC
  1366. >4 byte&0x0f =0x0e first is type DIR
  1367. >4 byte&0x0f =0x0f first is type SPECIAL
  1368. # HPACK archiver (Peter Gutmann, pgut1@cs.aukuni.ac.nz)
  1369. 0 string HPAK HPACK archive data
  1370. # JAM Archive volume format, by Dmitry.Kohmanyuk@UA.net
  1371. 0 string \351,\001JAM\ JAM archive,
  1372. >7 string >\0 version %.4s
  1373. >0x26 byte =0x27 -
  1374. >>0x2b string >\0 label %.11s,
  1375. >>0x27 lelong x serial %08x,
  1376. >>0x36 string >\0 fstype %.8s
  1377. # LHARC/LHA archiver (Greg Roelofs, newt@uchicago.edu)
  1378. # Update: Joerg Jenderek
  1379. # URL: https://en.wikipedia.org/wiki/LHA_(file_format)
  1380. # Reference: https://web.archive.org/web/20021005080911/http://www.osirusoft.com/joejared/lzhformat.html
  1381. #
  1382. # check and display information of lharc (LHa,PMarc) file
  1383. 0 name lharc-file
  1384. # check 1st character of method id like -lz4- -lh5- or -pm2-
  1385. >2 string -
  1386. # check 5th character of method id
  1387. >>6 string -
  1388. # check header level 0 1 2 3
  1389. >>>20 ubyte <4
  1390. # check 2nd, 3th and 4th character of method id
  1391. >>>>3 regex \^(lh[0-9a-ex]|lz[s2-8]|pm[012]|pc1) \b
  1392. !:mime application/x-lzh-compressed
  1393. # creator type "LHA "
  1394. !:apple ????LHA
  1395. # display archive type name like "LHa/LZS archive data" or "LArc archive"
  1396. >>>>>2 string -lz \b
  1397. !:ext lzs
  1398. # already known -lzs- -lz4- -lz5- with old names
  1399. >>>>>>2 string -lzs LHa/LZS archive data
  1400. >>>>>>3 regex \^lz[45] LHarc 1.x archive data
  1401. # missing -lz?- with wikipedia names
  1402. >>>>>>3 regex \^lz[2378] LArc archive
  1403. # display archive type name like "LHa (2.x) archive data"
  1404. >>>>>2 string -lh \b
  1405. # already known -lh0- -lh1- -lh2- -lh3- -lh4- -lh5- -lh6- -lh7- -lhd- variants with old names
  1406. >>>>>>3 regex \^lh[01] LHarc 1.x/ARX archive data
  1407. # LHice archiver use ".ICE" as name extension instead usual one ".lzh"
  1408. # FOOBAR archiver use ".foo" as name extension instead usual one
  1409. # "Florian Orjanov's and Olga Bachetska's ARchiver" not found at the moment
  1410. >>>>>>>2 string -lh1 \b
  1411. !:ext lha/lzh/ice
  1412. >>>>>>3 regex \^lh[23d] LHa 2.x? archive data
  1413. >>>>>>3 regex \^lh[7] LHa (2.x)/LHark archive data
  1414. >>>>>>3 regex \^lh[456] LHa (2.x) archive data
  1415. >>>>>>>2 string -lh5 \b
  1416. # https://en.wikipedia.org/wiki/BIOS
  1417. # Some mainboard BIOS like Award use LHa compression. So archives with unusual extension are found like
  1418. # bios.rom , kd7_v14.bin, 1010.004, ...
  1419. !:ext lha/lzh/rom/bin
  1420. # missing -lh?- variants (Joe Jared)
  1421. >>>>>>3 regex \^lh[89a-ce] LHa (Joe Jared) archive
  1422. # UNLHA32 2.67a
  1423. >>>>>>2 string -lhx LHa (UNLHA32) archive
  1424. # lha archives with standard file name extensions ".lha" ".lzh"
  1425. >>>>>>3 regex !\^(lh1|lh5) \b
  1426. !:ext lha/lzh
  1427. # this should not happen if all -lh variants are described
  1428. >>>>>>2 default x LHa (unknown) archive
  1429. #!:ext lha
  1430. # PMarc
  1431. >>>>>3 regex \^pm[012] PMarc archive data
  1432. !:ext pma
  1433. # append method id without leading and trailing minus character
  1434. >>>>>3 string x [%3.3s]
  1435. >>>>>>0 use lharc-header
  1436. #
  1437. # check and display information of lharc header
  1438. 0 name lharc-header
  1439. # header size 0x4 , 0x1b-0x61
  1440. >0 ubyte x
  1441. # compressed data size != compressed file size
  1442. #>7 ulelong x \b, data size %d
  1443. # attribute: 0x2~?? 0x10~symlink|target 0x20~normal
  1444. #>19 ubyte x \b, 19_%#x
  1445. # level identifier 0 1 2 3
  1446. #>20 ubyte x \b, level %d
  1447. # time stamp
  1448. #>15 ubelong x DATE %#8.8x
  1449. # OS ID for level 1
  1450. >20 ubyte 1
  1451. # 0x20 types find for *.rom files
  1452. >>(21.b+24) ubyte <0x21 \b, %#x OS
  1453. # ascii type like M for MSDOS
  1454. >>(21.b+24) ubyte >0x20 \b, '%c' OS
  1455. # OS ID for level 2
  1456. >20 ubyte 2
  1457. #>>23 ubyte x \b, OS ID %#x
  1458. >>23 ubyte <0x21 \b, %#x OS
  1459. >>23 ubyte >0x20 \b, '%c' OS
  1460. # filename only for level 0 and 1
  1461. >20 ubyte <2
  1462. # length of filename
  1463. >>21 ubyte >0 \b, with
  1464. # filename
  1465. >>>21 pstring x "%s"
  1466. #
  1467. #2 string -lh0- LHarc 1.x/ARX archive data [lh0]
  1468. #!:mime application/x-lharc
  1469. 2 string -lh0-
  1470. >0 use lharc-file
  1471. #2 string -lh1- LHarc 1.x/ARX archive data [lh1]
  1472. #!:mime application/x-lharc
  1473. 2 string -lh1-
  1474. >0 use lharc-file
  1475. # NEW -lz2- ... -lz8-
  1476. 2 string -lz2-
  1477. >0 use lharc-file
  1478. 2 string -lz3-
  1479. >0 use lharc-file
  1480. 2 string -lz4-
  1481. >0 use lharc-file
  1482. 2 string -lz5-
  1483. >0 use lharc-file
  1484. 2 string -lz7-
  1485. >0 use lharc-file
  1486. 2 string -lz8-
  1487. >0 use lharc-file
  1488. # [never seen any but the last; -lh4- reported in comp.compression:]
  1489. #2 string -lzs- LHa/LZS archive data [lzs]
  1490. 2 string -lzs-
  1491. >0 use lharc-file
  1492. # According to wikipedia and others such a version does not exist
  1493. #2 string -lh\40- LHa 2.x? archive data [lh ]
  1494. #2 string -lhd- LHa 2.x? archive data [lhd]
  1495. 2 string -lhd-
  1496. >0 use lharc-file
  1497. #2 string -lh2- LHa 2.x? archive data [lh2]
  1498. 2 string -lh2-
  1499. >0 use lharc-file
  1500. #2 string -lh3- LHa 2.x? archive data [lh3]
  1501. 2 string -lh3-
  1502. >0 use lharc-file
  1503. #2 string -lh4- LHa (2.x) archive data [lh4]
  1504. 2 string -lh4-
  1505. >0 use lharc-file
  1506. #2 string -lh5- LHa (2.x) archive data [lh5]
  1507. 2 string -lh5-
  1508. >0 use lharc-file
  1509. #2 string -lh6- LHa (2.x) archive data [lh6]
  1510. 2 string -lh6-
  1511. >0 use lharc-file
  1512. #2 string -lh7- LHa (2.x)/LHark archive data [lh7]
  1513. 2 string -lh7-
  1514. # !:mime application/x-lha
  1515. # >20 byte x - header level %d
  1516. >0 use lharc-file
  1517. # NEW -lh8- ... -lhe- , -lhx-
  1518. 2 string -lh8-
  1519. >0 use lharc-file
  1520. 2 string -lh9-
  1521. >0 use lharc-file
  1522. 2 string -lha-
  1523. >0 use lharc-file
  1524. 2 string -lhb-
  1525. >0 use lharc-file
  1526. 2 string -lhc-
  1527. >0 use lharc-file
  1528. 2 string -lhe-
  1529. >0 use lharc-file
  1530. 2 string -lhx-
  1531. >0 use lharc-file
  1532. # taken from idarc [JW]
  1533. 2 string -lZ PUT archive data
  1534. # already done by LHarc magics
  1535. # this should never happen if all sub types of LZS archive are identified
  1536. #2 string -lz LZS archive data
  1537. 2 string -sw1- Swag archive data
  1538. 0 name rar-file-header
  1539. >24 byte 15 \b, v1.5
  1540. >24 byte 20 \b, v2.0
  1541. >24 byte 29 \b, v4
  1542. >15 byte 0 \b, os: MS-DOS
  1543. >15 byte 1 \b, os: OS/2
  1544. >15 byte 2 \b, os: Win32
  1545. >15 byte 3 \b, os: Unix
  1546. >15 byte 4 \b, os: Mac OS
  1547. >15 byte 5 \b, os: BeOS
  1548. 0 name rar-archive-header
  1549. >3 leshort&0x1ff >0 \b, flags:
  1550. >>3 leshort &0x01 ArchiveVolume
  1551. >>3 leshort &0x02 Commented
  1552. >>3 leshort &0x04 Locked
  1553. >>3 leshort &0x10 NewVolumeNaming
  1554. >>3 leshort &0x08 Solid
  1555. >>3 leshort &0x20 Authenticated
  1556. >>3 leshort &0x40 RecoveryRecordPresent
  1557. >>3 leshort &0x80 EncryptedBlockHeader
  1558. >>3 leshort &0x100 FirstVolume
  1559. # RAR (Roshal Archive) archive
  1560. 0 string Rar!\x1a\7\0 RAR archive data
  1561. !:mime application/x-rar
  1562. !:ext rar/cbr
  1563. # file header
  1564. >(0xc.l+9) byte 0x74
  1565. >>(0xc.l+7) use rar-file-header
  1566. # subblock seems to share information with file header
  1567. >(0xc.l+9) byte 0x7a
  1568. >>(0xc.l+7) use rar-file-header
  1569. >9 byte 0x73
  1570. >>7 use rar-archive-header
  1571. 0 string Rar!\x1a\7\1\0 RAR archive data, v5
  1572. !:mime application/x-rar
  1573. !:ext rar
  1574. # Very old RAR archive
  1575. # https://jasonblanks.com/wp-includes/images/papers/KnowyourarchiveRAR.pdf
  1576. 0 string RE\x7e\x5e RAR archive data (<v1.5)
  1577. !:mime application/x-rar
  1578. !:ext rar/cbr
  1579. # SQUISH archiver (Greg Roelofs, newt@uchicago.edu)
  1580. 0 string SQSH squished archive data (Acorn RISCOS)
  1581. # UC2 archiver (Greg Roelofs, newt@uchicago.edu)
  1582. # [JW] see exe section for self-extracting version
  1583. 0 string UC2\x1a UC2 archive data
  1584. # PKZIP multi-volume archive
  1585. 0 string PK\x07\x08PK\x03\x04 Zip multi-volume archive data, at least PKZIP v2.50 to extract
  1586. !:mime application/zip
  1587. !:ext zip/cbz
  1588. # Android APK file (Zip archive)
  1589. 0 string PK\003\004
  1590. !:strength +1
  1591. # Starts with AndroidManifest.xml (file name length = 19)
  1592. >26 uleshort 19
  1593. >>30 string AndroidManifest.xml Android package (APK), with AndroidManifest.xml
  1594. !:mime application/vnd.android.package-archive
  1595. !:ext apk
  1596. >>>-22 string PK\005\006
  1597. >>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
  1598. # Starts with META-INF/com/android/build/gradle/app-metadata.properties
  1599. >26 uleshort 57
  1600. >>30 string META-INF/com/android/build/gradle/
  1601. >>>&0 string app-metadata.properties Android package (APK), with gradle app-metadata.properties
  1602. !:mime application/vnd.android.package-archive
  1603. !:ext apk
  1604. >>>>-22 string PK\005\006
  1605. >>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
  1606. # Starts with classes.dex (file name length = 11)
  1607. >26 uleshort 11
  1608. >>30 string classes.dex Android package (APK), with classes.dex
  1609. !:mime application/vnd.android.package-archive
  1610. !:ext apk
  1611. >>>-22 string PK\005\006
  1612. >>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
  1613. # Starts with META-INF/MANIFEST.MF (file name length = 20)
  1614. # NB: checks for resources.arsc, classes.dex, etc. as well to avoid matching JAR files
  1615. >26 uleshort 20
  1616. >>30 string META-INF/MANIFEST.MF
  1617. # Contains resources.arsc (near the end, in the central directory)
  1618. >>>-512 search resources.arsc Android package (APK), with MANIFEST.MF and resources.arsc
  1619. !:mime application/vnd.android.package-archive
  1620. !:ext apk
  1621. >>>>-22 string PK\005\006
  1622. >>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
  1623. >>>-512 default x
  1624. # Contains classes.dex (near the end, in the central directory)
  1625. >>>>-512 search classes.dex Android package (APK), with MANIFEST.MF and classes.dex
  1626. !:mime application/vnd.android.package-archive
  1627. !:ext apk
  1628. >>>>>-22 string PK\005\006
  1629. >>>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
  1630. >>>>-512 default x
  1631. # Contains lib/armeabi (near the end, in the central directory)
  1632. >>>>>-512 search lib/armeabi Android package (APK), with MANIFEST.MF and armeabi lib
  1633. !:mime application/vnd.android.package-archive
  1634. !:ext apk
  1635. >>>>>>-22 string PK\005\006
  1636. >>>>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
  1637. >>>>>-512 default x
  1638. # Contains drawables (near the end, in the central directory)
  1639. >>>>>>-512 search res/drawable Android package (APK), with MANIFEST.MF and drawables
  1640. !:mime application/vnd.android.package-archive
  1641. !:ext apk
  1642. >>>>>>>-22 string PK\005\006
  1643. >>>>>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
  1644. # It may or may not be an APK file, but it's definitely a Java JAR file
  1645. >>>>>>-512 default x Java archive data (JAR)
  1646. !:mime application/java-archive
  1647. !:ext jar
  1648. # Starts with zipflinger virtual entry (28 + 104 = 132 bytes)
  1649. # See https://github.com/obfusk/apksigcopier/blob/666f5b7/apksigcopier/__init__.py#L230
  1650. >4 string \x00\x00\x00\x00\x00\x00
  1651. >>&0 string \x21\x08\x21\x02
  1652. >>>&0 string \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
  1653. >>>>&0 string \x00\x00 Android package (APK), with zipflinger virtual entry
  1654. !:mime application/vnd.android.package-archive
  1655. !:ext apk
  1656. >>>>>-22 string PK\005\006
  1657. >>>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
  1658. # APK Signing Block
  1659. >0 default x
  1660. >>-22 string PK\005\006
  1661. >>>(-6.l-16) string APK\x20Sig\x20Block\x2042 Android package (APK), with APK Signing Block
  1662. !:mime application/vnd.android.package-archive
  1663. !:ext apk
  1664. # Zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
  1665. 0 string PK\005\006 Zip archive data (empty)
  1666. !:mime application/zip
  1667. !:ext zip/cbz
  1668. !:strength +1
  1669. 0 string PK\003\004
  1670. !:strength +1
  1671. # Specialised zip formats which start with a member named 'mimetype'
  1672. # (stored uncompressed, with no 'extra field') containing the file's MIME type.
  1673. # Check for have 8-byte name, 0-byte extra field, name "mimetype", and
  1674. # contents starting with "application/":
  1675. >26 string \x8\0\0\0mimetypeapplication/
  1676. # KOffice / OpenOffice & StarOffice / OpenDocument formats
  1677. # From: Abel Cheung <abel@oaka.org>
  1678. # KOffice (1.2 or above) formats
  1679. # (mimetype contains "application/vnd.kde.<SUBTYPE>")
  1680. >>50 string vnd.kde. KOffice (>=1.2)
  1681. >>>58 string karbon Karbon document
  1682. >>>58 string kchart KChart document
  1683. >>>58 string kformula KFormula document
  1684. >>>58 string kivio Kivio document
  1685. >>>58 string kontour Kontour document
  1686. >>>58 string kpresenter KPresenter document
  1687. >>>58 string kspread KSpread document
  1688. >>>58 string kword KWord document
  1689. # OpenOffice formats (for OpenOffice 1.x / StarOffice 6/7)
  1690. # (mimetype contains "application/vnd.sun.xml.<SUBTYPE>")
  1691. # URL: https://en.wikipedia.org/wiki/OpenOffice.org_XML
  1692. # reference: http://fileformats.archiveteam.org/wiki/OpenOffice.org_XML
  1693. >>50 string vnd.sun.xml. OpenOffice.org 1.x
  1694. >>>62 string writer Writer
  1695. >>>>68 byte !0x2e document
  1696. !:mime application/vnd.sun.xml.writer
  1697. !:ext sxw
  1698. >>>>68 string .template template
  1699. !:mime application/vnd.sun.xml.writer.template
  1700. !:ext stw
  1701. >>>>68 string .web Web template
  1702. !:mime application/vnd.sun.xml.writer.web
  1703. !:ext stw
  1704. >>>>68 string .global global document
  1705. !:mime application/vnd.sun.xml.writer.global
  1706. !:ext sxg
  1707. >>>62 string calc Calc
  1708. >>>>66 byte !0x2e spreadsheet
  1709. !:mime application/vnd.sun.xml.calc
  1710. !:ext sxc
  1711. >>>>66 string .template template
  1712. !:mime application/vnd.sun.xml.calc.template
  1713. !:ext stc
  1714. >>>62 string draw Draw
  1715. >>>>66 byte !0x2e document
  1716. !:mime application/vnd.sun.xml.draw
  1717. !:ext sxd
  1718. >>>>66 string .template template
  1719. !:mime application/vnd.sun.xml.draw.template
  1720. !:ext std
  1721. >>>62 string impress Impress
  1722. >>>>69 byte !0x2e presentation
  1723. !:mime application/vnd.sun.xml.impress
  1724. !:ext sxi
  1725. >>>>69 string .template template
  1726. !:mime application/vnd.sun.xml.impress.template
  1727. !:ext sti
  1728. >>>62 string math Math document
  1729. !:mime application/vnd.sun.xml.math
  1730. !:ext sxm
  1731. >>>62 string base Database file
  1732. !:mime application/vnd.sun.xml.base
  1733. !:ext sdb
  1734. # URL: https://wiki.openoffice.org/wiki/Documentation/DevGuide/Extensions/File_Format
  1735. # From: Joerg Jenderek
  1736. # Note: only few OXT samples are detected here by mimetype member
  1737. # is used by OpenOffice and LibreOffice and probably also NeoOffice
  1738. # verified by `unzip -Zv *.oxt` or `7z l -slt *.oxt`
  1739. >>50 string vnd.openofficeorg. OpenOffice
  1740. >>>68 string extension \b/LibreOffice Extension
  1741. # http://extension.nirsoft.net/oxt
  1742. !:mime application/vnd.openofficeorg.extension
  1743. # like: Gallery-Puzzle.2.1.0.1.oxt
  1744. !:ext oxt
  1745. # OpenDocument formats (for OpenOffice 2.x / StarOffice >= 8)
  1746. # URL: http://fileformats.archiveteam.org/wiki/OpenDocument
  1747. # https://lists.oasis-open.org/archives/office/200505/msg00006.html
  1748. # (mimetype contains "application/vnd.oasis.opendocument.<SUBTYPE>")
  1749. >>50 string vnd.oasis.opendocument. OpenDocument
  1750. >>>73 string text
  1751. >>>>77 byte !0x2d Text
  1752. !:mime application/vnd.oasis.opendocument.text
  1753. !:ext odt
  1754. >>>>77 string -template Text Template
  1755. !:mime application/vnd.oasis.opendocument.text-template
  1756. !:ext ott
  1757. >>>>77 string -web HTML Document Template
  1758. !:mime application/vnd.oasis.opendocument.text-web
  1759. !:ext oth
  1760. >>>>77 string -master
  1761. >>>>>84 byte !0x2d Master Document
  1762. !:mime application/vnd.oasis.opendocument.text-master
  1763. !:ext odm
  1764. >>>>>84 string -template Master Template
  1765. !:mime application/vnd.oasis.opendocument.text-master-template
  1766. !:ext otm
  1767. >>>73 string graphics
  1768. >>>>81 byte !0x2d Drawing
  1769. !:mime application/vnd.oasis.opendocument.graphics
  1770. !:ext odg
  1771. >>>>81 string -template Drawing Template
  1772. !:mime application/vnd.oasis.opendocument.graphics-template
  1773. !:ext otg
  1774. >>>73 string presentation
  1775. >>>>85 byte !0x2d Presentation
  1776. !:mime application/vnd.oasis.opendocument.presentation
  1777. !:ext odp
  1778. >>>>85 string -template Presentation Template
  1779. !:mime application/vnd.oasis.opendocument.presentation-template
  1780. !:ext otp
  1781. >>>73 string spreadsheet
  1782. >>>>84 byte !0x2d Spreadsheet
  1783. !:mime application/vnd.oasis.opendocument.spreadsheet
  1784. !:ext ods
  1785. >>>>84 string -template Spreadsheet Template
  1786. !:mime application/vnd.oasis.opendocument.spreadsheet-template
  1787. !:ext ots
  1788. >>>73 string chart
  1789. >>>>78 byte !0x2d Chart
  1790. !:mime application/vnd.oasis.opendocument.chart
  1791. !:ext odc
  1792. >>>>78 string -template Chart Template
  1793. !:mime application/vnd.oasis.opendocument.chart-template
  1794. !:ext otc
  1795. >>>73 string formula
  1796. >>>>80 byte !0x2d Formula
  1797. !:mime application/vnd.oasis.opendocument.formula
  1798. !:ext odf
  1799. >>>>80 string -template Formula Template
  1800. !:mime application/vnd.oasis.opendocument.formula-template
  1801. !:ext otf
  1802. # https://www.loc.gov/preservation/digital/formats/fdd/fdd000441.shtml
  1803. >>>73 string database Database
  1804. !:mime application/vnd.oasis.opendocument.database
  1805. !:ext odb
  1806. # Valid for LibreOffice Base 6.0.1.1 at least
  1807. >>>73 string base Database
  1808. # https://bugs.documentfoundation.org/show_bug.cgi?id=45854
  1809. !:mime application/vnd.oasis.opendocument.base
  1810. !:ext odb
  1811. >>>73 string image
  1812. >>>>78 byte !0x2d Image
  1813. !:mime application/vnd.oasis.opendocument.image
  1814. !:ext odi
  1815. >>>>78 string -template Image Template
  1816. !:mime application/vnd.oasis.opendocument.image-template
  1817. !:ext oti
  1818. # EPUB (OEBPS) books using OCF (OEBPS Container Format)
  1819. # https://www.idpf.org/ocf/ocf1.0/download/ocf10.htm, section 4.
  1820. # From: Ralf Brown <ralf.brown@gmail.com>
  1821. >>50 string epub+zip EPUB document
  1822. !:mime application/epub+zip
  1823. # From: Hajin Jang <jb6804@naver.com>
  1824. # hwpx (OWPML) document format follows OCF specification.
  1825. # Hangul Word Processor 2010+ supports HWPX format.
  1826. # URL: https://www.hancom.com/etc/hwpDownload.do
  1827. # https://standard.go.kr/KSCI/standardIntro/getStandardSearchView.do?menuId=503&topMenuId=502&ksNo=KSX6101
  1828. # https://e-ks.kr/streamdocs/view/sd;streamdocsId=72059197557727331
  1829. >>50 string hwp+zip Hancom HWP (Hangul Word Processor) file, HWPX
  1830. !:mime application/x-hwp+zip
  1831. !:ext hwpx
  1832. # From: Joerg Jenderek
  1833. # URL: http://en.wikipedia.org/wiki/CorelDRAW
  1834. # NOTE: version; til 2 WL-based; from 3 til 13 by ./riff; from 14 zip based
  1835. >>50 string x-vnd.corel. Corel
  1836. >>>62 string draw.document+zip Draw drawing, version 14-16
  1837. !:mime application/x-vnd.corel.draw.document+zip
  1838. !:ext cdr
  1839. >>>62 string draw.template+zip Draw template, version 14-16
  1840. !:mime application/x-vnd.corel.draw.template+zip
  1841. !:ext cdrt
  1842. >>>62 string zcf.draw.document+zip Draw drawing, version 17-22
  1843. !:mime application/x-vnd.corel.zcf.draw.document+zip
  1844. !:ext cdr
  1845. >>>62 string zcf.draw.template+zip Draw template, version 17-22
  1846. !:mime application/x-vnd.corel.zcf.draw.template+zip
  1847. !:ext cdt/cdrt
  1848. # URL: http://product.corel.com/help/CorelDRAW/540240626/Main/EN/Doc/CorelDRAW-Other-file-formats.html
  1849. >>>62 string zcf.pattern+zip Draw pattern, version 22
  1850. !:mime application/x-vnd.corel.zcf.pattern+zip
  1851. !:ext pat
  1852. # URL: https://en.wikipedia.org/wiki/Corel_Designer
  1853. # Reference: http://fileformats.archiveteam.org/wiki/Corel_Designer
  1854. # Note: called by TrID "Corel DESIGN graphics"
  1855. >>>62 string designer.document+zip DESIGNER graphics, version 14-16
  1856. !:mime application/x-vnd.corel.designer.document+zip
  1857. !:ext des
  1858. >>>62 string zcf.designer.document+zip DESIGNER graphics, version 17-21
  1859. !:mime application/x-vnd.corel.zcf.designer.document+zip
  1860. !:ext des
  1861. # URL: http://product.corel.com/help/CorelDRAW/540223850/Main/EN/Documentation/
  1862. # CorelDRAW-Corel-Symbol-Library-CSL.html
  1863. >>>62 string symbol.library+zip Symbol Library, version 6-16.3
  1864. !:mime application/x-vnd.corel.symbol.library+zip
  1865. !:ext csl
  1866. >>>62 string zcf.symbol.library+zip Symbol Library, version 17-22
  1867. !:mime application/x-vnd.corel.zcf.symbol.library+zip
  1868. !:ext csl
  1869. # Catch other ZIP-with-mimetype formats
  1870. # In a ZIP file, the bytes immediately after a member's contents are
  1871. # always "PK". The 2 regex rules here print the "mimetype" member's
  1872. # contents up to the first 'P'. Luckily, most MIME types don't contain
  1873. # any capital 'P's. This is a kludge.
  1874. # (mimetype contains "application/<OTHER>")
  1875. >>50 default x Zip data
  1876. >>>38 regex [!-OQ-~]+ (MIME type "%s"?)
  1877. !:mime application/zip
  1878. # (mimetype contents other than "application/*")
  1879. >26 string \x8\0\0\0mimetype
  1880. >>38 string !application/
  1881. >>>38 regex [!-OQ-~]+ Zip data (MIME type "%s"?)
  1882. !:mime application/zip
  1883. # Java Jar files (see also APK files above)
  1884. >(26.s+30) leshort 0xcafe Java archive data (JAR)
  1885. !:mime application/java-archive
  1886. !:ext jar
  1887. # iOS App
  1888. >(26.s+30) leshort !0xcafe
  1889. >>26 string !\x8\0\0\0mimetype
  1890. >>>30 string Payload/
  1891. >>>>38 search/64 .app/ iOS App
  1892. !:mime application/x-ios-app
  1893. # Dup, see above.
  1894. #>30 search/100/b application/epub+zip EPUB document
  1895. #!:mime application/epub+zip
  1896. # Generic zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
  1897. # Next line excludes specialized formats:
  1898. >(26.s+30) leshort !0xcafe
  1899. >>30 search/100/b !application/epub+zip
  1900. >>>26 string !\x8\0\0\0mimetype Zip archive data
  1901. !:mime application/zip
  1902. >>>>4 beshort x \b, at least
  1903. >>>>4 use zipversion
  1904. >>>>4 beshort x to extract
  1905. >>>>8 beshort x \b, compression method=
  1906. >>>>8 use zipcompression
  1907. >>>>0x161 string WINZIP \b, WinZIP self-extracting
  1908. # StarView Metafile
  1909. # From Pierre Ducroquet <pinaraf@pinaraf.info>
  1910. 0 string VCLMTF StarView MetaFile
  1911. >6 beshort x \b, version %d
  1912. >8 belong x \b, size %d
  1913. # Zoo archiver
  1914. # Update: Joerg Jenderek
  1915. # URL: https://en.wikipedia.org/wiki/Zoo_(file_format)
  1916. # http://fileformats.archiveteam.org/wiki/Zoo
  1917. # Reference: http://mark0.net/download/triddefs_xml.7z/defs/a/ark-zoo-strict.trid.xml
  1918. # http://distcache.freebsd.org/ports-distfiles/zoo-2.10pl1.tar.gz/zoo.h
  1919. # Note: called "ZOO compressed archive (strict)" by TrID and "ZOO Compressed Archive" by DROID via PUID x-fmt/269
  1920. # verified by command like `deark -m zoo -l -d2 WHRCGA.ZOO`
  1921. 20 lelong 0xfdc4a7dc
  1922. # skip DROID x-fmt-269-signature-id-621.zoo by looking for valid major version to manipulate archive
  1923. >32 byte >0 Zoo archive data
  1924. !:mime application/x-zoo
  1925. # bak is extension of backup-ed zoo
  1926. !:ext zoo/bak
  1927. # version in text form like: 1.50 2.00 2.10
  1928. >>4 byte >48 \b, v%c.
  1929. >>>6 byte >47 \b%c
  1930. >>>>7 byte >47 \b%c
  1931. # ZOO files typically start with "ZOO ?.?? Archive.", followed by the bytes 0x1a 0x0 0x0; not used by Zoo and they may be anything
  1932. >>8 string !\040Archive.\032 \b, at 8
  1933. >>>8 string x text "%0.10s"
  1934. # major_ver.minor_ver; minimum version needed to manipulate archive like: 1.0 2.0
  1935. >>32 byte >0 \b, modify: v%d
  1936. >>>33 byte x \b.%d+
  1937. # major_ver.minor_ver; minimum version needed to extract after modify like in old versions
  1938. >>(24.l+28) ubyte x \b, extract: v%u
  1939. >>(24.l+29) ubyte x \b.%u+
  1940. # with zoo 2.00 additional fields have been added in the archive header
  1941. >>32 byte >1
  1942. # type; type of archive header like: 1 2
  1943. >>>34 ubyte !1 \b, header type %u
  1944. # acmt_pos; position of archive comment like: 6258 30599 61369 149501
  1945. >>>35 lelong >0 \b, at %d
  1946. # acmt_len; length of archive comment like: 258
  1947. >>>>39 uleshort x %u bytes comment
  1948. #>>>>(35.l) ubequad x COMMENT=%16.16llx
  1949. # 1st character of comment maybe is CarriageReturn (0x0d)
  1950. >>>>(35.l) ubyte <040
  1951. # 2nd character of comment maybe is LineFeed (0x0a)
  1952. >>>>>(35.l+1) ubyte <040
  1953. # comment string after CRLF like "Anonymous ftp site garbo.uwasa.fi 128.214.87.1 moderated by"
  1954. >>>>>>(35.l+2) string x %s
  1955. # next character of remaining comment maybe is CarriageReturn (0x0d)
  1956. >>>>>>>&0 ubyte <040
  1957. >>>>>>>>&0 ubyte <040
  1958. # 2nd comment part like: Timo Salmi ts@chyde.uwasa.fi PC directories and uploads\015\012Harri Valkama hv@chyde.uwasa.fi PC, Mac, Unix files, and upload
  1959. >>>>>>>>>&0 string >037 %s
  1960. # vdata; archive-level versioning byte like: 1 3
  1961. >>>41 ubyte !1 \b, vdata %#x
  1962. # zoo_start; pointer to 1st entry header
  1963. >>24 lelong x \b; at %u
  1964. # zoo_minus; zoo_start -1 for consistency checking
  1965. #>>28 lelong x \b, zoo_minus %#x
  1966. # zoo_tag; tag for check
  1967. #>>(24.l+0) ulelong !0xfdc4a7dc \b, zoo_tag=%8.8x
  1968. # type; type of directory entry like: 1 2
  1969. >>(24.l+4) ubyte !2 type=%u
  1970. # packing_method; 0~no packing 1~normal LZW 2~lzh
  1971. >>(24.l+5) ubyte x method=
  1972. >>>(24.l+5) ubyte 0 \bnot-compressed
  1973. >>>(24.l+5) ubyte 1 \blzd
  1974. >>>(24.l+5) ubyte 2 \blzh
  1975. # next; position of next directory entry
  1976. >>(24.l+6) ulelong x \b, next entry at %u
  1977. # offset; position of file data for this entry
  1978. #>>(24.l+10) ulelong x \b, data at %u
  1979. # file_crc; CRC-16 of file data
  1980. >>(24.l+18) uleshort x \b, CRC %#4.4x
  1981. # comment; zero if none or points to entry comment like ADD9h (WHRCGA.ZOO)
  1982. >>(24.l+32) lelong >0 \b, at %#x
  1983. # cmt_size; if not 0 for none then length of entry comment like: 46
  1984. >>>(24.l+36) uleshort >0 %u bytes comment
  1985. # entry comment itself like: "CGA .GL file showing menu input from keyboard"
  1986. >>>>(&-6.l) string x "%s"
  1987. # org_size; original size of file
  1988. >>(24.l+20) ulelong x \b, size %u
  1989. # size_now; compressed size of file
  1990. >>(24.l+24) ulelong x (%u compressed)
  1991. # major_ver.minor_ver; minimum version needed to extract already done
  1992. # deleted; will be 1 if deleted, 0 if not
  1993. >>(24.l+30) ubyte =1 \b, deleted
  1994. # struc; file structure if any; WHAT IS THAT?
  1995. >>(24.l+31) ubyte !0 \b, structured
  1996. # fname[13]; short/DOS file name like 12345678.012
  1997. >>(24.l+38) string x \b, %0.13s
  1998. # for directory entry type 2 with variable part
  1999. >>(24.l+4) ubyte =2
  2000. # var_dir_len; length of variable part of dir entry
  2001. >>>(24.l+51) uleshort >0
  2002. #>>>(24.l+51) uleshort >0 \b, variable part length %u
  2003. # namlen; length of long filename
  2004. #>>>>(24.l+56) ubyte x \b, namlen %u
  2005. # dirlen; length of directory name
  2006. #>>>>(24.l+57) ubyte x \b, dirlen %u
  2007. # if file length positive then show long file name
  2008. >>>>(24.l+56) ubyte >0
  2009. # lfname[256]; long file name \0-terminated
  2010. >>>>>(24.l+58) string x "%s"
  2011. # if directory length positive then jump before file name field and then jump this addtional length plus 2 (\0-terminator + dirlen field) to following directory name
  2012. >>>>(24.l+57) ubyte >0
  2013. >>>>>(24.l+55) ubyte x
  2014. # dirname[256]; directory name \0-terminated
  2015. >>>>>>&(&0.b+2) string x in "%s"
  2016. # dir_crc; CRC of directory entry
  2017. #>>>(24.l+54) uleshort x \b, entry CRC %#4.4x
  2018. # tz; timezone where file was archived; 7Fh~unknown 4~1.00hoursWestOfUTC 12 16 20~5.00hoursWestOfUTC -107~26.75hoursEastOfUTC -4~1.00hoursEastOfUTC
  2019. >>>(24.l+53) byte !0x7f \b, time zone %d/4
  2020. # date; last mod file date in DOS format
  2021. >>>(24.l+14) lemsdosdate x \b, modified %s
  2022. # time; last mod file time in DOS format
  2023. >>>(24.l+16) lemsdostime x %s
  2024. # Shell archives
  2025. 10 string #\ This\ is\ a\ shell\ archive shell archive text
  2026. !:mime application/octet-stream
  2027. #
  2028. # LBR. NB: May conflict with the questionable
  2029. # "binary Computer Graphics Metafile" format.
  2030. #
  2031. 0 string \0\ \ \ \ \ \ \ \ \ \ \ \0\0 LBR archive data
  2032. #
  2033. # PMA (CP/M derivative of LHA)
  2034. # Update: Joerg Jenderek
  2035. # URL: https://en.wikipedia.org/wiki/LHA_(file_format)
  2036. #
  2037. #2 string -pm0- PMarc archive data [pm0]
  2038. 2 string -pm0-
  2039. >0 use lharc-file
  2040. #2 string -pm1- PMarc archive data [pm1]
  2041. 2 string -pm1-
  2042. >0 use lharc-file
  2043. #2 string -pm2- PMarc archive data [pm2]
  2044. 2 string -pm2-
  2045. >0 use lharc-file
  2046. 2 string -pms- PMarc SFX archive (CP/M, DOS)
  2047. #!:mime application/x-foobar-exec
  2048. !:ext com
  2049. 5 string -pc1- PopCom compressed executable (CP/M)
  2050. #!:mime application/x-
  2051. #!:ext com
  2052. # From Rafael Laboissiere <rafael@laboissiere.net>
  2053. # The Project Revision Control System (see
  2054. # http://prcs.sourceforge.net) generates a packaged project
  2055. # file which is recognized by the following entry:
  2056. 0 leshort 0xeb81 PRCS packaged project
  2057. # Microsoft cabinets
  2058. # by David Necas (Yeti) <yeti@physics.muni.cz>
  2059. #0 string MSCF\0\0\0\0 Microsoft cabinet file data,
  2060. #>25 byte x v%d
  2061. #>24 byte x \b.%d
  2062. # MPi: All CABs have version 1.3, so this is pointless.
  2063. # Better magic in debian-additions.
  2064. # GTKtalog catalogs
  2065. # by David Necas (Yeti) <yeti@physics.muni.cz>
  2066. 4 string gtktalog\ GTKtalog catalog data,
  2067. >13 string 3 version 3
  2068. >>14 beshort 0x677a (gzipped)
  2069. >>14 beshort !0x677a (not gzipped)
  2070. >13 string >3 version %s
  2071. ############################################################################
  2072. # Parity archive reconstruction file, the 'par' file format now used on Usenet.
  2073. 0 string PAR\0 PARity archive data
  2074. >48 leshort =0 - Index file
  2075. >48 leshort >0 - file number %d
  2076. # Felix von Leitner <felix-file@fefe.de>
  2077. 0 string d8:announce BitTorrent file
  2078. !:mime application/x-bittorrent
  2079. !:ext torrent
  2080. # Durval Menezes, <jmgthbfile at durval dot com>
  2081. 0 string d13:announce-list BitTorrent file
  2082. !:mime application/x-bittorrent
  2083. !:ext torrent
  2084. 0 string d7:comment BitTorrent file
  2085. !:mime application/x-bittorrent
  2086. !:ext torrent
  2087. 0 string d4:info BitTorrent file
  2088. !:mime application/x-bittorrent
  2089. !:ext torrent
  2090. # Atari MSA archive - Teemu Hukkanen <tjhukkan@iki.fi>
  2091. # URL: http://fileformats.archiveteam.org/wiki/MSA_(Magic_Shadow_Archiver)
  2092. # Reference: http://info-coach.fr/atari/documents/_mydoc/FD_Image_File_Format.pdf
  2093. # http://mark0.net/download/triddefs_xml.7z/defs/m/msa.trid.xml
  2094. # Update: Joerg Jenderek
  2095. # Note: called by TrID "Atari MSA Disk Image" and verified by
  2096. # command like `deark -l -m msa -d2 PDATS578.msa` as " Atari ST floppy disk image"
  2097. # GRR: line below is too general as it matches setup.skin
  2098. 0 beshort 0x0e0f
  2099. # skip foo setup.skin with unrealistic high number 52255 of sides by check for valid "low" value
  2100. >4 ubeshort <2 Atari MSA archive data
  2101. #!:mime application/octet-stream
  2102. !:mime application/x-atari-msa
  2103. !:ext msa
  2104. # sectors per track like: 9 10
  2105. >>2 beshort x \b, %d sectors per track
  2106. # sides (0 or 1; add 1 to this to get correct number of sides)
  2107. >>4 beshort 0 \b, 1 sided
  2108. >>4 beshort 1 \b, 2 sided
  2109. # starting track like: 0
  2110. >>6 beshort x \b, starting track: %d
  2111. # ending track like: 39 79 80 81
  2112. >>8 beshort x \b, ending track: %d
  2113. # tracks content
  2114. #>>10 ubequad x \b, track content %#16.16llx
  2115. # Alternate ZIP string (amc@arwen.cs.berkeley.edu)
  2116. 0 string PK00PK\003\004 Zip archive data
  2117. !:mime application/zip
  2118. !:ext zip/cbz
  2119. # Recognize ZIP archives with prepended data by end-of-central-directory record
  2120. # https://en.wikipedia.org/wiki/ZIP_(file_format)#End_of_central_directory_record_(EOCD)
  2121. # by Michal Gorny <mgorny@gentoo.org>
  2122. -2 uleshort 0
  2123. >&-22 string PK\005\006
  2124. # without #!
  2125. >>0 string !#! Zip archive, with extra data prepended
  2126. !:mime application/zip
  2127. !:ext zip/cbz
  2128. # with #!
  2129. >>0 string/w #!\ a
  2130. >>>&-1 string/T x %s script executable (Zip archive)
  2131. # ACE archive (from http://www.wotsit.org/download.asp?f=ace)
  2132. # by Stefan `Sec` Zehl <sec@42.org>
  2133. 7 string **ACE** ACE archive data
  2134. !:mime application/x-ace-compressed
  2135. !:ext ace
  2136. >15 byte >0 version %d
  2137. >16 byte =0x00 \b, from MS-DOS
  2138. >16 byte =0x01 \b, from OS/2
  2139. >16 byte =0x02 \b, from Win/32
  2140. >16 byte =0x03 \b, from Unix
  2141. >16 byte =0x04 \b, from MacOS
  2142. >16 byte =0x05 \b, from WinNT
  2143. >16 byte =0x06 \b, from Primos
  2144. >16 byte =0x07 \b, from AppleGS
  2145. >16 byte =0x08 \b, from Atari
  2146. >16 byte =0x09 \b, from Vax/VMS
  2147. >16 byte =0x0A \b, from Amiga
  2148. >16 byte =0x0B \b, from Next
  2149. >14 byte x \b, version %d to extract
  2150. >5 leshort &0x0080 \b, multiple volumes,
  2151. >>17 byte x \b (part %d),
  2152. >5 leshort &0x0002 \b, contains comment
  2153. >5 leshort &0x0200 \b, sfx
  2154. >5 leshort &0x0400 \b, small dictionary
  2155. >5 leshort &0x0800 \b, multi-volume
  2156. >5 leshort &0x1000 \b, contains AV-String
  2157. >>30 string \x16*UNREGISTERED\x20VERSION* (unregistered)
  2158. >5 leshort &0x2000 \b, with recovery record
  2159. >5 leshort &0x4000 \b, locked
  2160. >5 leshort &0x8000 \b, solid
  2161. # Date in MS-DOS format (whatever that is)
  2162. #>18 lelong x Created on
  2163. # sfArk : compression program for Soundfonts (sf2) by Dirk Jagdmann
  2164. # <doj@cubic.org>
  2165. 0x1A string sfArk sfArk compressed Soundfont
  2166. >0x15 string 2
  2167. >>0x1 string >\0 Version %s
  2168. >>0x2A string >\0 : %s
  2169. # DR-DOS 7.03 Packed File *.??_
  2170. # Reference: http://www.antonis.de/dos/dos-tuts/mpdostip/html/nwdostip.htm
  2171. # Note: unpacked by PNUNPACK.EXE
  2172. 0 string Packed\ File\
  2173. # by looking for Control-Z skip ASCII text starting with Packed File
  2174. >0x18 ubyte 0x1a Personal NetWare Packed File
  2175. !:mime application/x-novell-compress
  2176. !:ext ??_
  2177. >>12 string x \b, was "%.12s"
  2178. # 1 or 2
  2179. #>>0x19 ubyte x \b, at 0x19 %u
  2180. >>0x1b ulelong x with %u bytes
  2181. # EET archive
  2182. # From: Tilman Sauerbeck <tilman@code-monkey.de>
  2183. 0 belong 0x1ee7ff00 EET archive
  2184. !:mime application/x-eet
  2185. # rzip archives
  2186. 0 string RZIP rzip compressed data
  2187. >4 byte x - version %d
  2188. >5 byte x \b.%d
  2189. >6 belong x (%d bytes)
  2190. # From: Joerg Jenderek
  2191. # URL: https://help.foxitsoftware.com/kb/install-fzip-file.php
  2192. # reference: http://mark0.net/download/triddefs_xml.7z/
  2193. # defs/f/fzip.trid.xml
  2194. # Note: unknown compression; No "PK" zip magic; normally in directory like
  2195. # "%APPDATA%\Foxit Software\Addon\Foxit Reader\Install"
  2196. 0 ubequad 0x2506781901010000 Foxit add-on/update
  2197. !:mime application/x-fzip
  2198. !:ext fzip
  2199. # From: "Robert Dale" <robdale@gmail.com>
  2200. 0 belong 123 dar archive,
  2201. >4 belong x label "%.8x
  2202. >>8 belong x %.8x
  2203. >>>12 beshort x %.4x"
  2204. >14 byte 0x54 end slice
  2205. >14 beshort 0x4e4e multi-part
  2206. >14 beshort 0x4e53 multi-part, with -S
  2207. # Symbian installation files
  2208. # https://www.thouky.co.uk/software/psifs/sis.html
  2209. # http://developer.symbian.com/main/downloads/papers/SymbianOSv91/softwareinstallsis.pdf
  2210. 8 lelong 0x10000419 Symbian installation file
  2211. !:mime application/vnd.symbian.install
  2212. >4 lelong 0x1000006D (EPOC release 3/4/5)
  2213. >4 lelong 0x10003A12 (EPOC release 6)
  2214. 0 lelong 0x10201A7A Symbian installation file (Symbian OS 9.x)
  2215. !:mime x-epoc/x-sisx-app
  2216. # From "Nelson A. de Oliveira" <naoliv@gmail.com>
  2217. 0 string MPQ\032 MoPaQ (MPQ) archive
  2218. # From: "Nelson A. de Oliveira" <naoliv@gmail.com>
  2219. # .kgb
  2220. 0 string KGB_arch KGB Archiver file
  2221. >10 string x with compression level %.1s
  2222. # xar (eXtensible ARchiver) archive
  2223. # URL: https://en.wikipedia.org/wiki/Xar_(archiver)
  2224. # xar archive format: https://code.google.com/p/xar/
  2225. # From: "David Remahl" <dremahl@apple.com>
  2226. # Update: Joerg Jenderek
  2227. # TODO: lzma compression; X509Data for pkg and xip
  2228. # Note: verified by `xar --dump-header -f FullBundleUpdate.xar` or
  2229. # 7z t -txar Xcode_10.2_beta_4.xip`
  2230. 0 string xar! xar archive
  2231. !:mime application/x-xar
  2232. # pkg for Mac OSX installer package like FullBundleUpdate.pkg
  2233. # xip for signed Apple software like Xcode_10.2_beta_4.xip
  2234. !:ext xar/pkg/xip
  2235. # always 28 in older archives
  2236. >4 ubeshort >28 \b, header size %u
  2237. # currently there exit only version 1 since about 2014
  2238. >6 ubeshort >1 version %u,
  2239. >8 ubequad x compressed TOC: %llu,
  2240. #>16 ubequad x uncompressed TOC: %llu,
  2241. # cksum_alg 0-2 in older and also 3-4 in newer
  2242. >24 belong 0 no checksum
  2243. >24 belong 1 SHA-1 checksum
  2244. >24 belong 2 MD5 checksum
  2245. >24 belong 3 SHA-256 checksum
  2246. >24 belong 4 SHA-512 checksum
  2247. >24 belong >4 unknown %#x checksum
  2248. #>24 belong >4 checksum
  2249. # For no compression jump 0 bytes
  2250. >24 belong 0
  2251. >>0 ubyte x
  2252. # jump more bytes forward by header size
  2253. >>>&(4.S) ubyte x
  2254. # jump more bytes forward by compressed table of contents size
  2255. #>>>>&(8.Q) ubequad x \b, heap data %#llx
  2256. >>>>&(8.Q) ubyte x
  2257. # look for data by ./compress after message with 1 space at end
  2258. >>>>>&-3 indirect x \b, contains
  2259. # For SHA-1 jump 20 minus 2 bytes
  2260. >24 belong 1
  2261. >>18 ubyte x
  2262. # jump more bytes forward by header size
  2263. >>>&(4.S) ubyte x
  2264. # jump more bytes forward by compressed table of contents size
  2265. >>>>&(8.Q) ubyte x
  2266. # data compressed by gzip, bzip, lzma or none
  2267. >>>>>&-1 indirect x \b, contains
  2268. # For SHA-256 jump 32 minus 2 bytes
  2269. >24 belong 3
  2270. >>30 ubyte x
  2271. # jump more bytes forward by header size
  2272. >>>&(4.S) ubyte x
  2273. # jump more bytes forward by compressed table of contents size
  2274. >>>>&(8.Q) ubyte x
  2275. >>>>>&-1 indirect x \b, contains
  2276. # For SHA-512 jump 64 minus 2 bytes
  2277. >24 belong 4
  2278. >>62 ubyte x
  2279. # jump more bytes forward by header size
  2280. >>>&(4.S) ubyte x
  2281. # jump more bytes forward by compressed table of contents size
  2282. >>>>&(8.Q) ubyte x
  2283. >>>>>&-1 indirect x \b, contains
  2284. # Type: Parity Archive
  2285. # From: Daniel van Eeden <daniel_e@dds.nl>
  2286. 0 string PAR2 Parity Archive Volume Set
  2287. # Bacula volume format. (Volumes always start with a block header.)
  2288. # URL: https://bacula.org/3.0.x-manuals/en/developers/developers/Block_Header.html
  2289. # From: Adam Buchbinder <adam.buchbinder@gmail.com>
  2290. 12 string BB02 Bacula volume
  2291. >20 bedate x \b, started %s
  2292. # ePub is XHTML + XML inside a ZIP archive. The first member of the
  2293. # archive must be an uncompressed file called 'mimetype' with contents
  2294. # 'application/epub+zip'
  2295. # From: "Michael Gorny" <mgorny@gentoo.org>
  2296. # ZPAQ: http://mattmahoney.net/dc/zpaq.html
  2297. 0 string zPQ ZPAQ stream
  2298. >3 byte x \b, level %d
  2299. # From: Barry Carter <carter.barry@gmail.com>
  2300. # https://encode.ru/threads/456-zpaq-updates/page32
  2301. 0 string 7kSt ZPAQ file
  2302. # BBeB ebook, unencrypted (LRF format)
  2303. # URL: https://www.sven.de/librie/Librie/LrfFormat
  2304. # From: Adam Buchbinder <adam.buchbinder@gmail.com>
  2305. 0 string L\0R\0F\0\0\0 BBeB ebook data, unencrypted
  2306. >8 beshort x \b, version %d
  2307. >36 byte 1 \b, front-to-back
  2308. >36 byte 16 \b, back-to-front
  2309. >42 beshort x \b, (%dx,
  2310. >44 beshort x %d)
  2311. # Symantec GHOST image by Joerg Jenderek at May 2014
  2312. # https://us.norton.com/ghost/
  2313. # https://www.garykessler.net/library/file_sigs.html
  2314. 0 ubelong&0xFFFFf7f0 0xFEEF0100 Norton GHost image
  2315. # *.GHO
  2316. >2 ubyte&0x08 0x00 \b, first file
  2317. # *.GHS or *.[0-9] with cns program option
  2318. >2 ubyte&0x08 0x08 \b, split file
  2319. # part of split index interesting for *.ghs
  2320. >>4 ubyte x id=%#x
  2321. # compression tag minus one equals numeric compression command line switch z[1-9]
  2322. >3 ubyte 0 \b, no compression
  2323. >3 ubyte 2 \b, fast compression (Z1)
  2324. >3 ubyte 3 \b, medium compression (Z2)
  2325. >3 ubyte >3
  2326. >>3 ubyte <11 \b, compression (Z%d-1)
  2327. >2 ubyte&0x08 0x00
  2328. # ~ 30 byte password field only for *.gho
  2329. >>12 ubequad !0 \b, password protected
  2330. >>44 ubyte !1
  2331. # 1~Image All, sector-by-sector only for *.gho
  2332. >>>10 ubyte 1 \b, sector copy
  2333. # 1~Image Boot track only for *.gho
  2334. >>>43 ubyte 1 \b, boot track
  2335. # 1~Image Disc only for *.gho implies Image Boot track and sector copy
  2336. >>44 ubyte 1 \b, disc sector copy
  2337. # optional image description only *.gho
  2338. >>0xff string >\0 "%-.254s"
  2339. # look for DOS sector end sequence
  2340. >0xE08 search/7776 \x55\xAA
  2341. >>&-512 indirect x \b; contains
  2342. # Google Chrome extensions
  2343. # https://developer.chrome.com/extensions/crx
  2344. # https://developer.chrome.com/extensions/hosting
  2345. 0 string Cr24 Google Chrome extension
  2346. !:mime application/x-chrome-extension
  2347. >4 ulong x \b, version %u
  2348. # SeqBox - Sequenced container
  2349. # ext: sbx, seqbox
  2350. # Marco Pontello marcopon@gmail.com
  2351. # reference: https://github.com/MarcoPon/SeqBox
  2352. 0 string SBx SeqBox,
  2353. >3 byte x version %d
  2354. # LyNX archive
  2355. # Update: Joerg Jenderek
  2356. # URL: http://fileformats.archiveteam.org/wiki/Lynx_archive
  2357. # Reference: http://ist.uwaterloo.ca/~schepers/formats/LNX.TXT
  2358. # http://mark0.net/download/triddefs_xml.7z/defs/a/ark-lnx.trid.xml
  2359. # Note: called "Lynx archive" by TrID and "Commodore C64 BASIC program" with "POKE 53280" by ./c64
  2360. # TODO: merge and unify with Commodore C64 BASIC program
  2361. 56 string USE\040LYNX\040TO\040DISSOLVE\040THIS\040FILE LyNX archive
  2362. # display "Lynx archive" (strength=330) before Commodore C64 BASIC program (strength=50) handled by ./c64
  2363. #!:strength +0
  2364. #!:mime application/octet-stream
  2365. !:mime application/x-commodore-lnx
  2366. !:ext lnx
  2367. # afterwards look for BASIC tokenized GOTO (89h) 10, line terminator \0, end of programm tag \0\0 and CarriageReturn
  2368. >86 search/10 \x8910\0\0\0\r \b,
  2369. # for DEBUGGING
  2370. #>>&0 string x STRING="%s"
  2371. # number in ASCII of directory blocks with spaces on both sides like: 1 2 3 5
  2372. >>&0 regex [0-9]{1,5} %s directory blocks
  2373. # signature like: "*LYNX XII BY WILL CORLEY" " LYNX IX BY WILL CORLEY" "*LYNX BY CBMCONVERT 2.0*"
  2374. >>>&2 regex [^\r]{1,24} \b, signature "%s"
  2375. # number of files in ASCII surrounded by spaces and delimited by CR like: 2 3 6 13 69 144 (maximum?)
  2376. >>>>&1 regex [0-9]{1,3} \b, %s files
  2377. # From: Joerg Jenderek
  2378. # URL: https://www.acronis.com/
  2379. # Reference: https://en.wikipedia.org/wiki/TIB_(file_format)
  2380. # Note: only tested with True Image 2013 Build 5962 and 2019 Build 14110
  2381. 0 ubequad 0xce24b9a220000000 Acronis True Image backup
  2382. !:mime application/x-acronis-tib
  2383. !:ext tib
  2384. # 01000000
  2385. #>20 ubelong x \b, at 20 %#x
  2386. # 20000000
  2387. #>28 ubelong x \b, at 28 %#x
  2388. # strings like "Generic- SD/MMC 1.00" "Unknown Disk" "Msft Virtual Disk 1.0"
  2389. # ???
  2390. # strings like "\Device\0000011e" "\Device\0000015a"
  2391. #>0 search/0x6852300/cs \\Device\\
  2392. #>>&-1 pstring x \b, %s
  2393. # "\Device\HarddiskVolume30" "\Device\HarddiskVolume39"
  2394. #>>>&1 search/180/cs \\Device\\
  2395. #>>>>&-1 pstring x \b, %s
  2396. #>>>>>&0 search/29/cs \0\0\xc8\0
  2397. # disk label
  2398. #>>>>>>&10 lestring16 x \b, disk label %11.11s
  2399. #>>>>>>&9 plestring16 x \b, disk label "%11.11s"
  2400. #>>>>>>&10 ubequad x %16.16llx
  2401. # Gentoo XPAK binary package
  2402. # by Michal Gorny <mgorny@gentoo.org>
  2403. # https://gitweb.gentoo.org/proj/portage.git/tree/man/xpak.5
  2404. -4 string STOP
  2405. >-16 string XPAKSTOP Gentoo binary package (XPAK)
  2406. !:mime application/vnd.gentoo.xpak
  2407. # From: Joerg Jenderek
  2408. # URL: https://kodi.wiki/view/TexturePacker
  2409. # Reference: https://mirrors.kodi.tv/releases/source/17.3-Krypton.tar.gz
  2410. # /xbmc-Krypton/xbmc/guilib/XBTF.h
  2411. # /xbmc-Krypton/xbmc/guilib/XBTF.cpp
  2412. 0 string XBTF
  2413. # skip ASCII text by looking for terminating \0 of path
  2414. >264 ubyte 0 XBMC texture package
  2415. !:mime application/x-xbmc-xbt
  2416. !:ext xbt
  2417. # XBTF_VERSION 2
  2418. >>4 string !2 \b, version %-.1s
  2419. # nofFiles /xbmc-Krypton/xbmc/guilib/XBTFReader.cpp
  2420. >>5 ulelong x \b, %u file
  2421. # plural s
  2422. >>5 ulelong >1 \bs
  2423. # path[CXBTFFile[MaximumPathLength=256]
  2424. >>9 string x \b, 1st %s
  2425. # ALZIP archive
  2426. # by Hyungjun Park <hyungjun.park@worksmobile.com>, Hajin Jang <hajin_jang@worksmobile.com>
  2427. # http://kippler.com/win/unalz/
  2428. # https://salsa.debian.org/l10n-korean-team/unalz
  2429. 0 string ALZ\001 ALZ archive data
  2430. !:ext alz
  2431. # https://cf-aldn.altools.co.kr/setup/EGG_Specification.zip
  2432. 0 string EGGA EGG archive data,
  2433. !:ext egg
  2434. >5 byte x version %u
  2435. >4 byte x \b.%u
  2436. >>0x0E ulelong =0x08E28222
  2437. >>0x0E ulelong =0x24F5A262 \b, split
  2438. >>0x0E ulelong =0x24E5A060 \b, solid
  2439. >>0x0E default x \b, unknown
  2440. # PAQ9A archive
  2441. # URL: http://mattmahoney.net/dc/#paq9a
  2442. # Note: Line 1186 of paq9a.cpp gives the magic bytes
  2443. 0 string pQ9\001 PAQ9A archive
  2444. # From wof (wof@stachelkaktus.net)
  2445. 0 string Unison\ archive\ format Unison archive format
  2446. # https://ankiweb.net
  2447. 30 string collection.anki2 Anki APKG file
  2448. #!:ext .apkg
  2449. # Synology archive (DiskStation Manager 7.0+)
  2450. # From: Alexandre Iooss <erdnaxe@crans.org>
  2451. # Note: These archives are signed and encrypted.
  2452. 0 ulelong&0xFFFFFF00 0xEFBEAD00
  2453. # MessagePack header (fixarray of 5 elements starting with a bin of 32 bytes)
  2454. >8 ulelong&0x00FFFFFF 0x20C495 Synology archive
  2455. !:ext spk
  2456. # Extract some properties from MessagePack third item
  2457. >>43 search/0x10000 package=
  2458. >>>&0 string x \b, package %s
  2459. >>43 search/0x10000 arch=
  2460. >>>&0 string x %s
  2461. >>43 search/0x10000 version=
  2462. >>>&0 string x %s
  2463. >>43 search/0x10000 create_time=
  2464. >>>&0 string x \b, created on %s
  2465. # MonoGame/XNA processed assets archive
  2466. # From: Alexandre Iooss <erdnaxe@crans.org>
  2467. # URL: https://github.com/MonoGame/MonoGame/blob/v3.8.1/MonoGame.Framework/Content/ContentManager.cs
  2468. 0 string XNB
  2469. # XNB must be version 4 or 5
  2470. >4 byte <6
  2471. >>4 byte >3
  2472. # Size must be positive
  2473. >>>6 lelong >0 MonoGame/XNA processed assets
  2474. !:ext xnb
  2475. >>>>3 string =w \b, for Windows
  2476. >>>>3 string =x \b, for Xbox360
  2477. >>>>3 string =i \b, for iOS
  2478. >>>>3 string =a \b, for Android
  2479. >>>>3 string =d \b, for DesktopGL
  2480. >>>>3 string =X \b, for MacOSX
  2481. >>>>3 string =W \b, for WindowsStoreApp
  2482. >>>>3 string =n \b, for NativeClient
  2483. >>>>3 string =M \b, for WindowsPhone8
  2484. >>>>3 string =r \b, for RaspberryPi
  2485. >>>>3 string =P \b, for PlayStation4
  2486. >>>>3 string =5 \b, for PlayStation5
  2487. >>>>3 string =O \b, for XboxOne
  2488. >>>>3 string =S \b, for Nintendo Switch
  2489. >>>>3 string =G \b, for Google Stadia
  2490. >>>>3 string =b \b, for WebAssembly and Bridge.NET
  2491. >>>>3 string =m \b, for WindowsPhone7.0 (XNA)
  2492. >>>>3 string =p \b, for PlayStationMobile
  2493. >>>>3 string =v \b, for PSVita
  2494. >>>>3 string =g \b, for Windows (OpenGL)
  2495. >>>>3 string =l \b, for Linux
  2496. >>>>4 byte x \b, version %d
  2497. >>>>5 byte &0x80 \b, LZX compressed
  2498. >>>>>10 lelong x \b, decompressed size: %d bytes
  2499. >>>>5 byte &0x40 \b, LZ4 compressed
  2500. >>>>>10 lelong x \b, decompressed size: %d bytes
  2501. # Electron ASAR archive
  2502. # From: Alexandre Iooss <erdnaxe@crans.org>
  2503. # URL: https://github.com/electron/asar
  2504. 0 ulelong 4
  2505. # Match JSON header start and end
  2506. >16 string {"files":{"
  2507. >>(12.l+12) string }}}} Electron ASAR archive
  2508. !:ext asar
  2509. >>>12 ulelong x \b, header length: %d bytes