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,765 @@
|
|
|
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 MicrosoftPe(KaitaiStruct):
|
|
14
|
+
"""
|
|
15
|
+
.. seealso::
|
|
16
|
+
Source - https://learn.microsoft.com/en-us/windows/win32/debug/pe-format
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
class PeFormat(Enum):
|
|
20
|
+
rom_image = 263
|
|
21
|
+
pe32 = 267
|
|
22
|
+
pe32_plus = 523
|
|
23
|
+
SEQ_FIELDS = ["mz"]
|
|
24
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
25
|
+
self._io = _io
|
|
26
|
+
self._parent = _parent
|
|
27
|
+
self._root = _root if _root else self
|
|
28
|
+
self._debug = collections.defaultdict(dict)
|
|
29
|
+
|
|
30
|
+
def _read(self):
|
|
31
|
+
self._debug['mz']['start'] = self._io.pos()
|
|
32
|
+
self.mz = MicrosoftPe.MzPlaceholder(self._io, self, self._root)
|
|
33
|
+
self.mz._read()
|
|
34
|
+
self._debug['mz']['end'] = self._io.pos()
|
|
35
|
+
|
|
36
|
+
class CertificateEntry(KaitaiStruct):
|
|
37
|
+
"""
|
|
38
|
+
.. seealso::
|
|
39
|
+
Source - https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#the-attribute-certificate-table-image-only
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
class CertificateRevision(Enum):
|
|
43
|
+
revision_1_0 = 256
|
|
44
|
+
revision_2_0 = 512
|
|
45
|
+
|
|
46
|
+
class CertificateTypeEnum(Enum):
|
|
47
|
+
x509 = 1
|
|
48
|
+
pkcs_signed_data = 2
|
|
49
|
+
reserved_1 = 3
|
|
50
|
+
ts_stack_signed = 4
|
|
51
|
+
SEQ_FIELDS = ["length", "revision", "certificate_type", "certificate_bytes"]
|
|
52
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
53
|
+
self._io = _io
|
|
54
|
+
self._parent = _parent
|
|
55
|
+
self._root = _root if _root else self
|
|
56
|
+
self._debug = collections.defaultdict(dict)
|
|
57
|
+
|
|
58
|
+
def _read(self):
|
|
59
|
+
self._debug['length']['start'] = self._io.pos()
|
|
60
|
+
self.length = self._io.read_u4le()
|
|
61
|
+
self._debug['length']['end'] = self._io.pos()
|
|
62
|
+
self._debug['revision']['start'] = self._io.pos()
|
|
63
|
+
self.revision = KaitaiStream.resolve_enum(MicrosoftPe.CertificateEntry.CertificateRevision, self._io.read_u2le())
|
|
64
|
+
self._debug['revision']['end'] = self._io.pos()
|
|
65
|
+
self._debug['certificate_type']['start'] = self._io.pos()
|
|
66
|
+
self.certificate_type = KaitaiStream.resolve_enum(MicrosoftPe.CertificateEntry.CertificateTypeEnum, self._io.read_u2le())
|
|
67
|
+
self._debug['certificate_type']['end'] = self._io.pos()
|
|
68
|
+
self._debug['certificate_bytes']['start'] = self._io.pos()
|
|
69
|
+
self.certificate_bytes = self._io.read_bytes((self.length - 8))
|
|
70
|
+
self._debug['certificate_bytes']['end'] = self._io.pos()
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class OptionalHeaderWindows(KaitaiStruct):
|
|
74
|
+
|
|
75
|
+
class SubsystemEnum(Enum):
|
|
76
|
+
unknown = 0
|
|
77
|
+
native = 1
|
|
78
|
+
windows_gui = 2
|
|
79
|
+
windows_cui = 3
|
|
80
|
+
posix_cui = 7
|
|
81
|
+
windows_ce_gui = 9
|
|
82
|
+
efi_application = 10
|
|
83
|
+
efi_boot_service_driver = 11
|
|
84
|
+
efi_runtime_driver = 12
|
|
85
|
+
efi_rom = 13
|
|
86
|
+
xbox = 14
|
|
87
|
+
windows_boot_application = 16
|
|
88
|
+
SEQ_FIELDS = ["image_base_32", "image_base_64", "section_alignment", "file_alignment", "major_operating_system_version", "minor_operating_system_version", "major_image_version", "minor_image_version", "major_subsystem_version", "minor_subsystem_version", "win32_version_value", "size_of_image", "size_of_headers", "check_sum", "subsystem", "dll_characteristics", "size_of_stack_reserve_32", "size_of_stack_reserve_64", "size_of_stack_commit_32", "size_of_stack_commit_64", "size_of_heap_reserve_32", "size_of_heap_reserve_64", "size_of_heap_commit_32", "size_of_heap_commit_64", "loader_flags", "number_of_rva_and_sizes"]
|
|
89
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
90
|
+
self._io = _io
|
|
91
|
+
self._parent = _parent
|
|
92
|
+
self._root = _root if _root else self
|
|
93
|
+
self._debug = collections.defaultdict(dict)
|
|
94
|
+
|
|
95
|
+
def _read(self):
|
|
96
|
+
if self._parent.std.format == MicrosoftPe.PeFormat.pe32:
|
|
97
|
+
self._debug['image_base_32']['start'] = self._io.pos()
|
|
98
|
+
self.image_base_32 = self._io.read_u4le()
|
|
99
|
+
self._debug['image_base_32']['end'] = self._io.pos()
|
|
100
|
+
|
|
101
|
+
if self._parent.std.format == MicrosoftPe.PeFormat.pe32_plus:
|
|
102
|
+
self._debug['image_base_64']['start'] = self._io.pos()
|
|
103
|
+
self.image_base_64 = self._io.read_u8le()
|
|
104
|
+
self._debug['image_base_64']['end'] = self._io.pos()
|
|
105
|
+
|
|
106
|
+
self._debug['section_alignment']['start'] = self._io.pos()
|
|
107
|
+
self.section_alignment = self._io.read_u4le()
|
|
108
|
+
self._debug['section_alignment']['end'] = self._io.pos()
|
|
109
|
+
self._debug['file_alignment']['start'] = self._io.pos()
|
|
110
|
+
self.file_alignment = self._io.read_u4le()
|
|
111
|
+
self._debug['file_alignment']['end'] = self._io.pos()
|
|
112
|
+
self._debug['major_operating_system_version']['start'] = self._io.pos()
|
|
113
|
+
self.major_operating_system_version = self._io.read_u2le()
|
|
114
|
+
self._debug['major_operating_system_version']['end'] = self._io.pos()
|
|
115
|
+
self._debug['minor_operating_system_version']['start'] = self._io.pos()
|
|
116
|
+
self.minor_operating_system_version = self._io.read_u2le()
|
|
117
|
+
self._debug['minor_operating_system_version']['end'] = self._io.pos()
|
|
118
|
+
self._debug['major_image_version']['start'] = self._io.pos()
|
|
119
|
+
self.major_image_version = self._io.read_u2le()
|
|
120
|
+
self._debug['major_image_version']['end'] = self._io.pos()
|
|
121
|
+
self._debug['minor_image_version']['start'] = self._io.pos()
|
|
122
|
+
self.minor_image_version = self._io.read_u2le()
|
|
123
|
+
self._debug['minor_image_version']['end'] = self._io.pos()
|
|
124
|
+
self._debug['major_subsystem_version']['start'] = self._io.pos()
|
|
125
|
+
self.major_subsystem_version = self._io.read_u2le()
|
|
126
|
+
self._debug['major_subsystem_version']['end'] = self._io.pos()
|
|
127
|
+
self._debug['minor_subsystem_version']['start'] = self._io.pos()
|
|
128
|
+
self.minor_subsystem_version = self._io.read_u2le()
|
|
129
|
+
self._debug['minor_subsystem_version']['end'] = self._io.pos()
|
|
130
|
+
self._debug['win32_version_value']['start'] = self._io.pos()
|
|
131
|
+
self.win32_version_value = self._io.read_u4le()
|
|
132
|
+
self._debug['win32_version_value']['end'] = self._io.pos()
|
|
133
|
+
self._debug['size_of_image']['start'] = self._io.pos()
|
|
134
|
+
self.size_of_image = self._io.read_u4le()
|
|
135
|
+
self._debug['size_of_image']['end'] = self._io.pos()
|
|
136
|
+
self._debug['size_of_headers']['start'] = self._io.pos()
|
|
137
|
+
self.size_of_headers = self._io.read_u4le()
|
|
138
|
+
self._debug['size_of_headers']['end'] = self._io.pos()
|
|
139
|
+
self._debug['check_sum']['start'] = self._io.pos()
|
|
140
|
+
self.check_sum = self._io.read_u4le()
|
|
141
|
+
self._debug['check_sum']['end'] = self._io.pos()
|
|
142
|
+
self._debug['subsystem']['start'] = self._io.pos()
|
|
143
|
+
self.subsystem = KaitaiStream.resolve_enum(MicrosoftPe.OptionalHeaderWindows.SubsystemEnum, self._io.read_u2le())
|
|
144
|
+
self._debug['subsystem']['end'] = self._io.pos()
|
|
145
|
+
self._debug['dll_characteristics']['start'] = self._io.pos()
|
|
146
|
+
self.dll_characteristics = self._io.read_u2le()
|
|
147
|
+
self._debug['dll_characteristics']['end'] = self._io.pos()
|
|
148
|
+
if self._parent.std.format == MicrosoftPe.PeFormat.pe32:
|
|
149
|
+
self._debug['size_of_stack_reserve_32']['start'] = self._io.pos()
|
|
150
|
+
self.size_of_stack_reserve_32 = self._io.read_u4le()
|
|
151
|
+
self._debug['size_of_stack_reserve_32']['end'] = self._io.pos()
|
|
152
|
+
|
|
153
|
+
if self._parent.std.format == MicrosoftPe.PeFormat.pe32_plus:
|
|
154
|
+
self._debug['size_of_stack_reserve_64']['start'] = self._io.pos()
|
|
155
|
+
self.size_of_stack_reserve_64 = self._io.read_u8le()
|
|
156
|
+
self._debug['size_of_stack_reserve_64']['end'] = self._io.pos()
|
|
157
|
+
|
|
158
|
+
if self._parent.std.format == MicrosoftPe.PeFormat.pe32:
|
|
159
|
+
self._debug['size_of_stack_commit_32']['start'] = self._io.pos()
|
|
160
|
+
self.size_of_stack_commit_32 = self._io.read_u4le()
|
|
161
|
+
self._debug['size_of_stack_commit_32']['end'] = self._io.pos()
|
|
162
|
+
|
|
163
|
+
if self._parent.std.format == MicrosoftPe.PeFormat.pe32_plus:
|
|
164
|
+
self._debug['size_of_stack_commit_64']['start'] = self._io.pos()
|
|
165
|
+
self.size_of_stack_commit_64 = self._io.read_u8le()
|
|
166
|
+
self._debug['size_of_stack_commit_64']['end'] = self._io.pos()
|
|
167
|
+
|
|
168
|
+
if self._parent.std.format == MicrosoftPe.PeFormat.pe32:
|
|
169
|
+
self._debug['size_of_heap_reserve_32']['start'] = self._io.pos()
|
|
170
|
+
self.size_of_heap_reserve_32 = self._io.read_u4le()
|
|
171
|
+
self._debug['size_of_heap_reserve_32']['end'] = self._io.pos()
|
|
172
|
+
|
|
173
|
+
if self._parent.std.format == MicrosoftPe.PeFormat.pe32_plus:
|
|
174
|
+
self._debug['size_of_heap_reserve_64']['start'] = self._io.pos()
|
|
175
|
+
self.size_of_heap_reserve_64 = self._io.read_u8le()
|
|
176
|
+
self._debug['size_of_heap_reserve_64']['end'] = self._io.pos()
|
|
177
|
+
|
|
178
|
+
if self._parent.std.format == MicrosoftPe.PeFormat.pe32:
|
|
179
|
+
self._debug['size_of_heap_commit_32']['start'] = self._io.pos()
|
|
180
|
+
self.size_of_heap_commit_32 = self._io.read_u4le()
|
|
181
|
+
self._debug['size_of_heap_commit_32']['end'] = self._io.pos()
|
|
182
|
+
|
|
183
|
+
if self._parent.std.format == MicrosoftPe.PeFormat.pe32_plus:
|
|
184
|
+
self._debug['size_of_heap_commit_64']['start'] = self._io.pos()
|
|
185
|
+
self.size_of_heap_commit_64 = self._io.read_u8le()
|
|
186
|
+
self._debug['size_of_heap_commit_64']['end'] = self._io.pos()
|
|
187
|
+
|
|
188
|
+
self._debug['loader_flags']['start'] = self._io.pos()
|
|
189
|
+
self.loader_flags = self._io.read_u4le()
|
|
190
|
+
self._debug['loader_flags']['end'] = self._io.pos()
|
|
191
|
+
self._debug['number_of_rva_and_sizes']['start'] = self._io.pos()
|
|
192
|
+
self.number_of_rva_and_sizes = self._io.read_u4le()
|
|
193
|
+
self._debug['number_of_rva_and_sizes']['end'] = self._io.pos()
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
class OptionalHeaderDataDirs(KaitaiStruct):
|
|
197
|
+
SEQ_FIELDS = ["export_table", "import_table", "resource_table", "exception_table", "certificate_table", "base_relocation_table", "debug", "architecture", "global_ptr", "tls_table", "load_config_table", "bound_import", "iat", "delay_import_descriptor", "clr_runtime_header"]
|
|
198
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
199
|
+
self._io = _io
|
|
200
|
+
self._parent = _parent
|
|
201
|
+
self._root = _root if _root else self
|
|
202
|
+
self._debug = collections.defaultdict(dict)
|
|
203
|
+
|
|
204
|
+
def _read(self):
|
|
205
|
+
self._debug['export_table']['start'] = self._io.pos()
|
|
206
|
+
self.export_table = MicrosoftPe.DataDir(self._io, self, self._root)
|
|
207
|
+
self.export_table._read()
|
|
208
|
+
self._debug['export_table']['end'] = self._io.pos()
|
|
209
|
+
self._debug['import_table']['start'] = self._io.pos()
|
|
210
|
+
self.import_table = MicrosoftPe.DataDir(self._io, self, self._root)
|
|
211
|
+
self.import_table._read()
|
|
212
|
+
self._debug['import_table']['end'] = self._io.pos()
|
|
213
|
+
self._debug['resource_table']['start'] = self._io.pos()
|
|
214
|
+
self.resource_table = MicrosoftPe.DataDir(self._io, self, self._root)
|
|
215
|
+
self.resource_table._read()
|
|
216
|
+
self._debug['resource_table']['end'] = self._io.pos()
|
|
217
|
+
self._debug['exception_table']['start'] = self._io.pos()
|
|
218
|
+
self.exception_table = MicrosoftPe.DataDir(self._io, self, self._root)
|
|
219
|
+
self.exception_table._read()
|
|
220
|
+
self._debug['exception_table']['end'] = self._io.pos()
|
|
221
|
+
self._debug['certificate_table']['start'] = self._io.pos()
|
|
222
|
+
self.certificate_table = MicrosoftPe.DataDir(self._io, self, self._root)
|
|
223
|
+
self.certificate_table._read()
|
|
224
|
+
self._debug['certificate_table']['end'] = self._io.pos()
|
|
225
|
+
self._debug['base_relocation_table']['start'] = self._io.pos()
|
|
226
|
+
self.base_relocation_table = MicrosoftPe.DataDir(self._io, self, self._root)
|
|
227
|
+
self.base_relocation_table._read()
|
|
228
|
+
self._debug['base_relocation_table']['end'] = self._io.pos()
|
|
229
|
+
self._debug['debug']['start'] = self._io.pos()
|
|
230
|
+
self.debug = MicrosoftPe.DataDir(self._io, self, self._root)
|
|
231
|
+
self.debug._read()
|
|
232
|
+
self._debug['debug']['end'] = self._io.pos()
|
|
233
|
+
self._debug['architecture']['start'] = self._io.pos()
|
|
234
|
+
self.architecture = MicrosoftPe.DataDir(self._io, self, self._root)
|
|
235
|
+
self.architecture._read()
|
|
236
|
+
self._debug['architecture']['end'] = self._io.pos()
|
|
237
|
+
self._debug['global_ptr']['start'] = self._io.pos()
|
|
238
|
+
self.global_ptr = MicrosoftPe.DataDir(self._io, self, self._root)
|
|
239
|
+
self.global_ptr._read()
|
|
240
|
+
self._debug['global_ptr']['end'] = self._io.pos()
|
|
241
|
+
self._debug['tls_table']['start'] = self._io.pos()
|
|
242
|
+
self.tls_table = MicrosoftPe.DataDir(self._io, self, self._root)
|
|
243
|
+
self.tls_table._read()
|
|
244
|
+
self._debug['tls_table']['end'] = self._io.pos()
|
|
245
|
+
self._debug['load_config_table']['start'] = self._io.pos()
|
|
246
|
+
self.load_config_table = MicrosoftPe.DataDir(self._io, self, self._root)
|
|
247
|
+
self.load_config_table._read()
|
|
248
|
+
self._debug['load_config_table']['end'] = self._io.pos()
|
|
249
|
+
self._debug['bound_import']['start'] = self._io.pos()
|
|
250
|
+
self.bound_import = MicrosoftPe.DataDir(self._io, self, self._root)
|
|
251
|
+
self.bound_import._read()
|
|
252
|
+
self._debug['bound_import']['end'] = self._io.pos()
|
|
253
|
+
self._debug['iat']['start'] = self._io.pos()
|
|
254
|
+
self.iat = MicrosoftPe.DataDir(self._io, self, self._root)
|
|
255
|
+
self.iat._read()
|
|
256
|
+
self._debug['iat']['end'] = self._io.pos()
|
|
257
|
+
self._debug['delay_import_descriptor']['start'] = self._io.pos()
|
|
258
|
+
self.delay_import_descriptor = MicrosoftPe.DataDir(self._io, self, self._root)
|
|
259
|
+
self.delay_import_descriptor._read()
|
|
260
|
+
self._debug['delay_import_descriptor']['end'] = self._io.pos()
|
|
261
|
+
self._debug['clr_runtime_header']['start'] = self._io.pos()
|
|
262
|
+
self.clr_runtime_header = MicrosoftPe.DataDir(self._io, self, self._root)
|
|
263
|
+
self.clr_runtime_header._read()
|
|
264
|
+
self._debug['clr_runtime_header']['end'] = self._io.pos()
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
class DataDir(KaitaiStruct):
|
|
268
|
+
SEQ_FIELDS = ["virtual_address", "size"]
|
|
269
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
270
|
+
self._io = _io
|
|
271
|
+
self._parent = _parent
|
|
272
|
+
self._root = _root if _root else self
|
|
273
|
+
self._debug = collections.defaultdict(dict)
|
|
274
|
+
|
|
275
|
+
def _read(self):
|
|
276
|
+
self._debug['virtual_address']['start'] = self._io.pos()
|
|
277
|
+
self.virtual_address = self._io.read_u4le()
|
|
278
|
+
self._debug['virtual_address']['end'] = self._io.pos()
|
|
279
|
+
self._debug['size']['start'] = self._io.pos()
|
|
280
|
+
self.size = self._io.read_u4le()
|
|
281
|
+
self._debug['size']['end'] = self._io.pos()
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
class CoffSymbol(KaitaiStruct):
|
|
285
|
+
SEQ_FIELDS = ["name_annoying", "value", "section_number", "type", "storage_class", "number_of_aux_symbols"]
|
|
286
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
287
|
+
self._io = _io
|
|
288
|
+
self._parent = _parent
|
|
289
|
+
self._root = _root if _root else self
|
|
290
|
+
self._debug = collections.defaultdict(dict)
|
|
291
|
+
|
|
292
|
+
def _read(self):
|
|
293
|
+
self._debug['name_annoying']['start'] = self._io.pos()
|
|
294
|
+
self._raw_name_annoying = self._io.read_bytes(8)
|
|
295
|
+
_io__raw_name_annoying = KaitaiStream(BytesIO(self._raw_name_annoying))
|
|
296
|
+
self.name_annoying = MicrosoftPe.Annoyingstring(_io__raw_name_annoying, self, self._root)
|
|
297
|
+
self.name_annoying._read()
|
|
298
|
+
self._debug['name_annoying']['end'] = self._io.pos()
|
|
299
|
+
self._debug['value']['start'] = self._io.pos()
|
|
300
|
+
self.value = self._io.read_u4le()
|
|
301
|
+
self._debug['value']['end'] = self._io.pos()
|
|
302
|
+
self._debug['section_number']['start'] = self._io.pos()
|
|
303
|
+
self.section_number = self._io.read_u2le()
|
|
304
|
+
self._debug['section_number']['end'] = self._io.pos()
|
|
305
|
+
self._debug['type']['start'] = self._io.pos()
|
|
306
|
+
self.type = self._io.read_u2le()
|
|
307
|
+
self._debug['type']['end'] = self._io.pos()
|
|
308
|
+
self._debug['storage_class']['start'] = self._io.pos()
|
|
309
|
+
self.storage_class = self._io.read_u1()
|
|
310
|
+
self._debug['storage_class']['end'] = self._io.pos()
|
|
311
|
+
self._debug['number_of_aux_symbols']['start'] = self._io.pos()
|
|
312
|
+
self.number_of_aux_symbols = self._io.read_u1()
|
|
313
|
+
self._debug['number_of_aux_symbols']['end'] = self._io.pos()
|
|
314
|
+
|
|
315
|
+
@property
|
|
316
|
+
def section(self):
|
|
317
|
+
if hasattr(self, '_m_section'):
|
|
318
|
+
return self._m_section if hasattr(self, '_m_section') else None
|
|
319
|
+
|
|
320
|
+
self._m_section = self._root.pe.sections[(self.section_number - 1)]
|
|
321
|
+
return self._m_section if hasattr(self, '_m_section') else None
|
|
322
|
+
|
|
323
|
+
@property
|
|
324
|
+
def data(self):
|
|
325
|
+
if hasattr(self, '_m_data'):
|
|
326
|
+
return self._m_data if hasattr(self, '_m_data') else None
|
|
327
|
+
|
|
328
|
+
_pos = self._io.pos()
|
|
329
|
+
self._io.seek((self.section.pointer_to_raw_data + self.value))
|
|
330
|
+
self._debug['_m_data']['start'] = self._io.pos()
|
|
331
|
+
self._m_data = self._io.read_bytes(1)
|
|
332
|
+
self._debug['_m_data']['end'] = self._io.pos()
|
|
333
|
+
self._io.seek(_pos)
|
|
334
|
+
return self._m_data if hasattr(self, '_m_data') else None
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
class PeHeader(KaitaiStruct):
|
|
338
|
+
SEQ_FIELDS = ["pe_signature", "coff_hdr", "optional_hdr", "sections"]
|
|
339
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
340
|
+
self._io = _io
|
|
341
|
+
self._parent = _parent
|
|
342
|
+
self._root = _root if _root else self
|
|
343
|
+
self._debug = collections.defaultdict(dict)
|
|
344
|
+
|
|
345
|
+
def _read(self):
|
|
346
|
+
self._debug['pe_signature']['start'] = self._io.pos()
|
|
347
|
+
self.pe_signature = self._io.read_bytes(4)
|
|
348
|
+
self._debug['pe_signature']['end'] = self._io.pos()
|
|
349
|
+
if not self.pe_signature == b"\x50\x45\x00\x00":
|
|
350
|
+
raise kaitaistruct.ValidationNotEqualError(b"\x50\x45\x00\x00", self.pe_signature, self._io, u"/types/pe_header/seq/0")
|
|
351
|
+
self._debug['coff_hdr']['start'] = self._io.pos()
|
|
352
|
+
self.coff_hdr = MicrosoftPe.CoffHeader(self._io, self, self._root)
|
|
353
|
+
self.coff_hdr._read()
|
|
354
|
+
self._debug['coff_hdr']['end'] = self._io.pos()
|
|
355
|
+
self._debug['optional_hdr']['start'] = self._io.pos()
|
|
356
|
+
self._raw_optional_hdr = self._io.read_bytes(self.coff_hdr.size_of_optional_header)
|
|
357
|
+
_io__raw_optional_hdr = KaitaiStream(BytesIO(self._raw_optional_hdr))
|
|
358
|
+
self.optional_hdr = MicrosoftPe.OptionalHeader(_io__raw_optional_hdr, self, self._root)
|
|
359
|
+
self.optional_hdr._read()
|
|
360
|
+
self._debug['optional_hdr']['end'] = self._io.pos()
|
|
361
|
+
self._debug['sections']['start'] = self._io.pos()
|
|
362
|
+
self.sections = [None] * (self.coff_hdr.number_of_sections)
|
|
363
|
+
for i in range(self.coff_hdr.number_of_sections):
|
|
364
|
+
if not 'arr' in self._debug['sections']:
|
|
365
|
+
self._debug['sections']['arr'] = []
|
|
366
|
+
self._debug['sections']['arr'].append({'start': self._io.pos()})
|
|
367
|
+
_t_sections = MicrosoftPe.Section(self._io, self, self._root)
|
|
368
|
+
_t_sections._read()
|
|
369
|
+
self.sections[i] = _t_sections
|
|
370
|
+
self._debug['sections']['arr'][i]['end'] = self._io.pos()
|
|
371
|
+
|
|
372
|
+
self._debug['sections']['end'] = self._io.pos()
|
|
373
|
+
|
|
374
|
+
@property
|
|
375
|
+
def certificate_table(self):
|
|
376
|
+
if hasattr(self, '_m_certificate_table'):
|
|
377
|
+
return self._m_certificate_table if hasattr(self, '_m_certificate_table') else None
|
|
378
|
+
|
|
379
|
+
if self.optional_hdr.data_dirs.certificate_table.virtual_address != 0:
|
|
380
|
+
_pos = self._io.pos()
|
|
381
|
+
self._io.seek(self.optional_hdr.data_dirs.certificate_table.virtual_address)
|
|
382
|
+
self._debug['_m_certificate_table']['start'] = self._io.pos()
|
|
383
|
+
self._raw__m_certificate_table = self._io.read_bytes(self.optional_hdr.data_dirs.certificate_table.size)
|
|
384
|
+
_io__raw__m_certificate_table = KaitaiStream(BytesIO(self._raw__m_certificate_table))
|
|
385
|
+
self._m_certificate_table = MicrosoftPe.CertificateTable(_io__raw__m_certificate_table, self, self._root)
|
|
386
|
+
self._m_certificate_table._read()
|
|
387
|
+
self._debug['_m_certificate_table']['end'] = self._io.pos()
|
|
388
|
+
self._io.seek(_pos)
|
|
389
|
+
|
|
390
|
+
return self._m_certificate_table if hasattr(self, '_m_certificate_table') else None
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
class OptionalHeader(KaitaiStruct):
|
|
394
|
+
SEQ_FIELDS = ["std", "windows", "data_dirs"]
|
|
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['std']['start'] = self._io.pos()
|
|
403
|
+
self.std = MicrosoftPe.OptionalHeaderStd(self._io, self, self._root)
|
|
404
|
+
self.std._read()
|
|
405
|
+
self._debug['std']['end'] = self._io.pos()
|
|
406
|
+
self._debug['windows']['start'] = self._io.pos()
|
|
407
|
+
self.windows = MicrosoftPe.OptionalHeaderWindows(self._io, self, self._root)
|
|
408
|
+
self.windows._read()
|
|
409
|
+
self._debug['windows']['end'] = self._io.pos()
|
|
410
|
+
self._debug['data_dirs']['start'] = self._io.pos()
|
|
411
|
+
self.data_dirs = MicrosoftPe.OptionalHeaderDataDirs(self._io, self, self._root)
|
|
412
|
+
self.data_dirs._read()
|
|
413
|
+
self._debug['data_dirs']['end'] = self._io.pos()
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
class Section(KaitaiStruct):
|
|
417
|
+
SEQ_FIELDS = ["name", "virtual_size", "virtual_address", "size_of_raw_data", "pointer_to_raw_data", "pointer_to_relocations", "pointer_to_linenumbers", "number_of_relocations", "number_of_linenumbers", "characteristics"]
|
|
418
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
419
|
+
self._io = _io
|
|
420
|
+
self._parent = _parent
|
|
421
|
+
self._root = _root if _root else self
|
|
422
|
+
self._debug = collections.defaultdict(dict)
|
|
423
|
+
|
|
424
|
+
def _read(self):
|
|
425
|
+
self._debug['name']['start'] = self._io.pos()
|
|
426
|
+
self.name = (KaitaiStream.bytes_strip_right(self._io.read_bytes(8), 0)).decode(u"UTF-8")
|
|
427
|
+
self._debug['name']['end'] = self._io.pos()
|
|
428
|
+
self._debug['virtual_size']['start'] = self._io.pos()
|
|
429
|
+
self.virtual_size = self._io.read_u4le()
|
|
430
|
+
self._debug['virtual_size']['end'] = self._io.pos()
|
|
431
|
+
self._debug['virtual_address']['start'] = self._io.pos()
|
|
432
|
+
self.virtual_address = self._io.read_u4le()
|
|
433
|
+
self._debug['virtual_address']['end'] = self._io.pos()
|
|
434
|
+
self._debug['size_of_raw_data']['start'] = self._io.pos()
|
|
435
|
+
self.size_of_raw_data = self._io.read_u4le()
|
|
436
|
+
self._debug['size_of_raw_data']['end'] = self._io.pos()
|
|
437
|
+
self._debug['pointer_to_raw_data']['start'] = self._io.pos()
|
|
438
|
+
self.pointer_to_raw_data = self._io.read_u4le()
|
|
439
|
+
self._debug['pointer_to_raw_data']['end'] = self._io.pos()
|
|
440
|
+
self._debug['pointer_to_relocations']['start'] = self._io.pos()
|
|
441
|
+
self.pointer_to_relocations = self._io.read_u4le()
|
|
442
|
+
self._debug['pointer_to_relocations']['end'] = self._io.pos()
|
|
443
|
+
self._debug['pointer_to_linenumbers']['start'] = self._io.pos()
|
|
444
|
+
self.pointer_to_linenumbers = self._io.read_u4le()
|
|
445
|
+
self._debug['pointer_to_linenumbers']['end'] = self._io.pos()
|
|
446
|
+
self._debug['number_of_relocations']['start'] = self._io.pos()
|
|
447
|
+
self.number_of_relocations = self._io.read_u2le()
|
|
448
|
+
self._debug['number_of_relocations']['end'] = self._io.pos()
|
|
449
|
+
self._debug['number_of_linenumbers']['start'] = self._io.pos()
|
|
450
|
+
self.number_of_linenumbers = self._io.read_u2le()
|
|
451
|
+
self._debug['number_of_linenumbers']['end'] = self._io.pos()
|
|
452
|
+
self._debug['characteristics']['start'] = self._io.pos()
|
|
453
|
+
self.characteristics = self._io.read_u4le()
|
|
454
|
+
self._debug['characteristics']['end'] = self._io.pos()
|
|
455
|
+
|
|
456
|
+
@property
|
|
457
|
+
def body(self):
|
|
458
|
+
if hasattr(self, '_m_body'):
|
|
459
|
+
return self._m_body if hasattr(self, '_m_body') else None
|
|
460
|
+
|
|
461
|
+
_pos = self._io.pos()
|
|
462
|
+
self._io.seek(self.pointer_to_raw_data)
|
|
463
|
+
self._debug['_m_body']['start'] = self._io.pos()
|
|
464
|
+
self._m_body = self._io.read_bytes(self.size_of_raw_data)
|
|
465
|
+
self._debug['_m_body']['end'] = self._io.pos()
|
|
466
|
+
self._io.seek(_pos)
|
|
467
|
+
return self._m_body if hasattr(self, '_m_body') else None
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
class CertificateTable(KaitaiStruct):
|
|
471
|
+
SEQ_FIELDS = ["items"]
|
|
472
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
473
|
+
self._io = _io
|
|
474
|
+
self._parent = _parent
|
|
475
|
+
self._root = _root if _root else self
|
|
476
|
+
self._debug = collections.defaultdict(dict)
|
|
477
|
+
|
|
478
|
+
def _read(self):
|
|
479
|
+
self._debug['items']['start'] = self._io.pos()
|
|
480
|
+
self.items = []
|
|
481
|
+
i = 0
|
|
482
|
+
while not self._io.is_eof():
|
|
483
|
+
if not 'arr' in self._debug['items']:
|
|
484
|
+
self._debug['items']['arr'] = []
|
|
485
|
+
self._debug['items']['arr'].append({'start': self._io.pos()})
|
|
486
|
+
_t_items = MicrosoftPe.CertificateEntry(self._io, self, self._root)
|
|
487
|
+
_t_items._read()
|
|
488
|
+
self.items.append(_t_items)
|
|
489
|
+
self._debug['items']['arr'][len(self.items) - 1]['end'] = self._io.pos()
|
|
490
|
+
i += 1
|
|
491
|
+
|
|
492
|
+
self._debug['items']['end'] = self._io.pos()
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
class MzPlaceholder(KaitaiStruct):
|
|
496
|
+
SEQ_FIELDS = ["magic", "data1", "ofs_pe"]
|
|
497
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
498
|
+
self._io = _io
|
|
499
|
+
self._parent = _parent
|
|
500
|
+
self._root = _root if _root else self
|
|
501
|
+
self._debug = collections.defaultdict(dict)
|
|
502
|
+
|
|
503
|
+
def _read(self):
|
|
504
|
+
self._debug['magic']['start'] = self._io.pos()
|
|
505
|
+
self.magic = self._io.read_bytes(2)
|
|
506
|
+
self._debug['magic']['end'] = self._io.pos()
|
|
507
|
+
if not self.magic == b"\x4D\x5A":
|
|
508
|
+
raise kaitaistruct.ValidationNotEqualError(b"\x4D\x5A", self.magic, self._io, u"/types/mz_placeholder/seq/0")
|
|
509
|
+
self._debug['data1']['start'] = self._io.pos()
|
|
510
|
+
self.data1 = self._io.read_bytes(58)
|
|
511
|
+
self._debug['data1']['end'] = self._io.pos()
|
|
512
|
+
self._debug['ofs_pe']['start'] = self._io.pos()
|
|
513
|
+
self.ofs_pe = self._io.read_u4le()
|
|
514
|
+
self._debug['ofs_pe']['end'] = self._io.pos()
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
class OptionalHeaderStd(KaitaiStruct):
|
|
518
|
+
SEQ_FIELDS = ["format", "major_linker_version", "minor_linker_version", "size_of_code", "size_of_initialized_data", "size_of_uninitialized_data", "address_of_entry_point", "base_of_code", "base_of_data"]
|
|
519
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
520
|
+
self._io = _io
|
|
521
|
+
self._parent = _parent
|
|
522
|
+
self._root = _root if _root else self
|
|
523
|
+
self._debug = collections.defaultdict(dict)
|
|
524
|
+
|
|
525
|
+
def _read(self):
|
|
526
|
+
self._debug['format']['start'] = self._io.pos()
|
|
527
|
+
self.format = KaitaiStream.resolve_enum(MicrosoftPe.PeFormat, self._io.read_u2le())
|
|
528
|
+
self._debug['format']['end'] = self._io.pos()
|
|
529
|
+
self._debug['major_linker_version']['start'] = self._io.pos()
|
|
530
|
+
self.major_linker_version = self._io.read_u1()
|
|
531
|
+
self._debug['major_linker_version']['end'] = self._io.pos()
|
|
532
|
+
self._debug['minor_linker_version']['start'] = self._io.pos()
|
|
533
|
+
self.minor_linker_version = self._io.read_u1()
|
|
534
|
+
self._debug['minor_linker_version']['end'] = self._io.pos()
|
|
535
|
+
self._debug['size_of_code']['start'] = self._io.pos()
|
|
536
|
+
self.size_of_code = self._io.read_u4le()
|
|
537
|
+
self._debug['size_of_code']['end'] = self._io.pos()
|
|
538
|
+
self._debug['size_of_initialized_data']['start'] = self._io.pos()
|
|
539
|
+
self.size_of_initialized_data = self._io.read_u4le()
|
|
540
|
+
self._debug['size_of_initialized_data']['end'] = self._io.pos()
|
|
541
|
+
self._debug['size_of_uninitialized_data']['start'] = self._io.pos()
|
|
542
|
+
self.size_of_uninitialized_data = self._io.read_u4le()
|
|
543
|
+
self._debug['size_of_uninitialized_data']['end'] = self._io.pos()
|
|
544
|
+
self._debug['address_of_entry_point']['start'] = self._io.pos()
|
|
545
|
+
self.address_of_entry_point = self._io.read_u4le()
|
|
546
|
+
self._debug['address_of_entry_point']['end'] = self._io.pos()
|
|
547
|
+
self._debug['base_of_code']['start'] = self._io.pos()
|
|
548
|
+
self.base_of_code = self._io.read_u4le()
|
|
549
|
+
self._debug['base_of_code']['end'] = self._io.pos()
|
|
550
|
+
if self.format == MicrosoftPe.PeFormat.pe32:
|
|
551
|
+
self._debug['base_of_data']['start'] = self._io.pos()
|
|
552
|
+
self.base_of_data = self._io.read_u4le()
|
|
553
|
+
self._debug['base_of_data']['end'] = self._io.pos()
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
class CoffHeader(KaitaiStruct):
|
|
558
|
+
"""
|
|
559
|
+
.. seealso::
|
|
560
|
+
3.3. COFF File Header (Object and Image)
|
|
561
|
+
"""
|
|
562
|
+
|
|
563
|
+
class MachineType(Enum):
|
|
564
|
+
unknown = 0
|
|
565
|
+
i386 = 332
|
|
566
|
+
r4000 = 358
|
|
567
|
+
wcemipsv2 = 361
|
|
568
|
+
alpha = 388
|
|
569
|
+
sh3 = 418
|
|
570
|
+
sh3dsp = 419
|
|
571
|
+
sh4 = 422
|
|
572
|
+
sh5 = 424
|
|
573
|
+
arm = 448
|
|
574
|
+
thumb = 450
|
|
575
|
+
armnt = 452
|
|
576
|
+
am33 = 467
|
|
577
|
+
powerpc = 496
|
|
578
|
+
powerpcfp = 497
|
|
579
|
+
ia64 = 512
|
|
580
|
+
mips16 = 614
|
|
581
|
+
mipsfpu = 870
|
|
582
|
+
mipsfpu16 = 1126
|
|
583
|
+
ebc = 3772
|
|
584
|
+
riscv32 = 20530
|
|
585
|
+
riscv64 = 20580
|
|
586
|
+
riscv128 = 20776
|
|
587
|
+
loongarch32 = 25138
|
|
588
|
+
loongarch64 = 25188
|
|
589
|
+
amd64 = 34404
|
|
590
|
+
m32r = 36929
|
|
591
|
+
arm64 = 43620
|
|
592
|
+
SEQ_FIELDS = ["machine", "number_of_sections", "time_date_stamp", "pointer_to_symbol_table", "number_of_symbols", "size_of_optional_header", "characteristics"]
|
|
593
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
594
|
+
self._io = _io
|
|
595
|
+
self._parent = _parent
|
|
596
|
+
self._root = _root if _root else self
|
|
597
|
+
self._debug = collections.defaultdict(dict)
|
|
598
|
+
|
|
599
|
+
def _read(self):
|
|
600
|
+
self._debug['machine']['start'] = self._io.pos()
|
|
601
|
+
self.machine = KaitaiStream.resolve_enum(MicrosoftPe.CoffHeader.MachineType, self._io.read_u2le())
|
|
602
|
+
self._debug['machine']['end'] = self._io.pos()
|
|
603
|
+
self._debug['number_of_sections']['start'] = self._io.pos()
|
|
604
|
+
self.number_of_sections = self._io.read_u2le()
|
|
605
|
+
self._debug['number_of_sections']['end'] = self._io.pos()
|
|
606
|
+
self._debug['time_date_stamp']['start'] = self._io.pos()
|
|
607
|
+
self.time_date_stamp = self._io.read_u4le()
|
|
608
|
+
self._debug['time_date_stamp']['end'] = self._io.pos()
|
|
609
|
+
self._debug['pointer_to_symbol_table']['start'] = self._io.pos()
|
|
610
|
+
self.pointer_to_symbol_table = self._io.read_u4le()
|
|
611
|
+
self._debug['pointer_to_symbol_table']['end'] = self._io.pos()
|
|
612
|
+
self._debug['number_of_symbols']['start'] = self._io.pos()
|
|
613
|
+
self.number_of_symbols = self._io.read_u4le()
|
|
614
|
+
self._debug['number_of_symbols']['end'] = self._io.pos()
|
|
615
|
+
self._debug['size_of_optional_header']['start'] = self._io.pos()
|
|
616
|
+
self.size_of_optional_header = self._io.read_u2le()
|
|
617
|
+
self._debug['size_of_optional_header']['end'] = self._io.pos()
|
|
618
|
+
self._debug['characteristics']['start'] = self._io.pos()
|
|
619
|
+
self.characteristics = self._io.read_u2le()
|
|
620
|
+
self._debug['characteristics']['end'] = self._io.pos()
|
|
621
|
+
|
|
622
|
+
@property
|
|
623
|
+
def symbol_table_size(self):
|
|
624
|
+
if hasattr(self, '_m_symbol_table_size'):
|
|
625
|
+
return self._m_symbol_table_size if hasattr(self, '_m_symbol_table_size') else None
|
|
626
|
+
|
|
627
|
+
self._m_symbol_table_size = (self.number_of_symbols * 18)
|
|
628
|
+
return self._m_symbol_table_size if hasattr(self, '_m_symbol_table_size') else None
|
|
629
|
+
|
|
630
|
+
@property
|
|
631
|
+
def symbol_name_table_offset(self):
|
|
632
|
+
if hasattr(self, '_m_symbol_name_table_offset'):
|
|
633
|
+
return self._m_symbol_name_table_offset if hasattr(self, '_m_symbol_name_table_offset') else None
|
|
634
|
+
|
|
635
|
+
self._m_symbol_name_table_offset = (self.pointer_to_symbol_table + self.symbol_table_size)
|
|
636
|
+
return self._m_symbol_name_table_offset if hasattr(self, '_m_symbol_name_table_offset') else None
|
|
637
|
+
|
|
638
|
+
@property
|
|
639
|
+
def symbol_name_table_size(self):
|
|
640
|
+
if hasattr(self, '_m_symbol_name_table_size'):
|
|
641
|
+
return self._m_symbol_name_table_size if hasattr(self, '_m_symbol_name_table_size') else None
|
|
642
|
+
|
|
643
|
+
_pos = self._io.pos()
|
|
644
|
+
self._io.seek(self.symbol_name_table_offset)
|
|
645
|
+
self._debug['_m_symbol_name_table_size']['start'] = self._io.pos()
|
|
646
|
+
self._m_symbol_name_table_size = self._io.read_u4le()
|
|
647
|
+
self._debug['_m_symbol_name_table_size']['end'] = self._io.pos()
|
|
648
|
+
self._io.seek(_pos)
|
|
649
|
+
return self._m_symbol_name_table_size if hasattr(self, '_m_symbol_name_table_size') else None
|
|
650
|
+
|
|
651
|
+
@property
|
|
652
|
+
def symbol_table(self):
|
|
653
|
+
if hasattr(self, '_m_symbol_table'):
|
|
654
|
+
return self._m_symbol_table if hasattr(self, '_m_symbol_table') else None
|
|
655
|
+
|
|
656
|
+
_pos = self._io.pos()
|
|
657
|
+
self._io.seek(self.pointer_to_symbol_table)
|
|
658
|
+
self._debug['_m_symbol_table']['start'] = self._io.pos()
|
|
659
|
+
self._m_symbol_table = [None] * (self.number_of_symbols)
|
|
660
|
+
for i in range(self.number_of_symbols):
|
|
661
|
+
if not 'arr' in self._debug['_m_symbol_table']:
|
|
662
|
+
self._debug['_m_symbol_table']['arr'] = []
|
|
663
|
+
self._debug['_m_symbol_table']['arr'].append({'start': self._io.pos()})
|
|
664
|
+
_t__m_symbol_table = MicrosoftPe.CoffSymbol(self._io, self, self._root)
|
|
665
|
+
_t__m_symbol_table._read()
|
|
666
|
+
self._m_symbol_table[i] = _t__m_symbol_table
|
|
667
|
+
self._debug['_m_symbol_table']['arr'][i]['end'] = self._io.pos()
|
|
668
|
+
|
|
669
|
+
self._debug['_m_symbol_table']['end'] = self._io.pos()
|
|
670
|
+
self._io.seek(_pos)
|
|
671
|
+
return self._m_symbol_table if hasattr(self, '_m_symbol_table') else None
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
class Annoyingstring(KaitaiStruct):
|
|
675
|
+
SEQ_FIELDS = []
|
|
676
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
677
|
+
self._io = _io
|
|
678
|
+
self._parent = _parent
|
|
679
|
+
self._root = _root if _root else self
|
|
680
|
+
self._debug = collections.defaultdict(dict)
|
|
681
|
+
|
|
682
|
+
def _read(self):
|
|
683
|
+
pass
|
|
684
|
+
|
|
685
|
+
@property
|
|
686
|
+
def name_from_offset(self):
|
|
687
|
+
if hasattr(self, '_m_name_from_offset'):
|
|
688
|
+
return self._m_name_from_offset if hasattr(self, '_m_name_from_offset') else None
|
|
689
|
+
|
|
690
|
+
if self.name_zeroes == 0:
|
|
691
|
+
io = self._root._io
|
|
692
|
+
_pos = io.pos()
|
|
693
|
+
io.seek(((self._parent._parent.symbol_name_table_offset + self.name_offset) if self.name_zeroes == 0 else 0))
|
|
694
|
+
self._debug['_m_name_from_offset']['start'] = io.pos()
|
|
695
|
+
self._m_name_from_offset = (io.read_bytes_term(0, False, True, False)).decode(u"ascii")
|
|
696
|
+
self._debug['_m_name_from_offset']['end'] = io.pos()
|
|
697
|
+
io.seek(_pos)
|
|
698
|
+
|
|
699
|
+
return self._m_name_from_offset if hasattr(self, '_m_name_from_offset') else None
|
|
700
|
+
|
|
701
|
+
@property
|
|
702
|
+
def name_offset(self):
|
|
703
|
+
if hasattr(self, '_m_name_offset'):
|
|
704
|
+
return self._m_name_offset if hasattr(self, '_m_name_offset') else None
|
|
705
|
+
|
|
706
|
+
_pos = self._io.pos()
|
|
707
|
+
self._io.seek(4)
|
|
708
|
+
self._debug['_m_name_offset']['start'] = self._io.pos()
|
|
709
|
+
self._m_name_offset = self._io.read_u4le()
|
|
710
|
+
self._debug['_m_name_offset']['end'] = self._io.pos()
|
|
711
|
+
self._io.seek(_pos)
|
|
712
|
+
return self._m_name_offset if hasattr(self, '_m_name_offset') else None
|
|
713
|
+
|
|
714
|
+
@property
|
|
715
|
+
def name(self):
|
|
716
|
+
if hasattr(self, '_m_name'):
|
|
717
|
+
return self._m_name if hasattr(self, '_m_name') else None
|
|
718
|
+
|
|
719
|
+
self._m_name = (self.name_from_offset if self.name_zeroes == 0 else self.name_from_short)
|
|
720
|
+
return self._m_name if hasattr(self, '_m_name') else None
|
|
721
|
+
|
|
722
|
+
@property
|
|
723
|
+
def name_zeroes(self):
|
|
724
|
+
if hasattr(self, '_m_name_zeroes'):
|
|
725
|
+
return self._m_name_zeroes if hasattr(self, '_m_name_zeroes') else None
|
|
726
|
+
|
|
727
|
+
_pos = self._io.pos()
|
|
728
|
+
self._io.seek(0)
|
|
729
|
+
self._debug['_m_name_zeroes']['start'] = self._io.pos()
|
|
730
|
+
self._m_name_zeroes = self._io.read_u4le()
|
|
731
|
+
self._debug['_m_name_zeroes']['end'] = self._io.pos()
|
|
732
|
+
self._io.seek(_pos)
|
|
733
|
+
return self._m_name_zeroes if hasattr(self, '_m_name_zeroes') else None
|
|
734
|
+
|
|
735
|
+
@property
|
|
736
|
+
def name_from_short(self):
|
|
737
|
+
if hasattr(self, '_m_name_from_short'):
|
|
738
|
+
return self._m_name_from_short if hasattr(self, '_m_name_from_short') else None
|
|
739
|
+
|
|
740
|
+
if self.name_zeroes != 0:
|
|
741
|
+
_pos = self._io.pos()
|
|
742
|
+
self._io.seek(0)
|
|
743
|
+
self._debug['_m_name_from_short']['start'] = self._io.pos()
|
|
744
|
+
self._m_name_from_short = (self._io.read_bytes_term(0, False, True, False)).decode(u"ascii")
|
|
745
|
+
self._debug['_m_name_from_short']['end'] = self._io.pos()
|
|
746
|
+
self._io.seek(_pos)
|
|
747
|
+
|
|
748
|
+
return self._m_name_from_short if hasattr(self, '_m_name_from_short') else None
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
@property
|
|
752
|
+
def pe(self):
|
|
753
|
+
if hasattr(self, '_m_pe'):
|
|
754
|
+
return self._m_pe if hasattr(self, '_m_pe') else None
|
|
755
|
+
|
|
756
|
+
_pos = self._io.pos()
|
|
757
|
+
self._io.seek(self.mz.ofs_pe)
|
|
758
|
+
self._debug['_m_pe']['start'] = self._io.pos()
|
|
759
|
+
self._m_pe = MicrosoftPe.PeHeader(self._io, self, self._root)
|
|
760
|
+
self._m_pe._read()
|
|
761
|
+
self._debug['_m_pe']['end'] = self._io.pos()
|
|
762
|
+
self._io.seek(_pos)
|
|
763
|
+
return self._m_pe if hasattr(self, '_m_pe') else None
|
|
764
|
+
|
|
765
|
+
|