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,42 @@
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
+ import collections
7
+
8
+
9
+ if parse_version(kaitaistruct.__version__) < parse_version('0.9'):
10
+ raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__))
11
+
12
+ class UdpDatagram(KaitaiStruct):
13
+ """UDP is a simple stateless transport layer (AKA OSI layer 4)
14
+ protocol, one of the core Internet protocols. It provides source and
15
+ destination ports, basic checksumming, but provides not guarantees
16
+ of delivery, order of packets, or duplicate delivery.
17
+ """
18
+ SEQ_FIELDS = ["src_port", "dst_port", "length", "checksum", "body"]
19
+ def __init__(self, _io, _parent=None, _root=None):
20
+ self._io = _io
21
+ self._parent = _parent
22
+ self._root = _root if _root else self
23
+ self._debug = collections.defaultdict(dict)
24
+
25
+ def _read(self):
26
+ self._debug['src_port']['start'] = self._io.pos()
27
+ self.src_port = self._io.read_u2be()
28
+ self._debug['src_port']['end'] = self._io.pos()
29
+ self._debug['dst_port']['start'] = self._io.pos()
30
+ self.dst_port = self._io.read_u2be()
31
+ self._debug['dst_port']['end'] = self._io.pos()
32
+ self._debug['length']['start'] = self._io.pos()
33
+ self.length = self._io.read_u2be()
34
+ self._debug['length']['end'] = self._io.pos()
35
+ self._debug['checksum']['start'] = self._io.pos()
36
+ self.checksum = self._io.read_u2be()
37
+ self._debug['checksum']['end'] = self._io.pos()
38
+ self._debug['body']['start'] = self._io.pos()
39
+ self.body = self._io.read_bytes((self.length - 8))
40
+ self._debug['body']['end'] = self._io.pos()
41
+
42
+
@@ -0,0 +1,236 @@
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
+ import collections
7
+ from enum import Enum
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 UefiTe(KaitaiStruct):
14
+ """This type of executables could be found inside the UEFI firmware. The UEFI
15
+ firmware is stored in SPI flash memory, which is a chip soldered on a
16
+ system's motherboard. UEFI firmware is very modular: it usually contains
17
+ dozens, if not hundreds, of executables. To store all these separates files,
18
+ the firmware is laid out in volumes using the Firmware File System (FFS), a
19
+ file system specifically designed to store firmware images. The volumes
20
+ contain files that are identified by GUIDs and each of these files contain
21
+ one or more sections holding the data. One of these sections contains the
22
+ actual executable image. Most of the executable images follow the PE format.
23
+ However, some of them follow the TE format.
24
+
25
+ The Terse Executable (TE) image format was created as a mechanism to reduce
26
+ the overhead of the PE/COFF headers in PE32/PE32+ images, resulting in a
27
+ corresponding reduction of image sizes for executables running in the PI
28
+ (Platform Initialization) Architecture environment. Reducing image size
29
+ provides an opportunity for use of a smaller system flash part.
30
+
31
+ So the TE format is basically a stripped version of PE.
32
+
33
+ .. seealso::
34
+ Source - https://uefi.org/sites/default/files/resources/PI_Spec_1_6.pdf
35
+ """
36
+ SEQ_FIELDS = ["te_hdr", "sections"]
37
+ def __init__(self, _io, _parent=None, _root=None):
38
+ self._io = _io
39
+ self._parent = _parent
40
+ self._root = _root if _root else self
41
+ self._debug = collections.defaultdict(dict)
42
+
43
+ def _read(self):
44
+ self._debug['te_hdr']['start'] = self._io.pos()
45
+ self._raw_te_hdr = self._io.read_bytes(40)
46
+ _io__raw_te_hdr = KaitaiStream(BytesIO(self._raw_te_hdr))
47
+ self.te_hdr = UefiTe.TeHeader(_io__raw_te_hdr, self, self._root)
48
+ self.te_hdr._read()
49
+ self._debug['te_hdr']['end'] = self._io.pos()
50
+ self._debug['sections']['start'] = self._io.pos()
51
+ self.sections = [None] * (self.te_hdr.num_sections)
52
+ for i in range(self.te_hdr.num_sections):
53
+ if not 'arr' in self._debug['sections']:
54
+ self._debug['sections']['arr'] = []
55
+ self._debug['sections']['arr'].append({'start': self._io.pos()})
56
+ _t_sections = UefiTe.Section(self._io, self, self._root)
57
+ _t_sections._read()
58
+ self.sections[i] = _t_sections
59
+ self._debug['sections']['arr'][i]['end'] = self._io.pos()
60
+
61
+ self._debug['sections']['end'] = self._io.pos()
62
+
63
+ class TeHeader(KaitaiStruct):
64
+
65
+ class MachineType(Enum):
66
+ unknown = 0
67
+ i386 = 332
68
+ r4000 = 358
69
+ wcemipsv2 = 361
70
+ alpha = 388
71
+ sh3 = 418
72
+ sh3dsp = 419
73
+ sh4 = 422
74
+ sh5 = 424
75
+ arm = 448
76
+ thumb = 450
77
+ armnt = 452
78
+ am33 = 467
79
+ powerpc = 496
80
+ powerpcfp = 497
81
+ ia64 = 512
82
+ mips16 = 614
83
+ mipsfpu = 870
84
+ mipsfpu16 = 1126
85
+ ebc = 3772
86
+ riscv32 = 20530
87
+ riscv64 = 20580
88
+ riscv128 = 20776
89
+ amd64 = 34404
90
+ m32r = 36929
91
+ arm64 = 43620
92
+
93
+ class SubsystemEnum(Enum):
94
+ unknown = 0
95
+ native = 1
96
+ windows_gui = 2
97
+ windows_cui = 3
98
+ posix_cui = 7
99
+ windows_ce_gui = 9
100
+ efi_application = 10
101
+ efi_boot_service_driver = 11
102
+ efi_runtime_driver = 12
103
+ efi_rom = 13
104
+ xbox = 14
105
+ windows_boot_application = 16
106
+ SEQ_FIELDS = ["magic", "machine", "num_sections", "subsystem", "stripped_size", "entry_point_addr", "base_of_code", "image_base", "data_dirs"]
107
+ def __init__(self, _io, _parent=None, _root=None):
108
+ self._io = _io
109
+ self._parent = _parent
110
+ self._root = _root if _root else self
111
+ self._debug = collections.defaultdict(dict)
112
+
113
+ def _read(self):
114
+ self._debug['magic']['start'] = self._io.pos()
115
+ self.magic = self._io.read_bytes(2)
116
+ self._debug['magic']['end'] = self._io.pos()
117
+ if not self.magic == b"\x56\x5A":
118
+ raise kaitaistruct.ValidationNotEqualError(b"\x56\x5A", self.magic, self._io, u"/types/te_header/seq/0")
119
+ self._debug['machine']['start'] = self._io.pos()
120
+ self.machine = KaitaiStream.resolve_enum(UefiTe.TeHeader.MachineType, self._io.read_u2le())
121
+ self._debug['machine']['end'] = self._io.pos()
122
+ self._debug['num_sections']['start'] = self._io.pos()
123
+ self.num_sections = self._io.read_u1()
124
+ self._debug['num_sections']['end'] = self._io.pos()
125
+ self._debug['subsystem']['start'] = self._io.pos()
126
+ self.subsystem = KaitaiStream.resolve_enum(UefiTe.TeHeader.SubsystemEnum, self._io.read_u1())
127
+ self._debug['subsystem']['end'] = self._io.pos()
128
+ self._debug['stripped_size']['start'] = self._io.pos()
129
+ self.stripped_size = self._io.read_u2le()
130
+ self._debug['stripped_size']['end'] = self._io.pos()
131
+ self._debug['entry_point_addr']['start'] = self._io.pos()
132
+ self.entry_point_addr = self._io.read_u4le()
133
+ self._debug['entry_point_addr']['end'] = self._io.pos()
134
+ self._debug['base_of_code']['start'] = self._io.pos()
135
+ self.base_of_code = self._io.read_u4le()
136
+ self._debug['base_of_code']['end'] = self._io.pos()
137
+ self._debug['image_base']['start'] = self._io.pos()
138
+ self.image_base = self._io.read_u8le()
139
+ self._debug['image_base']['end'] = self._io.pos()
140
+ self._debug['data_dirs']['start'] = self._io.pos()
141
+ self.data_dirs = UefiTe.HeaderDataDirs(self._io, self, self._root)
142
+ self.data_dirs._read()
143
+ self._debug['data_dirs']['end'] = self._io.pos()
144
+
145
+
146
+ class HeaderDataDirs(KaitaiStruct):
147
+ SEQ_FIELDS = ["base_relocation_table", "debug"]
148
+ def __init__(self, _io, _parent=None, _root=None):
149
+ self._io = _io
150
+ self._parent = _parent
151
+ self._root = _root if _root else self
152
+ self._debug = collections.defaultdict(dict)
153
+
154
+ def _read(self):
155
+ self._debug['base_relocation_table']['start'] = self._io.pos()
156
+ self.base_relocation_table = UefiTe.DataDir(self._io, self, self._root)
157
+ self.base_relocation_table._read()
158
+ self._debug['base_relocation_table']['end'] = self._io.pos()
159
+ self._debug['debug']['start'] = self._io.pos()
160
+ self.debug = UefiTe.DataDir(self._io, self, self._root)
161
+ self.debug._read()
162
+ self._debug['debug']['end'] = self._io.pos()
163
+
164
+
165
+ class DataDir(KaitaiStruct):
166
+ SEQ_FIELDS = ["virtual_address", "size"]
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['virtual_address']['start'] = self._io.pos()
175
+ self.virtual_address = self._io.read_u4le()
176
+ self._debug['virtual_address']['end'] = self._io.pos()
177
+ self._debug['size']['start'] = self._io.pos()
178
+ self.size = self._io.read_u4le()
179
+ self._debug['size']['end'] = self._io.pos()
180
+
181
+
182
+ class Section(KaitaiStruct):
183
+ SEQ_FIELDS = ["name", "virtual_size", "virtual_address", "size_of_raw_data", "pointer_to_raw_data", "pointer_to_relocations", "pointer_to_linenumbers", "num_relocations", "num_linenumbers", "characteristics"]
184
+ def __init__(self, _io, _parent=None, _root=None):
185
+ self._io = _io
186
+ self._parent = _parent
187
+ self._root = _root if _root else self
188
+ self._debug = collections.defaultdict(dict)
189
+
190
+ def _read(self):
191
+ self._debug['name']['start'] = self._io.pos()
192
+ self.name = (KaitaiStream.bytes_strip_right(self._io.read_bytes(8), 0)).decode(u"UTF-8")
193
+ self._debug['name']['end'] = self._io.pos()
194
+ self._debug['virtual_size']['start'] = self._io.pos()
195
+ self.virtual_size = self._io.read_u4le()
196
+ self._debug['virtual_size']['end'] = self._io.pos()
197
+ self._debug['virtual_address']['start'] = self._io.pos()
198
+ self.virtual_address = self._io.read_u4le()
199
+ self._debug['virtual_address']['end'] = self._io.pos()
200
+ self._debug['size_of_raw_data']['start'] = self._io.pos()
201
+ self.size_of_raw_data = self._io.read_u4le()
202
+ self._debug['size_of_raw_data']['end'] = self._io.pos()
203
+ self._debug['pointer_to_raw_data']['start'] = self._io.pos()
204
+ self.pointer_to_raw_data = self._io.read_u4le()
205
+ self._debug['pointer_to_raw_data']['end'] = self._io.pos()
206
+ self._debug['pointer_to_relocations']['start'] = self._io.pos()
207
+ self.pointer_to_relocations = self._io.read_u4le()
208
+ self._debug['pointer_to_relocations']['end'] = self._io.pos()
209
+ self._debug['pointer_to_linenumbers']['start'] = self._io.pos()
210
+ self.pointer_to_linenumbers = self._io.read_u4le()
211
+ self._debug['pointer_to_linenumbers']['end'] = self._io.pos()
212
+ self._debug['num_relocations']['start'] = self._io.pos()
213
+ self.num_relocations = self._io.read_u2le()
214
+ self._debug['num_relocations']['end'] = self._io.pos()
215
+ self._debug['num_linenumbers']['start'] = self._io.pos()
216
+ self.num_linenumbers = self._io.read_u2le()
217
+ self._debug['num_linenumbers']['end'] = self._io.pos()
218
+ self._debug['characteristics']['start'] = self._io.pos()
219
+ self.characteristics = self._io.read_u4le()
220
+ self._debug['characteristics']['end'] = self._io.pos()
221
+
222
+ @property
223
+ def body(self):
224
+ if hasattr(self, '_m_body'):
225
+ return self._m_body if hasattr(self, '_m_body') else None
226
+
227
+ _pos = self._io.pos()
228
+ self._io.seek(((self.pointer_to_raw_data - self._root.te_hdr.stripped_size) + self._root.te_hdr._io.size()))
229
+ self._debug['_m_body']['start'] = self._io.pos()
230
+ self._m_body = self._io.read_bytes(self.size_of_raw_data)
231
+ self._debug['_m_body']['end'] = self._io.pos()
232
+ self._io.seek(_pos)
233
+ return self._m_body if hasattr(self, '_m_body') else None
234
+
235
+
236
+
@@ -0,0 +1,198 @@
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 Uimage(KaitaiStruct):
14
+ """The new uImage format allows more flexibility in handling images of various
15
+ types (kernel, ramdisk, etc.), it also enhances integrity protection of images
16
+ with sha1 and md5 checksums.
17
+
18
+ .. seealso::
19
+ Source - https://source.denx.de/u-boot/u-boot/-/raw/e4dba4ba6f/include/image.h
20
+ """
21
+
22
+ class UimageOs(Enum):
23
+ invalid = 0
24
+ openbsd = 1
25
+ netbsd = 2
26
+ freebsd = 3
27
+ bsd4_4 = 4
28
+ linux = 5
29
+ svr4 = 6
30
+ esix = 7
31
+ solaris = 8
32
+ irix = 9
33
+ sco = 10
34
+ dell = 11
35
+ ncr = 12
36
+ lynxos = 13
37
+ vxworks = 14
38
+ psos = 15
39
+ qnx = 16
40
+ u_boot = 17
41
+ rtems = 18
42
+ artos = 19
43
+ unity = 20
44
+ integrity = 21
45
+ ose = 22
46
+ plan9 = 23
47
+ openrtos = 24
48
+ arm_trusted_firmware = 25
49
+ tee = 26
50
+ opensbi = 27
51
+ efi = 28
52
+
53
+ class UimageArch(Enum):
54
+ invalid = 0
55
+ alpha = 1
56
+ arm = 2
57
+ i386 = 3
58
+ ia64 = 4
59
+ mips = 5
60
+ mips64 = 6
61
+ ppc = 7
62
+ s390 = 8
63
+ sh = 9
64
+ sparc = 10
65
+ sparc64 = 11
66
+ m68k = 12
67
+ nios = 13
68
+ microblaze = 14
69
+ nios2 = 15
70
+ blackfin = 16
71
+ avr32 = 17
72
+ st200 = 18
73
+ sandbox = 19
74
+ nds32 = 20
75
+ openrisc = 21
76
+ arm64 = 22
77
+ arc = 23
78
+ x86_64 = 24
79
+ xtensa = 25
80
+ riscv = 26
81
+
82
+ class UimageComp(Enum):
83
+ none = 0
84
+ gzip = 1
85
+ bzip2 = 2
86
+ lzma = 3
87
+ lzo = 4
88
+ lz4 = 5
89
+ zstd = 6
90
+
91
+ class UimageType(Enum):
92
+ invalid = 0
93
+ standalone = 1
94
+ kernel = 2
95
+ ramdisk = 3
96
+ multi = 4
97
+ firmware = 5
98
+ script = 6
99
+ filesystem = 7
100
+ flatdt = 8
101
+ kwbimage = 9
102
+ imximage = 10
103
+ ublimage = 11
104
+ omapimage = 12
105
+ aisimage = 13
106
+ kernel_noload = 14
107
+ pblimage = 15
108
+ mxsimage = 16
109
+ gpimage = 17
110
+ atmelimage = 18
111
+ socfpgaimage = 19
112
+ x86_setup = 20
113
+ lpc32xximage = 21
114
+ loadable = 22
115
+ rkimage = 23
116
+ rksd = 24
117
+ rkspi = 25
118
+ zynqimage = 26
119
+ zynqmpimage = 27
120
+ zynqmpbif = 28
121
+ fpga = 29
122
+ vybridimage = 30
123
+ tee = 31
124
+ firmware_ivt = 32
125
+ pmmc = 33
126
+ stm32image = 34
127
+ socfpgaimage_v1 = 35
128
+ mtkimage = 36
129
+ imx8mimage = 37
130
+ imx8image = 38
131
+ copro = 39
132
+ sunxi_egon = 40
133
+ SEQ_FIELDS = ["header", "data"]
134
+ def __init__(self, _io, _parent=None, _root=None):
135
+ self._io = _io
136
+ self._parent = _parent
137
+ self._root = _root if _root else self
138
+ self._debug = collections.defaultdict(dict)
139
+
140
+ def _read(self):
141
+ self._debug['header']['start'] = self._io.pos()
142
+ self.header = Uimage.Uheader(self._io, self, self._root)
143
+ self.header._read()
144
+ self._debug['header']['end'] = self._io.pos()
145
+ self._debug['data']['start'] = self._io.pos()
146
+ self.data = self._io.read_bytes(self.header.len_image)
147
+ self._debug['data']['end'] = self._io.pos()
148
+
149
+ class Uheader(KaitaiStruct):
150
+ SEQ_FIELDS = ["magic", "header_crc", "timestamp", "len_image", "load_address", "entry_address", "data_crc", "os_type", "architecture", "image_type", "compression_type", "name"]
151
+ def __init__(self, _io, _parent=None, _root=None):
152
+ self._io = _io
153
+ self._parent = _parent
154
+ self._root = _root if _root else self
155
+ self._debug = collections.defaultdict(dict)
156
+
157
+ def _read(self):
158
+ self._debug['magic']['start'] = self._io.pos()
159
+ self.magic = self._io.read_bytes(4)
160
+ self._debug['magic']['end'] = self._io.pos()
161
+ if not self.magic == b"\x27\x05\x19\x56":
162
+ raise kaitaistruct.ValidationNotEqualError(b"\x27\x05\x19\x56", self.magic, self._io, u"/types/uheader/seq/0")
163
+ self._debug['header_crc']['start'] = self._io.pos()
164
+ self.header_crc = self._io.read_u4be()
165
+ self._debug['header_crc']['end'] = self._io.pos()
166
+ self._debug['timestamp']['start'] = self._io.pos()
167
+ self.timestamp = self._io.read_u4be()
168
+ self._debug['timestamp']['end'] = self._io.pos()
169
+ self._debug['len_image']['start'] = self._io.pos()
170
+ self.len_image = self._io.read_u4be()
171
+ self._debug['len_image']['end'] = self._io.pos()
172
+ self._debug['load_address']['start'] = self._io.pos()
173
+ self.load_address = self._io.read_u4be()
174
+ self._debug['load_address']['end'] = self._io.pos()
175
+ self._debug['entry_address']['start'] = self._io.pos()
176
+ self.entry_address = self._io.read_u4be()
177
+ self._debug['entry_address']['end'] = self._io.pos()
178
+ self._debug['data_crc']['start'] = self._io.pos()
179
+ self.data_crc = self._io.read_u4be()
180
+ self._debug['data_crc']['end'] = self._io.pos()
181
+ self._debug['os_type']['start'] = self._io.pos()
182
+ self.os_type = KaitaiStream.resolve_enum(Uimage.UimageOs, self._io.read_u1())
183
+ self._debug['os_type']['end'] = self._io.pos()
184
+ self._debug['architecture']['start'] = self._io.pos()
185
+ self.architecture = KaitaiStream.resolve_enum(Uimage.UimageArch, self._io.read_u1())
186
+ self._debug['architecture']['end'] = self._io.pos()
187
+ self._debug['image_type']['start'] = self._io.pos()
188
+ self.image_type = KaitaiStream.resolve_enum(Uimage.UimageType, self._io.read_u1())
189
+ self._debug['image_type']['end'] = self._io.pos()
190
+ self._debug['compression_type']['start'] = self._io.pos()
191
+ self.compression_type = KaitaiStream.resolve_enum(Uimage.UimageComp, self._io.read_u1())
192
+ self._debug['compression_type']['end'] = self._io.pos()
193
+ self._debug['name']['start'] = self._io.pos()
194
+ self.name = (KaitaiStream.bytes_terminate(self._io.read_bytes(32), 0, False)).decode(u"UTF-8")
195
+ self._debug['name']['end'] = self._io.pos()
196
+
197
+
198
+
@@ -0,0 +1,137 @@
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
+ import collections
7
+
8
+
9
+ if parse_version(kaitaistruct.__version__) < parse_version('0.9'):
10
+ raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__))
11
+
12
+ class Utf8String(KaitaiStruct):
13
+ """UTF-8 is a popular character encoding scheme that allows to
14
+ represent strings as sequence of code points defined in Unicode
15
+ standard. Its features are:
16
+
17
+ * variable width (i.e. one code point might be represented by 1 to 4
18
+ bytes)
19
+ * backward compatiblity with ASCII
20
+ * basic validity checking (and thus distinguishing from other legacy
21
+ 8-bit encodings)
22
+ * maintaining sort order of codepoints if sorted as a byte array
23
+
24
+ WARNING: For the vast majority of practical purposes of format
25
+ definitions in Kaitai Struct, you'd likely NOT want to use this and
26
+ rather just use `type: str` with `encoding: utf-8`. That will use
27
+ native string implementations, which are most likely more efficient
28
+ and will give you native language strings, rather than an array of
29
+ individual codepoints. This format definition is provided mostly
30
+ for educational / research purposes.
31
+ """
32
+ SEQ_FIELDS = ["codepoints"]
33
+ def __init__(self, _io, _parent=None, _root=None):
34
+ self._io = _io
35
+ self._parent = _parent
36
+ self._root = _root if _root else self
37
+ self._debug = collections.defaultdict(dict)
38
+
39
+ def _read(self):
40
+ self._debug['codepoints']['start'] = self._io.pos()
41
+ self.codepoints = []
42
+ i = 0
43
+ while not self._io.is_eof():
44
+ if not 'arr' in self._debug['codepoints']:
45
+ self._debug['codepoints']['arr'] = []
46
+ self._debug['codepoints']['arr'].append({'start': self._io.pos()})
47
+ _t_codepoints = Utf8String.Utf8Codepoint(self._io.pos(), self._io, self, self._root)
48
+ _t_codepoints._read()
49
+ self.codepoints.append(_t_codepoints)
50
+ self._debug['codepoints']['arr'][len(self.codepoints) - 1]['end'] = self._io.pos()
51
+ i += 1
52
+
53
+ self._debug['codepoints']['end'] = self._io.pos()
54
+
55
+ class Utf8Codepoint(KaitaiStruct):
56
+ SEQ_FIELDS = ["bytes"]
57
+ def __init__(self, ofs, _io, _parent=None, _root=None):
58
+ self._io = _io
59
+ self._parent = _parent
60
+ self._root = _root if _root else self
61
+ self.ofs = ofs
62
+ self._debug = collections.defaultdict(dict)
63
+
64
+ def _read(self):
65
+ self._debug['bytes']['start'] = self._io.pos()
66
+ self.bytes = self._io.read_bytes(self.len_bytes)
67
+ self._debug['bytes']['end'] = self._io.pos()
68
+
69
+ @property
70
+ def raw1(self):
71
+ if hasattr(self, '_m_raw1'):
72
+ return self._m_raw1 if hasattr(self, '_m_raw1') else None
73
+
74
+ if self.len_bytes >= 2:
75
+ self._m_raw1 = (KaitaiStream.byte_array_index(self.bytes, 1) & 63)
76
+
77
+ return self._m_raw1 if hasattr(self, '_m_raw1') else None
78
+
79
+ @property
80
+ def len_bytes(self):
81
+ if hasattr(self, '_m_len_bytes'):
82
+ return self._m_len_bytes if hasattr(self, '_m_len_bytes') else None
83
+
84
+ self._m_len_bytes = (1 if (self.byte0 & 128) == 0 else (2 if (self.byte0 & 224) == 192 else (3 if (self.byte0 & 240) == 224 else (4 if (self.byte0 & 248) == 240 else -1))))
85
+ return self._m_len_bytes if hasattr(self, '_m_len_bytes') else None
86
+
87
+ @property
88
+ def raw3(self):
89
+ if hasattr(self, '_m_raw3'):
90
+ return self._m_raw3 if hasattr(self, '_m_raw3') else None
91
+
92
+ if self.len_bytes >= 4:
93
+ self._m_raw3 = (KaitaiStream.byte_array_index(self.bytes, 3) & 63)
94
+
95
+ return self._m_raw3 if hasattr(self, '_m_raw3') else None
96
+
97
+ @property
98
+ def value_as_int(self):
99
+ if hasattr(self, '_m_value_as_int'):
100
+ return self._m_value_as_int if hasattr(self, '_m_value_as_int') else None
101
+
102
+ self._m_value_as_int = (self.raw0 if self.len_bytes == 1 else (((self.raw0 << 6) | self.raw1) if self.len_bytes == 2 else ((((self.raw0 << 12) | (self.raw1 << 6)) | self.raw2) if self.len_bytes == 3 else (((((self.raw0 << 18) | (self.raw1 << 12)) | (self.raw2 << 6)) | self.raw3) if self.len_bytes == 4 else -1))))
103
+ return self._m_value_as_int if hasattr(self, '_m_value_as_int') else None
104
+
105
+ @property
106
+ def raw0(self):
107
+ if hasattr(self, '_m_raw0'):
108
+ return self._m_raw0 if hasattr(self, '_m_raw0') else None
109
+
110
+ self._m_raw0 = (KaitaiStream.byte_array_index(self.bytes, 0) & (127 if self.len_bytes == 1 else (31 if self.len_bytes == 2 else (15 if self.len_bytes == 3 else (7 if self.len_bytes == 4 else 0)))))
111
+ return self._m_raw0 if hasattr(self, '_m_raw0') else None
112
+
113
+ @property
114
+ def byte0(self):
115
+ if hasattr(self, '_m_byte0'):
116
+ return self._m_byte0 if hasattr(self, '_m_byte0') else None
117
+
118
+ _pos = self._io.pos()
119
+ self._io.seek(self.ofs)
120
+ self._debug['_m_byte0']['start'] = self._io.pos()
121
+ self._m_byte0 = self._io.read_u1()
122
+ self._debug['_m_byte0']['end'] = self._io.pos()
123
+ self._io.seek(_pos)
124
+ return self._m_byte0 if hasattr(self, '_m_byte0') else None
125
+
126
+ @property
127
+ def raw2(self):
128
+ if hasattr(self, '_m_raw2'):
129
+ return self._m_raw2 if hasattr(self, '_m_raw2') else None
130
+
131
+ if self.len_bytes >= 3:
132
+ self._m_raw2 = (KaitaiStream.byte_array_index(self.bytes, 2) & 63)
133
+
134
+ return self._m_raw2 if hasattr(self, '_m_raw2') else None
135
+
136
+
137
+