Njord0 / BNPyc

Binary ninja plugin for python compiled bytecode (pyc) disassembly
MIT License
29 stars 2 forks source link

Plug-in crashes on newest dev #1

Closed d0mnik closed 1 year ago

d0mnik commented 1 year ago

The plug-in crashes in the latest dev due to it being unable to open a BinaryView. Additionally, a NotImplementedError is raised when attempting to parse the byte code.

d0mnik commented 1 year ago

More information: On Windows, the bug appears to be in _set_temp_file where the file is deleted before the BinaryView could be opened. Adding delete=False to the tempfile constructor fixes the BinaryView issue, but does not fix the other errors:

Traceback (most recent call last):
  File "REDACTED\BinaryNinja\plugins\..\python\binaryninja\architecture.py", line 643, in _get_instruction_info
    info = self.get_instruction_info(buf.raw, addr)
  File "REDACTED\Binary Ninja\plugins\BNPyc\bnpyc\python.py", line 26, in get_instruction_info
    return self.disassembler.disasm(data, addr)
  File "REDACTED\Binary Ninja\plugins\BNPyc\bnpyc\disassembler.py", line 45, in disasm
    self.setup()
  File REDACTED\Binary Ninja\plugins\BNPyc\bnpyc\disassembler.py", line 40, in setup
    self.pycinfos: List[PycInfo] = self.bv.session_data['pycinfos']
KeyError: 'pycinfos'
Njord0 commented 1 year ago

Thanks for the report @d0minikkkk !

Issues should be fixed with commit 5a1fb82 (tested on 3.4.4183-dev), can you confirm so I can close the issue ?

d0mnik commented 1 year ago

works! thanks for the prompt update.