diff --git a/examples/change_watcher_plugin/bs_change_watcher/__init__.py b/examples/change_watcher_plugin/bs_change_watcher/__init__.py index 6dbf11e5..f9a01e5b 100644 --- a/examples/change_watcher_plugin/bs_change_watcher/__init__.py +++ b/examples/change_watcher_plugin/bs_change_watcher/__init__.py @@ -85,5 +85,10 @@ def install_angr(self, path=None, interactive=True): if not path: return + path = path / "plugins" / "bs_change_watcher" + path.mkdir(parents=True, exist_ok=True) + src = self.pkg_path / "plugin.toml" + dst = Path(path) / "plugin.toml" + self.link_or_copy(src, dst, symlink=True) self._copy_plugin_to_path(path) return path \ No newline at end of file diff --git a/examples/change_watcher_plugin/bs_change_watcher/bs_change_watcher_plugin.py b/examples/change_watcher_plugin/bs_change_watcher/bs_change_watcher_plugin.py index 66cfef04..748d6886 100644 --- a/examples/change_watcher_plugin/bs_change_watcher/bs_change_watcher_plugin.py +++ b/examples/change_watcher_plugin/bs_change_watcher/bs_change_watcher_plugin.py @@ -34,14 +34,28 @@ def create_plugin(*args, **kwargs): has_ida = True except ImportError: has_ida = False + try: + import angrmanagement + has_angr = True + except ImportError: + has_angr = False - if not has_ida: + if not has_ida and not has_angr: create_plugin() + elif has_angr: + from angrmanagement.plugins import BasePlugin + class PluginThunkClass(BasePlugin): + def __init__(self, workspace): + super().__init__(workspace) + globals()["workspace"] = workspace + self.plugin = create_plugin() + + def teardown(self): + pass def PLUGIN_ENTRY(*args, **kwargs): """ This is the entry point for IDA to load the plugin. """ - print("[+] Loading callback_watcher plugin (1/2)") return create_plugin(*args, **kwargs) diff --git a/examples/change_watcher_plugin/bs_change_watcher/plugin.toml b/examples/change_watcher_plugin/bs_change_watcher/plugin.toml new file mode 100644 index 00000000..992eabf1 --- /dev/null +++ b/examples/change_watcher_plugin/bs_change_watcher/plugin.toml @@ -0,0 +1,13 @@ +[meta] +plugin_metadata_version = 0 + +[plugin] +name = "bs_change_watcher" +shortname = "bs_change_watcher" +version = "0.0.0" +description = "" +long_description = "" +platforms = ["windows", "linux", "macos"] +min_angr_version = "9.0.0.0" +author = "The BinSync Team" +entrypoints = ["bs_change_watcher_plugin.py"] \ No newline at end of file diff --git a/examples/template_plugin_entry.py b/examples/template_plugin_entry.py index 1b38ef38..3421d0e1 100644 --- a/examples/template_plugin_entry.py +++ b/examples/template_plugin_entry.py @@ -37,9 +37,24 @@ def create_plugin(*args, **kwargs): has_ida = True except ImportError: has_ida = False + try: + import angrmanagement + has_angr = True + except ImportError: + has_angr = False - if not has_ida: + if not has_ida and not has_angr: create_plugin() + elif has_angr: + from angrmanagement.plugins import BasePlugin + class PluginThunkClass(BasePlugin): + def __init__(self, workspace): + super().__init__(workspace) + globals()["workspace"] = workspace + self.plugin = create_plugin() + + def teardown(self): + pass def PLUGIN_ENTRY(*args, **kwargs):