summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
author0cyn <kat@vector35.com>2025-11-03 15:04:53 -0500
committer0cyn <kat@vector35.com>2025-11-03 15:04:53 -0500
commit023ec070cf1328879ff95e520a6b14ee092dde60 (patch)
tree0c59006a0fd19fbe24ead3c51ed402dd7114d807 /python
parent0c55bf12f6148a8f3c4b1af66c950d73e371b351 (diff)
Revert "Refactor Plugin Load/Management to support upcoming changes"
This reverts commit 72fcf44f3731ade3cf1310da55f633f1cb9069ce.
Diffstat (limited to 'python')
-rw-r--r--python/__init__.py1
-rw-r--r--python/pluginmanager.py15
2 files changed, 9 insertions, 7 deletions
diff --git a/python/__init__.py b/python/__init__.py
index ebd7a331..02703972 100644
--- a/python/__init__.py
+++ b/python/__init__.py
@@ -250,6 +250,7 @@ def _init_plugins():
if _enable_default_log and is_headless_init_once and min_level in LogLevel.__members__ and not core_ui_enabled(
) and sys.stderr.isatty():
log_to_stderr(LogLevel[min_level])
+ core.BNInitRepoPlugins()
if core.BNIsLicenseValidated():
_plugin_init = True
else:
diff --git a/python/pluginmanager.py b/python/pluginmanager.py
index 8f6eaa6c..62066397 100644
--- a/python/pluginmanager.py
+++ b/python/pluginmanager.py
@@ -34,7 +34,7 @@ class RepoPlugin:
``RepoPlugin`` is mostly read-only, however you can install/uninstall enable/disable plugins. RepoPlugins are
created by parsing the plugins.json in a plugin repository.
"""
- def __init__(self, handle: core.BNPluginHandle):
+ def __init__(self, handle: core.BNRepoPluginHandle):
self.handle = handle
def __del__(self):
@@ -289,7 +289,7 @@ class Repository:
for plugin in self.plugins:
if plugin_path == plugin.path:
return plugin
- raise KeyError(plugin_path)
+ raise KeyError()
@property
def url(self) -> str:
@@ -337,23 +337,24 @@ class RepositoryManager:
"""
def __init__(self):
binaryninja._init_plugins()
+ self.handle = core.BNGetRepositoryManager()
def __getitem__(self, repo_path: str) -> Repository:
for repo in self.repositories:
if repo_path == repo.path:
return repo
- raise KeyError(repo_path)
+ raise KeyError()
def check_for_updates(self) -> bool:
"""Check for updates for all managed Repository objects"""
- return core.BNRepositoryManagerCheckForUpdates()
+ return core.BNRepositoryManagerCheckForUpdates(self.handle)
@property
def repositories(self) -> List[Repository]:
"""List of Repository objects being managed"""
result = []
count = ctypes.c_ulonglong(0)
- repos = core.BNRepositoryManagerGetRepositories(count)
+ repos = core.BNRepositoryManagerGetRepositories(self.handle, count)
assert repos is not None, "core.BNRepositoryManagerGetRepositories returned None"
try:
for i in range(count.value):
@@ -375,7 +376,7 @@ class RepositoryManager:
@property
def default_repository(self) -> Repository:
"""Gets the default Repository"""
- repo_handle = core.BNRepositoryManagerGetDefaultRepository()
+ repo_handle = core.BNRepositoryManagerGetDefaultRepository(self.handle)
assert repo_handle is not None, "core.BNRepositoryManagerGetDefaultRepository returned None"
repo_handle_ref = core.BNNewRepositoryReference(repo_handle)
assert repo_handle_ref is not None, "core.BNNewRepositoryReference returned None"
@@ -405,4 +406,4 @@ class RepositoryManager:
if not isinstance(url, str) or not isinstance(repopath, str):
raise ValueError("Expected url or repopath to be of type str.")
- return core.BNRepositoryManagerAddRepository(url, repopath)
+ return core.BNRepositoryManagerAddRepository(self.handle, url, repopath)