From 6ba0b0da6edf0403820700d7b1b4e6da8a349e89 Mon Sep 17 00:00:00 2001 From: Zion Leonahenahe Basque Date: Wed, 29 Nov 2023 13:57:49 -0700 Subject: [PATCH] Rename to LibBS (#8) * Initial Rename * Initial Rename * Update setup * bump --- README.md | 17 +++--- libbs/__init__.py | 1 + {yodalib => libbs}/__main__.py | 16 ++--- {yodalib => libbs}/api/__init__.py | 0 {yodalib => libbs}/api/artifact_dict.py | 2 +- {yodalib => libbs}/api/artifact_lifter.py | 4 +- .../api/decompiler_interface.py | 58 +++++++++---------- {yodalib => libbs}/api/type_parser.py | 0 {yodalib => libbs}/data/__init__.py | 0 {yodalib => libbs}/data/artifacts/__init__.py | 0 {yodalib => libbs}/data/artifacts/artifact.py | 0 {yodalib => libbs}/data/artifacts/comment.py | 0 .../data/artifacts/decompilation.py | 0 {yodalib => libbs}/data/artifacts/enum.py | 0 {yodalib => libbs}/data/artifacts/func.py | 0 .../data/artifacts/global_variable.py | 0 {yodalib => libbs}/data/artifacts/patch.py | 0 .../data/artifacts/stack_variable.py | 0 {yodalib => libbs}/data/artifacts/struct.py | 0 {yodalib => libbs}/data/state.py | 4 +- .../decompiler_stubs/__init__.py | 0 libbs/decompiler_stubs/angr_libbs/__init__.py | 4 ++ .../decompiler_stubs/angr_libbs}/plugin.toml | 4 +- .../decompiler_stubs/binja_libbs}/README.md | 4 +- .../decompiler_stubs/binja_libbs/__init__.py | 4 ++ .../decompiler_stubs/binja_libbs}/plugin.json | 12 ++-- .../binja_libbs/requirements.txt | 1 + .../ghidra_libbs/ghidra_libbs.py | 17 ++++++ .../ghidra_libbs/ghidra_libbs_shutdown.py | 15 +++++ .../ghidra_libbs/libbs_vendored}/__init__.py | 0 .../libbs_vendored}/ghidra_bridge_port.py | 0 .../libbs_vendored}/ghidra_bridge_server.py | 0 .../libbs_vendored}/jfx_bridge/__init__.py | 0 .../libbs_vendored}/jfx_bridge/bridge.py | 0 libbs/decompiler_stubs/ida_libbs.py | 8 +++ {yodalib => libbs}/decompilers/__init__.py | 2 +- .../decompilers/angr/__init__.py | 0 .../decompilers/angr/artifact_lifter.py | 2 +- .../decompilers/angr/interface.py | 8 +-- {yodalib => libbs}/decompilers/angr/plugin.py | 6 +- .../decompilers/binja/__init__.py | 0 .../decompilers/binja/artifact_lifter.py | 2 +- {yodalib => libbs}/decompilers/binja/hooks.py | 2 +- .../decompilers/binja/interface.py | 14 ++--- .../decompilers/ghidra/README.md | 0 .../decompilers/ghidra/__init__.py | 0 .../decompilers/ghidra/artifact_lifter.py | 2 +- .../decompilers/ghidra/ghidra_api.py | 0 {yodalib => libbs}/decompilers/ghidra/gui.py | 8 +-- .../decompilers/ghidra/interface.py | 8 +-- .../decompilers/ida/__init__.py | 0 .../decompilers/ida/artifact_lifter.py | 2 +- {yodalib => libbs}/decompilers/ida/compat.py | 30 +++++----- {yodalib => libbs}/decompilers/ida/hooks.py | 44 +++++++------- .../decompilers/ida/interface.py | 18 +++--- {yodalib => libbs}/logger.py | 6 +- {yodalib => libbs}/plugin_installer.py | 38 ++++++------ {yodalib => libbs}/ui/__init__.py | 4 +- {yodalib => libbs}/ui/qt_objects.py | 2 +- {yodalib => libbs}/ui/utils.py | 2 +- {yodalib => libbs}/ui/version.py | 0 setup.cfg | 10 ++-- yodalib/__init__.py | 1 - .../decompiler_stubs/angr_yodalib/__init__.py | 4 -- .../binja_yodalib/__init__.py | 4 -- .../binja_yodalib/requirements.txt | 1 - .../ghidra_yodalib/ghidra_yodalib.py | 17 ------ .../ghidra_yodalib/ghidra_yodalib_shutdown.py | 15 ----- yodalib/decompiler_stubs/ida_yodalib.py | 8 --- 69 files changed, 215 insertions(+), 216 deletions(-) create mode 100644 libbs/__init__.py rename {yodalib => libbs}/__main__.py (69%) rename {yodalib => libbs}/api/__init__.py (100%) rename {yodalib => libbs}/api/artifact_dict.py (98%) rename {yodalib => libbs}/api/artifact_lifter.py (96%) rename {yodalib => libbs}/api/decompiler_interface.py (90%) rename {yodalib => libbs}/api/type_parser.py (100%) rename {yodalib => libbs}/data/__init__.py (100%) rename {yodalib => libbs}/data/artifacts/__init__.py (100%) rename {yodalib => libbs}/data/artifacts/artifact.py (100%) rename {yodalib => libbs}/data/artifacts/comment.py (100%) rename {yodalib => libbs}/data/artifacts/decompilation.py (100%) rename {yodalib => libbs}/data/artifacts/enum.py (100%) rename {yodalib => libbs}/data/artifacts/func.py (100%) rename {yodalib => libbs}/data/artifacts/global_variable.py (100%) rename {yodalib => libbs}/data/artifacts/patch.py (100%) rename {yodalib => libbs}/data/artifacts/stack_variable.py (100%) rename {yodalib => libbs}/data/artifacts/struct.py (100%) rename {yodalib => libbs}/data/state.py (99%) rename {yodalib => libbs}/decompiler_stubs/__init__.py (100%) create mode 100644 libbs/decompiler_stubs/angr_libbs/__init__.py rename {yodalib/decompiler_stubs/angr_yodalib => libbs/decompiler_stubs/angr_libbs}/plugin.toml (85%) rename {yodalib/decompiler_stubs/binja_yodalib => libbs/decompiler_stubs/binja_libbs}/README.md (77%) create mode 100644 libbs/decompiler_stubs/binja_libbs/__init__.py rename {yodalib/decompiler_stubs/binja_yodalib => libbs/decompiler_stubs/binja_libbs}/plugin.json (76%) create mode 100644 libbs/decompiler_stubs/binja_libbs/requirements.txt create mode 100644 libbs/decompiler_stubs/ghidra_libbs/ghidra_libbs.py create mode 100644 libbs/decompiler_stubs/ghidra_libbs/ghidra_libbs_shutdown.py rename {yodalib/decompiler_stubs/ghidra_yodalib/yodalib_vendored => libbs/decompiler_stubs/ghidra_libbs/libbs_vendored}/__init__.py (100%) rename {yodalib/decompiler_stubs/ghidra_yodalib/yodalib_vendored => libbs/decompiler_stubs/ghidra_libbs/libbs_vendored}/ghidra_bridge_port.py (100%) rename {yodalib/decompiler_stubs/ghidra_yodalib/yodalib_vendored => libbs/decompiler_stubs/ghidra_libbs/libbs_vendored}/ghidra_bridge_server.py (100%) rename {yodalib/decompiler_stubs/ghidra_yodalib/yodalib_vendored => libbs/decompiler_stubs/ghidra_libbs/libbs_vendored}/jfx_bridge/__init__.py (100%) rename {yodalib/decompiler_stubs/ghidra_yodalib/yodalib_vendored => libbs/decompiler_stubs/ghidra_libbs/libbs_vendored}/jfx_bridge/bridge.py (100%) create mode 100644 libbs/decompiler_stubs/ida_libbs.py rename {yodalib => libbs}/decompilers/__init__.py (84%) rename {yodalib => libbs}/decompilers/angr/__init__.py (100%) rename {yodalib => libbs}/decompilers/angr/artifact_lifter.py (94%) rename {yodalib => libbs}/decompilers/angr/interface.py (98%) rename {yodalib => libbs}/decompilers/angr/plugin.py (94%) rename {yodalib => libbs}/decompilers/binja/__init__.py (100%) rename {yodalib => libbs}/decompilers/binja/artifact_lifter.py (96%) rename {yodalib => libbs}/decompilers/binja/hooks.py (98%) rename {yodalib => libbs}/decompilers/binja/interface.py (98%) rename {yodalib => libbs}/decompilers/ghidra/README.md (100%) rename {yodalib => libbs}/decompilers/ghidra/__init__.py (100%) rename {yodalib => libbs}/decompilers/ghidra/artifact_lifter.py (95%) rename {yodalib => libbs}/decompilers/ghidra/ghidra_api.py (100%) rename {yodalib => libbs}/decompilers/ghidra/gui.py (92%) rename {yodalib => libbs}/decompilers/ghidra/interface.py (99%) rename {yodalib => libbs}/decompilers/ida/__init__.py (100%) rename {yodalib => libbs}/decompilers/ida/artifact_lifter.py (96%) rename {yodalib => libbs}/decompilers/ida/compat.py (96%) rename {yodalib => libbs}/decompilers/ida/hooks.py (95%) rename {yodalib => libbs}/decompilers/ida/interface.py (94%) rename {yodalib => libbs}/logger.py (95%) rename {yodalib => libbs}/plugin_installer.py (87%) rename {yodalib => libbs}/ui/__init__.py (86%) rename {yodalib => libbs}/ui/qt_objects.py (98%) rename {yodalib => libbs}/ui/utils.py (97%) rename {yodalib => libbs}/ui/version.py (100%) delete mode 100644 yodalib/__init__.py delete mode 100644 yodalib/decompiler_stubs/angr_yodalib/__init__.py delete mode 100644 yodalib/decompiler_stubs/binja_yodalib/__init__.py delete mode 100644 yodalib/decompiler_stubs/binja_yodalib/requirements.txt delete mode 100644 yodalib/decompiler_stubs/ghidra_yodalib/ghidra_yodalib.py delete mode 100644 yodalib/decompiler_stubs/ghidra_yodalib/ghidra_yodalib_shutdown.py delete mode 100644 yodalib/decompiler_stubs/ida_yodalib.py diff --git a/README.md b/README.md index f4742057..32517aa8 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# YODALib - Your Only Decompiler API Library (YODALib)! +# LibBS +The decompiler API that works everywhere! -YODALib is an abstracted decompiler API that enables you to write plugins/scripts that work, with minimal edit, -in every decompiler supported by YODALib. +LibBS is an abstracted decompiler API that enables you to write plugins/scripts that work, with minimal edit, +in every decompiler supported by LibBS. LibBS was originally designed to work with [BinSync](https://binsync.net). ## Install ```bash @@ -10,7 +10,7 @@ pip install -e . ``` ## Usage -YODALib exposes all decompiler API through the abstract class `DecompilerInterface`. The `DecompilerInterface` +LibBS exposes all decompiler API through the abstract class `DecompilerInterface`. The `DecompilerInterface` can be used in either the default mode, which assumes a GUI, or `headless` mode. In `headless` mode, the interface will start a new process using a specified decompiler. @@ -18,7 +18,7 @@ start a new process using a specified decompiler. To use the same script everywhere, use the convenience function `DecompilerInterface.discover_interface()`, which will auto find the correct interface. Copy the below code into any supported decompiler and it should run without edit. ```python -from yodalib.api import DecompilerInterface +from libbs.api import DecompilerInterface deci = DecompilerInterface.discover_interface() for function in deci.functions: if function.header.type == "void *": @@ -30,7 +30,7 @@ for function in deci.functions: ### Headless Mode To use headless mode you must specify a decompiler to use. You can get the traditional interface using the following: ```python -from yodalib.api import DecompilerInterface +from libbs.api import DecompilerInterface deci = DecompilerInterface.discover_interface(force_decompiler="ida", headless=True) ``` @@ -65,9 +65,8 @@ G/S: Getters/Setters - [ ] Change Callbacks ### Ghidra -- [ ] Generic Interface Outline & Stubs -- [ ] Every G/S - [ ] Change Callbacks +- [ ] Get/Set Comments ### angr - [ ] Change Callbacks diff --git a/libbs/__init__.py b/libbs/__init__.py new file mode 100644 index 00000000..6a9beea8 --- /dev/null +++ b/libbs/__init__.py @@ -0,0 +1 @@ +__version__ = "0.4.0" diff --git a/yodalib/__main__.py b/libbs/__main__.py similarity index 69% rename from yodalib/__main__.py rename to libbs/__main__.py index 71c773d3..836afffa 100644 --- a/yodalib/__main__.py +++ b/libbs/__main__.py @@ -5,14 +5,14 @@ import importlib import importlib.resources -from yodalib.plugin_installer import YODAPluginInstaller +from libbs.plugin_installer import LibBSPluginInstaller _l = logging.getLogger(__name__) def run_ghidra_ui(): - yodalib_path = Path(str(importlib.resources.files("yodalib"))).absolute() - decompilers_path = yodalib_path / "decompilers" + libbs_path = Path(str(importlib.resources.files("libbs"))).absolute() + decompilers_path = libbs_path / "decompilers" if not decompilers_path.exists(): _l.error("Known plugins path does not exist, which means BinSync did not install correctly!") return False @@ -24,28 +24,28 @@ def run_ghidra_ui(): def install(): - YODAPluginInstaller().install() + LibBSPluginInstaller().install() def main(): parser = argparse.ArgumentParser( description=""" - The YODA Command Line Util. This is the script interface to YODA that allows you to install and run + The LibBS Command Line Util. This is the script interface to LibBS that allows you to install and run the Ghidra UI for running plugins. """, epilog=""" Examples: - yodalib --install + libbs --install """ ) parser.add_argument( "--install", action="store_true", help=""" - Install all the YODA plugins to every decompiler. + Install all the LibBS plugins to every decompiler. """ ) parser.add_argument( "--run-ghidra-ui", action="store_true", help=""" - Execute the Ghidra file selector UI for running YODA scripts. + Execute the Ghidra file selector UI for running LibBS scripts. """ ) args = parser.parse_args() diff --git a/yodalib/api/__init__.py b/libbs/api/__init__.py similarity index 100% rename from yodalib/api/__init__.py rename to libbs/api/__init__.py diff --git a/yodalib/api/artifact_dict.py b/libbs/api/artifact_dict.py similarity index 98% rename from yodalib/api/artifact_dict.py rename to libbs/api/artifact_dict.py index 7860ac7d..ef4991cb 100644 --- a/yodalib/api/artifact_dict.py +++ b/libbs/api/artifact_dict.py @@ -1,7 +1,7 @@ from typing import Type import logging -from yodalib.data import ( +from libbs.data import ( Artifact, Comment, Enum, FunctionHeader, Function, FunctionArgument, GlobalVariable, Patch, StackVariable, Struct, StructMember ) diff --git a/yodalib/api/artifact_lifter.py b/libbs/api/artifact_lifter.py similarity index 96% rename from yodalib/api/artifact_lifter.py rename to libbs/api/artifact_lifter.py index e03c7d6b..ec2e731f 100644 --- a/yodalib/api/artifact_lifter.py +++ b/libbs/api/artifact_lifter.py @@ -1,7 +1,7 @@ import logging -from yodalib.data import StackVariable, Artifact -from yodalib.api.type_parser import CTypeParser +from libbs.data import StackVariable, Artifact +from libbs.api.type_parser import CTypeParser _l = logging.getLogger(name=__name__) diff --git a/yodalib/api/decompiler_interface.py b/libbs/api/decompiler_interface.py similarity index 90% rename from yodalib/api/decompiler_interface.py rename to libbs/api/decompiler_interface.py index f2f6f8f8..3ee85aec 100644 --- a/yodalib/api/decompiler_interface.py +++ b/libbs/api/decompiler_interface.py @@ -6,17 +6,17 @@ from functools import wraps from typing import Dict, Optional, Union, Tuple, List -import yodalib -from yodalib.api.artifact_lifter import ArtifactLifter -from yodalib.api.artifact_dict import ArtifactDict -from yodalib.api.type_parser import CTypeParser, CType -from yodalib.data import ( +import libbs +from libbs.api.artifact_lifter import ArtifactLifter +from libbs.api.artifact_dict import ArtifactDict +from libbs.api.type_parser import CTypeParser, CType +from libbs.data import ( Artifact, Function, FunctionHeader, StackVariable, Comment, GlobalVariable, Patch, Enum, Struct ) -from yodalib.decompilers import YODALIB_SUPPORTED_DECOMPILERS, ANGR_DECOMPILER, \ +from libbs.decompilers import libbs_SUPPORTED_DECOMPILERS, ANGR_DECOMPILER, \ BINJA_DECOMPILER, IDA_DECOMPILER, GHIDRA_DECOMPILER _l = logging.getLogger(name=__name__) @@ -63,7 +63,7 @@ def __init__( # these will be changed often by public API use headless: bool = False, init_plugin: bool = False, - plugin_name: str = f"generic_yoda_plugin", + plugin_name: str = f"generic_libbs_plugin", # [category/name] = (action_string, callback_func) gui_ctx_menu_actions: Optional[dict] = None, ui_init_args: Optional[Tuple] = None, @@ -106,7 +106,7 @@ def __init__( # def _init_ui_components(self, *args, **kwargs): - from yodalib.ui.version import set_ui_version + from libbs.ui.version import set_ui_version set_ui_version(self.qt_version) # register a real plugin in the GUI @@ -134,9 +134,9 @@ def _init_ui_components(self, *args, **kwargs): def _init_gui_plugin(self, *args, **kwargs): return None - def active_context(self) -> yodalib.data.Function: + def active_context(self) -> libbs.data.Function: """ - Returns an yodalib Function. Currently only functions are supported as current contexts. + Returns an libbs Function. Currently only functions are supported as current contexts. This function will be called very frequently, so its important that its implementation is fast and can be done many times in the decompiler. """ @@ -155,7 +155,7 @@ def register_ctx_menu_item(self, name, action_string, callback_func, category=No raise NotImplementedError def gui_ask_for_string(self, question, title="Plugin Question") -> str: - from yodalib.ui.utils import gui_ask_for_string + from libbs.ui.utils import gui_ask_for_string return gui_ask_for_string(question, title=title) @@ -248,7 +248,7 @@ def get_decompilation_object(self, function: Function) -> Optional[object]: # # Override Optional API: - # These are API that provide extra introspection for plugins that may rely on YODA Interface + # These are API that provide extra introspection for plugins that may rely on LibBS Interface # def undo(self): @@ -260,7 +260,7 @@ def undo(self): def local_variable_names(self, func: Function) -> List[str]: """ Returns a list of local variable names for a function. Note, these also include register variables - that are normally not liftable in YODA. + that are normally not liftable in LibBS. @param func: Function to get local variable names for @return: List of local variable names """ @@ -269,7 +269,7 @@ def local_variable_names(self, func: Function) -> List[str]: def rename_local_variables_by_names(self, func: Function, name_map: Dict[str, str]) -> bool: """ Renames local variables in a function by a name map. Note, these also include register variables - that are normally not liftable in YODA. + that are normally not liftable in LibBS. @param func: Function to rename local variables in @param name_map: Dictionary of old name to new name @return: True if any local variables were renamed, False if otherwise @@ -280,7 +280,7 @@ def rename_local_variables_by_names(self, func: Function, name_map: Dict[str, st # Artifact API: # These functions are the main API for interacting with the decompiler artifacts. Generally, these functions # should all be implemented by the decompiler interface, but in the case that they are not, they should not - # crash the YODA Interface. + # crash the LibBS Interface. # # functions @@ -301,7 +301,7 @@ def _get_function(self, addr, **kwargs) -> Optional[Function]: def _functions(self) -> Dict[int, Function]: """ - Returns a dict of yodalib.Functions that contain the addr, name, and size of each function in the decompiler. + Returns a dict of libbs.Functions that contain the addr, name, and size of each function in the decompiler. Note: this does not contain the live data of the Artifact, only the minimum knowledge to that the Artifact exists. To get live data, use the singleton function of the same name. @@ -338,7 +338,7 @@ def _get_global_var(self, addr) -> Optional[GlobalVariable]: def _global_vars(self) -> Dict[int, GlobalVariable]: """ - Returns a dict of yodalib.GlobalVariable that contain the addr and size of each global var. + Returns a dict of libbs.GlobalVariable that contain the addr and size of each global var. Note: this does not contain the live data of the Artifact, only the minimum knowledge to that the Artifact exists. To get live data, use the singleton function of the same name. @@ -355,7 +355,7 @@ def _get_struct(self, name) -> Optional[Struct]: def _structs(self) -> Dict[str, Struct]: """ - Returns a dict of yodalib.Structs that contain the name and size of each struct in the decompiler. + Returns a dict of libbs.Structs that contain the name and size of each struct in the decompiler. Note: this does not contain the live data of the Artifact, only the minimum knowledge to that the Artifact exists. To get live data, use the singleton function of the same name. @@ -372,7 +372,7 @@ def _get_enum(self, name) -> Optional[Enum]: def _enums(self) -> Dict[str, Enum]: """ - Returns a dict of yodalib.Enum that contain the name of the enums in the decompiler. + Returns a dict of libbs.Enum that contain the name of the enums in the decompiler. Note: this does not contain the live data of the Artifact, only the minimum knowledge to that the Artifact exists. To get live data, use the singleton function of the same name. @@ -389,7 +389,7 @@ def _get_patch(self, addr) -> Optional[Patch]: def _patches(self) -> Dict[int, Patch]: """ - Returns a dict of yodalib.Patch that contain the addr of each Patch and the bytes. + Returns a dict of libbs.Patch that contain the addr of each Patch and the bytes. Note: this does not contain the live data of the Artifact, only the minimum knowledge to that the Artifact exists. To get live data, use the singleton function of the same name. @@ -430,7 +430,7 @@ def global_artifacts(self): def global_artifact(self, lookup_item: Union[str, int]): """ - Returns a live yodalib.data version of the Artifact located at the lookup_item location, which can + Returns a live libbs.data version of the Artifact located at the lookup_item location, which can lookup any artifact supported in `global_artifacts` @param lookup_item: @@ -451,8 +451,8 @@ def global_artifact(self, lookup_item: Union[str, int]): def set_artifact(self, artifact: Artifact, lower=True, **kwargs) -> bool: """ - Sets a yodalib Artifact into the decompilers local database. This operations allows you to change - what the native decompiler sees with yodalib Artifacts. This is different from opertions on a yodalib State, + Sets a libbs Artifact into the decompilers local database. This operations allows you to change + what the native decompiler sees with libbs Artifacts. This is different from opertions on a libbs State, since this is native to the decompiler >>> func = Function(0xdeadbeef, 0x800) @@ -597,7 +597,7 @@ def discover_interface(force_decompiler: str = None, **ctrl_kwargs) -> Optional[ @param force_decompiler: The optional string used to override the BSController returned @return: The DecompilerInterface associated with the current decompiler env """ - if force_decompiler and force_decompiler not in YODALIB_SUPPORTED_DECOMPILERS: + if force_decompiler and force_decompiler not in libbs_SUPPORTED_DECOMPILERS: raise ValueError(f"Unsupported decompiler {force_decompiler}") has_ida = False @@ -611,7 +611,7 @@ def discover_interface(force_decompiler: str = None, **ctrl_kwargs) -> Optional[ except ImportError: pass if has_ida or force_decompiler == IDA_DECOMPILER: - from yodalib.decompilers.ida.interface import IDAInterface + from libbs.decompilers.ida.interface import IDAInterface dec_controller = IDAInterface(**ctrl_kwargs) return dec_controller @@ -622,7 +622,7 @@ def discover_interface(force_decompiler: str = None, **ctrl_kwargs) -> Optional[ except ImportError: pass if has_binja or force_decompiler == BINJA_DECOMPILER: - from yodalib.decompilers.binja.interface import BinjaInterface + from libbs.decompilers.binja.interface import BinjaInterface bv = DecompilerInterface._find_global_in_call_frames('bv') dec_controller = BinjaInterface(bv=bv, **ctrl_kwargs) return dec_controller @@ -635,7 +635,7 @@ def discover_interface(force_decompiler: str = None, **ctrl_kwargs) -> Optional[ except ImportError: pass if has_angr_man or force_decompiler == ANGR_DECOMPILER: - from yodalib.decompilers.angr.interface import AngrInterface + from libbs.decompilers.angr.interface import AngrInterface workspace = DecompilerInterface._find_global_in_call_frames('workspace') dec_controller = AngrInterface(workspace=workspace, **ctrl_kwargs) return dec_controller @@ -644,9 +644,9 @@ def discover_interface(force_decompiler: str = None, **ctrl_kwargs) -> Optional[ # TODO: make this check do a check to see if a remote port is open and it can connect is_ghidra = True if is_ghidra or force_decompiler == GHIDRA_DECOMPILER: - from yodalib.decompilers.ghidra.interface import GhidraDecompilerInterface + from libbs.decompilers.ghidra.interface import GhidraDecompilerInterface dec_controller = GhidraDecompilerInterface(**ctrl_kwargs) else: - raise ValueError("Please use YODALib with our supported decompiler set!") + raise ValueError("Please use LibBS with our supported decompiler set!") return dec_controller diff --git a/yodalib/api/type_parser.py b/libbs/api/type_parser.py similarity index 100% rename from yodalib/api/type_parser.py rename to libbs/api/type_parser.py diff --git a/yodalib/data/__init__.py b/libbs/data/__init__.py similarity index 100% rename from yodalib/data/__init__.py rename to libbs/data/__init__.py diff --git a/yodalib/data/artifacts/__init__.py b/libbs/data/artifacts/__init__.py similarity index 100% rename from yodalib/data/artifacts/__init__.py rename to libbs/data/artifacts/__init__.py diff --git a/yodalib/data/artifacts/artifact.py b/libbs/data/artifacts/artifact.py similarity index 100% rename from yodalib/data/artifacts/artifact.py rename to libbs/data/artifacts/artifact.py diff --git a/yodalib/data/artifacts/comment.py b/libbs/data/artifacts/comment.py similarity index 100% rename from yodalib/data/artifacts/comment.py rename to libbs/data/artifacts/comment.py diff --git a/yodalib/data/artifacts/decompilation.py b/libbs/data/artifacts/decompilation.py similarity index 100% rename from yodalib/data/artifacts/decompilation.py rename to libbs/data/artifacts/decompilation.py diff --git a/yodalib/data/artifacts/enum.py b/libbs/data/artifacts/enum.py similarity index 100% rename from yodalib/data/artifacts/enum.py rename to libbs/data/artifacts/enum.py diff --git a/yodalib/data/artifacts/func.py b/libbs/data/artifacts/func.py similarity index 100% rename from yodalib/data/artifacts/func.py rename to libbs/data/artifacts/func.py diff --git a/yodalib/data/artifacts/global_variable.py b/libbs/data/artifacts/global_variable.py similarity index 100% rename from yodalib/data/artifacts/global_variable.py rename to libbs/data/artifacts/global_variable.py diff --git a/yodalib/data/artifacts/patch.py b/libbs/data/artifacts/patch.py similarity index 100% rename from yodalib/data/artifacts/patch.py rename to libbs/data/artifacts/patch.py diff --git a/yodalib/data/artifacts/stack_variable.py b/libbs/data/artifacts/stack_variable.py similarity index 100% rename from yodalib/data/artifacts/stack_variable.py rename to libbs/data/artifacts/stack_variable.py diff --git a/yodalib/data/artifacts/struct.py b/libbs/data/artifacts/struct.py similarity index 100% rename from yodalib/data/artifacts/struct.py rename to libbs/data/artifacts/struct.py diff --git a/yodalib/data/state.py b/libbs/data/state.py similarity index 99% rename from yodalib/data/state.py rename to libbs/data/state.py index f7e672e1..fe6717ea 100755 --- a/yodalib/data/state.py +++ b/libbs/data/state.py @@ -11,7 +11,7 @@ from sortedcontainers import SortedDict -from yodalib.data import ( +from libbs.data import ( Comment, Enum, Function, @@ -21,7 +21,7 @@ StackVariable, Struct, ) -from yodalib.data.artifacts.artifact import TomlHexEncoder +from libbs.data.artifacts.artifact import TomlHexEncoder l = logging.getLogger(__name__) diff --git a/yodalib/decompiler_stubs/__init__.py b/libbs/decompiler_stubs/__init__.py similarity index 100% rename from yodalib/decompiler_stubs/__init__.py rename to libbs/decompiler_stubs/__init__.py diff --git a/libbs/decompiler_stubs/angr_libbs/__init__.py b/libbs/decompiler_stubs/angr_libbs/__init__.py new file mode 100644 index 00000000..337f7aad --- /dev/null +++ b/libbs/decompiler_stubs/angr_libbs/__init__.py @@ -0,0 +1,4 @@ +try: + from libbs.decompilers.angr import * +except ImportError: + print("[!] libbs is not installed, please `pip install libbs` for THIS python interpreter") diff --git a/yodalib/decompiler_stubs/angr_yodalib/plugin.toml b/libbs/decompiler_stubs/angr_libbs/plugin.toml similarity index 85% rename from yodalib/decompiler_stubs/angr_yodalib/plugin.toml rename to libbs/decompiler_stubs/angr_libbs/plugin.toml index 57ae5e0c..6f3aa36e 100644 --- a/yodalib/decompiler_stubs/angr_yodalib/plugin.toml +++ b/libbs/decompiler_stubs/angr_libbs/plugin.toml @@ -2,8 +2,8 @@ plugin_metadata_version = 0 [plugin] -name = "yodalib" -shortname = "yodalib" +name = "libbs" +shortname = "libbs" version = "0.0.0" description = "" long_description = "" diff --git a/yodalib/decompiler_stubs/binja_yodalib/README.md b/libbs/decompiler_stubs/binja_libbs/README.md similarity index 77% rename from yodalib/decompiler_stubs/binja_yodalib/README.md rename to libbs/decompiler_stubs/binja_libbs/README.md index 735cde23..a9203c35 100644 --- a/yodalib/decompiler_stubs/binja_yodalib/README.md +++ b/libbs/decompiler_stubs/binja_libbs/README.md @@ -1,8 +1,8 @@ -## yodalib +## libbs

- yodalib Logo + libbs Logo

Your Only Decompiler API diff --git a/libbs/decompiler_stubs/binja_libbs/__init__.py b/libbs/decompiler_stubs/binja_libbs/__init__.py new file mode 100644 index 00000000..e95634bf --- /dev/null +++ b/libbs/decompiler_stubs/binja_libbs/__init__.py @@ -0,0 +1,4 @@ +try: + from libbs.decompilers.binja import * +except ImportError: + print("[!] libbs is not installed, please `pip install libbs` for THIS python interpreter") diff --git a/yodalib/decompiler_stubs/binja_yodalib/plugin.json b/libbs/decompiler_stubs/binja_libbs/plugin.json similarity index 76% rename from yodalib/decompiler_stubs/binja_yodalib/plugin.json rename to libbs/decompiler_stubs/binja_libbs/plugin.json index 1f21eec7..139f0b48 100644 --- a/yodalib/decompiler_stubs/binja_yodalib/plugin.json +++ b/libbs/decompiler_stubs/binja_libbs/plugin.json @@ -1,19 +1,19 @@ { "pluginmetadataversion" : 2, - "name": "YODALib", + "name": "LibBS", "type": ["core", "ui"], "api": ["python3"], - "description": "Adds support for cross-decompiler collab in the yodalib supported decompilers.", - "longdescription": "Adds support for cross-decompiler collab in the yodalib supported decompilers.", + "description": "Adds support for cross-decompiler collab in the libbs supported decompilers.", + "longdescription": "Adds support for cross-decompiler collab in the libbs supported decompilers.", "license": { "name": "BSD 2-clause", "text": "" }, "platforms" : ["Darwin", "Linux", "Windows"], "installinstructions" : { - "Darwin" : "Install through the Binja Plugin Manager. To update do `pip install -U yodalib`", - "Linux" : "Install through the Binja Plugin Manager. To update do `pip install -U yodalib`", - "Windows" : "Install through the Binja Plugin Manager. To update do `pip install -U yodalib`" + "Darwin" : "Install through the Binja Plugin Manager. To update do `pip install -U libbs`", + "Linux" : "Install through the Binja Plugin Manager. To update do `pip install -U libbs`", + "Windows" : "Install through the Binja Plugin Manager. To update do `pip install -U libbs`" }, "version": "0.0.0", "author": "BinSync Team", diff --git a/libbs/decompiler_stubs/binja_libbs/requirements.txt b/libbs/decompiler_stubs/binja_libbs/requirements.txt new file mode 100644 index 00000000..e3a61268 --- /dev/null +++ b/libbs/decompiler_stubs/binja_libbs/requirements.txt @@ -0,0 +1 @@ +libbs \ No newline at end of file diff --git a/libbs/decompiler_stubs/ghidra_libbs/ghidra_libbs.py b/libbs/decompiler_stubs/ghidra_libbs/ghidra_libbs.py new file mode 100644 index 00000000..a1b44e8b --- /dev/null +++ b/libbs/decompiler_stubs/ghidra_libbs/ghidra_libbs.py @@ -0,0 +1,17 @@ +# Starts the LibBS backend for Ghidra scripts. +# @author LibBS +# @category LibBS +# @menupath Tools.LibBS.Start LibBS Backend + +import subprocess +from libbs_vendored.ghidra_bridge_server import GhidraBridgeServer + + +def start_libbs_selector(): + subprocess.Popen("libbs --run-ghidra-ui".split(" ")) + + +if __name__ == "__main__": + GhidraBridgeServer.run_server(background=True) + # TODO: put the selector back + #start_libbs_selector() diff --git a/libbs/decompiler_stubs/ghidra_libbs/ghidra_libbs_shutdown.py b/libbs/decompiler_stubs/ghidra_libbs/ghidra_libbs_shutdown.py new file mode 100644 index 00000000..093fdf85 --- /dev/null +++ b/libbs/decompiler_stubs/ghidra_libbs/ghidra_libbs_shutdown.py @@ -0,0 +1,15 @@ +# Shutdown the LibBS backend server. +# @author LibBS +# @category LibBS +# @menupath Tools.LibBS.Shutdown LibBS Backend + +from libbs_vendored.jfx_bridge import bridge +from libbs_vendored.ghidra_bridge_port import DEFAULT_SERVER_PORT + +if __name__ == "__main__": + print("Requesting server shutdown...") + b = bridge.BridgeClient( + connect_to_host="127.0.0.1", connect_to_port=DEFAULT_SERVER_PORT + ) + + print(b.remote_shutdown()) diff --git a/yodalib/decompiler_stubs/ghidra_yodalib/yodalib_vendored/__init__.py b/libbs/decompiler_stubs/ghidra_libbs/libbs_vendored/__init__.py similarity index 100% rename from yodalib/decompiler_stubs/ghidra_yodalib/yodalib_vendored/__init__.py rename to libbs/decompiler_stubs/ghidra_libbs/libbs_vendored/__init__.py diff --git a/yodalib/decompiler_stubs/ghidra_yodalib/yodalib_vendored/ghidra_bridge_port.py b/libbs/decompiler_stubs/ghidra_libbs/libbs_vendored/ghidra_bridge_port.py similarity index 100% rename from yodalib/decompiler_stubs/ghidra_yodalib/yodalib_vendored/ghidra_bridge_port.py rename to libbs/decompiler_stubs/ghidra_libbs/libbs_vendored/ghidra_bridge_port.py diff --git a/yodalib/decompiler_stubs/ghidra_yodalib/yodalib_vendored/ghidra_bridge_server.py b/libbs/decompiler_stubs/ghidra_libbs/libbs_vendored/ghidra_bridge_server.py similarity index 100% rename from yodalib/decompiler_stubs/ghidra_yodalib/yodalib_vendored/ghidra_bridge_server.py rename to libbs/decompiler_stubs/ghidra_libbs/libbs_vendored/ghidra_bridge_server.py diff --git a/yodalib/decompiler_stubs/ghidra_yodalib/yodalib_vendored/jfx_bridge/__init__.py b/libbs/decompiler_stubs/ghidra_libbs/libbs_vendored/jfx_bridge/__init__.py similarity index 100% rename from yodalib/decompiler_stubs/ghidra_yodalib/yodalib_vendored/jfx_bridge/__init__.py rename to libbs/decompiler_stubs/ghidra_libbs/libbs_vendored/jfx_bridge/__init__.py diff --git a/yodalib/decompiler_stubs/ghidra_yodalib/yodalib_vendored/jfx_bridge/bridge.py b/libbs/decompiler_stubs/ghidra_libbs/libbs_vendored/jfx_bridge/bridge.py similarity index 100% rename from yodalib/decompiler_stubs/ghidra_yodalib/yodalib_vendored/jfx_bridge/bridge.py rename to libbs/decompiler_stubs/ghidra_libbs/libbs_vendored/jfx_bridge/bridge.py diff --git a/libbs/decompiler_stubs/ida_libbs.py b/libbs/decompiler_stubs/ida_libbs.py new file mode 100644 index 00000000..dfcb6de8 --- /dev/null +++ b/libbs/decompiler_stubs/ida_libbs.py @@ -0,0 +1,8 @@ +def PLUGIN_ENTRY(*args, **kwargs): + try: + from libbs.decompilers.ida import LibBSPlugin + except ImportError: + print("[!] libbs is not installed, please `pip install libbs` for THIS python interpreter") + return None + + return LibBSPlugin(*args, **kwargs) diff --git a/yodalib/decompilers/__init__.py b/libbs/decompilers/__init__.py similarity index 84% rename from yodalib/decompilers/__init__.py rename to libbs/decompilers/__init__.py index 7d9c49ac..710d232a 100644 --- a/yodalib/decompilers/__init__.py +++ b/libbs/decompilers/__init__.py @@ -3,6 +3,6 @@ BINJA_DECOMPILER = "binja" GHIDRA_DECOMPILER = "ghidra" -YODALIB_SUPPORTED_DECOMPILERS = { +libbs_SUPPORTED_DECOMPILERS = { ANGR_DECOMPILER, IDA_DECOMPILER, BINJA_DECOMPILER, GHIDRA_DECOMPILER } diff --git a/yodalib/decompilers/angr/__init__.py b/libbs/decompilers/angr/__init__.py similarity index 100% rename from yodalib/decompilers/angr/__init__.py rename to libbs/decompilers/angr/__init__.py diff --git a/yodalib/decompilers/angr/artifact_lifter.py b/libbs/decompilers/angr/artifact_lifter.py similarity index 94% rename from yodalib/decompilers/angr/artifact_lifter.py rename to libbs/decompilers/angr/artifact_lifter.py index d2e63ec2..355a57d4 100644 --- a/yodalib/decompilers/angr/artifact_lifter.py +++ b/libbs/decompilers/angr/artifact_lifter.py @@ -1,4 +1,4 @@ -from yodalib.api import ArtifactLifter +from libbs.api import ArtifactLifter class AngrArtifactLifter(ArtifactLifter): diff --git a/yodalib/decompilers/angr/interface.py b/libbs/decompilers/angr/interface.py similarity index 98% rename from yodalib/decompilers/angr/interface.py rename to libbs/decompilers/angr/interface.py index 0651dc3a..7f764a33 100644 --- a/yodalib/decompilers/angr/interface.py +++ b/libbs/decompilers/angr/interface.py @@ -6,10 +6,10 @@ import angr from angr.analyses.decompiler.structured_codegen import DummyStructuredCodeGenerator -from yodalib.api.decompiler_interface import ( +from libbs.api.decompiler_interface import ( DecompilerInterface, ) -from yodalib.data import ( +from libbs.data import ( Function, FunctionHeader, Comment, StackVariable, FunctionArgument, Artifact ) from .artifact_lifter import AngrArtifactLifter @@ -179,7 +179,7 @@ def _get_function(self, addr, **kwargs) -> Optional[Function]: if not decompilation: return func - func.header.args = self.func_args_as_yoda_args(decompilation) + func.header.args = self.func_args_as_libbs_args(decompilation) # overwrite type again since it can change with decompilation if decompilation.cfunc.functy.returnty: func.header.type = decompilation.cfunc.functy.returnty.c_repr() @@ -351,7 +351,7 @@ def stack_vars_in_dec(decompilation): yield var @staticmethod - def func_args_as_yoda_args(decompilation) -> Dict[int, FunctionArgument]: + def func_args_as_libbs_args(decompilation) -> Dict[int, FunctionArgument]: args = {} if not decompilation.cfunc.arg_list: return args diff --git a/yodalib/decompilers/angr/plugin.py b/libbs/decompilers/angr/plugin.py similarity index 94% rename from yodalib/decompilers/angr/plugin.py rename to libbs/decompilers/angr/plugin.py index 6c3a0100..773b4f89 100644 --- a/yodalib/decompilers/angr/plugin.py +++ b/libbs/decompilers/angr/plugin.py @@ -9,7 +9,7 @@ l = logging.getLogger(__name__) -class YODALibPlugin(BasePlugin): +class LibBSPlugin(BasePlugin): """ Controller plugin for BinSync """ @@ -57,14 +57,14 @@ def handle_stack_var_retyped(self, func, offset, old_type, new_type): # pylint: disable=unused-argument def handle_func_arg_renamed(self, func, offset, old_name, new_name): decompilation = self.interface.decompile_function(func) - func_args = AngrInterface.func_args_as_yoda_args(decompilation) + func_args = AngrInterface.func_args_as_libbs_args(decompilation) func_type = decompilation.cfunc.functy.returnty.c_repr() return False # pylint: disable=unused-argument def handle_func_arg_retyped(self, func, offset, old_type, new_type): decompilation = self.interface.decompile_function(func) - func_args = AngrInterface.func_args_as_yoda_args(decompilation) + func_args = AngrInterface.func_args_as_libbs_args(decompilation) func_type = decompilation.cfunc.functy.returnty.c_repr() return False diff --git a/yodalib/decompilers/binja/__init__.py b/libbs/decompilers/binja/__init__.py similarity index 100% rename from yodalib/decompilers/binja/__init__.py rename to libbs/decompilers/binja/__init__.py diff --git a/yodalib/decompilers/binja/artifact_lifter.py b/libbs/decompilers/binja/artifact_lifter.py similarity index 96% rename from yodalib/decompilers/binja/artifact_lifter.py rename to libbs/decompilers/binja/artifact_lifter.py index 4c1ffbf3..1782f45b 100644 --- a/yodalib/decompilers/binja/artifact_lifter.py +++ b/libbs/decompilers/binja/artifact_lifter.py @@ -1,4 +1,4 @@ -from yodalib.api import ArtifactLifter +from libbs.api import ArtifactLifter class BinjaArtifactLifter(ArtifactLifter): diff --git a/yodalib/decompilers/binja/hooks.py b/libbs/decompilers/binja/hooks.py similarity index 98% rename from yodalib/decompilers/binja/hooks.py rename to libbs/decompilers/binja/hooks.py index 4d8a596f..79b2165b 100644 --- a/yodalib/decompilers/binja/hooks.py +++ b/libbs/decompilers/binja/hooks.py @@ -51,7 +51,7 @@ def function_updated(self, view, func_): l.debug(f"Update on {hex(self._func_addr_requested)} being processed...") self._func_addr_requested = None - # convert to yodalib Function type for diffing + # convert to libbs Function type for diffing bn_func = view.get_function_at(func_.start) bs_func = BinjaInterface.bn_func_to_bs(bn_func) diff --git a/yodalib/decompilers/binja/interface.py b/libbs/decompilers/binja/interface.py similarity index 98% rename from yodalib/decompilers/binja/interface.py rename to libbs/decompilers/binja/interface.py index d46d1e2c..09093cd7 100644 --- a/yodalib/decompilers/binja/interface.py +++ b/libbs/decompilers/binja/interface.py @@ -19,9 +19,9 @@ from binaryninja.enums import VariableSourceType from binaryninja.types import StructureType, EnumerationType -from yodalib.api.decompiler_interface import DecompilerInterface -import yodalib -from yodalib.data import ( +from libbs.api.decompiler_interface import DecompilerInterface +import libbs +from libbs.data import ( Function, FunctionHeader, StackVariable, Comment, GlobalVariable, Patch, StructMember, FunctionArgument, Enum, Struct, Artifact @@ -205,7 +205,7 @@ def active_context(self): if func is None: return None - return yodalib.data.Function( + return libbs.data.Function( func.start, 0, header=FunctionHeader(func.name, func.start) ) @@ -451,8 +451,8 @@ def _patches(self) -> Dict[int, Patch]: # comments def _set_comment(self, comment: Comment, **kwargs) -> bool: # search for the right function - yoda_func = self.get_func_containing(comment.addr) - if yoda_func is None: + libbs_func = self.get_func_containing(comment.addr) + if libbs_func is None: # in the case of the function not existing, just comment in addr space self.bv.set_comment_at(comment.addr, comment.comment) return True @@ -549,7 +549,7 @@ def bn_func_to_bs(bn_func): var_sizes[var] = var.storage - sorted_stack[i].storage bs_stack_vars = { - off: yodalib.data.StackVariable( + off: libbs.data.StackVariable( off, var.name, var.type.get_string_before_name(), diff --git a/yodalib/decompilers/ghidra/README.md b/libbs/decompilers/ghidra/README.md similarity index 100% rename from yodalib/decompilers/ghidra/README.md rename to libbs/decompilers/ghidra/README.md diff --git a/yodalib/decompilers/ghidra/__init__.py b/libbs/decompilers/ghidra/__init__.py similarity index 100% rename from yodalib/decompilers/ghidra/__init__.py rename to libbs/decompilers/ghidra/__init__.py diff --git a/yodalib/decompilers/ghidra/artifact_lifter.py b/libbs/decompilers/ghidra/artifact_lifter.py similarity index 95% rename from yodalib/decompilers/ghidra/artifact_lifter.py rename to libbs/decompilers/ghidra/artifact_lifter.py index 799a137a..8fdb1ef5 100644 --- a/yodalib/decompilers/ghidra/artifact_lifter.py +++ b/libbs/decompilers/ghidra/artifact_lifter.py @@ -1,6 +1,6 @@ import logging -from yodalib.api import ArtifactLifter +from libbs.api import ArtifactLifter l = logging.getLogger(name=__name__) diff --git a/yodalib/decompilers/ghidra/ghidra_api.py b/libbs/decompilers/ghidra/ghidra_api.py similarity index 100% rename from yodalib/decompilers/ghidra/ghidra_api.py rename to libbs/decompilers/ghidra/ghidra_api.py diff --git a/yodalib/decompilers/ghidra/gui.py b/libbs/decompilers/ghidra/gui.py similarity index 92% rename from yodalib/decompilers/ghidra/gui.py rename to libbs/decompilers/ghidra/gui.py index 2226ccd4..801b6abd 100644 --- a/yodalib/decompilers/ghidra/gui.py +++ b/libbs/decompilers/ghidra/gui.py @@ -2,16 +2,16 @@ from pathlib import Path import subprocess -from yodalib.ui.version import set_ui_version +from libbs.ui.version import set_ui_version set_ui_version("PySide6") -from yodalib.ui.qt_objects import ( +from libbs.ui.qt_objects import ( QApplication, QWidget, QLabel, QMainWindow, QVBoxLayout, QPushButton, QFileDialog, QGridLayout, QDialog ) class FileSelectorDialog(QDialog): def __init__(self): super(FileSelectorDialog, self).__init__() - self.setWindowTitle("Run a YODA Python script") + self.setWindowTitle("Run a LibBS Python script") self._init_widgets() @@ -46,7 +46,7 @@ def _init_widgets(self): def _select_file(self): # open a dialog to select a file - file_name, _ = QFileDialog.getOpenFileName(self, "Select a YODA Python script") + file_name, _ = QFileDialog.getOpenFileName(self, "Select a LibBS Python script") # update the label to show the selected file self._label.setText(file_name) diff --git a/yodalib/decompilers/ghidra/interface.py b/libbs/decompilers/ghidra/interface.py similarity index 99% rename from yodalib/decompilers/ghidra/interface.py rename to libbs/decompilers/ghidra/interface.py index 6744c49c..71f57a48 100644 --- a/yodalib/decompilers/ghidra/interface.py +++ b/libbs/decompilers/ghidra/interface.py @@ -3,9 +3,9 @@ import logging from functools import wraps -from yodalib.api import DecompilerInterface -from yodalib.api.decompiler_interface import requires_decompilation -from yodalib.data import ( +from libbs.api import DecompilerInterface +from libbs.api.decompiler_interface import requires_decompilation +from libbs.data import ( Function, FunctionHeader, StackVariable, Comment, FunctionArgument, GlobalVariable, Struct, StructMember, Enum ) @@ -117,7 +117,7 @@ def get_decompilation_object(self, function: Function) -> Optional[object]: # # Override Optional API: - # There are API that provide extra introspection for plugins that may rely on YODA Interface + # There are API that provide extra introspection for plugins that may rely on LibBS Interface # def undo(self): diff --git a/yodalib/decompilers/ida/__init__.py b/libbs/decompilers/ida/__init__.py similarity index 100% rename from yodalib/decompilers/ida/__init__.py rename to libbs/decompilers/ida/__init__.py diff --git a/yodalib/decompilers/ida/artifact_lifter.py b/libbs/decompilers/ida/artifact_lifter.py similarity index 96% rename from yodalib/decompilers/ida/artifact_lifter.py rename to libbs/decompilers/ida/artifact_lifter.py index 93f3f38c..153a1d6a 100644 --- a/yodalib/decompilers/ida/artifact_lifter.py +++ b/libbs/decompilers/ida/artifact_lifter.py @@ -1,6 +1,6 @@ import logging -from yodalib.api import ArtifactLifter +from libbs.api import ArtifactLifter l = logging.getLogger(name=__name__) diff --git a/yodalib/decompilers/ida/compat.py b/libbs/decompilers/ida/compat.py similarity index 96% rename from yodalib/decompilers/ida/compat.py rename to libbs/decompilers/ida/compat.py index 0e0b2e6a..b3ffe6d9 100644 --- a/yodalib/decompilers/ida/compat.py +++ b/libbs/decompilers/ida/compat.py @@ -17,8 +17,8 @@ import idc, idaapi, ida_kernwin, ida_hexrays, ida_funcs, \ ida_bytes, ida_struct, ida_idaapi, ida_typeinf, idautils, ida_enum -import yodalib -from yodalib.data import ( +import libbs +from libbs.data import ( Struct, FunctionHeader, FunctionArgument, StackVariable, Function, GlobalVariable, Enum, Artifact ) @@ -291,7 +291,7 @@ def function_header(ida_code_view) -> FunctionHeader: @execute_write @requires_decompilation -def set_function_header(yodalib_header: yodalib.data.FunctionHeader, exit_on_bad_type=False, ida_code_view=None): +def set_function_header(libbs_header: libbs.data.FunctionHeader, exit_on_bad_type=False, ida_code_view=None): data_changed = False func_addr = ida_code_view.cfunc.entry_ea cur_ida_func = function_header(ida_code_view) @@ -300,8 +300,8 @@ def set_function_header(yodalib_header: yodalib.data.FunctionHeader, exit_on_bad # FUNCTION NAME # - if yodalib_header.name and yodalib_header.name != cur_ida_func.name: - set_ida_func_name(func_addr, yodalib_header.name) + if libbs_header.name and libbs_header.name != cur_ida_func.name: + set_ida_func_name(func_addr, libbs_header.name) # # FUNCTION RET TYPE @@ -309,9 +309,9 @@ def set_function_header(yodalib_header: yodalib.data.FunctionHeader, exit_on_bad func_name = get_func_name(func_addr) cur_ret_type_str = str(ida_code_view.cfunc.type.get_rettype()) - if yodalib_header.type and yodalib_header.type != cur_ret_type_str: + if libbs_header.type and libbs_header.type != cur_ret_type_str: old_prototype = str(ida_code_view.cfunc.type).replace("(", f" {func_name}(", 1) - new_prototype = old_prototype.replace(cur_ret_type_str, yodalib_header.type, 1) + new_prototype = old_prototype.replace(cur_ret_type_str, libbs_header.type, 1) success = bool( ida_typeinf.apply_tinfo(func_addr, convert_type_str_to_ida_type(new_prototype), ida_typeinf.TINFO_DEFINITE) ) @@ -328,20 +328,20 @@ def set_function_header(yodalib_header: yodalib.data.FunctionHeader, exit_on_bad # types_to_change = {} - for idx, yodalib_arg in yodalib_header.args.items(): + for idx, libbs_arg in libbs_header.args.items(): if idx >= len(cur_ida_func.args): break cur_ida_arg = cur_ida_func.args[idx] # change the name - if yodalib_arg.name and yodalib_arg.name != cur_ida_arg.name: - success = ida_code_view.rename_lvar(ida_code_view.cfunc.arguments[idx], yodalib_arg.name, 1) + if libbs_arg.name and libbs_arg.name != cur_ida_arg.name: + success = ida_code_view.rename_lvar(ida_code_view.cfunc.arguments[idx], libbs_arg.name, 1) data_changed |= success # record the type to change - if yodalib_arg.type and yodalib_arg.type != cur_ida_arg.type: - types_to_change[idx] = (cur_ida_arg.type, yodalib_arg.type) + if libbs_arg.type and libbs_arg.type != cur_ida_arg.type: + types_to_change[idx] = (cur_ida_arg.type, libbs_arg.type) # crazy prototype parsing func_prototype = str(ida_code_view.cfunc.type).replace("(", f" {func_name}(", 1) @@ -513,7 +513,7 @@ def set_stack_vars_types(var_type_dict, ida_code_view) -> bool: @param var_type_dict: Dict[stack_offset, ida_typeinf_t] @param ida_code_view: A pointer to a vdui_t screen - @param controller: The yodalib controller to do operations on + @param controller: The libbs controller to do operations on @return: """ @@ -896,8 +896,8 @@ class GenericIDAPlugin(QObject, idaapi.plugin_t): def __init__(self, *args, name=None, comment=None, interface=None, **kwargs): QObject.__init__(self, *args, **kwargs) idaapi.plugin_t.__init__(self) - self.wanted_name = name or "generic_yoda_plugin" - self.comment = comment or "A generic YODA plugin" + self.wanted_name = name or "generic_libbs_plugin" + self.comment = comment or "A generic LibBS plugin" self.interface: "IDAInterface" = interface def init(self): diff --git a/yodalib/decompilers/ida/hooks.py b/libbs/decompilers/ida/hooks.py similarity index 95% rename from yodalib/decompilers/ida/hooks.py rename to libbs/decompilers/ida/hooks.py index 3aeaee25..9a8027a6 100644 --- a/yodalib/decompilers/ida/hooks.py +++ b/libbs/decompilers/ida/hooks.py @@ -38,7 +38,7 @@ from . import compat -from yodalib.data import ( +from libbs.data import ( FunctionHeader, FunctionArgument, StackVariable, Comment, GlobalVariable, Enum, Struct ) @@ -131,7 +131,7 @@ def ti_changed(self, ea, type_, fname): def bs_enum_modified(self, enum): name = ida_enum.get_enum_name(enum) _enum = compat.enum(name) - self.yodalib_state_change( + self.libbs_state_change( self.controller.push_artifact, _enum ) @@ -148,7 +148,7 @@ def enum_created(self, enum): def deleting_enum(self, id): name = ida_enum.get_enum_name(id) enum = Enum(name, {}) - self.yodalib_state_change( + self.libbs_state_change( self.controller.push_artifact, enum ) @@ -290,7 +290,7 @@ def struc_member_renamed(self, sptr, mptr): sv = StackVariable( angr_offset, new_name, type_str, size, func_addr ) - self.yodalib_state_change( + self.libbs_state_change( self.controller.push_artifact, sv ) @@ -328,7 +328,7 @@ def struc_member_changed(self, sptr, mptr): sv = StackVariable( angr_offset, new_name, type_str, size, func_addr ) - self.yodalib_state_change( + self.libbs_state_change( self.controller.push_artifact, sv ) @@ -367,7 +367,7 @@ def renamed(self, ea, new_name, local_name): # global var renaming if ida_func is None: size = idaapi.get_item_size(ea) - self.yodalib_state_change( + self.libbs_state_change( self.controller.push_artifact, GlobalVariable(ea, new_name, size=size) ) @@ -376,7 +376,7 @@ def renamed(self, ea, new_name, local_name): elif ida_func.start_ea == ea: # grab the name instead from ida name = idc.get_func_name(ida_func.start_ea) - self.yodalib_state_change( + self.libbs_state_change( self.controller.push_artifact, FunctionHeader(name, ida_func.start_ea) ) @@ -437,7 +437,7 @@ def ida_comment_changed(self, comment: str, address: int, cmt_type: str): bs_cmt = Comment(address, comment, **kwarg) # disass comment changed if cmt_type == "cmt": - self.yodalib_state_change( + self.libbs_state_change( self.controller.push_artifact, bs_cmt ) @@ -445,7 +445,7 @@ def ida_comment_changed(self, comment: str, address: int, cmt_type: str): # function comment changed elif cmt_type == "range": # overwrite the entire function comment - self.yodalib_state_change( + self.libbs_state_change( self.controller.push_artifact, bs_cmt ) @@ -484,31 +484,31 @@ def ida_struct_changed(self, sid: int, old_name=None, new_name=None, deleted=Fal # if deleted, finish early if deleted: - self.yodalib_state_change( + self.libbs_state_change( self.controller.push_artifact, Struct(s_name, None, {}) ) return 0 - # convert the ida_struct into a yodalib_struct - yodalib_struct = Struct(s_name, s_size, {}) + # convert the ida_struct into a libbs_struct + libbs_struct = Struct(s_name, s_size, {}) for mptr in sptr.members: mid = mptr.id m_name = ida_struct.get_member_name(mid) m_off = mptr.soff m_type = ida_typeinf.idc_get_type(mptr.id) if mptr.has_ti() else "" m_size = ida_struct.get_member_size(mptr) - yodalib_struct.add_struct_member(m_name, m_off, m_type, m_size) + libbs_struct.add_struct_member(m_name, m_off, m_type, m_size) # make the controller update the local state and push old_s_name = old_name if old_name else s_name - self.yodalib_state_change( + self.libbs_state_change( self.controller.push_artifact, - yodalib_struct + libbs_struct ) return 0 - def yodalib_state_change(self, *args, **kwargs): + def libbs_state_change(self, *args, **kwargs): self.controller.schedule_job(*args, **kwargs) @@ -606,15 +606,15 @@ def _push_new_func_header(self, ida_cfunc): cur_header_str = str(ida_cfunc.type) if cur_header_str != self._cached_funcs[ida_cfunc.entry_ea]["header"]: - # convert to yodalib type + # convert to libbs type fake_codeview = FakeIDACodeView(ida_cfunc) cur_func_header = compat.function_header(fake_codeview) - yodalib_args = {} + libbs_args = {} for idx, arg in cur_func_header.args.items(): - yodalib_args[idx] = FunctionArgument(idx, arg.name, arg.type, arg.size) + libbs_args[idx] = FunctionArgument(idx, arg.name, arg.type, arg.size) # send the change - self.yodalib_state_change( + self.libbs_state_change( self.controller.push_artifact, cur_func_header ) @@ -652,7 +652,7 @@ def _push_new_comments(self, ea): sync_cmts = [Comment(addr, cmt, decompiled=True) for addr, cmt in cmts.items()] for cmt in sync_cmts: cmt.func_addr = ea - self.yodalib_state_change( + self.libbs_state_change( self.controller.push_artifact, cmt ) @@ -675,7 +675,7 @@ def refresh_pseudocode_view(ea): if ida_funcs.func_contains(func, ea): vu.refresh_view(False) - def yodalib_state_change(self, *args, **kwargs): + def libbs_state_change(self, *args, **kwargs): self.controller.schedule_job(*args, **kwargs) diff --git a/yodalib/decompilers/ida/interface.py b/libbs/decompilers/ida/interface.py similarity index 94% rename from yodalib/decompilers/ida/interface.py rename to libbs/decompilers/ida/interface.py index eee33780..d7715394 100755 --- a/yodalib/decompilers/ida/interface.py +++ b/libbs/decompilers/ida/interface.py @@ -8,12 +8,12 @@ import idaapi import ida_hexrays -import yodalib -from yodalib.api.decompiler_interface import DecompilerInterface, artifact_set_event -from yodalib.data import ( +import libbs +from libbs.api.decompiler_interface import DecompilerInterface, artifact_set_event +from libbs.data import ( StackVariable, Function, FunctionHeader, Struct, Comment, GlobalVariable, Enum, Patch, Artifact ) -from yodalib.api.decompiler_interface import requires_decompilation +from libbs.api.decompiler_interface import requires_decompilation from . import compat from .artifact_lifter import IDAArtifactLifter from .hooks import ContextMenuHooks, ScreenHook @@ -146,7 +146,7 @@ def _ea_to_func(self, addr): if func_addr is None: return None - func = yodalib.data.Function( + func = libbs.data.Function( func_addr, 0, header=FunctionHeader(compat.get_func_name(func_addr), func_addr) ) return func @@ -232,7 +232,7 @@ def _get_global_var(self, addr) -> Optional[GlobalVariable]: def _global_vars(self) -> Dict[int, GlobalVariable]: """ - Returns a dict of yodalib.GlobalVariable that contain the addr and size of each global var. + Returns a dict of libbs.GlobalVariable that contain the addr and size of each global var. Note: this does not contain the live data of the Artifact, only the minimum knowledge to that the Artifact exists. To get live data, use the singleton function of the same name. @@ -260,7 +260,7 @@ def _get_struct(self, name) -> Optional[Struct]: def _structs(self) -> Dict[str, Struct]: """ - Returns a dict of yodalib.Structs that contain the name and size of each struct in the decompiler. + Returns a dict of libbs.Structs that contain the name and size of each struct in the decompiler. Note: this does not contain the live data of the Artifact, only the minimum knowledge to that the Artifact exists. To get live data, use the singleton function of the same name. @@ -277,7 +277,7 @@ def _get_enum(self, name) -> Optional[Enum]: def _enums(self) -> Dict[str, Enum]: """ - Returns a dict of yodalib.Enum that contain the name of the enums in the decompiler. + Returns a dict of libbs.Enum that contain the name of the enums in the decompiler. Note: this does not contain the live data of the Artifact, only the minimum knowledge to that the Artifact exists. To get live data, use the singleton function of the same name. @@ -296,7 +296,7 @@ def _get_patch(self, addr) -> Optional[Patch]: def _patches(self) -> Dict[int, Patch]: """ - Returns a dict of yodalib.Patch that contain the addr of each Patch and the bytes. + Returns a dict of libbs.Patch that contain the addr of each Patch and the bytes. Note: this does not contain the live data of the Artifact, only the minimum knowledge to that the Artifact exists. To get live data, use the singleton function of the same name. diff --git a/yodalib/logger.py b/libbs/logger.py similarity index 95% rename from yodalib/logger.py rename to libbs/logger.py index 1d858370..e8c2e2e3 100644 --- a/yodalib/logger.py +++ b/libbs/logger.py @@ -4,7 +4,7 @@ from datetime import datetime timestamp = datetime.now().strftime("%Y%m%d-%H%M%S") -_, tempfilename = tempfile.mkstemp(prefix=timestamp + '.yodalib.', suffix='.log') +_, tempfilename = tempfile.mkstemp(prefix=timestamp + '.libbs.', suffix='.log') string_format = "%(levelname)s | %(asctime)s | %(name)-8s | %(message)s" @@ -40,7 +40,7 @@ } }, 'loggers': { - 'yodalib': { + 'libbs': { 'handlers': ["console", "local_file_handler"], 'level': 'INFO', 'propagate': False @@ -53,7 +53,7 @@ class Loggers: """ Logger Manager. """ - IN_SCOPE_LOGGERS = ('yodalib', ) + IN_SCOPE_LOGGERS = ('libbs', ) def __init__(self): self._loggers = {} diff --git a/yodalib/plugin_installer.py b/libbs/plugin_installer.py similarity index 87% rename from yodalib/plugin_installer.py rename to libbs/plugin_installer.py index f9984be9..e1117678 100644 --- a/yodalib/plugin_installer.py +++ b/libbs/plugin_installer.py @@ -224,23 +224,23 @@ def install_gdb(self, path=None, interactive=True): else default_path -class YODAPluginInstaller(PluginInstaller): +class LibBSPluginInstaller(PluginInstaller): def __init__(self): super().__init__(targets=PluginInstaller.DECOMPILERS) - self.plugins_path = Path(str(importlib.resources.files("yodalib"))).joinpath("decompiler_stubs") + self.plugins_path = Path(str(importlib.resources.files("libbs"))).joinpath("decompiler_stubs") def display_prologue(self): print(textwrap.dedent(""" - Now installing YODALib plugins for all supported decompilers...""")) + Now installing LibBS plugins for all supported decompilers...""")) def install_ida(self, path=None, interactive=True): ida_plugin_path = super().install_ida(path=path, interactive=interactive) if ida_plugin_path is None: return None - src_ida_yodalib_py = self.plugins_path.joinpath("ida_yodalib.py") - dst_ida_yodalib_py = ida_plugin_path.joinpath("ida_yodalib.py") - self.link_or_copy(src_ida_yodalib_py, dst_ida_yodalib_py) + src_ida_libbs_py = self.plugins_path.joinpath("ida_libbs.py") + dst_ida_libbs_py = ida_plugin_path.joinpath("ida_libbs.py") + self.link_or_copy(src_ida_libbs_py, dst_ida_libbs_py) return ida_plugin_path def install_angr(self, path=None, interactive=True): @@ -248,9 +248,9 @@ def install_angr(self, path=None, interactive=True): if angr_plugin_path is None: return None - src_angr_yodalib_pkg = self.plugins_path.joinpath("angr_yodalib") - dst_angr_yodalib_pkg = angr_plugin_path.joinpath("angr_yodalib") - self.link_or_copy(src_angr_yodalib_pkg, dst_angr_yodalib_pkg, is_dir=True) + src_angr_libbs_pkg = self.plugins_path.joinpath("angr_libbs") + dst_angr_libbs_pkg = angr_plugin_path.joinpath("angr_libbs") + self.link_or_copy(src_angr_libbs_pkg, dst_angr_libbs_pkg, is_dir=True) return angr_plugin_path def install_ghidra(self, path=None, interactive=True): @@ -258,16 +258,16 @@ def install_ghidra(self, path=None, interactive=True): if ghidra_path is None: return None - src_ghidra_yodalib_pkg = self.plugins_path.joinpath("ghidra_yodalib") - src_vendored = src_ghidra_yodalib_pkg.joinpath("yodalib_vendored") - src_script = src_ghidra_yodalib_pkg.joinpath("ghidra_yodalib.py") - src_script_shutdown = src_ghidra_yodalib_pkg.joinpath("ghidra_yodalib_shutdown.py") + src_ghidra_libbs_pkg = self.plugins_path.joinpath("ghidra_libbs") + src_vendored = src_ghidra_libbs_pkg.joinpath("libbs_vendored") + src_script = src_ghidra_libbs_pkg.joinpath("ghidra_libbs.py") + src_script_shutdown = src_ghidra_libbs_pkg.joinpath("ghidra_libbs_shutdown.py") - dst_ghidra_yodalib_pkg = ghidra_path.joinpath("yodalib_vendored") - dst_ghidra_script = ghidra_path.joinpath("ghidra_yodalib.py") - dst_script_shutdown = ghidra_path.joinpath("ghidra_yodalib_shutdown.py") + dst_ghidra_libbs_pkg = ghidra_path.joinpath("libbs_vendored") + dst_ghidra_script = ghidra_path.joinpath("ghidra_libbs.py") + dst_script_shutdown = ghidra_path.joinpath("ghidra_libbs_shutdown.py") - self.link_or_copy(src_vendored, dst_ghidra_yodalib_pkg, is_dir=True) + self.link_or_copy(src_vendored, dst_ghidra_libbs_pkg, is_dir=True) self.link_or_copy(src_script, dst_ghidra_script) self.link_or_copy(src_script_shutdown, dst_script_shutdown) return ghidra_path @@ -277,7 +277,7 @@ def install_binja(self, path=None, interactive=True): if binja_plugin_path is None: return None - src_path = self.plugins_path.joinpath("binja_yodalib") - dst_path = binja_plugin_path.joinpath("binja_yodalib") + src_path = self.plugins_path.joinpath("binja_libbs") + dst_path = binja_plugin_path.joinpath("binja_libbs") self.link_or_copy(src_path, dst_path, is_dir=True) return binja_plugin_path diff --git a/yodalib/ui/__init__.py b/libbs/ui/__init__.py similarity index 86% rename from yodalib/ui/__init__.py rename to libbs/ui/__init__.py index 92b316a6..fb69f959 100644 --- a/yodalib/ui/__init__.py +++ b/libbs/ui/__init__.py @@ -5,14 +5,14 @@ def progress_bar(items, gui=True, desc="Progressing..."): """ - This displays either a text or GUI progress bar using the YODA GUI backend. + This displays either a text or GUI progress bar using the LibBS GUI backend. This assumes that the GUI is already initialized and running if in GUI mode. """ if not gui: for item in tqdm.tqdm(items, desc=desc): yield item else: - from yodalib.ui.utils import QProgressBarDialog + from libbs.ui.utils import QProgressBarDialog pbar = QProgressBarDialog(label_text=desc) pbar.show() callback_stub = pbar.update_progress diff --git a/yodalib/ui/qt_objects.py b/libbs/ui/qt_objects.py similarity index 98% rename from yodalib/ui/qt_objects.py rename to libbs/ui/qt_objects.py index dcc140ac..8609f577 100644 --- a/yodalib/ui/qt_objects.py +++ b/libbs/ui/qt_objects.py @@ -1,4 +1,4 @@ -from yodalib.ui.version import ui_version +from libbs.ui.version import ui_version if ui_version == "PySide6": from PySide6.QtCore import ( diff --git a/yodalib/ui/utils.py b/libbs/ui/utils.py similarity index 97% rename from yodalib/ui/utils.py rename to libbs/ui/utils.py index 14e99999..d6a63e5c 100644 --- a/yodalib/ui/utils.py +++ b/libbs/ui/utils.py @@ -38,7 +38,7 @@ def __init__(self, label_text="Loading...", on_cancel_callback=None, parent=None super().__init__(parent) self.on_cancel_callback = on_cancel_callback - self.setWindowTitle("YODA Loading...") + self.setWindowTitle("LibBS Loading...") self.setWindowModality(Qt.ApplicationModal) self.layout = QVBoxLayout() diff --git a/yodalib/ui/version.py b/libbs/ui/version.py similarity index 100% rename from yodalib/ui/version.py rename to libbs/ui/version.py diff --git a/setup.cfg b/setup.cfg index 1f79c8d5..34e735d9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] -name = yodalib -version = attr: yodalib.__version__ -url = https://github.com/binsync/yodalib +name = libbs +version = attr: libbs.__version__ +url = https://github.com/binsync/libbs classifiers = License :: OSI Approved :: BSD License Programming Language :: Python :: 3 @@ -22,13 +22,13 @@ install_requires = ghidra_bridge PySide6-Essentials>=6.4.2 -python_requires = >= 3.6 +python_requires = >= 3.8 include_package_data = True packages = find: [options.entry_points] console_scripts = - yodalib = yodalib.__main__:main + libbs = libbs.__main__:main [options.extras_require] test = diff --git a/yodalib/__init__.py b/yodalib/__init__.py deleted file mode 100644 index 493f7415..00000000 --- a/yodalib/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "0.3.0" diff --git a/yodalib/decompiler_stubs/angr_yodalib/__init__.py b/yodalib/decompiler_stubs/angr_yodalib/__init__.py deleted file mode 100644 index 55a494e9..00000000 --- a/yodalib/decompiler_stubs/angr_yodalib/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -try: - from yodalib.decompilers.angr import * -except ImportError: - print("[!] yodalib is not installed, please `pip install yodalib` for THIS python interpreter") diff --git a/yodalib/decompiler_stubs/binja_yodalib/__init__.py b/yodalib/decompiler_stubs/binja_yodalib/__init__.py deleted file mode 100644 index faa6d06b..00000000 --- a/yodalib/decompiler_stubs/binja_yodalib/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -try: - from yodalib.decompilers.binja import * -except ImportError: - print("[!] yodalib is not installed, please `pip install yodalib` for THIS python interpreter") diff --git a/yodalib/decompiler_stubs/binja_yodalib/requirements.txt b/yodalib/decompiler_stubs/binja_yodalib/requirements.txt deleted file mode 100644 index 9b9260fc..00000000 --- a/yodalib/decompiler_stubs/binja_yodalib/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -yodalib \ No newline at end of file diff --git a/yodalib/decompiler_stubs/ghidra_yodalib/ghidra_yodalib.py b/yodalib/decompiler_stubs/ghidra_yodalib/ghidra_yodalib.py deleted file mode 100644 index b2cc7834..00000000 --- a/yodalib/decompiler_stubs/ghidra_yodalib/ghidra_yodalib.py +++ /dev/null @@ -1,17 +0,0 @@ -# Starts the YODA backend for Ghidra scripts. -# @author YODALib -# @category YODALib -# @menupath Tools.YODALib.Start YODA Backend - -import subprocess -from yodalib_vendored.ghidra_bridge_server import GhidraBridgeServer - - -def start_yoda_selector(): - subprocess.Popen("yodalib --run-ghidra-ui".split(" ")) - - -if __name__ == "__main__": - GhidraBridgeServer.run_server(background=True) - # TODO: put the selector back - #start_yoda_selector() diff --git a/yodalib/decompiler_stubs/ghidra_yodalib/ghidra_yodalib_shutdown.py b/yodalib/decompiler_stubs/ghidra_yodalib/ghidra_yodalib_shutdown.py deleted file mode 100644 index 5d23cd9b..00000000 --- a/yodalib/decompiler_stubs/ghidra_yodalib/ghidra_yodalib_shutdown.py +++ /dev/null @@ -1,15 +0,0 @@ -# Shutdown the YODALib backend server. -# @author YODALib -# @category YODALib -# @menupath Tools.YODALib.Shutdown YODA Backend - -from yodalib_vendored.jfx_bridge import bridge -from yodalib_vendored.ghidra_bridge_port import DEFAULT_SERVER_PORT - -if __name__ == "__main__": - print("Requesting server shutdown...") - b = bridge.BridgeClient( - connect_to_host="127.0.0.1", connect_to_port=DEFAULT_SERVER_PORT - ) - - print(b.remote_shutdown()) diff --git a/yodalib/decompiler_stubs/ida_yodalib.py b/yodalib/decompiler_stubs/ida_yodalib.py deleted file mode 100644 index a004dd19..00000000 --- a/yodalib/decompiler_stubs/ida_yodalib.py +++ /dev/null @@ -1,8 +0,0 @@ -def PLUGIN_ENTRY(*args, **kwargs): - try: - from yodalib.decompilers.ida import YODALibPlugin - except ImportError: - print("[!] yodalib is not installed, please `pip install yodalib` for THIS python interpreter") - return None - - return YODALibPlugin(*args, **kwargs)