summaryrefslogtreecommitdiff
path: root/view/kernelcache/api
diff options
context:
space:
mode:
authorAlexander Taylor <alex@vector35.com>2025-04-07 18:08:23 -0400
committerAlexander Taylor <alex@vector35.com>2025-04-07 18:08:23 -0400
commit24cee30359d7da61bd86098ebf7ee1d34d2f1a03 (patch)
tree5199e148bc90ca9134f3f5ef53d3a65a435b49f2 /view/kernelcache/api
parentbfa7fe303ccf9dc10635d8e65d3a6169d3bb055a (diff)
Also update kernelcache template.
Fixes #6586, but for this plugin as well.
Diffstat (limited to 'view/kernelcache/api')
-rw-r--r--view/kernelcache/api/python/_kernelcachecore_template.py41
1 files changed, 28 insertions, 13 deletions
diff --git a/view/kernelcache/api/python/_kernelcachecore_template.py b/view/kernelcache/api/python/_kernelcachecore_template.py
index c1f05e72..ecbcb35d 100644
--- a/view/kernelcache/api/python/_kernelcachecore_template.py
+++ b/view/kernelcache/api/python/_kernelcachecore_template.py
@@ -8,22 +8,37 @@ import platform
core = None
core_platform = platform.system()
-# By the time the debugger is loaded, binaryninja has not fully initialized.
-# So we cannot call binaryninja.bundled_plugin_path()
-from binaryninja._binaryninjacore import BNGetBundledPluginDirectory, BNFreeString
-if core_platform == "Darwin":
- _base_path = BNGetBundledPluginDirectory()
- core = ctypes.CDLL(os.path.join(_base_path, "libkernelcache.dylib"))
+from binaryninja import Settings
+if Settings().get_bool("corePlugins.view.kernelCache"):
+ from binaryninja._binaryninjacore import BNGetBundledPluginDirectory
+ if core_platform == "Darwin":
+ _base_path = BNGetBundledPluginDirectory()
+ core = ctypes.CDLL(os.path.join(_base_path, "libkernelcache.dylib"))
-elif core_platform == "Linux":
- _base_path = BNGetBundledPluginDirectory()
- core = ctypes.CDLL(os.path.join(_base_path, "libkernelcache.so"))
+ elif core_platform == "Linux":
+ _base_path = BNGetBundledPluginDirectory()
+ core = ctypes.CDLL(os.path.join(_base_path, "libkernelcache.so"))
-elif (core_platform == "Windows") or (core_platform.find("CYGWIN_NT") == 0):
- _base_path = BNGetBundledPluginDirectory()
- core = ctypes.CDLL(os.path.join(_base_path, "kernelcache.dll"))
+ elif (core_platform == "Windows") or (core_platform.find("CYGWIN_NT") == 0):
+ _base_path = BNGetBundledPluginDirectory()
+ core = ctypes.CDLL(os.path.join(_base_path, "kernelcache.dll"))
+ else:
+ raise Exception("OS not supported")
else:
- raise Exception("OS not supported")
+ from binaryninja._binaryninjacore import BNGetUserPluginDirectory
+ if core_platform == "Darwin":
+ _base_path = BNGetUserPluginDirectory()
+ core = ctypes.CDLL(os.path.join(_base_path, "libkernelcache.dylib"))
+
+ elif core_platform == "Linux":
+ _base_path = BNGetUserPluginDirectory()
+ core = ctypes.CDLL(os.path.join(_base_path, "libkernelcache.so"))
+
+ elif (core_platform == "Windows") or (core_platform.find("CYGWIN_NT") == 0):
+ _base_path = BNGetUserPluginDirectory()
+ core = ctypes.CDLL(os.path.join(_base_path, "kernelcache.dll"))
+ else:
+ raise Exception("OS not supported")
def cstr(var) -> Optional[ctypes.c_char_p]:
if var is None: