Mahlet-Inc / hobbits

A multi-platform GUI for bit-based analysis, processing, and visualization
https://mahlet-inc.github.io
MIT License
660 stars 45 forks source link

ModuleNotFoundError: No module named 'vlq_base128_le' #132

Closed ehrenb closed 2 years ago

ehrenb commented 2 years ago

When running the hobbits GUI and opening a classes.dex file and applying the Kaitai Struct Dex parser, I get the following error popup:

Analyzer Plugin Error: Plugin 'Kaitai Struct' reported an error with its processing: Failure Running parser in Python:
Python stderr:
Traceback (most recent call last):
  File "/tmp/HobbitsPythonJXpUia/thescript.py", line 162, in parse_data
    struct_module = importlib.__import__(package_name, fromlist=[class_name])
  File "<frozen importlib._bootstrap>", line 1109, in __import__
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/tmp/hobbits-nggZfm/dex.py", line 13, in <module>
    import vlq_base128_le
ModuleNotFoundError: No module named 'vlq_base128_le'

I believe this is because the Dex parser yaml has an import 'vlq_base128_le':

https://formats.kaitai.io/dex/index.html :

meta:
  id: dex
  title: Android Dalvik VM executable (dex)
  file-extension: dex
  xref:
    pronom: fmt/694
    wikidata: Q29000585
  tags:
    - android
    - executable
  license: Apache-2.0
  imports:
    - /common/vlq_base128_le
...

My guess is that this occurs because 'vlq_base128_le.py' does not get pulled into the tmp directory. When listing files in one of the temp directories after attempting to use the Dex parser, I see the following structure:

cd /tmp
tree hobbits-BEeLZN
├── dex.py
├── input_bit_container.bits
├── parsed_ranges.json
├── __pycache__
│   └── dex.cpython-39.pyc
└── pydeps
    └── kaitaistruct.py

I have tested on both v0.51.1 and v0.52.0 and get the same results. I am able to use other Kaitai parsers, such as ELF which has no import (http://formats.kaitai.io/elf/) just fine without error.

hello-adam commented 2 years ago

Yeah, I think there's issues with the parsers importing each other. I need to revamp that a little bit. I should be able to sit down with this within a few weeks.

hello-adam commented 2 years ago

This might be fixed in 0.53.1 - I was able to get wav (which imports riff) to work