Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libbs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "3.3.0"
__version__ = "3.3.1"


import logging
Expand Down
8 changes: 8 additions & 0 deletions libbs/api/decompiler_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,9 +1016,17 @@ def find_current_decompiler(force: str = None) -> Optional[str]:
return IDA_DECOMPILER
except Exception:
pass

try:
# for IDA 9 Beta
import ida
available.add(IDA_DECOMPILER)
except ImportError:
pass
try:
# for IDA 9+
import idapro
available.add(IDA_DECOMPILER)
except Exception:
pass

Expand Down
2 changes: 1 addition & 1 deletion libbs/decompilers/angr/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ def _headless_decompile(self, func):
if not func.normalized:
func.normalize()

return self.main_instance.project.analyses.Decompiler(func, cfg=self._cfg, flavor='pseudocode')
return self.main_instance.project.analyses.Decompiler(func, cfg=self._cfg, flavor='pseudocode', preset="full")

def _angr_management_decompile(self, func):
# recover direct pseudocode
Expand Down
7 changes: 6 additions & 1 deletion libbs/decompilers/ida/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@
pass

if not IDA_IS_INTERACTIVE:
import ida
try:
# IDA 9+
import idapro
except ImportError:
# IDA 9 Beta
import ida as idapro

import idc, idaapi, ida_kernwin, ida_hexrays, ida_funcs, \
ida_bytes, ida_idaapi, ida_typeinf, idautils, ida_kernwin, ida_segment
Expand Down
11 changes: 8 additions & 3 deletions libbs/decompilers/ida/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
if compat.IDA_IS_INTERACTIVE:
from . import ida_ui
else:
import ida
try:
# IDA 9+
import idapro
except ImportError:
# IDA 9 Beta
import ida as idapro

import idc
import idaapi
Expand Down Expand Up @@ -60,7 +65,7 @@ def _init_headless_components(self, *args, **kwargs):
This also means that this feature is only supported in IDA versions >= 9.0
"""
super()._init_headless_components(*args, **kwargs)
failure = ida.open_database(str(self.binary_path), True)
failure = idapro.open_database(str(self.binary_path), True)
if failure:
raise RuntimeError(f"Failed to open database {self.binary_path}")

Expand All @@ -69,7 +74,7 @@ def _deinit_headless_components(self):
This function deinitializes the headless functionality of IDA through idalib.
This also means that this feature is only supported in IDA versions >= 9.0
"""
ida.close_database(False)
idapro.close_database(False)

def _init_gui_hooks(self):
"""
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ urls = {Homepage = "https://github.com/binsync/libbs"}
requires-python = ">= 3.10"
dependencies = [
"toml",
"ply",
"pycparser",
"pycparser<3.0",
"setuptools",
"prompt_toolkit",
"tqdm",
Expand Down
7 changes: 5 additions & 2 deletions tests/test_decompilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@
_l = logging.getLogger(__name__)

def custom_load_ida(binary_path: Path, extra_args: list[str] | None = None, delete_old_idb=True) -> None:
import ida
idat_path = Path(ida.__file__).parent / "bin/idat64"
try:
import idapro
except ImportError:
import ida as idapro
idat_path = Path(idapro.__file__).parent / "bin/idat64"
assert idat_path.exists(), "IDA executable not found, this cannot run"

# first, assure no idb currently reside there
Expand Down