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.
- polyfile/__init__.py +15 -0
- polyfile/__main__.py +394 -0
- polyfile/arithmetic.py +27 -0
- polyfile/ast.py +114 -0
- polyfile/debugger.py +1039 -0
- polyfile/expressions.py +346 -0
- polyfile/fileutils.py +343 -0
- polyfile/html.py +135 -0
- polyfile/http/__init__.py +1 -0
- polyfile/http/defacto.py +37 -0
- polyfile/http/deprecated.py +51 -0
- polyfile/http/experimental.py +67 -0
- polyfile/http/http_11.py +548 -0
- polyfile/http/matcher.py +37 -0
- polyfile/http/structured_headers.py +48 -0
- polyfile/iterators.py +72 -0
- polyfile/jpeg.py +24 -0
- polyfile/kaitai/__init__.py +0 -0
- polyfile/kaitai/compiler.py +156 -0
- polyfile/kaitai/parser.py +312 -0
- polyfile/kaitai/parsers/__init__.py +0 -0
- polyfile/kaitai/parsers/aix_utmp.py +116 -0
- polyfile/kaitai/parsers/allegro_dat.py +367 -0
- polyfile/kaitai/parsers/andes_firmware.py +64 -0
- polyfile/kaitai/parsers/android_bootldr_asus.py +105 -0
- polyfile/kaitai/parsers/android_bootldr_huawei.py +181 -0
- polyfile/kaitai/parsers/android_bootldr_qcom.py +217 -0
- polyfile/kaitai/parsers/android_dto.py +138 -0
- polyfile/kaitai/parsers/android_img.py +319 -0
- polyfile/kaitai/parsers/android_nanoapp_header.py +83 -0
- polyfile/kaitai/parsers/android_opengl_shaders_cache.py +151 -0
- polyfile/kaitai/parsers/android_sparse.py +237 -0
- polyfile/kaitai/parsers/android_super.py +401 -0
- polyfile/kaitai/parsers/apm_partition_table.py +196 -0
- polyfile/kaitai/parsers/apple_single_double.py +180 -0
- polyfile/kaitai/parsers/asn1_der.py +235 -0
- polyfile/kaitai/parsers/au.py +138 -0
- polyfile/kaitai/parsers/avantes_roh60.py +112 -0
- polyfile/kaitai/parsers/avi.py +296 -0
- polyfile/kaitai/parsers/bcd.py +111 -0
- polyfile/kaitai/parsers/bitcoin_transaction.py +210 -0
- polyfile/kaitai/parsers/blender_blend.py +334 -0
- polyfile/kaitai/parsers/bmp.py +780 -0
- polyfile/kaitai/parsers/bson.py +411 -0
- polyfile/kaitai/parsers/btrfs_stream.py +318 -0
- polyfile/kaitai/parsers/bytes_with_io.py +27 -0
- polyfile/kaitai/parsers/chrome_pak.py +194 -0
- polyfile/kaitai/parsers/code_6502.py +456 -0
- polyfile/kaitai/parsers/compressed_resource.py +217 -0
- polyfile/kaitai/parsers/cpio_old_le.py +154 -0
- polyfile/kaitai/parsers/cramfs.py +344 -0
- polyfile/kaitai/parsers/creative_voice_file.py +342 -0
- polyfile/kaitai/parsers/dbf.py +274 -0
- polyfile/kaitai/parsers/dcmp_0.py +664 -0
- polyfile/kaitai/parsers/dcmp_1.py +422 -0
- polyfile/kaitai/parsers/dcmp_2.py +312 -0
- polyfile/kaitai/parsers/dcmp_variable_length_integer.py +66 -0
- polyfile/kaitai/parsers/dex.py +1086 -0
- polyfile/kaitai/parsers/dicom.py +4370 -0
- polyfile/kaitai/parsers/dime_message.py +201 -0
- polyfile/kaitai/parsers/dns_packet.py +569 -0
- polyfile/kaitai/parsers/doom_wad.py +654 -0
- polyfile/kaitai/parsers/dos_datetime.py +191 -0
- polyfile/kaitai/parsers/dos_mz.py +172 -0
- polyfile/kaitai/parsers/ds_store.py +513 -0
- polyfile/kaitai/parsers/dtb.py +310 -0
- polyfile/kaitai/parsers/dune_2_pak.py +126 -0
- polyfile/kaitai/parsers/edid.py +472 -0
- polyfile/kaitai/parsers/efivar_signature_list.py +331 -0
- polyfile/kaitai/parsers/elf.py +2482 -0
- polyfile/kaitai/parsers/ethernet_frame.py +114 -0
- polyfile/kaitai/parsers/exif.py +723 -0
- polyfile/kaitai/parsers/ext2.py +537 -0
- polyfile/kaitai/parsers/fallout2_dat.py +187 -0
- polyfile/kaitai/parsers/fallout_dat.py +156 -0
- polyfile/kaitai/parsers/fasttracker_xm_module.py +558 -0
- polyfile/kaitai/parsers/ftl_dat.py +90 -0
- polyfile/kaitai/parsers/genmidi_op2.py +161 -0
- polyfile/kaitai/parsers/gettext_mo.py +541 -0
- polyfile/kaitai/parsers/gif.py +492 -0
- polyfile/kaitai/parsers/gimp_brush.py +244 -0
- polyfile/kaitai/parsers/glibc_utmp.py +114 -0
- polyfile/kaitai/parsers/gltf_binary.py +132 -0
- polyfile/kaitai/parsers/google_protobuf.py +151 -0
- polyfile/kaitai/parsers/gpt_partition_table.py +175 -0
- polyfile/kaitai/parsers/gran_turismo_vol.py +140 -0
- polyfile/kaitai/parsers/grub2_font.py +337 -0
- polyfile/kaitai/parsers/gzip.py +232 -0
- polyfile/kaitai/parsers/hashcat_restore.py +60 -0
- polyfile/kaitai/parsers/hccap.py +111 -0
- polyfile/kaitai/parsers/hccapx.py +103 -0
- polyfile/kaitai/parsers/heaps_pak.py +177 -0
- polyfile/kaitai/parsers/heroes_of_might_and_magic_agg.py +116 -0
- polyfile/kaitai/parsers/heroes_of_might_and_magic_bmp.py +34 -0
- polyfile/kaitai/parsers/icmp_packet.py +136 -0
- polyfile/kaitai/parsers/ico.py +129 -0
- polyfile/kaitai/parsers/id3v1_1.py +220 -0
- polyfile/kaitai/parsers/id3v2_3.py +324 -0
- polyfile/kaitai/parsers/id3v2_4.py +423 -0
- polyfile/kaitai/parsers/ines.py +282 -0
- polyfile/kaitai/parsers/ipv4_packet.py +158 -0
- polyfile/kaitai/parsers/ipv6_packet.py +55 -0
- polyfile/kaitai/parsers/iso9660.py +544 -0
- polyfile/kaitai/parsers/java_class.py +1113 -0
- polyfile/kaitai/parsers/jpeg.py +361 -0
- polyfile/kaitai/parsers/luks.py +149 -0
- polyfile/kaitai/parsers/lzh.py +165 -0
- polyfile/kaitai/parsers/mac_os_resource_snd.py +493 -0
- polyfile/kaitai/parsers/mach_o.py +3033 -0
- polyfile/kaitai/parsers/mach_o_fat.py +92 -0
- polyfile/kaitai/parsers/magicavoxel_vox.py +391 -0
- polyfile/kaitai/parsers/manifest.json +1 -0
- polyfile/kaitai/parsers/mbr_partition_table.py +119 -0
- polyfile/kaitai/parsers/mcap.py +1015 -0
- polyfile/kaitai/parsers/microsoft_cfb.py +293 -0
- polyfile/kaitai/parsers/microsoft_network_monitor_v2.py +309 -0
- polyfile/kaitai/parsers/microsoft_pe.py +765 -0
- polyfile/kaitai/parsers/mifare_classic.py +706 -0
- polyfile/kaitai/parsers/minecraft_nbt.py +449 -0
- polyfile/kaitai/parsers/monomakh_sapr_chg.py +69 -0
- polyfile/kaitai/parsers/mozilla_mar.py +239 -0
- polyfile/kaitai/parsers/mp4.py +333 -0
- polyfile/kaitai/parsers/msgpack.py +467 -0
- polyfile/kaitai/parsers/nitf.py +1189 -0
- polyfile/kaitai/parsers/nt_mdt_pal.py +155 -0
- polyfile/kaitai/parsers/ogg.py +118 -0
- polyfile/kaitai/parsers/openpgp_message.py +993 -0
- polyfile/kaitai/parsers/packet_ppi.py +515 -0
- polyfile/kaitai/parsers/pcap.py +344 -0
- polyfile/kaitai/parsers/pcf_font.py +506 -0
- polyfile/kaitai/parsers/pcx.py +195 -0
- polyfile/kaitai/parsers/pcx_dcx.py +79 -0
- polyfile/kaitai/parsers/phar_without_stub.py +399 -0
- polyfile/kaitai/parsers/php_serialized_value.py +505 -0
- polyfile/kaitai/parsers/png.py +721 -0
- polyfile/kaitai/parsers/protocol_body.py +260 -0
- polyfile/kaitai/parsers/psx_tim.py +104 -0
- polyfile/kaitai/parsers/python_pickle.py +718 -0
- polyfile/kaitai/parsers/python_pyc_27.py +510 -0
- polyfile/kaitai/parsers/quake_mdl.py +441 -0
- polyfile/kaitai/parsers/quake_pak.py +112 -0
- polyfile/kaitai/parsers/quicktime_mov.py +634 -0
- polyfile/kaitai/parsers/rar.py +265 -0
- polyfile/kaitai/parsers/regf.py +569 -0
- polyfile/kaitai/parsers/renderware_binary_stream.py +877 -0
- polyfile/kaitai/parsers/resource_fork.py +611 -0
- polyfile/kaitai/parsers/respack.py +57 -0
- polyfile/kaitai/parsers/riff.py +409 -0
- polyfile/kaitai/parsers/rpm.py +964 -0
- polyfile/kaitai/parsers/rtcp_payload.py +579 -0
- polyfile/kaitai/parsers/rtp_packet.py +150 -0
- polyfile/kaitai/parsers/rtpdump.py +115 -0
- polyfile/kaitai/parsers/ruby_marshal.py +423 -0
- polyfile/kaitai/parsers/s3m.py +493 -0
- polyfile/kaitai/parsers/saints_row_2_vpp_pc.py +254 -0
- polyfile/kaitai/parsers/shapefile_index.py +174 -0
- polyfile/kaitai/parsers/shapefile_main.py +893 -0
- polyfile/kaitai/parsers/some_ip.py +209 -0
- polyfile/kaitai/parsers/some_ip_container.py +37 -0
- polyfile/kaitai/parsers/some_ip_sd.py +86 -0
- polyfile/kaitai/parsers/some_ip_sd_entries.py +160 -0
- polyfile/kaitai/parsers/some_ip_sd_options.py +374 -0
- polyfile/kaitai/parsers/specpr.py +404 -0
- polyfile/kaitai/parsers/sqlite3.py +472 -0
- polyfile/kaitai/parsers/ssh_public_key.py +252 -0
- polyfile/kaitai/parsers/standard_midi_file.py +390 -0
- polyfile/kaitai/parsers/stl.py +111 -0
- polyfile/kaitai/parsers/sudoers_ts.py +201 -0
- polyfile/kaitai/parsers/swf.py +406 -0
- polyfile/kaitai/parsers/systemd_journal.py +361 -0
- polyfile/kaitai/parsers/tcp_segment.py +57 -0
- polyfile/kaitai/parsers/tga.py +213 -0
- polyfile/kaitai/parsers/tls_client_hello.py +293 -0
- polyfile/kaitai/parsers/tr_dos_image.py +322 -0
- polyfile/kaitai/parsers/tsm.py +198 -0
- polyfile/kaitai/parsers/ttf.py +1847 -0
- polyfile/kaitai/parsers/udp_datagram.py +42 -0
- polyfile/kaitai/parsers/uefi_te.py +236 -0
- polyfile/kaitai/parsers/uimage.py +198 -0
- polyfile/kaitai/parsers/utf8_string.py +137 -0
- polyfile/kaitai/parsers/vfat.py +410 -0
- polyfile/kaitai/parsers/vlq_base128_be.py +104 -0
- polyfile/kaitai/parsers/vlq_base128_le.py +129 -0
- polyfile/kaitai/parsers/vmware_vmdk.py +167 -0
- polyfile/kaitai/parsers/vp8_ivf.py +112 -0
- polyfile/kaitai/parsers/warcraft_2_pud.py +423 -0
- polyfile/kaitai/parsers/wav.py +1014 -0
- polyfile/kaitai/parsers/websocket.py +167 -0
- polyfile/kaitai/parsers/windows_evt_log.py +304 -0
- polyfile/kaitai/parsers/windows_lnk_file.py +467 -0
- polyfile/kaitai/parsers/windows_minidump.py +575 -0
- polyfile/kaitai/parsers/windows_resource_file.py +243 -0
- polyfile/kaitai/parsers/windows_shell_items.py +190 -0
- polyfile/kaitai/parsers/windows_systemtime.py +52 -0
- polyfile/kaitai/parsers/wmf.py +502 -0
- polyfile/kaitai/parsers/xar.py +181 -0
- polyfile/kaitai/parsers/xwd.py +189 -0
- polyfile/kaitai/parsers/zip.py +685 -0
- polyfile/kaitai/parsers/zisofs.py +158 -0
- polyfile/kaitai/parsers/zx_spectrum_tap.py +184 -0
- polyfile/kaitaimatcher.py +113 -0
- polyfile/languagematcher.py +217 -0
- polyfile/logger.py +135 -0
- polyfile/magic.py +2983 -0
- polyfile/magic_defs/COPYING +29 -0
- polyfile/magic_defs/__init__.py +0 -0
- polyfile/magic_defs/acorn +102 -0
- polyfile/magic_defs/adi +13 -0
- polyfile/magic_defs/adventure +122 -0
- polyfile/magic_defs/aes +29 -0
- polyfile/magic_defs/algol68 +35 -0
- polyfile/magic_defs/allegro +9 -0
- polyfile/magic_defs/alliant +18 -0
- polyfile/magic_defs/alpha +32 -0
- polyfile/magic_defs/amanda +12 -0
- polyfile/magic_defs/amigaos +218 -0
- polyfile/magic_defs/android +259 -0
- polyfile/magic_defs/animation +1197 -0
- polyfile/magic_defs/aout +46 -0
- polyfile/magic_defs/apache +28 -0
- polyfile/magic_defs/apl +7 -0
- polyfile/magic_defs/apple +773 -0
- polyfile/magic_defs/application +7 -0
- polyfile/magic_defs/applix +13 -0
- polyfile/magic_defs/apt +52 -0
- polyfile/magic_defs/archive +2586 -0
- polyfile/magic_defs/aria +38 -0
- polyfile/magic_defs/arm +50 -0
- polyfile/magic_defs/asf +132 -0
- polyfile/magic_defs/assembler +18 -0
- polyfile/magic_defs/asterix +18 -0
- polyfile/magic_defs/att3b +41 -0
- polyfile/magic_defs/audio +1291 -0
- polyfile/magic_defs/avm +33 -0
- polyfile/magic_defs/basis +18 -0
- polyfile/magic_defs/beetle +7 -0
- polyfile/magic_defs/ber +65 -0
- polyfile/magic_defs/bflt +14 -0
- polyfile/magic_defs/bhl +10 -0
- polyfile/magic_defs/bioinformatics +178 -0
- polyfile/magic_defs/biosig +154 -0
- polyfile/magic_defs/blackberry +8 -0
- polyfile/magic_defs/blcr +25 -0
- polyfile/magic_defs/blender +50 -0
- polyfile/magic_defs/blit +24 -0
- polyfile/magic_defs/bm +10 -0
- polyfile/magic_defs/bout +11 -0
- polyfile/magic_defs/bsdi +33 -0
- polyfile/magic_defs/bsi +10 -0
- polyfile/magic_defs/btsnoop +13 -0
- polyfile/magic_defs/burp +7 -0
- polyfile/magic_defs/bytecode +41 -0
- polyfile/magic_defs/c-lang +110 -0
- polyfile/magic_defs/c64 +531 -0
- polyfile/magic_defs/cad +437 -0
- polyfile/magic_defs/cafebabe +107 -0
- polyfile/magic_defs/cbor +21 -0
- polyfile/magic_defs/ccf +14 -0
- polyfile/magic_defs/cddb +12 -0
- polyfile/magic_defs/chord +15 -0
- polyfile/magic_defs/cisco +12 -0
- polyfile/magic_defs/citrus +12 -0
- polyfile/magic_defs/clarion +27 -0
- polyfile/magic_defs/claris +48 -0
- polyfile/magic_defs/clipper +65 -0
- polyfile/magic_defs/clojure +30 -0
- polyfile/magic_defs/coff +98 -0
- polyfile/magic_defs/commands +201 -0
- polyfile/magic_defs/communications +22 -0
- polyfile/magic_defs/compress +461 -0
- polyfile/magic_defs/console +1213 -0
- polyfile/magic_defs/convex +69 -0
- polyfile/magic_defs/coverage +91 -0
- polyfile/magic_defs/cracklib +14 -0
- polyfile/magic_defs/crypto +31 -0
- polyfile/magic_defs/csv +8 -0
- polyfile/magic_defs/ctags +6 -0
- polyfile/magic_defs/ctf +23 -0
- polyfile/magic_defs/cubemap +8 -0
- polyfile/magic_defs/cups +56 -0
- polyfile/magic_defs/dact +11 -0
- polyfile/magic_defs/database +886 -0
- polyfile/magic_defs/dataone +47 -0
- polyfile/magic_defs/dbpf +15 -0
- polyfile/magic_defs/der +146 -0
- polyfile/magic_defs/diamond +12 -0
- polyfile/magic_defs/dif +33 -0
- polyfile/magic_defs/diff +41 -0
- polyfile/magic_defs/digital +59 -0
- polyfile/magic_defs/dolby +69 -0
- polyfile/magic_defs/dsf +25 -0
- polyfile/magic_defs/dump +96 -0
- polyfile/magic_defs/dwarfs +45 -0
- polyfile/magic_defs/dyadic +61 -0
- polyfile/magic_defs/ebml +8 -0
- polyfile/magic_defs/edid +11 -0
- polyfile/magic_defs/editors +43 -0
- polyfile/magic_defs/efi +15 -0
- polyfile/magic_defs/elf +379 -0
- polyfile/magic_defs/encore +22 -0
- polyfile/magic_defs/epoc +62 -0
- polyfile/magic_defs/erlang +21 -0
- polyfile/magic_defs/espressif +57 -0
- polyfile/magic_defs/esri +28 -0
- polyfile/magic_defs/etf +33 -0
- polyfile/magic_defs/fcs +9 -0
- polyfile/magic_defs/filesystems +2694 -0
- polyfile/magic_defs/finger +16 -0
- polyfile/magic_defs/firmware +133 -0
- polyfile/magic_defs/flash +62 -0
- polyfile/magic_defs/flif +36 -0
- polyfile/magic_defs/fonts +449 -0
- polyfile/magic_defs/forth +82 -0
- polyfile/magic_defs/fortran +9 -0
- polyfile/magic_defs/frame +62 -0
- polyfile/magic_defs/freebsd +164 -0
- polyfile/magic_defs/fsav +128 -0
- polyfile/magic_defs/fusecompress +12 -0
- polyfile/magic_defs/games +696 -0
- polyfile/magic_defs/gcc +17 -0
- polyfile/magic_defs/gconv +10 -0
- polyfile/magic_defs/gentoo +85 -0
- polyfile/magic_defs/geo +166 -0
- polyfile/magic_defs/geos +20 -0
- polyfile/magic_defs/gimp +77 -0
- polyfile/magic_defs/git +13 -0
- polyfile/magic_defs/glibc +21 -0
- polyfile/magic_defs/gnome +59 -0
- polyfile/magic_defs/gnu +173 -0
- polyfile/magic_defs/gnumeric +8 -0
- polyfile/magic_defs/gpt +240 -0
- polyfile/magic_defs/gpu +28 -0
- polyfile/magic_defs/grace +21 -0
- polyfile/magic_defs/graphviz +12 -0
- polyfile/magic_defs/gringotts +48 -0
- polyfile/magic_defs/guile +13 -0
- polyfile/magic_defs/hardware +12 -0
- polyfile/magic_defs/hitachi-sh +30 -0
- polyfile/magic_defs/hp +433 -0
- polyfile/magic_defs/human68k +26 -0
- polyfile/magic_defs/ibm370 +52 -0
- polyfile/magic_defs/ibm6000 +35 -0
- polyfile/magic_defs/icc +214 -0
- polyfile/magic_defs/iff +80 -0
- polyfile/magic_defs/images +4210 -0
- polyfile/magic_defs/inform +9 -0
- polyfile/magic_defs/intel +310 -0
- polyfile/magic_defs/interleaf +9 -0
- polyfile/magic_defs/island +10 -0
- polyfile/magic_defs/ispell +63 -0
- polyfile/magic_defs/isz +15 -0
- polyfile/magic_defs/java +52 -0
- polyfile/magic_defs/javascript +171 -0
- polyfile/magic_defs/jpeg +252 -0
- polyfile/magic_defs/json +8 -0
- polyfile/magic_defs/karma +9 -0
- polyfile/magic_defs/kde +11 -0
- polyfile/magic_defs/keepass +20 -0
- polyfile/magic_defs/kerberos +45 -0
- polyfile/magic_defs/kicad +85 -0
- polyfile/magic_defs/kml +34 -0
- polyfile/magic_defs/lammps +64 -0
- polyfile/magic_defs/lecter +6 -0
- polyfile/magic_defs/lex +12 -0
- polyfile/magic_defs/lif +50 -0
- polyfile/magic_defs/linux +557 -0
- polyfile/magic_defs/lisp +78 -0
- polyfile/magic_defs/llvm +22 -0
- polyfile/magic_defs/locoscript +12 -0
- polyfile/magic_defs/lua +31 -0
- polyfile/magic_defs/luks +126 -0
- polyfile/magic_defs/m4 +11 -0
- polyfile/magic_defs/mach +303 -0
- polyfile/magic_defs/macintosh +505 -0
- polyfile/magic_defs/macos +7 -0
- polyfile/magic_defs/magic +10 -0
- polyfile/magic_defs/magic.mgc +0 -0
- polyfile/magic_defs/mail.news +132 -0
- polyfile/magic_defs/make +21 -0
- polyfile/magic_defs/map +413 -0
- polyfile/magic_defs/maple +109 -0
- polyfile/magic_defs/marc21 +30 -0
- polyfile/magic_defs/mathcad +8 -0
- polyfile/magic_defs/mathematica +188 -0
- polyfile/magic_defs/matroska +17 -0
- polyfile/magic_defs/mcrypt +52 -0
- polyfile/magic_defs/measure +44 -0
- polyfile/magic_defs/mercurial +13 -0
- polyfile/magic_defs/metastore +8 -0
- polyfile/magic_defs/meteorological +53 -0
- polyfile/magic_defs/microfocus +21 -0
- polyfile/magic_defs/mime +9 -0
- polyfile/magic_defs/mips +120 -0
- polyfile/magic_defs/mirage +8 -0
- polyfile/magic_defs/misctools +140 -0
- polyfile/magic_defs/mkid +11 -0
- polyfile/magic_defs/mlssa +8 -0
- polyfile/magic_defs/mmdf +6 -0
- polyfile/magic_defs/modem +92 -0
- polyfile/magic_defs/modulefile +9 -0
- polyfile/magic_defs/motorola +71 -0
- polyfile/magic_defs/mozilla +37 -0
- polyfile/magic_defs/msdos +2304 -0
- polyfile/magic_defs/msooxml +68 -0
- polyfile/magic_defs/msvc +222 -0
- polyfile/magic_defs/msx +309 -0
- polyfile/magic_defs/mup +24 -0
- polyfile/magic_defs/music +17 -0
- polyfile/magic_defs/nasa +7 -0
- polyfile/magic_defs/natinst +24 -0
- polyfile/magic_defs/ncr +49 -0
- polyfile/magic_defs/neko +12 -0
- polyfile/magic_defs/netbsd +251 -0
- polyfile/magic_defs/netscape +26 -0
- polyfile/magic_defs/netware +11 -0
- polyfile/magic_defs/news +13 -0
- polyfile/magic_defs/nifty +202 -0
- polyfile/magic_defs/nim-lang +29 -0
- polyfile/magic_defs/nitpicker +14 -0
- polyfile/magic_defs/numpy +9 -0
- polyfile/magic_defs/oasis +12 -0
- polyfile/magic_defs/ocaml +14 -0
- polyfile/magic_defs/octave +6 -0
- polyfile/magic_defs/ole2compounddocs +760 -0
- polyfile/magic_defs/olf +98 -0
- polyfile/magic_defs/openfst +17 -0
- polyfile/magic_defs/opentimestamps +16 -0
- polyfile/magic_defs/oric +16 -0
- polyfile/magic_defs/os2 +186 -0
- polyfile/magic_defs/os400 +39 -0
- polyfile/magic_defs/os9 +80 -0
- polyfile/magic_defs/osf1 +10 -0
- polyfile/magic_defs/palm +156 -0
- polyfile/magic_defs/parix +13 -0
- polyfile/magic_defs/parrot +22 -0
- polyfile/magic_defs/pascal +39 -0
- polyfile/magic_defs/pbf +11 -0
- polyfile/magic_defs/pbm +8 -0
- polyfile/magic_defs/pc88 +24 -0
- polyfile/magic_defs/pc98 +77 -0
- polyfile/magic_defs/pci_ids +116 -0
- polyfile/magic_defs/pcjr +8 -0
- polyfile/magic_defs/pdf +51 -0
- polyfile/magic_defs/pdp +42 -0
- polyfile/magic_defs/perl +100 -0
- polyfile/magic_defs/pgf +52 -0
- polyfile/magic_defs/pgp +581 -0
- polyfile/magic_defs/pgp-binary-keys +388 -0
- polyfile/magic_defs/pkgadd +7 -0
- polyfile/magic_defs/plan9 +25 -0
- polyfile/magic_defs/playdate +57 -0
- polyfile/magic_defs/plus5 +18 -0
- polyfile/magic_defs/pmem +46 -0
- polyfile/magic_defs/polyfile_zip +5 -0
- polyfile/magic_defs/polyml +23 -0
- polyfile/magic_defs/printer +269 -0
- polyfile/magic_defs/project +10 -0
- polyfile/magic_defs/psdbms +14 -0
- polyfile/magic_defs/psl +14 -0
- polyfile/magic_defs/pulsar +13 -0
- polyfile/magic_defs/puzzle +17 -0
- polyfile/magic_defs/pwsafe +14 -0
- polyfile/magic_defs/pyramid +12 -0
- polyfile/magic_defs/python +305 -0
- polyfile/magic_defs/qt +30 -0
- polyfile/magic_defs/revision +66 -0
- polyfile/magic_defs/riff +840 -0
- polyfile/magic_defs/rinex +44 -0
- polyfile/magic_defs/ringdove +45 -0
- polyfile/magic_defs/rpi +52 -0
- polyfile/magic_defs/rpm +45 -0
- polyfile/magic_defs/rpmsg +7 -0
- polyfile/magic_defs/rst +11 -0
- polyfile/magic_defs/rtf +94 -0
- polyfile/magic_defs/ruby +55 -0
- polyfile/magic_defs/rust +21 -0
- polyfile/magic_defs/sc +7 -0
- polyfile/magic_defs/sccs +24 -0
- polyfile/magic_defs/scientific +144 -0
- polyfile/magic_defs/securitycerts +6 -0
- polyfile/magic_defs/selinux +24 -0
- polyfile/magic_defs/sendmail +37 -0
- polyfile/magic_defs/sequent +42 -0
- polyfile/magic_defs/sereal +35 -0
- polyfile/magic_defs/sgi +144 -0
- polyfile/magic_defs/sgml +161 -0
- polyfile/magic_defs/sharc +23 -0
- polyfile/magic_defs/sinclair +40 -0
- polyfile/magic_defs/sisu +18 -0
- polyfile/magic_defs/sketch +6 -0
- polyfile/magic_defs/smalltalk +25 -0
- polyfile/magic_defs/smile +34 -0
- polyfile/magic_defs/sniffer +482 -0
- polyfile/magic_defs/softquad +40 -0
- polyfile/magic_defs/sosi +40 -0
- polyfile/magic_defs/spec +21 -0
- polyfile/magic_defs/spectrum +184 -0
- polyfile/magic_defs/sql +288 -0
- polyfile/magic_defs/ssh +39 -0
- polyfile/magic_defs/ssl +20 -0
- polyfile/magic_defs/statistics +45 -0
- polyfile/magic_defs/subtitle +38 -0
- polyfile/magic_defs/sun +141 -0
- polyfile/magic_defs/svf +5 -0
- polyfile/magic_defs/sylk +36 -0
- polyfile/magic_defs/symbos +42 -0
- polyfile/magic_defs/sysex +429 -0
- polyfile/magic_defs/tcl +29 -0
- polyfile/magic_defs/teapot +6 -0
- polyfile/magic_defs/terminfo +63 -0
- polyfile/magic_defs/tex +141 -0
- polyfile/magic_defs/tgif +7 -0
- polyfile/magic_defs/ti-8x +239 -0
- polyfile/magic_defs/timezone +42 -0
- polyfile/magic_defs/tplink +95 -0
- polyfile/magic_defs/troff +38 -0
- polyfile/magic_defs/tuxedo +8 -0
- polyfile/magic_defs/typeset +8 -0
- polyfile/magic_defs/uf2 +72 -0
- polyfile/magic_defs/unicode +15 -0
- polyfile/magic_defs/unisig +12 -0
- polyfile/magic_defs/unknown +34 -0
- polyfile/magic_defs/usd +21 -0
- polyfile/magic_defs/uterus +16 -0
- polyfile/magic_defs/uuencode +28 -0
- polyfile/magic_defs/vacuum-cleaner +54 -0
- polyfile/magic_defs/varied.out +46 -0
- polyfile/magic_defs/varied.script +21 -0
- polyfile/magic_defs/vax +32 -0
- polyfile/magic_defs/vicar +17 -0
- polyfile/magic_defs/virtual +307 -0
- polyfile/magic_defs/virtutech +12 -0
- polyfile/magic_defs/visx +32 -0
- polyfile/magic_defs/vms +30 -0
- polyfile/magic_defs/vmware +6 -0
- polyfile/magic_defs/vorbis +155 -0
- polyfile/magic_defs/vxl +14 -0
- polyfile/magic_defs/warc +16 -0
- polyfile/magic_defs/weak +16 -0
- polyfile/magic_defs/web +18 -0
- polyfile/magic_defs/webassembly +17 -0
- polyfile/magic_defs/windows +1811 -0
- polyfile/magic_defs/wireless +7 -0
- polyfile/magic_defs/wordprocessors +630 -0
- polyfile/magic_defs/wsdl +23 -0
- polyfile/magic_defs/x68000 +25 -0
- polyfile/magic_defs/xdelta +13 -0
- polyfile/magic_defs/xenix +106 -0
- polyfile/magic_defs/xilinx +58 -0
- polyfile/magic_defs/xo65 +37 -0
- polyfile/magic_defs/xwindows +43 -0
- polyfile/magic_defs/yara +17 -0
- polyfile/magic_defs/zfs +96 -0
- polyfile/magic_defs/zilog +12 -0
- polyfile/magic_defs/zip +126 -0
- polyfile/magic_defs/zyxel +17 -0
- polyfile/nes.py +144 -0
- polyfile/nitf.py +15 -0
- polyfile/pdf.py +1264 -0
- polyfile/pickles.py +45 -0
- polyfile/polyfile.py +409 -0
- polyfile/profiling.py +115 -0
- polyfile/repl.py +624 -0
- polyfile/search.py +310 -0
- polyfile/serialization.py +323 -0
- polyfile/structmatcher.py +46 -0
- polyfile/structs.py +281 -0
- polyfile/templates/download.js +162 -0
- polyfile/templates/hexdump.css +268 -0
- polyfile/templates/hexdump.js +756 -0
- polyfile/templates/jquery-3.4.1.min.js +2 -0
- polyfile/templates/template.html +119 -0
- polyfile/wildcards.py +62 -0
- polyfile/zipmatcher.py +183 -0
- polyfile_weave-0.5.5.dist-info/METADATA +173 -0
- polyfile_weave-0.5.5.dist-info/RECORD +585 -0
- polyfile_weave-0.5.5.dist-info/WHEEL +5 -0
- polyfile_weave-0.5.5.dist-info/entry_points.txt +2 -0
- polyfile_weave-0.5.5.dist-info/licenses/LICENSE +202 -0
- polyfile_weave-0.5.5.dist-info/top_level.txt +2 -0
- polymerge/__init__.py +1 -0
- polymerge/__main__.py +296 -0
- polymerge/cfg.py +127 -0
- polymerge/polymerge.py +227 -0
- polymerge/polytracker.py +190 -0
|
@@ -0,0 +1,611 @@
|
|
|
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
|
+
from polyfile.kaitai.parsers import bytes_with_io
|
|
13
|
+
class ResourceFork(KaitaiStruct):
|
|
14
|
+
"""The data format of Macintosh resource forks,
|
|
15
|
+
used on Classic Mac OS and Mac OS X/macOS to store additional structured data along with a file's main data (the data fork).
|
|
16
|
+
The kinds of data stored in resource forks include:
|
|
17
|
+
|
|
18
|
+
* Document resources:
|
|
19
|
+
images, sounds, etc. used by a document
|
|
20
|
+
* Application resources:
|
|
21
|
+
graphics, GUI layouts, localizable strings,
|
|
22
|
+
and even code used by an application, a library, or system files
|
|
23
|
+
* Common metadata:
|
|
24
|
+
custom icons and version metadata that could be displayed by the Finder
|
|
25
|
+
* Application-specific metadata:
|
|
26
|
+
because resource forks follow a common format,
|
|
27
|
+
other applications can store new metadata in them,
|
|
28
|
+
even if the original application does not recognize or understand it
|
|
29
|
+
|
|
30
|
+
Macintosh file systems (MFS, HFS, HFS+, APFS) support resource forks natively,
|
|
31
|
+
which allows storing resources along with any file.
|
|
32
|
+
Non-Macintosh file systems and protocols have little or no support for resource forks,
|
|
33
|
+
so the resource fork data must be stored in some other way when using such file systems or protocols.
|
|
34
|
+
Various file formats and tools exist for this purpose,
|
|
35
|
+
such as BinHex, MacBinary, AppleSingle, AppleDouble, or QuickTime RezWack.
|
|
36
|
+
In some cases,
|
|
37
|
+
resource forks are stored as plain data in separate files with a .rsrc extension,
|
|
38
|
+
even on Mac systems that natively support resource forks.
|
|
39
|
+
|
|
40
|
+
On modern Mac OS X/macOS systems,
|
|
41
|
+
resource forks are used far less commonly than on classic Mac OS systems,
|
|
42
|
+
because of compatibility issues with other systems and historical limitations in the format.
|
|
43
|
+
Modern macOS APIs and libraries do not use resource forks,
|
|
44
|
+
and the legacy Carbon API that still used them has been deprecated since OS X 10.8.
|
|
45
|
+
Despite this,
|
|
46
|
+
even current macOS systems still use resource forks for certain purposes,
|
|
47
|
+
such as custom file icons.
|
|
48
|
+
|
|
49
|
+
.. seealso::
|
|
50
|
+
Inside Macintosh, More Macintosh Toolbox, Resource Manager, Resource Manager Reference, Resource File Format - https://developer.apple.com/library/archive/documentation/mac/pdf/MoreMacintoshToolbox.pdf#page=151
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
.. seealso::
|
|
54
|
+
Inside Macintosh, Volume I, The Resource Manager, Format of a Resource File - https://www.pagetable.com/?p=50
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
.. seealso::
|
|
58
|
+
Source - https://github.com/kreativekorp/ksfl/wiki/Macintosh-Resource-File-Format
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
.. seealso::
|
|
62
|
+
Source - https://github.com/dgelessus/mac_file_format_docs/blob/master/README.md#resource-forks
|
|
63
|
+
"""
|
|
64
|
+
SEQ_FIELDS = ["header", "system_data", "application_data"]
|
|
65
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
66
|
+
self._io = _io
|
|
67
|
+
self._parent = _parent
|
|
68
|
+
self._root = _root if _root else self
|
|
69
|
+
self._debug = collections.defaultdict(dict)
|
|
70
|
+
|
|
71
|
+
def _read(self):
|
|
72
|
+
self._debug['header']['start'] = self._io.pos()
|
|
73
|
+
self.header = ResourceFork.FileHeader(self._io, self, self._root)
|
|
74
|
+
self.header._read()
|
|
75
|
+
self._debug['header']['end'] = self._io.pos()
|
|
76
|
+
self._debug['system_data']['start'] = self._io.pos()
|
|
77
|
+
self.system_data = self._io.read_bytes(112)
|
|
78
|
+
self._debug['system_data']['end'] = self._io.pos()
|
|
79
|
+
self._debug['application_data']['start'] = self._io.pos()
|
|
80
|
+
self.application_data = self._io.read_bytes(128)
|
|
81
|
+
self._debug['application_data']['end'] = self._io.pos()
|
|
82
|
+
|
|
83
|
+
class FileHeader(KaitaiStruct):
|
|
84
|
+
"""Resource file header,
|
|
85
|
+
containing the offsets and lengths of the resource data area and resource map.
|
|
86
|
+
"""
|
|
87
|
+
SEQ_FIELDS = ["ofs_data_blocks", "ofs_resource_map", "len_data_blocks", "len_resource_map"]
|
|
88
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
89
|
+
self._io = _io
|
|
90
|
+
self._parent = _parent
|
|
91
|
+
self._root = _root if _root else self
|
|
92
|
+
self._debug = collections.defaultdict(dict)
|
|
93
|
+
|
|
94
|
+
def _read(self):
|
|
95
|
+
self._debug['ofs_data_blocks']['start'] = self._io.pos()
|
|
96
|
+
self.ofs_data_blocks = self._io.read_u4be()
|
|
97
|
+
self._debug['ofs_data_blocks']['end'] = self._io.pos()
|
|
98
|
+
self._debug['ofs_resource_map']['start'] = self._io.pos()
|
|
99
|
+
self.ofs_resource_map = self._io.read_u4be()
|
|
100
|
+
self._debug['ofs_resource_map']['end'] = self._io.pos()
|
|
101
|
+
self._debug['len_data_blocks']['start'] = self._io.pos()
|
|
102
|
+
self.len_data_blocks = self._io.read_u4be()
|
|
103
|
+
self._debug['len_data_blocks']['end'] = self._io.pos()
|
|
104
|
+
self._debug['len_resource_map']['start'] = self._io.pos()
|
|
105
|
+
self.len_resource_map = self._io.read_u4be()
|
|
106
|
+
self._debug['len_resource_map']['end'] = self._io.pos()
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class DataBlock(KaitaiStruct):
|
|
110
|
+
"""A resource data block,
|
|
111
|
+
as stored in the resource data area.
|
|
112
|
+
|
|
113
|
+
Each data block stores the data contained in a resource,
|
|
114
|
+
along with its length.
|
|
115
|
+
"""
|
|
116
|
+
SEQ_FIELDS = ["len_data", "data"]
|
|
117
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
118
|
+
self._io = _io
|
|
119
|
+
self._parent = _parent
|
|
120
|
+
self._root = _root if _root else self
|
|
121
|
+
self._debug = collections.defaultdict(dict)
|
|
122
|
+
|
|
123
|
+
def _read(self):
|
|
124
|
+
self._debug['len_data']['start'] = self._io.pos()
|
|
125
|
+
self.len_data = self._io.read_u4be()
|
|
126
|
+
self._debug['len_data']['end'] = self._io.pos()
|
|
127
|
+
self._debug['data']['start'] = self._io.pos()
|
|
128
|
+
self.data = self._io.read_bytes(self.len_data)
|
|
129
|
+
self._debug['data']['end'] = self._io.pos()
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
class ResourceMap(KaitaiStruct):
|
|
133
|
+
"""Resource map,
|
|
134
|
+
containing information about the resources in the file and where they are located in the data area.
|
|
135
|
+
"""
|
|
136
|
+
SEQ_FIELDS = ["reserved_file_header_copy", "reserved_next_resource_map_handle", "reserved_file_reference_number", "file_attributes", "ofs_type_list", "ofs_names"]
|
|
137
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
138
|
+
self._io = _io
|
|
139
|
+
self._parent = _parent
|
|
140
|
+
self._root = _root if _root else self
|
|
141
|
+
self._debug = collections.defaultdict(dict)
|
|
142
|
+
|
|
143
|
+
def _read(self):
|
|
144
|
+
self._debug['reserved_file_header_copy']['start'] = self._io.pos()
|
|
145
|
+
self.reserved_file_header_copy = ResourceFork.FileHeader(self._io, self, self._root)
|
|
146
|
+
self.reserved_file_header_copy._read()
|
|
147
|
+
self._debug['reserved_file_header_copy']['end'] = self._io.pos()
|
|
148
|
+
self._debug['reserved_next_resource_map_handle']['start'] = self._io.pos()
|
|
149
|
+
self.reserved_next_resource_map_handle = self._io.read_u4be()
|
|
150
|
+
self._debug['reserved_next_resource_map_handle']['end'] = self._io.pos()
|
|
151
|
+
self._debug['reserved_file_reference_number']['start'] = self._io.pos()
|
|
152
|
+
self.reserved_file_reference_number = self._io.read_u2be()
|
|
153
|
+
self._debug['reserved_file_reference_number']['end'] = self._io.pos()
|
|
154
|
+
self._debug['file_attributes']['start'] = self._io.pos()
|
|
155
|
+
self._raw_file_attributes = self._io.read_bytes(2)
|
|
156
|
+
_io__raw_file_attributes = KaitaiStream(BytesIO(self._raw_file_attributes))
|
|
157
|
+
self.file_attributes = ResourceFork.ResourceMap.FileAttributes(_io__raw_file_attributes, self, self._root)
|
|
158
|
+
self.file_attributes._read()
|
|
159
|
+
self._debug['file_attributes']['end'] = self._io.pos()
|
|
160
|
+
self._debug['ofs_type_list']['start'] = self._io.pos()
|
|
161
|
+
self.ofs_type_list = self._io.read_u2be()
|
|
162
|
+
self._debug['ofs_type_list']['end'] = self._io.pos()
|
|
163
|
+
self._debug['ofs_names']['start'] = self._io.pos()
|
|
164
|
+
self.ofs_names = self._io.read_u2be()
|
|
165
|
+
self._debug['ofs_names']['end'] = self._io.pos()
|
|
166
|
+
|
|
167
|
+
class FileAttributes(KaitaiStruct):
|
|
168
|
+
"""A resource file's attributes,
|
|
169
|
+
as stored in the resource map.
|
|
170
|
+
|
|
171
|
+
These attributes are sometimes also referred to as resource map attributes,
|
|
172
|
+
because of where they are stored in the file.
|
|
173
|
+
"""
|
|
174
|
+
SEQ_FIELDS = ["resources_locked", "reserved0", "printer_driver_multifinder_compatible", "no_write_changes", "needs_compact", "map_needs_write", "reserved1"]
|
|
175
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
176
|
+
self._io = _io
|
|
177
|
+
self._parent = _parent
|
|
178
|
+
self._root = _root if _root else self
|
|
179
|
+
self._debug = collections.defaultdict(dict)
|
|
180
|
+
|
|
181
|
+
def _read(self):
|
|
182
|
+
self._debug['resources_locked']['start'] = self._io.pos()
|
|
183
|
+
self.resources_locked = self._io.read_bits_int_be(1) != 0
|
|
184
|
+
self._debug['resources_locked']['end'] = self._io.pos()
|
|
185
|
+
self._debug['reserved0']['start'] = self._io.pos()
|
|
186
|
+
self.reserved0 = self._io.read_bits_int_be(6)
|
|
187
|
+
self._debug['reserved0']['end'] = self._io.pos()
|
|
188
|
+
self._debug['printer_driver_multifinder_compatible']['start'] = self._io.pos()
|
|
189
|
+
self.printer_driver_multifinder_compatible = self._io.read_bits_int_be(1) != 0
|
|
190
|
+
self._debug['printer_driver_multifinder_compatible']['end'] = self._io.pos()
|
|
191
|
+
self._debug['no_write_changes']['start'] = self._io.pos()
|
|
192
|
+
self.no_write_changes = self._io.read_bits_int_be(1) != 0
|
|
193
|
+
self._debug['no_write_changes']['end'] = self._io.pos()
|
|
194
|
+
self._debug['needs_compact']['start'] = self._io.pos()
|
|
195
|
+
self.needs_compact = self._io.read_bits_int_be(1) != 0
|
|
196
|
+
self._debug['needs_compact']['end'] = self._io.pos()
|
|
197
|
+
self._debug['map_needs_write']['start'] = self._io.pos()
|
|
198
|
+
self.map_needs_write = self._io.read_bits_int_be(1) != 0
|
|
199
|
+
self._debug['map_needs_write']['end'] = self._io.pos()
|
|
200
|
+
self._debug['reserved1']['start'] = self._io.pos()
|
|
201
|
+
self.reserved1 = self._io.read_bits_int_be(5)
|
|
202
|
+
self._debug['reserved1']['end'] = self._io.pos()
|
|
203
|
+
|
|
204
|
+
@property
|
|
205
|
+
def as_int(self):
|
|
206
|
+
"""The attributes as a packed integer,
|
|
207
|
+
as they are stored in the file.
|
|
208
|
+
"""
|
|
209
|
+
if hasattr(self, '_m_as_int'):
|
|
210
|
+
return self._m_as_int if hasattr(self, '_m_as_int') else None
|
|
211
|
+
|
|
212
|
+
_pos = self._io.pos()
|
|
213
|
+
self._io.seek(0)
|
|
214
|
+
self._debug['_m_as_int']['start'] = self._io.pos()
|
|
215
|
+
self._m_as_int = self._io.read_u2be()
|
|
216
|
+
self._debug['_m_as_int']['end'] = self._io.pos()
|
|
217
|
+
self._io.seek(_pos)
|
|
218
|
+
return self._m_as_int if hasattr(self, '_m_as_int') else None
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
class TypeListAndReferenceLists(KaitaiStruct):
|
|
222
|
+
"""Resource type list and storage area for resource reference lists in the resource map.
|
|
223
|
+
|
|
224
|
+
The two parts are combined into a single type here for technical reasons:
|
|
225
|
+
the start of the resource reference list area is not stored explicitly in the file,
|
|
226
|
+
instead it always starts directly after the resource type list.
|
|
227
|
+
The simplest way to implement this is by placing both types into a single `seq`.
|
|
228
|
+
"""
|
|
229
|
+
SEQ_FIELDS = ["type_list", "reference_lists"]
|
|
230
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
231
|
+
self._io = _io
|
|
232
|
+
self._parent = _parent
|
|
233
|
+
self._root = _root if _root else self
|
|
234
|
+
self._debug = collections.defaultdict(dict)
|
|
235
|
+
|
|
236
|
+
def _read(self):
|
|
237
|
+
self._debug['type_list']['start'] = self._io.pos()
|
|
238
|
+
self.type_list = ResourceFork.ResourceMap.TypeListAndReferenceLists.TypeList(self._io, self, self._root)
|
|
239
|
+
self.type_list._read()
|
|
240
|
+
self._debug['type_list']['end'] = self._io.pos()
|
|
241
|
+
self._debug['reference_lists']['start'] = self._io.pos()
|
|
242
|
+
self.reference_lists = self._io.read_bytes_full()
|
|
243
|
+
self._debug['reference_lists']['end'] = self._io.pos()
|
|
244
|
+
|
|
245
|
+
class TypeList(KaitaiStruct):
|
|
246
|
+
"""Resource type list in the resource map."""
|
|
247
|
+
SEQ_FIELDS = ["num_types_m1", "entries"]
|
|
248
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
249
|
+
self._io = _io
|
|
250
|
+
self._parent = _parent
|
|
251
|
+
self._root = _root if _root else self
|
|
252
|
+
self._debug = collections.defaultdict(dict)
|
|
253
|
+
|
|
254
|
+
def _read(self):
|
|
255
|
+
self._debug['num_types_m1']['start'] = self._io.pos()
|
|
256
|
+
self.num_types_m1 = self._io.read_u2be()
|
|
257
|
+
self._debug['num_types_m1']['end'] = self._io.pos()
|
|
258
|
+
self._debug['entries']['start'] = self._io.pos()
|
|
259
|
+
self.entries = [None] * (self.num_types)
|
|
260
|
+
for i in range(self.num_types):
|
|
261
|
+
if not 'arr' in self._debug['entries']:
|
|
262
|
+
self._debug['entries']['arr'] = []
|
|
263
|
+
self._debug['entries']['arr'].append({'start': self._io.pos()})
|
|
264
|
+
_t_entries = ResourceFork.ResourceMap.TypeListAndReferenceLists.TypeList.TypeListEntry(self._io, self, self._root)
|
|
265
|
+
_t_entries._read()
|
|
266
|
+
self.entries[i] = _t_entries
|
|
267
|
+
self._debug['entries']['arr'][i]['end'] = self._io.pos()
|
|
268
|
+
|
|
269
|
+
self._debug['entries']['end'] = self._io.pos()
|
|
270
|
+
|
|
271
|
+
class TypeListEntry(KaitaiStruct):
|
|
272
|
+
"""A single entry in the resource type list.
|
|
273
|
+
|
|
274
|
+
Each entry corresponds to exactly one resource reference list.
|
|
275
|
+
"""
|
|
276
|
+
SEQ_FIELDS = ["type", "num_references_m1", "ofs_reference_list"]
|
|
277
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
278
|
+
self._io = _io
|
|
279
|
+
self._parent = _parent
|
|
280
|
+
self._root = _root if _root else self
|
|
281
|
+
self._debug = collections.defaultdict(dict)
|
|
282
|
+
|
|
283
|
+
def _read(self):
|
|
284
|
+
self._debug['type']['start'] = self._io.pos()
|
|
285
|
+
self.type = self._io.read_bytes(4)
|
|
286
|
+
self._debug['type']['end'] = self._io.pos()
|
|
287
|
+
self._debug['num_references_m1']['start'] = self._io.pos()
|
|
288
|
+
self.num_references_m1 = self._io.read_u2be()
|
|
289
|
+
self._debug['num_references_m1']['end'] = self._io.pos()
|
|
290
|
+
self._debug['ofs_reference_list']['start'] = self._io.pos()
|
|
291
|
+
self.ofs_reference_list = self._io.read_u2be()
|
|
292
|
+
self._debug['ofs_reference_list']['end'] = self._io.pos()
|
|
293
|
+
|
|
294
|
+
@property
|
|
295
|
+
def num_references(self):
|
|
296
|
+
"""The number of resources in the reference list for this type."""
|
|
297
|
+
if hasattr(self, '_m_num_references'):
|
|
298
|
+
return self._m_num_references if hasattr(self, '_m_num_references') else None
|
|
299
|
+
|
|
300
|
+
self._m_num_references = ((self.num_references_m1 + 1) % 65536)
|
|
301
|
+
return self._m_num_references if hasattr(self, '_m_num_references') else None
|
|
302
|
+
|
|
303
|
+
@property
|
|
304
|
+
def reference_list(self):
|
|
305
|
+
"""The resource reference list for this resource type.
|
|
306
|
+
"""
|
|
307
|
+
if hasattr(self, '_m_reference_list'):
|
|
308
|
+
return self._m_reference_list if hasattr(self, '_m_reference_list') else None
|
|
309
|
+
|
|
310
|
+
io = self._parent._parent._io
|
|
311
|
+
_pos = io.pos()
|
|
312
|
+
io.seek(self.ofs_reference_list)
|
|
313
|
+
self._debug['_m_reference_list']['start'] = io.pos()
|
|
314
|
+
self._m_reference_list = ResourceFork.ResourceMap.TypeListAndReferenceLists.ReferenceList(self.num_references, io, self, self._root)
|
|
315
|
+
self._m_reference_list._read()
|
|
316
|
+
self._debug['_m_reference_list']['end'] = io.pos()
|
|
317
|
+
io.seek(_pos)
|
|
318
|
+
return self._m_reference_list if hasattr(self, '_m_reference_list') else None
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
@property
|
|
322
|
+
def num_types(self):
|
|
323
|
+
"""The number of resource types in this list."""
|
|
324
|
+
if hasattr(self, '_m_num_types'):
|
|
325
|
+
return self._m_num_types if hasattr(self, '_m_num_types') else None
|
|
326
|
+
|
|
327
|
+
self._m_num_types = ((self.num_types_m1 + 1) % 65536)
|
|
328
|
+
return self._m_num_types if hasattr(self, '_m_num_types') else None
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
class ReferenceList(KaitaiStruct):
|
|
332
|
+
"""A resource reference list,
|
|
333
|
+
as stored in the reference list area.
|
|
334
|
+
|
|
335
|
+
Each reference list has exactly one matching entry in the resource type list,
|
|
336
|
+
and describes all resources of a single type in the file.
|
|
337
|
+
"""
|
|
338
|
+
SEQ_FIELDS = ["references"]
|
|
339
|
+
def __init__(self, num_references, _io, _parent=None, _root=None):
|
|
340
|
+
self._io = _io
|
|
341
|
+
self._parent = _parent
|
|
342
|
+
self._root = _root if _root else self
|
|
343
|
+
self.num_references = num_references
|
|
344
|
+
self._debug = collections.defaultdict(dict)
|
|
345
|
+
|
|
346
|
+
def _read(self):
|
|
347
|
+
self._debug['references']['start'] = self._io.pos()
|
|
348
|
+
self.references = [None] * (self.num_references)
|
|
349
|
+
for i in range(self.num_references):
|
|
350
|
+
if not 'arr' in self._debug['references']:
|
|
351
|
+
self._debug['references']['arr'] = []
|
|
352
|
+
self._debug['references']['arr'].append({'start': self._io.pos()})
|
|
353
|
+
_t_references = ResourceFork.ResourceMap.TypeListAndReferenceLists.ReferenceList.Reference(self._io, self, self._root)
|
|
354
|
+
_t_references._read()
|
|
355
|
+
self.references[i] = _t_references
|
|
356
|
+
self._debug['references']['arr'][i]['end'] = self._io.pos()
|
|
357
|
+
|
|
358
|
+
self._debug['references']['end'] = self._io.pos()
|
|
359
|
+
|
|
360
|
+
class Reference(KaitaiStruct):
|
|
361
|
+
"""A single resource reference in a resource reference list."""
|
|
362
|
+
SEQ_FIELDS = ["id", "ofs_name", "attributes", "ofs_data_block", "reserved_handle"]
|
|
363
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
364
|
+
self._io = _io
|
|
365
|
+
self._parent = _parent
|
|
366
|
+
self._root = _root if _root else self
|
|
367
|
+
self._debug = collections.defaultdict(dict)
|
|
368
|
+
|
|
369
|
+
def _read(self):
|
|
370
|
+
self._debug['id']['start'] = self._io.pos()
|
|
371
|
+
self.id = self._io.read_s2be()
|
|
372
|
+
self._debug['id']['end'] = self._io.pos()
|
|
373
|
+
self._debug['ofs_name']['start'] = self._io.pos()
|
|
374
|
+
self.ofs_name = self._io.read_u2be()
|
|
375
|
+
self._debug['ofs_name']['end'] = self._io.pos()
|
|
376
|
+
self._debug['attributes']['start'] = self._io.pos()
|
|
377
|
+
self._raw_attributes = self._io.read_bytes(1)
|
|
378
|
+
_io__raw_attributes = KaitaiStream(BytesIO(self._raw_attributes))
|
|
379
|
+
self.attributes = ResourceFork.ResourceMap.TypeListAndReferenceLists.ReferenceList.Reference.Attributes(_io__raw_attributes, self, self._root)
|
|
380
|
+
self.attributes._read()
|
|
381
|
+
self._debug['attributes']['end'] = self._io.pos()
|
|
382
|
+
self._debug['ofs_data_block']['start'] = self._io.pos()
|
|
383
|
+
self.ofs_data_block = self._io.read_bits_int_be(24)
|
|
384
|
+
self._debug['ofs_data_block']['end'] = self._io.pos()
|
|
385
|
+
self._io.align_to_byte()
|
|
386
|
+
self._debug['reserved_handle']['start'] = self._io.pos()
|
|
387
|
+
self.reserved_handle = self._io.read_u4be()
|
|
388
|
+
self._debug['reserved_handle']['end'] = self._io.pos()
|
|
389
|
+
|
|
390
|
+
class Attributes(KaitaiStruct):
|
|
391
|
+
"""A resource's attributes,
|
|
392
|
+
as stored in a resource reference.
|
|
393
|
+
"""
|
|
394
|
+
SEQ_FIELDS = ["system_reference", "load_into_system_heap", "purgeable", "locked", "protected", "preload", "needs_write", "compressed"]
|
|
395
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
396
|
+
self._io = _io
|
|
397
|
+
self._parent = _parent
|
|
398
|
+
self._root = _root if _root else self
|
|
399
|
+
self._debug = collections.defaultdict(dict)
|
|
400
|
+
|
|
401
|
+
def _read(self):
|
|
402
|
+
self._debug['system_reference']['start'] = self._io.pos()
|
|
403
|
+
self.system_reference = self._io.read_bits_int_be(1) != 0
|
|
404
|
+
self._debug['system_reference']['end'] = self._io.pos()
|
|
405
|
+
self._debug['load_into_system_heap']['start'] = self._io.pos()
|
|
406
|
+
self.load_into_system_heap = self._io.read_bits_int_be(1) != 0
|
|
407
|
+
self._debug['load_into_system_heap']['end'] = self._io.pos()
|
|
408
|
+
self._debug['purgeable']['start'] = self._io.pos()
|
|
409
|
+
self.purgeable = self._io.read_bits_int_be(1) != 0
|
|
410
|
+
self._debug['purgeable']['end'] = self._io.pos()
|
|
411
|
+
self._debug['locked']['start'] = self._io.pos()
|
|
412
|
+
self.locked = self._io.read_bits_int_be(1) != 0
|
|
413
|
+
self._debug['locked']['end'] = self._io.pos()
|
|
414
|
+
self._debug['protected']['start'] = self._io.pos()
|
|
415
|
+
self.protected = self._io.read_bits_int_be(1) != 0
|
|
416
|
+
self._debug['protected']['end'] = self._io.pos()
|
|
417
|
+
self._debug['preload']['start'] = self._io.pos()
|
|
418
|
+
self.preload = self._io.read_bits_int_be(1) != 0
|
|
419
|
+
self._debug['preload']['end'] = self._io.pos()
|
|
420
|
+
self._debug['needs_write']['start'] = self._io.pos()
|
|
421
|
+
self.needs_write = self._io.read_bits_int_be(1) != 0
|
|
422
|
+
self._debug['needs_write']['end'] = self._io.pos()
|
|
423
|
+
self._debug['compressed']['start'] = self._io.pos()
|
|
424
|
+
self.compressed = self._io.read_bits_int_be(1) != 0
|
|
425
|
+
self._debug['compressed']['end'] = self._io.pos()
|
|
426
|
+
|
|
427
|
+
@property
|
|
428
|
+
def as_int(self):
|
|
429
|
+
"""The attributes as a packed integer,
|
|
430
|
+
as they are stored in the file.
|
|
431
|
+
"""
|
|
432
|
+
if hasattr(self, '_m_as_int'):
|
|
433
|
+
return self._m_as_int if hasattr(self, '_m_as_int') else None
|
|
434
|
+
|
|
435
|
+
_pos = self._io.pos()
|
|
436
|
+
self._io.seek(0)
|
|
437
|
+
self._debug['_m_as_int']['start'] = self._io.pos()
|
|
438
|
+
self._m_as_int = self._io.read_u1()
|
|
439
|
+
self._debug['_m_as_int']['end'] = self._io.pos()
|
|
440
|
+
self._io.seek(_pos)
|
|
441
|
+
return self._m_as_int if hasattr(self, '_m_as_int') else None
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
@property
|
|
445
|
+
def name(self):
|
|
446
|
+
"""The name (if any) of the resource described by this reference.
|
|
447
|
+
"""
|
|
448
|
+
if hasattr(self, '_m_name'):
|
|
449
|
+
return self._m_name if hasattr(self, '_m_name') else None
|
|
450
|
+
|
|
451
|
+
if self.ofs_name != 65535:
|
|
452
|
+
io = self._root.resource_map.names_with_io._io
|
|
453
|
+
_pos = io.pos()
|
|
454
|
+
io.seek(self.ofs_name)
|
|
455
|
+
self._debug['_m_name']['start'] = io.pos()
|
|
456
|
+
self._m_name = ResourceFork.ResourceMap.Name(io, self, self._root)
|
|
457
|
+
self._m_name._read()
|
|
458
|
+
self._debug['_m_name']['end'] = io.pos()
|
|
459
|
+
io.seek(_pos)
|
|
460
|
+
|
|
461
|
+
return self._m_name if hasattr(self, '_m_name') else None
|
|
462
|
+
|
|
463
|
+
@property
|
|
464
|
+
def data_block(self):
|
|
465
|
+
"""The data block containing the data for the resource described by this reference.
|
|
466
|
+
"""
|
|
467
|
+
if hasattr(self, '_m_data_block'):
|
|
468
|
+
return self._m_data_block if hasattr(self, '_m_data_block') else None
|
|
469
|
+
|
|
470
|
+
io = self._root.data_blocks_with_io._io
|
|
471
|
+
_pos = io.pos()
|
|
472
|
+
io.seek(self.ofs_data_block)
|
|
473
|
+
self._debug['_m_data_block']['start'] = io.pos()
|
|
474
|
+
self._m_data_block = ResourceFork.DataBlock(io, self, self._root)
|
|
475
|
+
self._m_data_block._read()
|
|
476
|
+
self._debug['_m_data_block']['end'] = io.pos()
|
|
477
|
+
io.seek(_pos)
|
|
478
|
+
return self._m_data_block if hasattr(self, '_m_data_block') else None
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
class Name(KaitaiStruct):
|
|
484
|
+
"""A resource name,
|
|
485
|
+
as stored in the resource name storage area in the resource map.
|
|
486
|
+
|
|
487
|
+
The resource names are not required to appear in any particular order.
|
|
488
|
+
There may be unused space between and around resource names,
|
|
489
|
+
but in practice they are often contiguous.
|
|
490
|
+
"""
|
|
491
|
+
SEQ_FIELDS = ["len_value", "value"]
|
|
492
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
493
|
+
self._io = _io
|
|
494
|
+
self._parent = _parent
|
|
495
|
+
self._root = _root if _root else self
|
|
496
|
+
self._debug = collections.defaultdict(dict)
|
|
497
|
+
|
|
498
|
+
def _read(self):
|
|
499
|
+
self._debug['len_value']['start'] = self._io.pos()
|
|
500
|
+
self.len_value = self._io.read_u1()
|
|
501
|
+
self._debug['len_value']['end'] = self._io.pos()
|
|
502
|
+
self._debug['value']['start'] = self._io.pos()
|
|
503
|
+
self.value = self._io.read_bytes(self.len_value)
|
|
504
|
+
self._debug['value']['end'] = self._io.pos()
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
@property
|
|
508
|
+
def type_list_and_reference_lists(self):
|
|
509
|
+
"""The resource map's resource type list, followed by the resource reference list area."""
|
|
510
|
+
if hasattr(self, '_m_type_list_and_reference_lists'):
|
|
511
|
+
return self._m_type_list_and_reference_lists if hasattr(self, '_m_type_list_and_reference_lists') else None
|
|
512
|
+
|
|
513
|
+
_pos = self._io.pos()
|
|
514
|
+
self._io.seek(self.ofs_type_list)
|
|
515
|
+
self._debug['_m_type_list_and_reference_lists']['start'] = self._io.pos()
|
|
516
|
+
self._raw__m_type_list_and_reference_lists = self._io.read_bytes((self.ofs_names - self.ofs_type_list))
|
|
517
|
+
_io__raw__m_type_list_and_reference_lists = KaitaiStream(BytesIO(self._raw__m_type_list_and_reference_lists))
|
|
518
|
+
self._m_type_list_and_reference_lists = ResourceFork.ResourceMap.TypeListAndReferenceLists(_io__raw__m_type_list_and_reference_lists, self, self._root)
|
|
519
|
+
self._m_type_list_and_reference_lists._read()
|
|
520
|
+
self._debug['_m_type_list_and_reference_lists']['end'] = self._io.pos()
|
|
521
|
+
self._io.seek(_pos)
|
|
522
|
+
return self._m_type_list_and_reference_lists if hasattr(self, '_m_type_list_and_reference_lists') else None
|
|
523
|
+
|
|
524
|
+
@property
|
|
525
|
+
def names_with_io(self):
|
|
526
|
+
"""Use `names` instead,
|
|
527
|
+
unless you need access to this instance's `_io`.
|
|
528
|
+
"""
|
|
529
|
+
if hasattr(self, '_m_names_with_io'):
|
|
530
|
+
return self._m_names_with_io if hasattr(self, '_m_names_with_io') else None
|
|
531
|
+
|
|
532
|
+
_pos = self._io.pos()
|
|
533
|
+
self._io.seek(self.ofs_names)
|
|
534
|
+
self._debug['_m_names_with_io']['start'] = self._io.pos()
|
|
535
|
+
self._raw__m_names_with_io = self._io.read_bytes_full()
|
|
536
|
+
_io__raw__m_names_with_io = KaitaiStream(BytesIO(self._raw__m_names_with_io))
|
|
537
|
+
self._m_names_with_io = bytes_with_io.BytesWithIo(_io__raw__m_names_with_io)
|
|
538
|
+
self._m_names_with_io._read()
|
|
539
|
+
self._debug['_m_names_with_io']['end'] = self._io.pos()
|
|
540
|
+
self._io.seek(_pos)
|
|
541
|
+
return self._m_names_with_io if hasattr(self, '_m_names_with_io') else None
|
|
542
|
+
|
|
543
|
+
@property
|
|
544
|
+
def names(self):
|
|
545
|
+
"""Storage area for the names of all resources."""
|
|
546
|
+
if hasattr(self, '_m_names'):
|
|
547
|
+
return self._m_names if hasattr(self, '_m_names') else None
|
|
548
|
+
|
|
549
|
+
self._m_names = self.names_with_io.data
|
|
550
|
+
return self._m_names if hasattr(self, '_m_names') else None
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
@property
|
|
554
|
+
def data_blocks_with_io(self):
|
|
555
|
+
"""Use `data_blocks` instead,
|
|
556
|
+
unless you need access to this instance's `_io`.
|
|
557
|
+
"""
|
|
558
|
+
if hasattr(self, '_m_data_blocks_with_io'):
|
|
559
|
+
return self._m_data_blocks_with_io if hasattr(self, '_m_data_blocks_with_io') else None
|
|
560
|
+
|
|
561
|
+
_pos = self._io.pos()
|
|
562
|
+
self._io.seek(self.header.ofs_data_blocks)
|
|
563
|
+
self._debug['_m_data_blocks_with_io']['start'] = self._io.pos()
|
|
564
|
+
self._raw__m_data_blocks_with_io = self._io.read_bytes(self.header.len_data_blocks)
|
|
565
|
+
_io__raw__m_data_blocks_with_io = KaitaiStream(BytesIO(self._raw__m_data_blocks_with_io))
|
|
566
|
+
self._m_data_blocks_with_io = bytes_with_io.BytesWithIo(_io__raw__m_data_blocks_with_io)
|
|
567
|
+
self._m_data_blocks_with_io._read()
|
|
568
|
+
self._debug['_m_data_blocks_with_io']['end'] = self._io.pos()
|
|
569
|
+
self._io.seek(_pos)
|
|
570
|
+
return self._m_data_blocks_with_io if hasattr(self, '_m_data_blocks_with_io') else None
|
|
571
|
+
|
|
572
|
+
@property
|
|
573
|
+
def data_blocks(self):
|
|
574
|
+
"""Storage area for the data blocks of all resources.
|
|
575
|
+
|
|
576
|
+
These data blocks are not required to appear in any particular order,
|
|
577
|
+
and there may be unused space between and around them.
|
|
578
|
+
|
|
579
|
+
In practice,
|
|
580
|
+
the data blocks in newly created resource files are usually contiguous.
|
|
581
|
+
When existing resources are shortened,
|
|
582
|
+
the Mac OS resource manager leaves unused space where the now removed resource data was,
|
|
583
|
+
as this is quicker than moving the following resource data into the newly freed space.
|
|
584
|
+
Such unused space may be cleaned up later when the resource manager "compacts" the resource file,
|
|
585
|
+
which happens when resources are removed entirely,
|
|
586
|
+
or when resources are added or grown so that more space is needed in the data area.
|
|
587
|
+
"""
|
|
588
|
+
if hasattr(self, '_m_data_blocks'):
|
|
589
|
+
return self._m_data_blocks if hasattr(self, '_m_data_blocks') else None
|
|
590
|
+
|
|
591
|
+
self._m_data_blocks = self.data_blocks_with_io.data
|
|
592
|
+
return self._m_data_blocks if hasattr(self, '_m_data_blocks') else None
|
|
593
|
+
|
|
594
|
+
@property
|
|
595
|
+
def resource_map(self):
|
|
596
|
+
"""The resource file's resource map."""
|
|
597
|
+
if hasattr(self, '_m_resource_map'):
|
|
598
|
+
return self._m_resource_map if hasattr(self, '_m_resource_map') else None
|
|
599
|
+
|
|
600
|
+
_pos = self._io.pos()
|
|
601
|
+
self._io.seek(self.header.ofs_resource_map)
|
|
602
|
+
self._debug['_m_resource_map']['start'] = self._io.pos()
|
|
603
|
+
self._raw__m_resource_map = self._io.read_bytes(self.header.len_resource_map)
|
|
604
|
+
_io__raw__m_resource_map = KaitaiStream(BytesIO(self._raw__m_resource_map))
|
|
605
|
+
self._m_resource_map = ResourceFork.ResourceMap(_io__raw__m_resource_map, self, self._root)
|
|
606
|
+
self._m_resource_map._read()
|
|
607
|
+
self._debug['_m_resource_map']['end'] = self._io.pos()
|
|
608
|
+
self._io.seek(_pos)
|
|
609
|
+
return self._m_resource_map if hasattr(self, '_m_resource_map') else None
|
|
610
|
+
|
|
611
|
+
|
|
@@ -0,0 +1,57 @@
|
|
|
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 Respack(KaitaiStruct):
|
|
13
|
+
"""Resource file found in CPB firmware archives, mostly used on older CoolPad
|
|
14
|
+
phones and/or tablets. The only observed files are called "ResPack.cfg".
|
|
15
|
+
"""
|
|
16
|
+
SEQ_FIELDS = ["header", "json"]
|
|
17
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
18
|
+
self._io = _io
|
|
19
|
+
self._parent = _parent
|
|
20
|
+
self._root = _root if _root else self
|
|
21
|
+
self._debug = collections.defaultdict(dict)
|
|
22
|
+
|
|
23
|
+
def _read(self):
|
|
24
|
+
self._debug['header']['start'] = self._io.pos()
|
|
25
|
+
self.header = Respack.Header(self._io, self, self._root)
|
|
26
|
+
self.header._read()
|
|
27
|
+
self._debug['header']['end'] = self._io.pos()
|
|
28
|
+
self._debug['json']['start'] = self._io.pos()
|
|
29
|
+
self.json = (self._io.read_bytes(self.header.len_json)).decode(u"UTF-8")
|
|
30
|
+
self._debug['json']['end'] = self._io.pos()
|
|
31
|
+
|
|
32
|
+
class Header(KaitaiStruct):
|
|
33
|
+
SEQ_FIELDS = ["magic", "unknown", "len_json", "md5"]
|
|
34
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
35
|
+
self._io = _io
|
|
36
|
+
self._parent = _parent
|
|
37
|
+
self._root = _root if _root else self
|
|
38
|
+
self._debug = collections.defaultdict(dict)
|
|
39
|
+
|
|
40
|
+
def _read(self):
|
|
41
|
+
self._debug['magic']['start'] = self._io.pos()
|
|
42
|
+
self.magic = self._io.read_bytes(2)
|
|
43
|
+
self._debug['magic']['end'] = self._io.pos()
|
|
44
|
+
if not self.magic == b"\x52\x53":
|
|
45
|
+
raise kaitaistruct.ValidationNotEqualError(b"\x52\x53", self.magic, self._io, u"/types/header/seq/0")
|
|
46
|
+
self._debug['unknown']['start'] = self._io.pos()
|
|
47
|
+
self.unknown = self._io.read_bytes(8)
|
|
48
|
+
self._debug['unknown']['end'] = self._io.pos()
|
|
49
|
+
self._debug['len_json']['start'] = self._io.pos()
|
|
50
|
+
self.len_json = self._io.read_u4le()
|
|
51
|
+
self._debug['len_json']['end'] = self._io.pos()
|
|
52
|
+
self._debug['md5']['start'] = self._io.pos()
|
|
53
|
+
self.md5 = (self._io.read_bytes(32)).decode(u"UTF-8")
|
|
54
|
+
self._debug['md5']['end'] = self._io.pos()
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|