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,410 @@
|
|
|
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 dos_datetime
|
|
13
|
+
class Vfat(KaitaiStruct):
|
|
14
|
+
"""
|
|
15
|
+
.. seealso::
|
|
16
|
+
Source - https://download.microsoft.com/download/0/8/4/084c452b-b772-4fe5-89bb-a0cbf082286a/fatgen103.doc
|
|
17
|
+
"""
|
|
18
|
+
SEQ_FIELDS = ["boot_sector"]
|
|
19
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
20
|
+
self._io = _io
|
|
21
|
+
self._parent = _parent
|
|
22
|
+
self._root = _root if _root else self
|
|
23
|
+
self._debug = collections.defaultdict(dict)
|
|
24
|
+
|
|
25
|
+
def _read(self):
|
|
26
|
+
self._debug['boot_sector']['start'] = self._io.pos()
|
|
27
|
+
self.boot_sector = Vfat.BootSector(self._io, self, self._root)
|
|
28
|
+
self.boot_sector._read()
|
|
29
|
+
self._debug['boot_sector']['end'] = self._io.pos()
|
|
30
|
+
|
|
31
|
+
class ExtBiosParamBlockFat32(KaitaiStruct):
|
|
32
|
+
"""Extended BIOS Parameter Block for FAT32."""
|
|
33
|
+
SEQ_FIELDS = ["ls_per_fat", "has_active_fat", "reserved1", "active_fat_id", "reserved2", "fat_version", "root_dir_start_clus", "ls_fs_info", "boot_sectors_copy_start_ls", "reserved3", "phys_drive_num", "reserved4", "ext_boot_sign", "volume_id", "partition_volume_label", "fs_type_str"]
|
|
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['ls_per_fat']['start'] = self._io.pos()
|
|
42
|
+
self.ls_per_fat = self._io.read_u4le()
|
|
43
|
+
self._debug['ls_per_fat']['end'] = self._io.pos()
|
|
44
|
+
self._debug['has_active_fat']['start'] = self._io.pos()
|
|
45
|
+
self.has_active_fat = self._io.read_bits_int_le(1) != 0
|
|
46
|
+
self._debug['has_active_fat']['end'] = self._io.pos()
|
|
47
|
+
self._debug['reserved1']['start'] = self._io.pos()
|
|
48
|
+
self.reserved1 = self._io.read_bits_int_le(3)
|
|
49
|
+
self._debug['reserved1']['end'] = self._io.pos()
|
|
50
|
+
self._debug['active_fat_id']['start'] = self._io.pos()
|
|
51
|
+
self.active_fat_id = self._io.read_bits_int_le(4)
|
|
52
|
+
self._debug['active_fat_id']['end'] = self._io.pos()
|
|
53
|
+
self._io.align_to_byte()
|
|
54
|
+
self._debug['reserved2']['start'] = self._io.pos()
|
|
55
|
+
self.reserved2 = self._io.read_bytes(1)
|
|
56
|
+
self._debug['reserved2']['end'] = self._io.pos()
|
|
57
|
+
if not self.reserved2 == b"\x00":
|
|
58
|
+
raise kaitaistruct.ValidationNotEqualError(b"\x00", self.reserved2, self._io, u"/types/ext_bios_param_block_fat32/seq/4")
|
|
59
|
+
self._debug['fat_version']['start'] = self._io.pos()
|
|
60
|
+
self.fat_version = self._io.read_u2le()
|
|
61
|
+
self._debug['fat_version']['end'] = self._io.pos()
|
|
62
|
+
self._debug['root_dir_start_clus']['start'] = self._io.pos()
|
|
63
|
+
self.root_dir_start_clus = self._io.read_u4le()
|
|
64
|
+
self._debug['root_dir_start_clus']['end'] = self._io.pos()
|
|
65
|
+
self._debug['ls_fs_info']['start'] = self._io.pos()
|
|
66
|
+
self.ls_fs_info = self._io.read_u2le()
|
|
67
|
+
self._debug['ls_fs_info']['end'] = self._io.pos()
|
|
68
|
+
self._debug['boot_sectors_copy_start_ls']['start'] = self._io.pos()
|
|
69
|
+
self.boot_sectors_copy_start_ls = self._io.read_u2le()
|
|
70
|
+
self._debug['boot_sectors_copy_start_ls']['end'] = self._io.pos()
|
|
71
|
+
self._debug['reserved3']['start'] = self._io.pos()
|
|
72
|
+
self.reserved3 = self._io.read_bytes(12)
|
|
73
|
+
self._debug['reserved3']['end'] = self._io.pos()
|
|
74
|
+
self._debug['phys_drive_num']['start'] = self._io.pos()
|
|
75
|
+
self.phys_drive_num = self._io.read_u1()
|
|
76
|
+
self._debug['phys_drive_num']['end'] = self._io.pos()
|
|
77
|
+
self._debug['reserved4']['start'] = self._io.pos()
|
|
78
|
+
self.reserved4 = self._io.read_u1()
|
|
79
|
+
self._debug['reserved4']['end'] = self._io.pos()
|
|
80
|
+
self._debug['ext_boot_sign']['start'] = self._io.pos()
|
|
81
|
+
self.ext_boot_sign = self._io.read_u1()
|
|
82
|
+
self._debug['ext_boot_sign']['end'] = self._io.pos()
|
|
83
|
+
self._debug['volume_id']['start'] = self._io.pos()
|
|
84
|
+
self.volume_id = self._io.read_bytes(4)
|
|
85
|
+
self._debug['volume_id']['end'] = self._io.pos()
|
|
86
|
+
self._debug['partition_volume_label']['start'] = self._io.pos()
|
|
87
|
+
self.partition_volume_label = (KaitaiStream.bytes_strip_right(self._io.read_bytes(11), 32)).decode(u"ASCII")
|
|
88
|
+
self._debug['partition_volume_label']['end'] = self._io.pos()
|
|
89
|
+
self._debug['fs_type_str']['start'] = self._io.pos()
|
|
90
|
+
self.fs_type_str = (KaitaiStream.bytes_strip_right(self._io.read_bytes(8), 32)).decode(u"ASCII")
|
|
91
|
+
self._debug['fs_type_str']['end'] = self._io.pos()
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class BootSector(KaitaiStruct):
|
|
95
|
+
SEQ_FIELDS = ["jmp_instruction", "oem_name", "bpb", "ebpb_fat16", "ebpb_fat32"]
|
|
96
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
97
|
+
self._io = _io
|
|
98
|
+
self._parent = _parent
|
|
99
|
+
self._root = _root if _root else self
|
|
100
|
+
self._debug = collections.defaultdict(dict)
|
|
101
|
+
|
|
102
|
+
def _read(self):
|
|
103
|
+
self._debug['jmp_instruction']['start'] = self._io.pos()
|
|
104
|
+
self.jmp_instruction = self._io.read_bytes(3)
|
|
105
|
+
self._debug['jmp_instruction']['end'] = self._io.pos()
|
|
106
|
+
self._debug['oem_name']['start'] = self._io.pos()
|
|
107
|
+
self.oem_name = (KaitaiStream.bytes_strip_right(self._io.read_bytes(8), 32)).decode(u"ASCII")
|
|
108
|
+
self._debug['oem_name']['end'] = self._io.pos()
|
|
109
|
+
self._debug['bpb']['start'] = self._io.pos()
|
|
110
|
+
self.bpb = Vfat.BiosParamBlock(self._io, self, self._root)
|
|
111
|
+
self.bpb._read()
|
|
112
|
+
self._debug['bpb']['end'] = self._io.pos()
|
|
113
|
+
if not (self.is_fat32):
|
|
114
|
+
self._debug['ebpb_fat16']['start'] = self._io.pos()
|
|
115
|
+
self.ebpb_fat16 = Vfat.ExtBiosParamBlockFat16(self._io, self, self._root)
|
|
116
|
+
self.ebpb_fat16._read()
|
|
117
|
+
self._debug['ebpb_fat16']['end'] = self._io.pos()
|
|
118
|
+
|
|
119
|
+
if self.is_fat32:
|
|
120
|
+
self._debug['ebpb_fat32']['start'] = self._io.pos()
|
|
121
|
+
self.ebpb_fat32 = Vfat.ExtBiosParamBlockFat32(self._io, self, self._root)
|
|
122
|
+
self.ebpb_fat32._read()
|
|
123
|
+
self._debug['ebpb_fat32']['end'] = self._io.pos()
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
@property
|
|
127
|
+
def pos_fats(self):
|
|
128
|
+
"""Offset of FATs in bytes from start of filesystem."""
|
|
129
|
+
if hasattr(self, '_m_pos_fats'):
|
|
130
|
+
return self._m_pos_fats if hasattr(self, '_m_pos_fats') else None
|
|
131
|
+
|
|
132
|
+
self._m_pos_fats = (self.bpb.bytes_per_ls * self.bpb.num_reserved_ls)
|
|
133
|
+
return self._m_pos_fats if hasattr(self, '_m_pos_fats') else None
|
|
134
|
+
|
|
135
|
+
@property
|
|
136
|
+
def ls_per_fat(self):
|
|
137
|
+
if hasattr(self, '_m_ls_per_fat'):
|
|
138
|
+
return self._m_ls_per_fat if hasattr(self, '_m_ls_per_fat') else None
|
|
139
|
+
|
|
140
|
+
self._m_ls_per_fat = (self.ebpb_fat32.ls_per_fat if self.is_fat32 else self.bpb.ls_per_fat)
|
|
141
|
+
return self._m_ls_per_fat if hasattr(self, '_m_ls_per_fat') else None
|
|
142
|
+
|
|
143
|
+
@property
|
|
144
|
+
def ls_per_root_dir(self):
|
|
145
|
+
"""Size of root directory in logical sectors.
|
|
146
|
+
|
|
147
|
+
.. seealso::
|
|
148
|
+
FAT: General Overview of On-Disk Format, section "FAT Data Structure"
|
|
149
|
+
"""
|
|
150
|
+
if hasattr(self, '_m_ls_per_root_dir'):
|
|
151
|
+
return self._m_ls_per_root_dir if hasattr(self, '_m_ls_per_root_dir') else None
|
|
152
|
+
|
|
153
|
+
self._m_ls_per_root_dir = (((self.bpb.max_root_dir_rec * 32) + self.bpb.bytes_per_ls) - 1) // self.bpb.bytes_per_ls
|
|
154
|
+
return self._m_ls_per_root_dir if hasattr(self, '_m_ls_per_root_dir') else None
|
|
155
|
+
|
|
156
|
+
@property
|
|
157
|
+
def is_fat32(self):
|
|
158
|
+
"""Determines if filesystem is FAT32 (true) or FAT12/16 (false)
|
|
159
|
+
by analyzing some preliminary conditions in BPB. Used to
|
|
160
|
+
determine whether we should parse post-BPB data as
|
|
161
|
+
`ext_bios_param_block_fat16` or `ext_bios_param_block_fat32`.
|
|
162
|
+
"""
|
|
163
|
+
if hasattr(self, '_m_is_fat32'):
|
|
164
|
+
return self._m_is_fat32 if hasattr(self, '_m_is_fat32') else None
|
|
165
|
+
|
|
166
|
+
self._m_is_fat32 = self.bpb.max_root_dir_rec == 0
|
|
167
|
+
return self._m_is_fat32 if hasattr(self, '_m_is_fat32') else None
|
|
168
|
+
|
|
169
|
+
@property
|
|
170
|
+
def size_fat(self):
|
|
171
|
+
"""Size of one FAT in bytes."""
|
|
172
|
+
if hasattr(self, '_m_size_fat'):
|
|
173
|
+
return self._m_size_fat if hasattr(self, '_m_size_fat') else None
|
|
174
|
+
|
|
175
|
+
self._m_size_fat = (self.bpb.bytes_per_ls * self.ls_per_fat)
|
|
176
|
+
return self._m_size_fat if hasattr(self, '_m_size_fat') else None
|
|
177
|
+
|
|
178
|
+
@property
|
|
179
|
+
def pos_root_dir(self):
|
|
180
|
+
"""Offset of root directory in bytes from start of filesystem."""
|
|
181
|
+
if hasattr(self, '_m_pos_root_dir'):
|
|
182
|
+
return self._m_pos_root_dir if hasattr(self, '_m_pos_root_dir') else None
|
|
183
|
+
|
|
184
|
+
self._m_pos_root_dir = (self.bpb.bytes_per_ls * (self.bpb.num_reserved_ls + (self.ls_per_fat * self.bpb.num_fats)))
|
|
185
|
+
return self._m_pos_root_dir if hasattr(self, '_m_pos_root_dir') else None
|
|
186
|
+
|
|
187
|
+
@property
|
|
188
|
+
def size_root_dir(self):
|
|
189
|
+
"""Size of root directory in bytes."""
|
|
190
|
+
if hasattr(self, '_m_size_root_dir'):
|
|
191
|
+
return self._m_size_root_dir if hasattr(self, '_m_size_root_dir') else None
|
|
192
|
+
|
|
193
|
+
self._m_size_root_dir = (self.ls_per_root_dir * self.bpb.bytes_per_ls)
|
|
194
|
+
return self._m_size_root_dir if hasattr(self, '_m_size_root_dir') else None
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
class BiosParamBlock(KaitaiStruct):
|
|
198
|
+
SEQ_FIELDS = ["bytes_per_ls", "ls_per_clus", "num_reserved_ls", "num_fats", "max_root_dir_rec", "total_ls_2", "media_code", "ls_per_fat", "ps_per_track", "num_heads", "num_hidden_sectors", "total_ls_4"]
|
|
199
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
200
|
+
self._io = _io
|
|
201
|
+
self._parent = _parent
|
|
202
|
+
self._root = _root if _root else self
|
|
203
|
+
self._debug = collections.defaultdict(dict)
|
|
204
|
+
|
|
205
|
+
def _read(self):
|
|
206
|
+
self._debug['bytes_per_ls']['start'] = self._io.pos()
|
|
207
|
+
self.bytes_per_ls = self._io.read_u2le()
|
|
208
|
+
self._debug['bytes_per_ls']['end'] = self._io.pos()
|
|
209
|
+
self._debug['ls_per_clus']['start'] = self._io.pos()
|
|
210
|
+
self.ls_per_clus = self._io.read_u1()
|
|
211
|
+
self._debug['ls_per_clus']['end'] = self._io.pos()
|
|
212
|
+
self._debug['num_reserved_ls']['start'] = self._io.pos()
|
|
213
|
+
self.num_reserved_ls = self._io.read_u2le()
|
|
214
|
+
self._debug['num_reserved_ls']['end'] = self._io.pos()
|
|
215
|
+
self._debug['num_fats']['start'] = self._io.pos()
|
|
216
|
+
self.num_fats = self._io.read_u1()
|
|
217
|
+
self._debug['num_fats']['end'] = self._io.pos()
|
|
218
|
+
self._debug['max_root_dir_rec']['start'] = self._io.pos()
|
|
219
|
+
self.max_root_dir_rec = self._io.read_u2le()
|
|
220
|
+
self._debug['max_root_dir_rec']['end'] = self._io.pos()
|
|
221
|
+
self._debug['total_ls_2']['start'] = self._io.pos()
|
|
222
|
+
self.total_ls_2 = self._io.read_u2le()
|
|
223
|
+
self._debug['total_ls_2']['end'] = self._io.pos()
|
|
224
|
+
self._debug['media_code']['start'] = self._io.pos()
|
|
225
|
+
self.media_code = self._io.read_u1()
|
|
226
|
+
self._debug['media_code']['end'] = self._io.pos()
|
|
227
|
+
self._debug['ls_per_fat']['start'] = self._io.pos()
|
|
228
|
+
self.ls_per_fat = self._io.read_u2le()
|
|
229
|
+
self._debug['ls_per_fat']['end'] = self._io.pos()
|
|
230
|
+
self._debug['ps_per_track']['start'] = self._io.pos()
|
|
231
|
+
self.ps_per_track = self._io.read_u2le()
|
|
232
|
+
self._debug['ps_per_track']['end'] = self._io.pos()
|
|
233
|
+
self._debug['num_heads']['start'] = self._io.pos()
|
|
234
|
+
self.num_heads = self._io.read_u2le()
|
|
235
|
+
self._debug['num_heads']['end'] = self._io.pos()
|
|
236
|
+
self._debug['num_hidden_sectors']['start'] = self._io.pos()
|
|
237
|
+
self.num_hidden_sectors = self._io.read_u4le()
|
|
238
|
+
self._debug['num_hidden_sectors']['end'] = self._io.pos()
|
|
239
|
+
self._debug['total_ls_4']['start'] = self._io.pos()
|
|
240
|
+
self.total_ls_4 = self._io.read_u4le()
|
|
241
|
+
self._debug['total_ls_4']['end'] = self._io.pos()
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
class RootDirectoryRec(KaitaiStruct):
|
|
245
|
+
SEQ_FIELDS = ["file_name", "attrs", "reserved", "last_write_time", "start_clus", "file_size"]
|
|
246
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
247
|
+
self._io = _io
|
|
248
|
+
self._parent = _parent
|
|
249
|
+
self._root = _root if _root else self
|
|
250
|
+
self._debug = collections.defaultdict(dict)
|
|
251
|
+
|
|
252
|
+
def _read(self):
|
|
253
|
+
self._debug['file_name']['start'] = self._io.pos()
|
|
254
|
+
self.file_name = self._io.read_bytes(11)
|
|
255
|
+
self._debug['file_name']['end'] = self._io.pos()
|
|
256
|
+
self._debug['attrs']['start'] = self._io.pos()
|
|
257
|
+
self._raw_attrs = self._io.read_bytes(1)
|
|
258
|
+
_io__raw_attrs = KaitaiStream(BytesIO(self._raw_attrs))
|
|
259
|
+
self.attrs = Vfat.RootDirectoryRec.AttrFlags(_io__raw_attrs, self, self._root)
|
|
260
|
+
self.attrs._read()
|
|
261
|
+
self._debug['attrs']['end'] = self._io.pos()
|
|
262
|
+
self._debug['reserved']['start'] = self._io.pos()
|
|
263
|
+
self.reserved = self._io.read_bytes(10)
|
|
264
|
+
self._debug['reserved']['end'] = self._io.pos()
|
|
265
|
+
self._debug['last_write_time']['start'] = self._io.pos()
|
|
266
|
+
self._raw_last_write_time = self._io.read_bytes(4)
|
|
267
|
+
_io__raw_last_write_time = KaitaiStream(BytesIO(self._raw_last_write_time))
|
|
268
|
+
self.last_write_time = dos_datetime.DosDatetime(_io__raw_last_write_time)
|
|
269
|
+
self.last_write_time._read()
|
|
270
|
+
self._debug['last_write_time']['end'] = self._io.pos()
|
|
271
|
+
self._debug['start_clus']['start'] = self._io.pos()
|
|
272
|
+
self.start_clus = self._io.read_u2le()
|
|
273
|
+
self._debug['start_clus']['end'] = self._io.pos()
|
|
274
|
+
self._debug['file_size']['start'] = self._io.pos()
|
|
275
|
+
self.file_size = self._io.read_u4le()
|
|
276
|
+
self._debug['file_size']['end'] = self._io.pos()
|
|
277
|
+
|
|
278
|
+
class AttrFlags(KaitaiStruct):
|
|
279
|
+
SEQ_FIELDS = ["read_only", "hidden", "system", "volume_id", "is_directory", "archive", "reserved"]
|
|
280
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
281
|
+
self._io = _io
|
|
282
|
+
self._parent = _parent
|
|
283
|
+
self._root = _root if _root else self
|
|
284
|
+
self._debug = collections.defaultdict(dict)
|
|
285
|
+
|
|
286
|
+
def _read(self):
|
|
287
|
+
self._debug['read_only']['start'] = self._io.pos()
|
|
288
|
+
self.read_only = self._io.read_bits_int_le(1) != 0
|
|
289
|
+
self._debug['read_only']['end'] = self._io.pos()
|
|
290
|
+
self._debug['hidden']['start'] = self._io.pos()
|
|
291
|
+
self.hidden = self._io.read_bits_int_le(1) != 0
|
|
292
|
+
self._debug['hidden']['end'] = self._io.pos()
|
|
293
|
+
self._debug['system']['start'] = self._io.pos()
|
|
294
|
+
self.system = self._io.read_bits_int_le(1) != 0
|
|
295
|
+
self._debug['system']['end'] = self._io.pos()
|
|
296
|
+
self._debug['volume_id']['start'] = self._io.pos()
|
|
297
|
+
self.volume_id = self._io.read_bits_int_le(1) != 0
|
|
298
|
+
self._debug['volume_id']['end'] = self._io.pos()
|
|
299
|
+
self._debug['is_directory']['start'] = self._io.pos()
|
|
300
|
+
self.is_directory = self._io.read_bits_int_le(1) != 0
|
|
301
|
+
self._debug['is_directory']['end'] = self._io.pos()
|
|
302
|
+
self._debug['archive']['start'] = self._io.pos()
|
|
303
|
+
self.archive = self._io.read_bits_int_le(1) != 0
|
|
304
|
+
self._debug['archive']['end'] = self._io.pos()
|
|
305
|
+
self._debug['reserved']['start'] = self._io.pos()
|
|
306
|
+
self.reserved = self._io.read_bits_int_le(2)
|
|
307
|
+
self._debug['reserved']['end'] = self._io.pos()
|
|
308
|
+
|
|
309
|
+
@property
|
|
310
|
+
def long_name(self):
|
|
311
|
+
if hasattr(self, '_m_long_name'):
|
|
312
|
+
return self._m_long_name if hasattr(self, '_m_long_name') else None
|
|
313
|
+
|
|
314
|
+
self._m_long_name = ((self.read_only) and (self.hidden) and (self.system) and (self.volume_id))
|
|
315
|
+
return self._m_long_name if hasattr(self, '_m_long_name') else None
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
class RootDirectory(KaitaiStruct):
|
|
320
|
+
SEQ_FIELDS = ["records"]
|
|
321
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
322
|
+
self._io = _io
|
|
323
|
+
self._parent = _parent
|
|
324
|
+
self._root = _root if _root else self
|
|
325
|
+
self._debug = collections.defaultdict(dict)
|
|
326
|
+
|
|
327
|
+
def _read(self):
|
|
328
|
+
self._debug['records']['start'] = self._io.pos()
|
|
329
|
+
self.records = [None] * (self._root.boot_sector.bpb.max_root_dir_rec)
|
|
330
|
+
for i in range(self._root.boot_sector.bpb.max_root_dir_rec):
|
|
331
|
+
if not 'arr' in self._debug['records']:
|
|
332
|
+
self._debug['records']['arr'] = []
|
|
333
|
+
self._debug['records']['arr'].append({'start': self._io.pos()})
|
|
334
|
+
_t_records = Vfat.RootDirectoryRec(self._io, self, self._root)
|
|
335
|
+
_t_records._read()
|
|
336
|
+
self.records[i] = _t_records
|
|
337
|
+
self._debug['records']['arr'][i]['end'] = self._io.pos()
|
|
338
|
+
|
|
339
|
+
self._debug['records']['end'] = self._io.pos()
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
class ExtBiosParamBlockFat16(KaitaiStruct):
|
|
343
|
+
"""Extended BIOS Parameter Block (DOS 4.0+, OS/2 1.0+). Used only
|
|
344
|
+
for FAT12 and FAT16.
|
|
345
|
+
"""
|
|
346
|
+
SEQ_FIELDS = ["phys_drive_num", "reserved1", "ext_boot_sign", "volume_id", "partition_volume_label", "fs_type_str"]
|
|
347
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
348
|
+
self._io = _io
|
|
349
|
+
self._parent = _parent
|
|
350
|
+
self._root = _root if _root else self
|
|
351
|
+
self._debug = collections.defaultdict(dict)
|
|
352
|
+
|
|
353
|
+
def _read(self):
|
|
354
|
+
self._debug['phys_drive_num']['start'] = self._io.pos()
|
|
355
|
+
self.phys_drive_num = self._io.read_u1()
|
|
356
|
+
self._debug['phys_drive_num']['end'] = self._io.pos()
|
|
357
|
+
self._debug['reserved1']['start'] = self._io.pos()
|
|
358
|
+
self.reserved1 = self._io.read_u1()
|
|
359
|
+
self._debug['reserved1']['end'] = self._io.pos()
|
|
360
|
+
self._debug['ext_boot_sign']['start'] = self._io.pos()
|
|
361
|
+
self.ext_boot_sign = self._io.read_u1()
|
|
362
|
+
self._debug['ext_boot_sign']['end'] = self._io.pos()
|
|
363
|
+
self._debug['volume_id']['start'] = self._io.pos()
|
|
364
|
+
self.volume_id = self._io.read_bytes(4)
|
|
365
|
+
self._debug['volume_id']['end'] = self._io.pos()
|
|
366
|
+
self._debug['partition_volume_label']['start'] = self._io.pos()
|
|
367
|
+
self.partition_volume_label = (KaitaiStream.bytes_strip_right(self._io.read_bytes(11), 32)).decode(u"ASCII")
|
|
368
|
+
self._debug['partition_volume_label']['end'] = self._io.pos()
|
|
369
|
+
self._debug['fs_type_str']['start'] = self._io.pos()
|
|
370
|
+
self.fs_type_str = (KaitaiStream.bytes_strip_right(self._io.read_bytes(8), 32)).decode(u"ASCII")
|
|
371
|
+
self._debug['fs_type_str']['end'] = self._io.pos()
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
@property
|
|
375
|
+
def fats(self):
|
|
376
|
+
if hasattr(self, '_m_fats'):
|
|
377
|
+
return self._m_fats if hasattr(self, '_m_fats') else None
|
|
378
|
+
|
|
379
|
+
_pos = self._io.pos()
|
|
380
|
+
self._io.seek(self.boot_sector.pos_fats)
|
|
381
|
+
self._debug['_m_fats']['start'] = self._io.pos()
|
|
382
|
+
self._m_fats = [None] * (self.boot_sector.bpb.num_fats)
|
|
383
|
+
for i in range(self.boot_sector.bpb.num_fats):
|
|
384
|
+
if not 'arr' in self._debug['_m_fats']:
|
|
385
|
+
self._debug['_m_fats']['arr'] = []
|
|
386
|
+
self._debug['_m_fats']['arr'].append({'start': self._io.pos()})
|
|
387
|
+
self._m_fats[i] = self._io.read_bytes(self.boot_sector.size_fat)
|
|
388
|
+
self._debug['_m_fats']['arr'][i]['end'] = self._io.pos()
|
|
389
|
+
|
|
390
|
+
self._debug['_m_fats']['end'] = self._io.pos()
|
|
391
|
+
self._io.seek(_pos)
|
|
392
|
+
return self._m_fats if hasattr(self, '_m_fats') else None
|
|
393
|
+
|
|
394
|
+
@property
|
|
395
|
+
def root_dir(self):
|
|
396
|
+
if hasattr(self, '_m_root_dir'):
|
|
397
|
+
return self._m_root_dir if hasattr(self, '_m_root_dir') else None
|
|
398
|
+
|
|
399
|
+
_pos = self._io.pos()
|
|
400
|
+
self._io.seek(self.boot_sector.pos_root_dir)
|
|
401
|
+
self._debug['_m_root_dir']['start'] = self._io.pos()
|
|
402
|
+
self._raw__m_root_dir = self._io.read_bytes(self.boot_sector.size_root_dir)
|
|
403
|
+
_io__raw__m_root_dir = KaitaiStream(BytesIO(self._raw__m_root_dir))
|
|
404
|
+
self._m_root_dir = Vfat.RootDirectory(_io__raw__m_root_dir, self, self._root)
|
|
405
|
+
self._m_root_dir._read()
|
|
406
|
+
self._debug['_m_root_dir']['end'] = self._io.pos()
|
|
407
|
+
self._io.seek(_pos)
|
|
408
|
+
return self._m_root_dir if hasattr(self, '_m_root_dir') else None
|
|
409
|
+
|
|
410
|
+
|
|
@@ -0,0 +1,104 @@
|
|
|
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 VlqBase128Be(KaitaiStruct):
|
|
13
|
+
"""A variable-length unsigned integer using base128 encoding. 1-byte groups
|
|
14
|
+
consist of 1-bit flag of continuation and 7-bit value chunk, and are ordered
|
|
15
|
+
"most significant group first", i.e. in "big-endian" manner.
|
|
16
|
+
|
|
17
|
+
This particular encoding is specified and used in:
|
|
18
|
+
|
|
19
|
+
* Standard MIDI file format
|
|
20
|
+
* ASN.1 BER encoding
|
|
21
|
+
* RAR 5.0 file format
|
|
22
|
+
|
|
23
|
+
More information on this encoding is available at
|
|
24
|
+
<https://en.wikipedia.org/wiki/Variable-length_quantity>
|
|
25
|
+
|
|
26
|
+
This particular implementation supports serialized values to up 8 bytes long.
|
|
27
|
+
"""
|
|
28
|
+
SEQ_FIELDS = ["groups"]
|
|
29
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
30
|
+
self._io = _io
|
|
31
|
+
self._parent = _parent
|
|
32
|
+
self._root = _root if _root else self
|
|
33
|
+
self._debug = collections.defaultdict(dict)
|
|
34
|
+
|
|
35
|
+
def _read(self):
|
|
36
|
+
self._debug['groups']['start'] = self._io.pos()
|
|
37
|
+
self.groups = []
|
|
38
|
+
i = 0
|
|
39
|
+
while True:
|
|
40
|
+
if not 'arr' in self._debug['groups']:
|
|
41
|
+
self._debug['groups']['arr'] = []
|
|
42
|
+
self._debug['groups']['arr'].append({'start': self._io.pos()})
|
|
43
|
+
_t_groups = VlqBase128Be.Group(self._io, self, self._root)
|
|
44
|
+
_t_groups._read()
|
|
45
|
+
_ = _t_groups
|
|
46
|
+
self.groups.append(_)
|
|
47
|
+
self._debug['groups']['arr'][len(self.groups) - 1]['end'] = self._io.pos()
|
|
48
|
+
if not (_.has_next):
|
|
49
|
+
break
|
|
50
|
+
i += 1
|
|
51
|
+
self._debug['groups']['end'] = self._io.pos()
|
|
52
|
+
|
|
53
|
+
class Group(KaitaiStruct):
|
|
54
|
+
"""One byte group, clearly divided into 7-bit "value" chunk and 1-bit "continuation" flag.
|
|
55
|
+
"""
|
|
56
|
+
SEQ_FIELDS = ["b"]
|
|
57
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
58
|
+
self._io = _io
|
|
59
|
+
self._parent = _parent
|
|
60
|
+
self._root = _root if _root else self
|
|
61
|
+
self._debug = collections.defaultdict(dict)
|
|
62
|
+
|
|
63
|
+
def _read(self):
|
|
64
|
+
self._debug['b']['start'] = self._io.pos()
|
|
65
|
+
self.b = self._io.read_u1()
|
|
66
|
+
self._debug['b']['end'] = self._io.pos()
|
|
67
|
+
|
|
68
|
+
@property
|
|
69
|
+
def has_next(self):
|
|
70
|
+
"""If true, then we have more bytes to read."""
|
|
71
|
+
if hasattr(self, '_m_has_next'):
|
|
72
|
+
return self._m_has_next if hasattr(self, '_m_has_next') else None
|
|
73
|
+
|
|
74
|
+
self._m_has_next = (self.b & 128) != 0
|
|
75
|
+
return self._m_has_next if hasattr(self, '_m_has_next') else None
|
|
76
|
+
|
|
77
|
+
@property
|
|
78
|
+
def value(self):
|
|
79
|
+
"""The 7-bit (base128) numeric value chunk of this group."""
|
|
80
|
+
if hasattr(self, '_m_value'):
|
|
81
|
+
return self._m_value if hasattr(self, '_m_value') else None
|
|
82
|
+
|
|
83
|
+
self._m_value = (self.b & 127)
|
|
84
|
+
return self._m_value if hasattr(self, '_m_value') else None
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
@property
|
|
88
|
+
def last(self):
|
|
89
|
+
if hasattr(self, '_m_last'):
|
|
90
|
+
return self._m_last if hasattr(self, '_m_last') else None
|
|
91
|
+
|
|
92
|
+
self._m_last = (len(self.groups) - 1)
|
|
93
|
+
return self._m_last if hasattr(self, '_m_last') else None
|
|
94
|
+
|
|
95
|
+
@property
|
|
96
|
+
def value(self):
|
|
97
|
+
"""Resulting value as normal integer."""
|
|
98
|
+
if hasattr(self, '_m_value'):
|
|
99
|
+
return self._m_value if hasattr(self, '_m_value') else None
|
|
100
|
+
|
|
101
|
+
self._m_value = (((((((self.groups[self.last].value + ((self.groups[(self.last - 1)].value << 7) if self.last >= 1 else 0)) + ((self.groups[(self.last - 2)].value << 14) if self.last >= 2 else 0)) + ((self.groups[(self.last - 3)].value << 21) if self.last >= 3 else 0)) + ((self.groups[(self.last - 4)].value << 28) if self.last >= 4 else 0)) + ((self.groups[(self.last - 5)].value << 35) if self.last >= 5 else 0)) + ((self.groups[(self.last - 6)].value << 42) if self.last >= 6 else 0)) + ((self.groups[(self.last - 7)].value << 49) if self.last >= 7 else 0))
|
|
102
|
+
return self._m_value if hasattr(self, '_m_value') else None
|
|
103
|
+
|
|
104
|
+
|
|
@@ -0,0 +1,129 @@
|
|
|
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 VlqBase128Le(KaitaiStruct):
|
|
13
|
+
"""A variable-length unsigned/signed integer using base128 encoding. 1-byte groups
|
|
14
|
+
consist of 1-bit flag of continuation and 7-bit value chunk, and are ordered
|
|
15
|
+
"least significant group first", i.e. in "little-endian" manner.
|
|
16
|
+
|
|
17
|
+
This particular encoding is specified and used in:
|
|
18
|
+
|
|
19
|
+
* DWARF debug file format, where it's dubbed "unsigned LEB128" or "ULEB128".
|
|
20
|
+
<https://dwarfstd.org/doc/dwarf-2.0.0.pdf> - page 139
|
|
21
|
+
* Google Protocol Buffers, where it's called "Base 128 Varints".
|
|
22
|
+
<https://protobuf.dev/programming-guides/encoding/#varints>
|
|
23
|
+
* Apache Lucene, where it's called "VInt"
|
|
24
|
+
<https://lucene.apache.org/core/3_5_0/fileformats.html#VInt>
|
|
25
|
+
* Apache Avro uses this as a basis for integer encoding, adding ZigZag on
|
|
26
|
+
top of it for signed ints
|
|
27
|
+
<https://avro.apache.org/docs/current/spec.html#binary_encode_primitive>
|
|
28
|
+
|
|
29
|
+
More information on this encoding is available at <https://en.wikipedia.org/wiki/LEB128>
|
|
30
|
+
|
|
31
|
+
This particular implementation supports serialized values to up 8 bytes long.
|
|
32
|
+
"""
|
|
33
|
+
SEQ_FIELDS = ["groups"]
|
|
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['groups']['start'] = self._io.pos()
|
|
42
|
+
self.groups = []
|
|
43
|
+
i = 0
|
|
44
|
+
while True:
|
|
45
|
+
if not 'arr' in self._debug['groups']:
|
|
46
|
+
self._debug['groups']['arr'] = []
|
|
47
|
+
self._debug['groups']['arr'].append({'start': self._io.pos()})
|
|
48
|
+
_t_groups = VlqBase128Le.Group(self._io, self, self._root)
|
|
49
|
+
_t_groups._read()
|
|
50
|
+
_ = _t_groups
|
|
51
|
+
self.groups.append(_)
|
|
52
|
+
self._debug['groups']['arr'][len(self.groups) - 1]['end'] = self._io.pos()
|
|
53
|
+
if not (_.has_next):
|
|
54
|
+
break
|
|
55
|
+
i += 1
|
|
56
|
+
self._debug['groups']['end'] = self._io.pos()
|
|
57
|
+
|
|
58
|
+
class Group(KaitaiStruct):
|
|
59
|
+
"""One byte group, clearly divided into 7-bit "value" chunk and 1-bit "continuation" flag.
|
|
60
|
+
"""
|
|
61
|
+
SEQ_FIELDS = ["b"]
|
|
62
|
+
def __init__(self, _io, _parent=None, _root=None):
|
|
63
|
+
self._io = _io
|
|
64
|
+
self._parent = _parent
|
|
65
|
+
self._root = _root if _root else self
|
|
66
|
+
self._debug = collections.defaultdict(dict)
|
|
67
|
+
|
|
68
|
+
def _read(self):
|
|
69
|
+
self._debug['b']['start'] = self._io.pos()
|
|
70
|
+
self.b = self._io.read_u1()
|
|
71
|
+
self._debug['b']['end'] = self._io.pos()
|
|
72
|
+
|
|
73
|
+
@property
|
|
74
|
+
def has_next(self):
|
|
75
|
+
"""If true, then we have more bytes to read."""
|
|
76
|
+
if hasattr(self, '_m_has_next'):
|
|
77
|
+
return self._m_has_next if hasattr(self, '_m_has_next') else None
|
|
78
|
+
|
|
79
|
+
self._m_has_next = (self.b & 128) != 0
|
|
80
|
+
return self._m_has_next if hasattr(self, '_m_has_next') else None
|
|
81
|
+
|
|
82
|
+
@property
|
|
83
|
+
def value(self):
|
|
84
|
+
"""The 7-bit (base128) numeric value chunk of this group."""
|
|
85
|
+
if hasattr(self, '_m_value'):
|
|
86
|
+
return self._m_value if hasattr(self, '_m_value') else None
|
|
87
|
+
|
|
88
|
+
self._m_value = (self.b & 127)
|
|
89
|
+
return self._m_value if hasattr(self, '_m_value') else None
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
@property
|
|
93
|
+
def len(self):
|
|
94
|
+
if hasattr(self, '_m_len'):
|
|
95
|
+
return self._m_len if hasattr(self, '_m_len') else None
|
|
96
|
+
|
|
97
|
+
self._m_len = len(self.groups)
|
|
98
|
+
return self._m_len if hasattr(self, '_m_len') else None
|
|
99
|
+
|
|
100
|
+
@property
|
|
101
|
+
def value(self):
|
|
102
|
+
"""Resulting unsigned value as normal integer."""
|
|
103
|
+
if hasattr(self, '_m_value'):
|
|
104
|
+
return self._m_value if hasattr(self, '_m_value') else None
|
|
105
|
+
|
|
106
|
+
self._m_value = (((((((self.groups[0].value + ((self.groups[1].value << 7) if self.len >= 2 else 0)) + ((self.groups[2].value << 14) if self.len >= 3 else 0)) + ((self.groups[3].value << 21) if self.len >= 4 else 0)) + ((self.groups[4].value << 28) if self.len >= 5 else 0)) + ((self.groups[5].value << 35) if self.len >= 6 else 0)) + ((self.groups[6].value << 42) if self.len >= 7 else 0)) + ((self.groups[7].value << 49) if self.len >= 8 else 0))
|
|
107
|
+
return self._m_value if hasattr(self, '_m_value') else None
|
|
108
|
+
|
|
109
|
+
@property
|
|
110
|
+
def sign_bit(self):
|
|
111
|
+
if hasattr(self, '_m_sign_bit'):
|
|
112
|
+
return self._m_sign_bit if hasattr(self, '_m_sign_bit') else None
|
|
113
|
+
|
|
114
|
+
self._m_sign_bit = (1 << ((7 * self.len) - 1))
|
|
115
|
+
return self._m_sign_bit if hasattr(self, '_m_sign_bit') else None
|
|
116
|
+
|
|
117
|
+
@property
|
|
118
|
+
def value_signed(self):
|
|
119
|
+
"""
|
|
120
|
+
.. seealso::
|
|
121
|
+
Source - https://graphics.stanford.edu/~seander/bithacks.html#VariableSignExtend
|
|
122
|
+
"""
|
|
123
|
+
if hasattr(self, '_m_value_signed'):
|
|
124
|
+
return self._m_value_signed if hasattr(self, '_m_value_signed') else None
|
|
125
|
+
|
|
126
|
+
self._m_value_signed = ((self.value ^ self.sign_bit) - self.sign_bit)
|
|
127
|
+
return self._m_value_signed if hasattr(self, '_m_value_signed') else None
|
|
128
|
+
|
|
129
|
+
|