polyfile-weave 0.5.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of polyfile-weave might be problematic. Click here for more details.

Files changed (585) hide show
  1. polyfile/__init__.py +15 -0
  2. polyfile/__main__.py +394 -0
  3. polyfile/arithmetic.py +27 -0
  4. polyfile/ast.py +114 -0
  5. polyfile/debugger.py +1039 -0
  6. polyfile/expressions.py +346 -0
  7. polyfile/fileutils.py +343 -0
  8. polyfile/html.py +135 -0
  9. polyfile/http/__init__.py +1 -0
  10. polyfile/http/defacto.py +37 -0
  11. polyfile/http/deprecated.py +51 -0
  12. polyfile/http/experimental.py +67 -0
  13. polyfile/http/http_11.py +548 -0
  14. polyfile/http/matcher.py +37 -0
  15. polyfile/http/structured_headers.py +48 -0
  16. polyfile/iterators.py +72 -0
  17. polyfile/jpeg.py +24 -0
  18. polyfile/kaitai/__init__.py +0 -0
  19. polyfile/kaitai/compiler.py +156 -0
  20. polyfile/kaitai/parser.py +312 -0
  21. polyfile/kaitai/parsers/__init__.py +0 -0
  22. polyfile/kaitai/parsers/aix_utmp.py +116 -0
  23. polyfile/kaitai/parsers/allegro_dat.py +367 -0
  24. polyfile/kaitai/parsers/andes_firmware.py +64 -0
  25. polyfile/kaitai/parsers/android_bootldr_asus.py +105 -0
  26. polyfile/kaitai/parsers/android_bootldr_huawei.py +181 -0
  27. polyfile/kaitai/parsers/android_bootldr_qcom.py +217 -0
  28. polyfile/kaitai/parsers/android_dto.py +138 -0
  29. polyfile/kaitai/parsers/android_img.py +319 -0
  30. polyfile/kaitai/parsers/android_nanoapp_header.py +83 -0
  31. polyfile/kaitai/parsers/android_opengl_shaders_cache.py +151 -0
  32. polyfile/kaitai/parsers/android_sparse.py +237 -0
  33. polyfile/kaitai/parsers/android_super.py +401 -0
  34. polyfile/kaitai/parsers/apm_partition_table.py +196 -0
  35. polyfile/kaitai/parsers/apple_single_double.py +180 -0
  36. polyfile/kaitai/parsers/asn1_der.py +235 -0
  37. polyfile/kaitai/parsers/au.py +138 -0
  38. polyfile/kaitai/parsers/avantes_roh60.py +112 -0
  39. polyfile/kaitai/parsers/avi.py +296 -0
  40. polyfile/kaitai/parsers/bcd.py +111 -0
  41. polyfile/kaitai/parsers/bitcoin_transaction.py +210 -0
  42. polyfile/kaitai/parsers/blender_blend.py +334 -0
  43. polyfile/kaitai/parsers/bmp.py +780 -0
  44. polyfile/kaitai/parsers/bson.py +411 -0
  45. polyfile/kaitai/parsers/btrfs_stream.py +318 -0
  46. polyfile/kaitai/parsers/bytes_with_io.py +27 -0
  47. polyfile/kaitai/parsers/chrome_pak.py +194 -0
  48. polyfile/kaitai/parsers/code_6502.py +456 -0
  49. polyfile/kaitai/parsers/compressed_resource.py +217 -0
  50. polyfile/kaitai/parsers/cpio_old_le.py +154 -0
  51. polyfile/kaitai/parsers/cramfs.py +344 -0
  52. polyfile/kaitai/parsers/creative_voice_file.py +342 -0
  53. polyfile/kaitai/parsers/dbf.py +274 -0
  54. polyfile/kaitai/parsers/dcmp_0.py +664 -0
  55. polyfile/kaitai/parsers/dcmp_1.py +422 -0
  56. polyfile/kaitai/parsers/dcmp_2.py +312 -0
  57. polyfile/kaitai/parsers/dcmp_variable_length_integer.py +66 -0
  58. polyfile/kaitai/parsers/dex.py +1086 -0
  59. polyfile/kaitai/parsers/dicom.py +4370 -0
  60. polyfile/kaitai/parsers/dime_message.py +201 -0
  61. polyfile/kaitai/parsers/dns_packet.py +569 -0
  62. polyfile/kaitai/parsers/doom_wad.py +654 -0
  63. polyfile/kaitai/parsers/dos_datetime.py +191 -0
  64. polyfile/kaitai/parsers/dos_mz.py +172 -0
  65. polyfile/kaitai/parsers/ds_store.py +513 -0
  66. polyfile/kaitai/parsers/dtb.py +310 -0
  67. polyfile/kaitai/parsers/dune_2_pak.py +126 -0
  68. polyfile/kaitai/parsers/edid.py +472 -0
  69. polyfile/kaitai/parsers/efivar_signature_list.py +331 -0
  70. polyfile/kaitai/parsers/elf.py +2482 -0
  71. polyfile/kaitai/parsers/ethernet_frame.py +114 -0
  72. polyfile/kaitai/parsers/exif.py +723 -0
  73. polyfile/kaitai/parsers/ext2.py +537 -0
  74. polyfile/kaitai/parsers/fallout2_dat.py +187 -0
  75. polyfile/kaitai/parsers/fallout_dat.py +156 -0
  76. polyfile/kaitai/parsers/fasttracker_xm_module.py +558 -0
  77. polyfile/kaitai/parsers/ftl_dat.py +90 -0
  78. polyfile/kaitai/parsers/genmidi_op2.py +161 -0
  79. polyfile/kaitai/parsers/gettext_mo.py +541 -0
  80. polyfile/kaitai/parsers/gif.py +492 -0
  81. polyfile/kaitai/parsers/gimp_brush.py +244 -0
  82. polyfile/kaitai/parsers/glibc_utmp.py +114 -0
  83. polyfile/kaitai/parsers/gltf_binary.py +132 -0
  84. polyfile/kaitai/parsers/google_protobuf.py +151 -0
  85. polyfile/kaitai/parsers/gpt_partition_table.py +175 -0
  86. polyfile/kaitai/parsers/gran_turismo_vol.py +140 -0
  87. polyfile/kaitai/parsers/grub2_font.py +337 -0
  88. polyfile/kaitai/parsers/gzip.py +232 -0
  89. polyfile/kaitai/parsers/hashcat_restore.py +60 -0
  90. polyfile/kaitai/parsers/hccap.py +111 -0
  91. polyfile/kaitai/parsers/hccapx.py +103 -0
  92. polyfile/kaitai/parsers/heaps_pak.py +177 -0
  93. polyfile/kaitai/parsers/heroes_of_might_and_magic_agg.py +116 -0
  94. polyfile/kaitai/parsers/heroes_of_might_and_magic_bmp.py +34 -0
  95. polyfile/kaitai/parsers/icmp_packet.py +136 -0
  96. polyfile/kaitai/parsers/ico.py +129 -0
  97. polyfile/kaitai/parsers/id3v1_1.py +220 -0
  98. polyfile/kaitai/parsers/id3v2_3.py +324 -0
  99. polyfile/kaitai/parsers/id3v2_4.py +423 -0
  100. polyfile/kaitai/parsers/ines.py +282 -0
  101. polyfile/kaitai/parsers/ipv4_packet.py +158 -0
  102. polyfile/kaitai/parsers/ipv6_packet.py +55 -0
  103. polyfile/kaitai/parsers/iso9660.py +544 -0
  104. polyfile/kaitai/parsers/java_class.py +1113 -0
  105. polyfile/kaitai/parsers/jpeg.py +361 -0
  106. polyfile/kaitai/parsers/luks.py +149 -0
  107. polyfile/kaitai/parsers/lzh.py +165 -0
  108. polyfile/kaitai/parsers/mac_os_resource_snd.py +493 -0
  109. polyfile/kaitai/parsers/mach_o.py +3033 -0
  110. polyfile/kaitai/parsers/mach_o_fat.py +92 -0
  111. polyfile/kaitai/parsers/magicavoxel_vox.py +391 -0
  112. polyfile/kaitai/parsers/manifest.json +1 -0
  113. polyfile/kaitai/parsers/mbr_partition_table.py +119 -0
  114. polyfile/kaitai/parsers/mcap.py +1015 -0
  115. polyfile/kaitai/parsers/microsoft_cfb.py +293 -0
  116. polyfile/kaitai/parsers/microsoft_network_monitor_v2.py +309 -0
  117. polyfile/kaitai/parsers/microsoft_pe.py +765 -0
  118. polyfile/kaitai/parsers/mifare_classic.py +706 -0
  119. polyfile/kaitai/parsers/minecraft_nbt.py +449 -0
  120. polyfile/kaitai/parsers/monomakh_sapr_chg.py +69 -0
  121. polyfile/kaitai/parsers/mozilla_mar.py +239 -0
  122. polyfile/kaitai/parsers/mp4.py +333 -0
  123. polyfile/kaitai/parsers/msgpack.py +467 -0
  124. polyfile/kaitai/parsers/nitf.py +1189 -0
  125. polyfile/kaitai/parsers/nt_mdt_pal.py +155 -0
  126. polyfile/kaitai/parsers/ogg.py +118 -0
  127. polyfile/kaitai/parsers/openpgp_message.py +993 -0
  128. polyfile/kaitai/parsers/packet_ppi.py +515 -0
  129. polyfile/kaitai/parsers/pcap.py +344 -0
  130. polyfile/kaitai/parsers/pcf_font.py +506 -0
  131. polyfile/kaitai/parsers/pcx.py +195 -0
  132. polyfile/kaitai/parsers/pcx_dcx.py +79 -0
  133. polyfile/kaitai/parsers/phar_without_stub.py +399 -0
  134. polyfile/kaitai/parsers/php_serialized_value.py +505 -0
  135. polyfile/kaitai/parsers/png.py +721 -0
  136. polyfile/kaitai/parsers/protocol_body.py +260 -0
  137. polyfile/kaitai/parsers/psx_tim.py +104 -0
  138. polyfile/kaitai/parsers/python_pickle.py +718 -0
  139. polyfile/kaitai/parsers/python_pyc_27.py +510 -0
  140. polyfile/kaitai/parsers/quake_mdl.py +441 -0
  141. polyfile/kaitai/parsers/quake_pak.py +112 -0
  142. polyfile/kaitai/parsers/quicktime_mov.py +634 -0
  143. polyfile/kaitai/parsers/rar.py +265 -0
  144. polyfile/kaitai/parsers/regf.py +569 -0
  145. polyfile/kaitai/parsers/renderware_binary_stream.py +877 -0
  146. polyfile/kaitai/parsers/resource_fork.py +611 -0
  147. polyfile/kaitai/parsers/respack.py +57 -0
  148. polyfile/kaitai/parsers/riff.py +409 -0
  149. polyfile/kaitai/parsers/rpm.py +964 -0
  150. polyfile/kaitai/parsers/rtcp_payload.py +579 -0
  151. polyfile/kaitai/parsers/rtp_packet.py +150 -0
  152. polyfile/kaitai/parsers/rtpdump.py +115 -0
  153. polyfile/kaitai/parsers/ruby_marshal.py +423 -0
  154. polyfile/kaitai/parsers/s3m.py +493 -0
  155. polyfile/kaitai/parsers/saints_row_2_vpp_pc.py +254 -0
  156. polyfile/kaitai/parsers/shapefile_index.py +174 -0
  157. polyfile/kaitai/parsers/shapefile_main.py +893 -0
  158. polyfile/kaitai/parsers/some_ip.py +209 -0
  159. polyfile/kaitai/parsers/some_ip_container.py +37 -0
  160. polyfile/kaitai/parsers/some_ip_sd.py +86 -0
  161. polyfile/kaitai/parsers/some_ip_sd_entries.py +160 -0
  162. polyfile/kaitai/parsers/some_ip_sd_options.py +374 -0
  163. polyfile/kaitai/parsers/specpr.py +404 -0
  164. polyfile/kaitai/parsers/sqlite3.py +472 -0
  165. polyfile/kaitai/parsers/ssh_public_key.py +252 -0
  166. polyfile/kaitai/parsers/standard_midi_file.py +390 -0
  167. polyfile/kaitai/parsers/stl.py +111 -0
  168. polyfile/kaitai/parsers/sudoers_ts.py +201 -0
  169. polyfile/kaitai/parsers/swf.py +406 -0
  170. polyfile/kaitai/parsers/systemd_journal.py +361 -0
  171. polyfile/kaitai/parsers/tcp_segment.py +57 -0
  172. polyfile/kaitai/parsers/tga.py +213 -0
  173. polyfile/kaitai/parsers/tls_client_hello.py +293 -0
  174. polyfile/kaitai/parsers/tr_dos_image.py +322 -0
  175. polyfile/kaitai/parsers/tsm.py +198 -0
  176. polyfile/kaitai/parsers/ttf.py +1847 -0
  177. polyfile/kaitai/parsers/udp_datagram.py +42 -0
  178. polyfile/kaitai/parsers/uefi_te.py +236 -0
  179. polyfile/kaitai/parsers/uimage.py +198 -0
  180. polyfile/kaitai/parsers/utf8_string.py +137 -0
  181. polyfile/kaitai/parsers/vfat.py +410 -0
  182. polyfile/kaitai/parsers/vlq_base128_be.py +104 -0
  183. polyfile/kaitai/parsers/vlq_base128_le.py +129 -0
  184. polyfile/kaitai/parsers/vmware_vmdk.py +167 -0
  185. polyfile/kaitai/parsers/vp8_ivf.py +112 -0
  186. polyfile/kaitai/parsers/warcraft_2_pud.py +423 -0
  187. polyfile/kaitai/parsers/wav.py +1014 -0
  188. polyfile/kaitai/parsers/websocket.py +167 -0
  189. polyfile/kaitai/parsers/windows_evt_log.py +304 -0
  190. polyfile/kaitai/parsers/windows_lnk_file.py +467 -0
  191. polyfile/kaitai/parsers/windows_minidump.py +575 -0
  192. polyfile/kaitai/parsers/windows_resource_file.py +243 -0
  193. polyfile/kaitai/parsers/windows_shell_items.py +190 -0
  194. polyfile/kaitai/parsers/windows_systemtime.py +52 -0
  195. polyfile/kaitai/parsers/wmf.py +502 -0
  196. polyfile/kaitai/parsers/xar.py +181 -0
  197. polyfile/kaitai/parsers/xwd.py +189 -0
  198. polyfile/kaitai/parsers/zip.py +685 -0
  199. polyfile/kaitai/parsers/zisofs.py +158 -0
  200. polyfile/kaitai/parsers/zx_spectrum_tap.py +184 -0
  201. polyfile/kaitaimatcher.py +113 -0
  202. polyfile/languagematcher.py +217 -0
  203. polyfile/logger.py +135 -0
  204. polyfile/magic.py +2983 -0
  205. polyfile/magic_defs/COPYING +29 -0
  206. polyfile/magic_defs/__init__.py +0 -0
  207. polyfile/magic_defs/acorn +102 -0
  208. polyfile/magic_defs/adi +13 -0
  209. polyfile/magic_defs/adventure +122 -0
  210. polyfile/magic_defs/aes +29 -0
  211. polyfile/magic_defs/algol68 +35 -0
  212. polyfile/magic_defs/allegro +9 -0
  213. polyfile/magic_defs/alliant +18 -0
  214. polyfile/magic_defs/alpha +32 -0
  215. polyfile/magic_defs/amanda +12 -0
  216. polyfile/magic_defs/amigaos +218 -0
  217. polyfile/magic_defs/android +259 -0
  218. polyfile/magic_defs/animation +1197 -0
  219. polyfile/magic_defs/aout +46 -0
  220. polyfile/magic_defs/apache +28 -0
  221. polyfile/magic_defs/apl +7 -0
  222. polyfile/magic_defs/apple +773 -0
  223. polyfile/magic_defs/application +7 -0
  224. polyfile/magic_defs/applix +13 -0
  225. polyfile/magic_defs/apt +52 -0
  226. polyfile/magic_defs/archive +2586 -0
  227. polyfile/magic_defs/aria +38 -0
  228. polyfile/magic_defs/arm +50 -0
  229. polyfile/magic_defs/asf +132 -0
  230. polyfile/magic_defs/assembler +18 -0
  231. polyfile/magic_defs/asterix +18 -0
  232. polyfile/magic_defs/att3b +41 -0
  233. polyfile/magic_defs/audio +1291 -0
  234. polyfile/magic_defs/avm +33 -0
  235. polyfile/magic_defs/basis +18 -0
  236. polyfile/magic_defs/beetle +7 -0
  237. polyfile/magic_defs/ber +65 -0
  238. polyfile/magic_defs/bflt +14 -0
  239. polyfile/magic_defs/bhl +10 -0
  240. polyfile/magic_defs/bioinformatics +178 -0
  241. polyfile/magic_defs/biosig +154 -0
  242. polyfile/magic_defs/blackberry +8 -0
  243. polyfile/magic_defs/blcr +25 -0
  244. polyfile/magic_defs/blender +50 -0
  245. polyfile/magic_defs/blit +24 -0
  246. polyfile/magic_defs/bm +10 -0
  247. polyfile/magic_defs/bout +11 -0
  248. polyfile/magic_defs/bsdi +33 -0
  249. polyfile/magic_defs/bsi +10 -0
  250. polyfile/magic_defs/btsnoop +13 -0
  251. polyfile/magic_defs/burp +7 -0
  252. polyfile/magic_defs/bytecode +41 -0
  253. polyfile/magic_defs/c-lang +110 -0
  254. polyfile/magic_defs/c64 +531 -0
  255. polyfile/magic_defs/cad +437 -0
  256. polyfile/magic_defs/cafebabe +107 -0
  257. polyfile/magic_defs/cbor +21 -0
  258. polyfile/magic_defs/ccf +14 -0
  259. polyfile/magic_defs/cddb +12 -0
  260. polyfile/magic_defs/chord +15 -0
  261. polyfile/magic_defs/cisco +12 -0
  262. polyfile/magic_defs/citrus +12 -0
  263. polyfile/magic_defs/clarion +27 -0
  264. polyfile/magic_defs/claris +48 -0
  265. polyfile/magic_defs/clipper +65 -0
  266. polyfile/magic_defs/clojure +30 -0
  267. polyfile/magic_defs/coff +98 -0
  268. polyfile/magic_defs/commands +201 -0
  269. polyfile/magic_defs/communications +22 -0
  270. polyfile/magic_defs/compress +461 -0
  271. polyfile/magic_defs/console +1213 -0
  272. polyfile/magic_defs/convex +69 -0
  273. polyfile/magic_defs/coverage +91 -0
  274. polyfile/magic_defs/cracklib +14 -0
  275. polyfile/magic_defs/crypto +31 -0
  276. polyfile/magic_defs/csv +8 -0
  277. polyfile/magic_defs/ctags +6 -0
  278. polyfile/magic_defs/ctf +23 -0
  279. polyfile/magic_defs/cubemap +8 -0
  280. polyfile/magic_defs/cups +56 -0
  281. polyfile/magic_defs/dact +11 -0
  282. polyfile/magic_defs/database +886 -0
  283. polyfile/magic_defs/dataone +47 -0
  284. polyfile/magic_defs/dbpf +15 -0
  285. polyfile/magic_defs/der +146 -0
  286. polyfile/magic_defs/diamond +12 -0
  287. polyfile/magic_defs/dif +33 -0
  288. polyfile/magic_defs/diff +41 -0
  289. polyfile/magic_defs/digital +59 -0
  290. polyfile/magic_defs/dolby +69 -0
  291. polyfile/magic_defs/dsf +25 -0
  292. polyfile/magic_defs/dump +96 -0
  293. polyfile/magic_defs/dwarfs +45 -0
  294. polyfile/magic_defs/dyadic +61 -0
  295. polyfile/magic_defs/ebml +8 -0
  296. polyfile/magic_defs/edid +11 -0
  297. polyfile/magic_defs/editors +43 -0
  298. polyfile/magic_defs/efi +15 -0
  299. polyfile/magic_defs/elf +379 -0
  300. polyfile/magic_defs/encore +22 -0
  301. polyfile/magic_defs/epoc +62 -0
  302. polyfile/magic_defs/erlang +21 -0
  303. polyfile/magic_defs/espressif +57 -0
  304. polyfile/magic_defs/esri +28 -0
  305. polyfile/magic_defs/etf +33 -0
  306. polyfile/magic_defs/fcs +9 -0
  307. polyfile/magic_defs/filesystems +2694 -0
  308. polyfile/magic_defs/finger +16 -0
  309. polyfile/magic_defs/firmware +133 -0
  310. polyfile/magic_defs/flash +62 -0
  311. polyfile/magic_defs/flif +36 -0
  312. polyfile/magic_defs/fonts +449 -0
  313. polyfile/magic_defs/forth +82 -0
  314. polyfile/magic_defs/fortran +9 -0
  315. polyfile/magic_defs/frame +62 -0
  316. polyfile/magic_defs/freebsd +164 -0
  317. polyfile/magic_defs/fsav +128 -0
  318. polyfile/magic_defs/fusecompress +12 -0
  319. polyfile/magic_defs/games +696 -0
  320. polyfile/magic_defs/gcc +17 -0
  321. polyfile/magic_defs/gconv +10 -0
  322. polyfile/magic_defs/gentoo +85 -0
  323. polyfile/magic_defs/geo +166 -0
  324. polyfile/magic_defs/geos +20 -0
  325. polyfile/magic_defs/gimp +77 -0
  326. polyfile/magic_defs/git +13 -0
  327. polyfile/magic_defs/glibc +21 -0
  328. polyfile/magic_defs/gnome +59 -0
  329. polyfile/magic_defs/gnu +173 -0
  330. polyfile/magic_defs/gnumeric +8 -0
  331. polyfile/magic_defs/gpt +240 -0
  332. polyfile/magic_defs/gpu +28 -0
  333. polyfile/magic_defs/grace +21 -0
  334. polyfile/magic_defs/graphviz +12 -0
  335. polyfile/magic_defs/gringotts +48 -0
  336. polyfile/magic_defs/guile +13 -0
  337. polyfile/magic_defs/hardware +12 -0
  338. polyfile/magic_defs/hitachi-sh +30 -0
  339. polyfile/magic_defs/hp +433 -0
  340. polyfile/magic_defs/human68k +26 -0
  341. polyfile/magic_defs/ibm370 +52 -0
  342. polyfile/magic_defs/ibm6000 +35 -0
  343. polyfile/magic_defs/icc +214 -0
  344. polyfile/magic_defs/iff +80 -0
  345. polyfile/magic_defs/images +4210 -0
  346. polyfile/magic_defs/inform +9 -0
  347. polyfile/magic_defs/intel +310 -0
  348. polyfile/magic_defs/interleaf +9 -0
  349. polyfile/magic_defs/island +10 -0
  350. polyfile/magic_defs/ispell +63 -0
  351. polyfile/magic_defs/isz +15 -0
  352. polyfile/magic_defs/java +52 -0
  353. polyfile/magic_defs/javascript +171 -0
  354. polyfile/magic_defs/jpeg +252 -0
  355. polyfile/magic_defs/json +8 -0
  356. polyfile/magic_defs/karma +9 -0
  357. polyfile/magic_defs/kde +11 -0
  358. polyfile/magic_defs/keepass +20 -0
  359. polyfile/magic_defs/kerberos +45 -0
  360. polyfile/magic_defs/kicad +85 -0
  361. polyfile/magic_defs/kml +34 -0
  362. polyfile/magic_defs/lammps +64 -0
  363. polyfile/magic_defs/lecter +6 -0
  364. polyfile/magic_defs/lex +12 -0
  365. polyfile/magic_defs/lif +50 -0
  366. polyfile/magic_defs/linux +557 -0
  367. polyfile/magic_defs/lisp +78 -0
  368. polyfile/magic_defs/llvm +22 -0
  369. polyfile/magic_defs/locoscript +12 -0
  370. polyfile/magic_defs/lua +31 -0
  371. polyfile/magic_defs/luks +126 -0
  372. polyfile/magic_defs/m4 +11 -0
  373. polyfile/magic_defs/mach +303 -0
  374. polyfile/magic_defs/macintosh +505 -0
  375. polyfile/magic_defs/macos +7 -0
  376. polyfile/magic_defs/magic +10 -0
  377. polyfile/magic_defs/magic.mgc +0 -0
  378. polyfile/magic_defs/mail.news +132 -0
  379. polyfile/magic_defs/make +21 -0
  380. polyfile/magic_defs/map +413 -0
  381. polyfile/magic_defs/maple +109 -0
  382. polyfile/magic_defs/marc21 +30 -0
  383. polyfile/magic_defs/mathcad +8 -0
  384. polyfile/magic_defs/mathematica +188 -0
  385. polyfile/magic_defs/matroska +17 -0
  386. polyfile/magic_defs/mcrypt +52 -0
  387. polyfile/magic_defs/measure +44 -0
  388. polyfile/magic_defs/mercurial +13 -0
  389. polyfile/magic_defs/metastore +8 -0
  390. polyfile/magic_defs/meteorological +53 -0
  391. polyfile/magic_defs/microfocus +21 -0
  392. polyfile/magic_defs/mime +9 -0
  393. polyfile/magic_defs/mips +120 -0
  394. polyfile/magic_defs/mirage +8 -0
  395. polyfile/magic_defs/misctools +140 -0
  396. polyfile/magic_defs/mkid +11 -0
  397. polyfile/magic_defs/mlssa +8 -0
  398. polyfile/magic_defs/mmdf +6 -0
  399. polyfile/magic_defs/modem +92 -0
  400. polyfile/magic_defs/modulefile +9 -0
  401. polyfile/magic_defs/motorola +71 -0
  402. polyfile/magic_defs/mozilla +37 -0
  403. polyfile/magic_defs/msdos +2304 -0
  404. polyfile/magic_defs/msooxml +68 -0
  405. polyfile/magic_defs/msvc +222 -0
  406. polyfile/magic_defs/msx +309 -0
  407. polyfile/magic_defs/mup +24 -0
  408. polyfile/magic_defs/music +17 -0
  409. polyfile/magic_defs/nasa +7 -0
  410. polyfile/magic_defs/natinst +24 -0
  411. polyfile/magic_defs/ncr +49 -0
  412. polyfile/magic_defs/neko +12 -0
  413. polyfile/magic_defs/netbsd +251 -0
  414. polyfile/magic_defs/netscape +26 -0
  415. polyfile/magic_defs/netware +11 -0
  416. polyfile/magic_defs/news +13 -0
  417. polyfile/magic_defs/nifty +202 -0
  418. polyfile/magic_defs/nim-lang +29 -0
  419. polyfile/magic_defs/nitpicker +14 -0
  420. polyfile/magic_defs/numpy +9 -0
  421. polyfile/magic_defs/oasis +12 -0
  422. polyfile/magic_defs/ocaml +14 -0
  423. polyfile/magic_defs/octave +6 -0
  424. polyfile/magic_defs/ole2compounddocs +760 -0
  425. polyfile/magic_defs/olf +98 -0
  426. polyfile/magic_defs/openfst +17 -0
  427. polyfile/magic_defs/opentimestamps +16 -0
  428. polyfile/magic_defs/oric +16 -0
  429. polyfile/magic_defs/os2 +186 -0
  430. polyfile/magic_defs/os400 +39 -0
  431. polyfile/magic_defs/os9 +80 -0
  432. polyfile/magic_defs/osf1 +10 -0
  433. polyfile/magic_defs/palm +156 -0
  434. polyfile/magic_defs/parix +13 -0
  435. polyfile/magic_defs/parrot +22 -0
  436. polyfile/magic_defs/pascal +39 -0
  437. polyfile/magic_defs/pbf +11 -0
  438. polyfile/magic_defs/pbm +8 -0
  439. polyfile/magic_defs/pc88 +24 -0
  440. polyfile/magic_defs/pc98 +77 -0
  441. polyfile/magic_defs/pci_ids +116 -0
  442. polyfile/magic_defs/pcjr +8 -0
  443. polyfile/magic_defs/pdf +51 -0
  444. polyfile/magic_defs/pdp +42 -0
  445. polyfile/magic_defs/perl +100 -0
  446. polyfile/magic_defs/pgf +52 -0
  447. polyfile/magic_defs/pgp +581 -0
  448. polyfile/magic_defs/pgp-binary-keys +388 -0
  449. polyfile/magic_defs/pkgadd +7 -0
  450. polyfile/magic_defs/plan9 +25 -0
  451. polyfile/magic_defs/playdate +57 -0
  452. polyfile/magic_defs/plus5 +18 -0
  453. polyfile/magic_defs/pmem +46 -0
  454. polyfile/magic_defs/polyfile_zip +5 -0
  455. polyfile/magic_defs/polyml +23 -0
  456. polyfile/magic_defs/printer +269 -0
  457. polyfile/magic_defs/project +10 -0
  458. polyfile/magic_defs/psdbms +14 -0
  459. polyfile/magic_defs/psl +14 -0
  460. polyfile/magic_defs/pulsar +13 -0
  461. polyfile/magic_defs/puzzle +17 -0
  462. polyfile/magic_defs/pwsafe +14 -0
  463. polyfile/magic_defs/pyramid +12 -0
  464. polyfile/magic_defs/python +305 -0
  465. polyfile/magic_defs/qt +30 -0
  466. polyfile/magic_defs/revision +66 -0
  467. polyfile/magic_defs/riff +840 -0
  468. polyfile/magic_defs/rinex +44 -0
  469. polyfile/magic_defs/ringdove +45 -0
  470. polyfile/magic_defs/rpi +52 -0
  471. polyfile/magic_defs/rpm +45 -0
  472. polyfile/magic_defs/rpmsg +7 -0
  473. polyfile/magic_defs/rst +11 -0
  474. polyfile/magic_defs/rtf +94 -0
  475. polyfile/magic_defs/ruby +55 -0
  476. polyfile/magic_defs/rust +21 -0
  477. polyfile/magic_defs/sc +7 -0
  478. polyfile/magic_defs/sccs +24 -0
  479. polyfile/magic_defs/scientific +144 -0
  480. polyfile/magic_defs/securitycerts +6 -0
  481. polyfile/magic_defs/selinux +24 -0
  482. polyfile/magic_defs/sendmail +37 -0
  483. polyfile/magic_defs/sequent +42 -0
  484. polyfile/magic_defs/sereal +35 -0
  485. polyfile/magic_defs/sgi +144 -0
  486. polyfile/magic_defs/sgml +161 -0
  487. polyfile/magic_defs/sharc +23 -0
  488. polyfile/magic_defs/sinclair +40 -0
  489. polyfile/magic_defs/sisu +18 -0
  490. polyfile/magic_defs/sketch +6 -0
  491. polyfile/magic_defs/smalltalk +25 -0
  492. polyfile/magic_defs/smile +34 -0
  493. polyfile/magic_defs/sniffer +482 -0
  494. polyfile/magic_defs/softquad +40 -0
  495. polyfile/magic_defs/sosi +40 -0
  496. polyfile/magic_defs/spec +21 -0
  497. polyfile/magic_defs/spectrum +184 -0
  498. polyfile/magic_defs/sql +288 -0
  499. polyfile/magic_defs/ssh +39 -0
  500. polyfile/magic_defs/ssl +20 -0
  501. polyfile/magic_defs/statistics +45 -0
  502. polyfile/magic_defs/subtitle +38 -0
  503. polyfile/magic_defs/sun +141 -0
  504. polyfile/magic_defs/svf +5 -0
  505. polyfile/magic_defs/sylk +36 -0
  506. polyfile/magic_defs/symbos +42 -0
  507. polyfile/magic_defs/sysex +429 -0
  508. polyfile/magic_defs/tcl +29 -0
  509. polyfile/magic_defs/teapot +6 -0
  510. polyfile/magic_defs/terminfo +63 -0
  511. polyfile/magic_defs/tex +141 -0
  512. polyfile/magic_defs/tgif +7 -0
  513. polyfile/magic_defs/ti-8x +239 -0
  514. polyfile/magic_defs/timezone +42 -0
  515. polyfile/magic_defs/tplink +95 -0
  516. polyfile/magic_defs/troff +38 -0
  517. polyfile/magic_defs/tuxedo +8 -0
  518. polyfile/magic_defs/typeset +8 -0
  519. polyfile/magic_defs/uf2 +72 -0
  520. polyfile/magic_defs/unicode +15 -0
  521. polyfile/magic_defs/unisig +12 -0
  522. polyfile/magic_defs/unknown +34 -0
  523. polyfile/magic_defs/usd +21 -0
  524. polyfile/magic_defs/uterus +16 -0
  525. polyfile/magic_defs/uuencode +28 -0
  526. polyfile/magic_defs/vacuum-cleaner +54 -0
  527. polyfile/magic_defs/varied.out +46 -0
  528. polyfile/magic_defs/varied.script +21 -0
  529. polyfile/magic_defs/vax +32 -0
  530. polyfile/magic_defs/vicar +17 -0
  531. polyfile/magic_defs/virtual +307 -0
  532. polyfile/magic_defs/virtutech +12 -0
  533. polyfile/magic_defs/visx +32 -0
  534. polyfile/magic_defs/vms +30 -0
  535. polyfile/magic_defs/vmware +6 -0
  536. polyfile/magic_defs/vorbis +155 -0
  537. polyfile/magic_defs/vxl +14 -0
  538. polyfile/magic_defs/warc +16 -0
  539. polyfile/magic_defs/weak +16 -0
  540. polyfile/magic_defs/web +18 -0
  541. polyfile/magic_defs/webassembly +17 -0
  542. polyfile/magic_defs/windows +1811 -0
  543. polyfile/magic_defs/wireless +7 -0
  544. polyfile/magic_defs/wordprocessors +630 -0
  545. polyfile/magic_defs/wsdl +23 -0
  546. polyfile/magic_defs/x68000 +25 -0
  547. polyfile/magic_defs/xdelta +13 -0
  548. polyfile/magic_defs/xenix +106 -0
  549. polyfile/magic_defs/xilinx +58 -0
  550. polyfile/magic_defs/xo65 +37 -0
  551. polyfile/magic_defs/xwindows +43 -0
  552. polyfile/magic_defs/yara +17 -0
  553. polyfile/magic_defs/zfs +96 -0
  554. polyfile/magic_defs/zilog +12 -0
  555. polyfile/magic_defs/zip +126 -0
  556. polyfile/magic_defs/zyxel +17 -0
  557. polyfile/nes.py +144 -0
  558. polyfile/nitf.py +15 -0
  559. polyfile/pdf.py +1264 -0
  560. polyfile/pickles.py +45 -0
  561. polyfile/polyfile.py +409 -0
  562. polyfile/profiling.py +115 -0
  563. polyfile/repl.py +624 -0
  564. polyfile/search.py +310 -0
  565. polyfile/serialization.py +323 -0
  566. polyfile/structmatcher.py +46 -0
  567. polyfile/structs.py +281 -0
  568. polyfile/templates/download.js +162 -0
  569. polyfile/templates/hexdump.css +268 -0
  570. polyfile/templates/hexdump.js +756 -0
  571. polyfile/templates/jquery-3.4.1.min.js +2 -0
  572. polyfile/templates/template.html +119 -0
  573. polyfile/wildcards.py +62 -0
  574. polyfile/zipmatcher.py +183 -0
  575. polyfile_weave-0.5.5.dist-info/METADATA +173 -0
  576. polyfile_weave-0.5.5.dist-info/RECORD +585 -0
  577. polyfile_weave-0.5.5.dist-info/WHEEL +5 -0
  578. polyfile_weave-0.5.5.dist-info/entry_points.txt +2 -0
  579. polyfile_weave-0.5.5.dist-info/licenses/LICENSE +202 -0
  580. polyfile_weave-0.5.5.dist-info/top_level.txt +2 -0
  581. polymerge/__init__.py +1 -0
  582. polymerge/__main__.py +296 -0
  583. polymerge/cfg.py +127 -0
  584. polymerge/polymerge.py +227 -0
  585. polymerge/polytracker.py +190 -0
@@ -0,0 +1,718 @@
1
+ # This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
2
+
3
+ from pkg_resources import parse_version
4
+ import kaitaistruct
5
+ from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO
6
+ from enum import Enum
7
+ import collections
8
+
9
+
10
+ if parse_version(kaitaistruct.__version__) < parse_version('0.9'):
11
+ raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__))
12
+
13
+ class PythonPickle(KaitaiStruct):
14
+ """Python Pickle format serializes Python objects to a byte stream, as a sequence
15
+ of operations to run on the Pickle Virtual Machine.
16
+
17
+ The format is mostly implementation defined, there is no formal specification.
18
+ Pickle data types are closely coupled to the Python object model.
19
+ Python singletons, and most builtin types (e.g. `None`, `int`,`dict`, `list`)
20
+ are serialised using dedicated Pickle opcodes.
21
+ Other builtin types, and all classes (e.g. `set`, `datetime.datetime`) are
22
+ serialised by encoding the name of a constructor callable.
23
+ They are deserialised by importing that constructor, and calling it.
24
+ So, unpickling an arbitrary pickle, using the Python's stdlib pickle module
25
+ can cause arbitrary code execution.
26
+
27
+ Pickle format has evolved with Python, later protocols add opcodes & types.
28
+ Later Python releases can pickle to or unpickle from any earlier protocol.
29
+
30
+ * Protocol 0: ASCII clean, no explicit version, fields are '\n' terminated.
31
+ * Protocol 1: Binary, no explicit version, first length prefixed types.
32
+ * Protocol 2 ([PEP 307](https://peps.python.org/pep-0307/)): Python 2.3+.
33
+ Explicit versioning, more length prefixed types.
34
+ * Protocol 3: Python 3.0+. Dedicated opcodes for `bytes` objects.
35
+ * Protocol 4 ([PEP 3154](https://peps.python.org/pep-3154/)): Python 3.4+.
36
+ Opcodes for 64 bit strings, framing, `set`.
37
+ * Protocol 5 ([PEP 574](https://peps.python.org/pep-0574/)): Python 3.8+:
38
+ Opcodes for `bytearray` and out of band data
39
+
40
+ .. seealso::
41
+ Source - https://github.com/python/cpython/blob/v3.8.1/Lib/pickletools.py
42
+ """
43
+
44
+ class Opcode(Enum):
45
+ mark = 40
46
+ empty_tuple = 41
47
+ stop = 46
48
+ pop = 48
49
+ pop_mark = 49
50
+ dup = 50
51
+ binbytes = 66
52
+ short_binbytes = 67
53
+ float = 70
54
+ binfloat = 71
55
+ int = 73
56
+ binint = 74
57
+ binint1 = 75
58
+ long = 76
59
+ binint2 = 77
60
+ none = 78
61
+ persid = 80
62
+ binpersid = 81
63
+ reduce = 82
64
+ string = 83
65
+ binstring = 84
66
+ short_binstring = 85
67
+ unicode = 86
68
+ binunicode = 88
69
+ empty_list = 93
70
+ append = 97
71
+ build = 98
72
+ global_opcode = 99
73
+ dict = 100
74
+ appends = 101
75
+ get = 103
76
+ binget = 104
77
+ inst = 105
78
+ long_binget = 106
79
+ list = 108
80
+ obj = 111
81
+ put = 112
82
+ binput = 113
83
+ long_binput = 114
84
+ setitem = 115
85
+ tuple = 116
86
+ setitems = 117
87
+ empty_dict = 125
88
+ proto = 128
89
+ newobj = 129
90
+ ext1 = 130
91
+ ext2 = 131
92
+ ext4 = 132
93
+ tuple1 = 133
94
+ tuple2 = 134
95
+ tuple3 = 135
96
+ newtrue = 136
97
+ newfalse = 137
98
+ long1 = 138
99
+ long4 = 139
100
+ short_binunicode = 140
101
+ binunicode8 = 141
102
+ binbytes8 = 142
103
+ empty_set = 143
104
+ additems = 144
105
+ frozenset = 145
106
+ newobj_ex = 146
107
+ stack_global = 147
108
+ memoize = 148
109
+ frame = 149
110
+ bytearray8 = 150
111
+ next_buffer = 151
112
+ readonly_buffer = 152
113
+ SEQ_FIELDS = ["ops"]
114
+ def __init__(self, _io, _parent=None, _root=None):
115
+ self._io = _io
116
+ self._parent = _parent
117
+ self._root = _root if _root else self
118
+ self._debug = collections.defaultdict(dict)
119
+
120
+ def _read(self):
121
+ self._debug['ops']['start'] = self._io.pos()
122
+ self.ops = []
123
+ i = 0
124
+ while True:
125
+ if not 'arr' in self._debug['ops']:
126
+ self._debug['ops']['arr'] = []
127
+ self._debug['ops']['arr'].append({'start': self._io.pos()})
128
+ _t_ops = PythonPickle.Op(self._io, self, self._root)
129
+ _t_ops._read()
130
+ _ = _t_ops
131
+ self.ops.append(_)
132
+ self._debug['ops']['arr'][len(self.ops) - 1]['end'] = self._io.pos()
133
+ if _.code == PythonPickle.Opcode.stop:
134
+ break
135
+ i += 1
136
+ self._debug['ops']['end'] = self._io.pos()
137
+
138
+ class Unicodestring8(KaitaiStruct):
139
+ """Length prefixed string, between 0 and 2**64-1 bytes long.
140
+
141
+ Only a 64-bit build of Python would produce a pickle containing strings
142
+ large enough to need this type. Such a pickle could not be unpickled on
143
+ a 32-bit build of Python, because the string would be larger than
144
+ `sys.maxsize`.
145
+ """
146
+ SEQ_FIELDS = ["len", "val"]
147
+ def __init__(self, _io, _parent=None, _root=None):
148
+ self._io = _io
149
+ self._parent = _parent
150
+ self._root = _root if _root else self
151
+ self._debug = collections.defaultdict(dict)
152
+
153
+ def _read(self):
154
+ self._debug['len']['start'] = self._io.pos()
155
+ self.len = self._io.read_u8le()
156
+ self._debug['len']['end'] = self._io.pos()
157
+ self._debug['val']['start'] = self._io.pos()
158
+ self.val = (self._io.read_bytes(self.len)).decode(u"utf8")
159
+ self._debug['val']['end'] = self._io.pos()
160
+
161
+
162
+ class Long1(KaitaiStruct):
163
+ """Large signed integer, in the range -2**(8*255-1) to 2**(8*255-1)-1,
164
+ encoded as two's complement.
165
+ """
166
+ SEQ_FIELDS = ["len", "val"]
167
+ def __init__(self, _io, _parent=None, _root=None):
168
+ self._io = _io
169
+ self._parent = _parent
170
+ self._root = _root if _root else self
171
+ self._debug = collections.defaultdict(dict)
172
+
173
+ def _read(self):
174
+ self._debug['len']['start'] = self._io.pos()
175
+ self.len = self._io.read_u1()
176
+ self._debug['len']['end'] = self._io.pos()
177
+ self._debug['val']['start'] = self._io.pos()
178
+ self.val = self._io.read_bytes(self.len)
179
+ self._debug['val']['end'] = self._io.pos()
180
+
181
+
182
+ class Bytes8(KaitaiStruct):
183
+ """Length prefixed string, between 0 and 2**64-1 bytes long.
184
+
185
+ Only a 64-bit build of Python would produce a pickle containing strings
186
+ large enough to need this type. Such a pickle could not be unpickled on
187
+ a 32-bit build of Python, because the string would be larger than
188
+ `sys.maxsize`.
189
+ """
190
+ SEQ_FIELDS = ["len", "val"]
191
+ def __init__(self, _io, _parent=None, _root=None):
192
+ self._io = _io
193
+ self._parent = _parent
194
+ self._root = _root if _root else self
195
+ self._debug = collections.defaultdict(dict)
196
+
197
+ def _read(self):
198
+ self._debug['len']['start'] = self._io.pos()
199
+ self.len = self._io.read_u8le()
200
+ self._debug['len']['end'] = self._io.pos()
201
+ self._debug['val']['start'] = self._io.pos()
202
+ self.val = self._io.read_bytes(self.len)
203
+ self._debug['val']['end'] = self._io.pos()
204
+
205
+
206
+ class Bytes1(KaitaiStruct):
207
+ """Length prefixed byte string, between 0 and 255 bytes long."""
208
+ SEQ_FIELDS = ["len", "val"]
209
+ def __init__(self, _io, _parent=None, _root=None):
210
+ self._io = _io
211
+ self._parent = _parent
212
+ self._root = _root if _root else self
213
+ self._debug = collections.defaultdict(dict)
214
+
215
+ def _read(self):
216
+ self._debug['len']['start'] = self._io.pos()
217
+ self.len = self._io.read_u1()
218
+ self._debug['len']['end'] = self._io.pos()
219
+ self._debug['val']['start'] = self._io.pos()
220
+ self.val = self._io.read_bytes(self.len)
221
+ self._debug['val']['end'] = self._io.pos()
222
+
223
+
224
+ class Bytes4(KaitaiStruct):
225
+ """Length prefixed string, between 0 and 2**32-1 bytes long."""
226
+ SEQ_FIELDS = ["len", "val"]
227
+ def __init__(self, _io, _parent=None, _root=None):
228
+ self._io = _io
229
+ self._parent = _parent
230
+ self._root = _root if _root else self
231
+ self._debug = collections.defaultdict(dict)
232
+
233
+ def _read(self):
234
+ self._debug['len']['start'] = self._io.pos()
235
+ self.len = self._io.read_u4le()
236
+ self._debug['len']['end'] = self._io.pos()
237
+ self._debug['val']['start'] = self._io.pos()
238
+ self.val = self._io.read_bytes(self.len)
239
+ self._debug['val']['end'] = self._io.pos()
240
+
241
+
242
+ class NoArg(KaitaiStruct):
243
+ """Some opcodes take no argument, this empty type is used for them."""
244
+ SEQ_FIELDS = []
245
+ def __init__(self, _io, _parent=None, _root=None):
246
+ self._io = _io
247
+ self._parent = _parent
248
+ self._root = _root if _root else self
249
+ self._debug = collections.defaultdict(dict)
250
+
251
+ def _read(self):
252
+ pass
253
+
254
+
255
+ class StringnlNoescape(KaitaiStruct):
256
+ """Unquoted string, does not contain string escapes."""
257
+ SEQ_FIELDS = ["val"]
258
+ def __init__(self, _io, _parent=None, _root=None):
259
+ self._io = _io
260
+ self._parent = _parent
261
+ self._root = _root if _root else self
262
+ self._debug = collections.defaultdict(dict)
263
+
264
+ def _read(self):
265
+ self._debug['val']['start'] = self._io.pos()
266
+ self.val = (self._io.read_bytes_term(10, False, True, True)).decode(u"ascii")
267
+ self._debug['val']['end'] = self._io.pos()
268
+
269
+
270
+ class DecimalnlLong(KaitaiStruct):
271
+ """Integer, encoded with the ASCII chracters [0-9-], followed by 'L'."""
272
+ SEQ_FIELDS = ["val"]
273
+ def __init__(self, _io, _parent=None, _root=None):
274
+ self._io = _io
275
+ self._parent = _parent
276
+ self._root = _root if _root else self
277
+ self._debug = collections.defaultdict(dict)
278
+
279
+ def _read(self):
280
+ self._debug['val']['start'] = self._io.pos()
281
+ self.val = (self._io.read_bytes_term(10, False, True, True)).decode(u"ascii")
282
+ self._debug['val']['end'] = self._io.pos()
283
+
284
+
285
+ class Unicodestring4(KaitaiStruct):
286
+ """Length prefixed string, between 0 and 2**32-1 bytes long."""
287
+ SEQ_FIELDS = ["len", "val"]
288
+ def __init__(self, _io, _parent=None, _root=None):
289
+ self._io = _io
290
+ self._parent = _parent
291
+ self._root = _root if _root else self
292
+ self._debug = collections.defaultdict(dict)
293
+
294
+ def _read(self):
295
+ self._debug['len']['start'] = self._io.pos()
296
+ self.len = self._io.read_u4le()
297
+ self._debug['len']['end'] = self._io.pos()
298
+ self._debug['val']['start'] = self._io.pos()
299
+ self.val = (self._io.read_bytes(self.len)).decode(u"utf8")
300
+ self._debug['val']['end'] = self._io.pos()
301
+
302
+
303
+ class Unicodestringnl(KaitaiStruct):
304
+ """Unquoted string, containing Python Unicode escapes."""
305
+ SEQ_FIELDS = ["val"]
306
+ def __init__(self, _io, _parent=None, _root=None):
307
+ self._io = _io
308
+ self._parent = _parent
309
+ self._root = _root if _root else self
310
+ self._debug = collections.defaultdict(dict)
311
+
312
+ def _read(self):
313
+ self._debug['val']['start'] = self._io.pos()
314
+ self.val = (self._io.read_bytes_term(10, False, True, True)).decode(u"ascii")
315
+ self._debug['val']['end'] = self._io.pos()
316
+
317
+
318
+ class Long4(KaitaiStruct):
319
+ """Large signed integer, in the range -2**(8*2**32-1) to 2**(8*2**32-1)-1,
320
+ encoded as two's complement.
321
+ """
322
+ SEQ_FIELDS = ["len", "val"]
323
+ def __init__(self, _io, _parent=None, _root=None):
324
+ self._io = _io
325
+ self._parent = _parent
326
+ self._root = _root if _root else self
327
+ self._debug = collections.defaultdict(dict)
328
+
329
+ def _read(self):
330
+ self._debug['len']['start'] = self._io.pos()
331
+ self.len = self._io.read_u4le()
332
+ self._debug['len']['end'] = self._io.pos()
333
+ self._debug['val']['start'] = self._io.pos()
334
+ self.val = self._io.read_bytes(self.len)
335
+ self._debug['val']['end'] = self._io.pos()
336
+
337
+
338
+ class String1(KaitaiStruct):
339
+ """Length prefixed string, between 0 and 255 bytes long. Encoding is
340
+ unspecified.
341
+
342
+ The default Python 2.x string type (`str`) is a sequence of bytes.
343
+ These are pickled as `string1` or `string4`, when protocol == 2.
344
+ The bytes are written directly, no explicit encoding is performed.
345
+
346
+ Python 3.x will not pickle an object as `string1` or `string4`.
347
+ Instead, opcodes and types with a known encoding are used.
348
+ When unpickling
349
+
350
+ - `pickle.Unpickler` objects default to ASCII, which can be overriden
351
+ - `pickletools.dis` uses latin1, and cannot be overriden
352
+
353
+ .. seealso::
354
+ Source - https://github.com/python/cpython/blob/bb8071a4cae/Lib/pickle.py#L486-L495
355
+ """
356
+ SEQ_FIELDS = ["len", "val"]
357
+ def __init__(self, _io, _parent=None, _root=None):
358
+ self._io = _io
359
+ self._parent = _parent
360
+ self._root = _root if _root else self
361
+ self._debug = collections.defaultdict(dict)
362
+
363
+ def _read(self):
364
+ self._debug['len']['start'] = self._io.pos()
365
+ self.len = self._io.read_u1()
366
+ self._debug['len']['end'] = self._io.pos()
367
+ self._debug['val']['start'] = self._io.pos()
368
+ self.val = self._io.read_bytes(self.len)
369
+ self._debug['val']['end'] = self._io.pos()
370
+
371
+
372
+ class Bytearray8(KaitaiStruct):
373
+ """Length prefixed string, between 0 and 2**64-1 bytes long.
374
+
375
+ The contents are deserilised into a `bytearray` object.
376
+ """
377
+ SEQ_FIELDS = ["len", "val"]
378
+ def __init__(self, _io, _parent=None, _root=None):
379
+ self._io = _io
380
+ self._parent = _parent
381
+ self._root = _root if _root else self
382
+ self._debug = collections.defaultdict(dict)
383
+
384
+ def _read(self):
385
+ self._debug['len']['start'] = self._io.pos()
386
+ self.len = self._io.read_u8le()
387
+ self._debug['len']['end'] = self._io.pos()
388
+ self._debug['val']['start'] = self._io.pos()
389
+ self.val = self._io.read_bytes(self.len)
390
+ self._debug['val']['end'] = self._io.pos()
391
+
392
+
393
+ class DecimalnlShort(KaitaiStruct):
394
+ """Integer or boolean, encoded with the ASCII characters [0-9-].
395
+
396
+ The values '00' and '01' encode the Python values `False` and `True`.
397
+ Normally a value would not contain leading '0' characters.
398
+ """
399
+ SEQ_FIELDS = ["val"]
400
+ def __init__(self, _io, _parent=None, _root=None):
401
+ self._io = _io
402
+ self._parent = _parent
403
+ self._root = _root if _root else self
404
+ self._debug = collections.defaultdict(dict)
405
+
406
+ def _read(self):
407
+ self._debug['val']['start'] = self._io.pos()
408
+ self.val = (self._io.read_bytes_term(10, False, True, True)).decode(u"ascii")
409
+ self._debug['val']['end'] = self._io.pos()
410
+
411
+
412
+ class Unicodestring1(KaitaiStruct):
413
+ """Length prefixed string, between 0 and 255 bytes long."""
414
+ SEQ_FIELDS = ["len", "val"]
415
+ def __init__(self, _io, _parent=None, _root=None):
416
+ self._io = _io
417
+ self._parent = _parent
418
+ self._root = _root if _root else self
419
+ self._debug = collections.defaultdict(dict)
420
+
421
+ def _read(self):
422
+ self._debug['len']['start'] = self._io.pos()
423
+ self.len = self._io.read_u1()
424
+ self._debug['len']['end'] = self._io.pos()
425
+ self._debug['val']['start'] = self._io.pos()
426
+ self.val = (self._io.read_bytes(self.len)).decode(u"utf8")
427
+ self._debug['val']['end'] = self._io.pos()
428
+
429
+
430
+ class Stringnl(KaitaiStruct):
431
+ """Quoted string, possibly containing Python string escapes."""
432
+ SEQ_FIELDS = ["val"]
433
+ def __init__(self, _io, _parent=None, _root=None):
434
+ self._io = _io
435
+ self._parent = _parent
436
+ self._root = _root if _root else self
437
+ self._debug = collections.defaultdict(dict)
438
+
439
+ def _read(self):
440
+ self._debug['val']['start'] = self._io.pos()
441
+ self.val = (self._io.read_bytes_term(10, False, True, True)).decode(u"ascii")
442
+ self._debug['val']['end'] = self._io.pos()
443
+
444
+
445
+ class StringnlNoescapePair(KaitaiStruct):
446
+ """Pair of unquoted, unescaped strings."""
447
+ SEQ_FIELDS = ["val1", "val2"]
448
+ def __init__(self, _io, _parent=None, _root=None):
449
+ self._io = _io
450
+ self._parent = _parent
451
+ self._root = _root if _root else self
452
+ self._debug = collections.defaultdict(dict)
453
+
454
+ def _read(self):
455
+ self._debug['val1']['start'] = self._io.pos()
456
+ self.val1 = PythonPickle.StringnlNoescape(self._io, self, self._root)
457
+ self.val1._read()
458
+ self._debug['val1']['end'] = self._io.pos()
459
+ self._debug['val2']['start'] = self._io.pos()
460
+ self.val2 = PythonPickle.StringnlNoescape(self._io, self, self._root)
461
+ self.val2._read()
462
+ self._debug['val2']['end'] = self._io.pos()
463
+
464
+
465
+ class String4(KaitaiStruct):
466
+ """Length prefixed string, between 0 and 2**31-1 bytes long. Encoding is
467
+ unspecified.
468
+
469
+ Although the len field is signed, any length < 0 will raise an exception
470
+ during unpickling.
471
+
472
+ See the documentation for `string1` for further detail about encodings.
473
+
474
+ .. seealso::
475
+ Source - https://github.com/python/cpython/blob/bb8071a4cae/Lib/pickle.py#L486-L495
476
+ """
477
+ SEQ_FIELDS = ["len", "val"]
478
+ def __init__(self, _io, _parent=None, _root=None):
479
+ self._io = _io
480
+ self._parent = _parent
481
+ self._root = _root if _root else self
482
+ self._debug = collections.defaultdict(dict)
483
+
484
+ def _read(self):
485
+ self._debug['len']['start'] = self._io.pos()
486
+ self.len = self._io.read_s4le()
487
+ self._debug['len']['end'] = self._io.pos()
488
+ self._debug['val']['start'] = self._io.pos()
489
+ self.val = self._io.read_bytes(self.len)
490
+ self._debug['val']['end'] = self._io.pos()
491
+
492
+
493
+ class Op(KaitaiStruct):
494
+ SEQ_FIELDS = ["code", "arg"]
495
+ def __init__(self, _io, _parent=None, _root=None):
496
+ self._io = _io
497
+ self._parent = _parent
498
+ self._root = _root if _root else self
499
+ self._debug = collections.defaultdict(dict)
500
+
501
+ def _read(self):
502
+ self._debug['code']['start'] = self._io.pos()
503
+ self.code = KaitaiStream.resolve_enum(PythonPickle.Opcode, self._io.read_u1())
504
+ self._debug['code']['end'] = self._io.pos()
505
+ self._debug['arg']['start'] = self._io.pos()
506
+ _on = self.code
507
+ if _on == PythonPickle.Opcode.ext4:
508
+ self.arg = self._io.read_u4le()
509
+ elif _on == PythonPickle.Opcode.tuple1:
510
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
511
+ self.arg._read()
512
+ elif _on == PythonPickle.Opcode.setitem:
513
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
514
+ self.arg._read()
515
+ elif _on == PythonPickle.Opcode.readonly_buffer:
516
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
517
+ self.arg._read()
518
+ elif _on == PythonPickle.Opcode.stop:
519
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
520
+ self.arg._read()
521
+ elif _on == PythonPickle.Opcode.ext2:
522
+ self.arg = self._io.read_u2le()
523
+ elif _on == PythonPickle.Opcode.empty_tuple:
524
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
525
+ self.arg._read()
526
+ elif _on == PythonPickle.Opcode.newtrue:
527
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
528
+ self.arg._read()
529
+ elif _on == PythonPickle.Opcode.long:
530
+ self.arg = PythonPickle.DecimalnlLong(self._io, self, self._root)
531
+ self.arg._read()
532
+ elif _on == PythonPickle.Opcode.newobj:
533
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
534
+ self.arg._read()
535
+ elif _on == PythonPickle.Opcode.bytearray8:
536
+ self.arg = PythonPickle.Bytearray8(self._io, self, self._root)
537
+ self.arg._read()
538
+ elif _on == PythonPickle.Opcode.put:
539
+ self.arg = PythonPickle.DecimalnlShort(self._io, self, self._root)
540
+ self.arg._read()
541
+ elif _on == PythonPickle.Opcode.stack_global:
542
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
543
+ self.arg._read()
544
+ elif _on == PythonPickle.Opcode.pop_mark:
545
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
546
+ self.arg._read()
547
+ elif _on == PythonPickle.Opcode.append:
548
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
549
+ self.arg._read()
550
+ elif _on == PythonPickle.Opcode.newfalse:
551
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
552
+ self.arg._read()
553
+ elif _on == PythonPickle.Opcode.binpersid:
554
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
555
+ self.arg._read()
556
+ elif _on == PythonPickle.Opcode.build:
557
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
558
+ self.arg._read()
559
+ elif _on == PythonPickle.Opcode.empty_dict:
560
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
561
+ self.arg._read()
562
+ elif _on == PythonPickle.Opcode.tuple2:
563
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
564
+ self.arg._read()
565
+ elif _on == PythonPickle.Opcode.long4:
566
+ self.arg = PythonPickle.Long4(self._io, self, self._root)
567
+ self.arg._read()
568
+ elif _on == PythonPickle.Opcode.next_buffer:
569
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
570
+ self.arg._read()
571
+ elif _on == PythonPickle.Opcode.appends:
572
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
573
+ self.arg._read()
574
+ elif _on == PythonPickle.Opcode.binbytes:
575
+ self.arg = PythonPickle.Bytes4(self._io, self, self._root)
576
+ self.arg._read()
577
+ elif _on == PythonPickle.Opcode.dup:
578
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
579
+ self.arg._read()
580
+ elif _on == PythonPickle.Opcode.list:
581
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
582
+ self.arg._read()
583
+ elif _on == PythonPickle.Opcode.proto:
584
+ self.arg = self._io.read_u1()
585
+ elif _on == PythonPickle.Opcode.pop:
586
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
587
+ self.arg._read()
588
+ elif _on == PythonPickle.Opcode.frame:
589
+ self.arg = self._io.read_u8le()
590
+ elif _on == PythonPickle.Opcode.string:
591
+ self.arg = PythonPickle.Stringnl(self._io, self, self._root)
592
+ self.arg._read()
593
+ elif _on == PythonPickle.Opcode.binunicode:
594
+ self.arg = PythonPickle.Unicodestring4(self._io, self, self._root)
595
+ self.arg._read()
596
+ elif _on == PythonPickle.Opcode.float:
597
+ self.arg = PythonPickle.Floatnl(self._io, self, self._root)
598
+ self.arg._read()
599
+ elif _on == PythonPickle.Opcode.reduce:
600
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
601
+ self.arg._read()
602
+ elif _on == PythonPickle.Opcode.global_opcode:
603
+ self.arg = PythonPickle.StringnlNoescapePair(self._io, self, self._root)
604
+ self.arg._read()
605
+ elif _on == PythonPickle.Opcode.binput:
606
+ self.arg = self._io.read_u1()
607
+ elif _on == PythonPickle.Opcode.memoize:
608
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
609
+ self.arg._read()
610
+ elif _on == PythonPickle.Opcode.persid:
611
+ self.arg = PythonPickle.StringnlNoescape(self._io, self, self._root)
612
+ self.arg._read()
613
+ elif _on == PythonPickle.Opcode.ext1:
614
+ self.arg = self._io.read_u1()
615
+ elif _on == PythonPickle.Opcode.none:
616
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
617
+ self.arg._read()
618
+ elif _on == PythonPickle.Opcode.short_binunicode:
619
+ self.arg = PythonPickle.Unicodestring1(self._io, self, self._root)
620
+ self.arg._read()
621
+ elif _on == PythonPickle.Opcode.obj:
622
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
623
+ self.arg._read()
624
+ elif _on == PythonPickle.Opcode.binfloat:
625
+ self.arg = self._io.read_f8be()
626
+ elif _on == PythonPickle.Opcode.newobj_ex:
627
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
628
+ self.arg._read()
629
+ elif _on == PythonPickle.Opcode.empty_list:
630
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
631
+ self.arg._read()
632
+ elif _on == PythonPickle.Opcode.tuple:
633
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
634
+ self.arg._read()
635
+ elif _on == PythonPickle.Opcode.binunicode8:
636
+ self.arg = PythonPickle.Unicodestring8(self._io, self, self._root)
637
+ self.arg._read()
638
+ elif _on == PythonPickle.Opcode.binget:
639
+ self.arg = self._io.read_u1()
640
+ elif _on == PythonPickle.Opcode.dict:
641
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
642
+ self.arg._read()
643
+ elif _on == PythonPickle.Opcode.binstring:
644
+ self.arg = PythonPickle.String4(self._io, self, self._root)
645
+ self.arg._read()
646
+ elif _on == PythonPickle.Opcode.setitems:
647
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
648
+ self.arg._read()
649
+ elif _on == PythonPickle.Opcode.binint2:
650
+ self.arg = self._io.read_u2le()
651
+ elif _on == PythonPickle.Opcode.binbytes8:
652
+ self.arg = PythonPickle.Bytes8(self._io, self, self._root)
653
+ self.arg._read()
654
+ elif _on == PythonPickle.Opcode.binint1:
655
+ self.arg = self._io.read_u1()
656
+ elif _on == PythonPickle.Opcode.inst:
657
+ self.arg = PythonPickle.StringnlNoescapePair(self._io, self, self._root)
658
+ self.arg._read()
659
+ elif _on == PythonPickle.Opcode.long_binget:
660
+ self.arg = self._io.read_u4le()
661
+ elif _on == PythonPickle.Opcode.long_binput:
662
+ self.arg = self._io.read_u4le()
663
+ elif _on == PythonPickle.Opcode.int:
664
+ self.arg = PythonPickle.DecimalnlShort(self._io, self, self._root)
665
+ self.arg._read()
666
+ elif _on == PythonPickle.Opcode.binint:
667
+ self.arg = self._io.read_s4le()
668
+ elif _on == PythonPickle.Opcode.unicode:
669
+ self.arg = PythonPickle.Unicodestringnl(self._io, self, self._root)
670
+ self.arg._read()
671
+ elif _on == PythonPickle.Opcode.long1:
672
+ self.arg = PythonPickle.Long1(self._io, self, self._root)
673
+ self.arg._read()
674
+ elif _on == PythonPickle.Opcode.short_binstring:
675
+ self.arg = PythonPickle.String1(self._io, self, self._root)
676
+ self.arg._read()
677
+ elif _on == PythonPickle.Opcode.mark:
678
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
679
+ self.arg._read()
680
+ elif _on == PythonPickle.Opcode.frozenset:
681
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
682
+ self.arg._read()
683
+ elif _on == PythonPickle.Opcode.tuple3:
684
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
685
+ self.arg._read()
686
+ elif _on == PythonPickle.Opcode.additems:
687
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
688
+ self.arg._read()
689
+ elif _on == PythonPickle.Opcode.get:
690
+ self.arg = PythonPickle.DecimalnlShort(self._io, self, self._root)
691
+ self.arg._read()
692
+ elif _on == PythonPickle.Opcode.empty_set:
693
+ self.arg = PythonPickle.NoArg(self._io, self, self._root)
694
+ self.arg._read()
695
+ elif _on == PythonPickle.Opcode.short_binbytes:
696
+ self.arg = PythonPickle.Bytes1(self._io, self, self._root)
697
+ self.arg._read()
698
+ self._debug['arg']['end'] = self._io.pos()
699
+
700
+
701
+ class Floatnl(KaitaiStruct):
702
+ """Double float, encoded with the ASCII characters [0-9.e+-], '-inf', 'inf',
703
+ or 'nan'.
704
+ """
705
+ SEQ_FIELDS = ["val"]
706
+ def __init__(self, _io, _parent=None, _root=None):
707
+ self._io = _io
708
+ self._parent = _parent
709
+ self._root = _root if _root else self
710
+ self._debug = collections.defaultdict(dict)
711
+
712
+ def _read(self):
713
+ self._debug['val']['start'] = self._io.pos()
714
+ self.val = (self._io.read_bytes_term(10, False, True, True)).decode(u"ascii")
715
+ self._debug['val']['end'] = self._io.pos()
716
+
717
+
718
+