|
8 | 8 | core = None |
9 | 9 | core_platform = platform.system() |
10 | 10 |
|
11 | | -# By the time the debugger is loaded, binaryninja has not fully initialized. |
12 | | -# So we cannot call binaryninja.bundled_plugin_path() |
13 | | -from binaryninja._binaryninjacore import BNGetBundledPluginDirectory, BNFreeString |
14 | | -if core_platform == "Darwin": |
15 | | - _base_path = BNGetBundledPluginDirectory() |
16 | | - core = ctypes.CDLL(os.path.join(_base_path, "libkernelcache.dylib")) |
17 | | - |
18 | | -elif core_platform == "Linux": |
19 | | - _base_path = BNGetBundledPluginDirectory() |
20 | | - core = ctypes.CDLL(os.path.join(_base_path, "libkernelcache.so")) |
21 | | - |
22 | | -elif (core_platform == "Windows") or (core_platform.find("CYGWIN_NT") == 0): |
23 | | - _base_path = BNGetBundledPluginDirectory() |
24 | | - core = ctypes.CDLL(os.path.join(_base_path, "kernelcache.dll")) |
| 11 | +from binaryninja import Settings |
| 12 | +if Settings().get_bool("corePlugins.view.kernelCache"): |
| 13 | + from binaryninja._binaryninjacore import BNGetBundledPluginDirectory |
| 14 | + if core_platform == "Darwin": |
| 15 | + _base_path = BNGetBundledPluginDirectory() |
| 16 | + core = ctypes.CDLL(os.path.join(_base_path, "libkernelcache.dylib")) |
| 17 | + |
| 18 | + elif core_platform == "Linux": |
| 19 | + _base_path = BNGetBundledPluginDirectory() |
| 20 | + core = ctypes.CDLL(os.path.join(_base_path, "libkernelcache.so")) |
| 21 | + |
| 22 | + elif (core_platform == "Windows") or (core_platform.find("CYGWIN_NT") == 0): |
| 23 | + _base_path = BNGetBundledPluginDirectory() |
| 24 | + core = ctypes.CDLL(os.path.join(_base_path, "kernelcache.dll")) |
| 25 | + else: |
| 26 | + raise Exception("OS not supported") |
25 | 27 | else: |
26 | | - raise Exception("OS not supported") |
| 28 | + from binaryninja._binaryninjacore import BNGetUserPluginDirectory |
| 29 | + if core_platform == "Darwin": |
| 30 | + _base_path = BNGetUserPluginDirectory() |
| 31 | + core = ctypes.CDLL(os.path.join(_base_path, "libkernelcache.dylib")) |
| 32 | + |
| 33 | + elif core_platform == "Linux": |
| 34 | + _base_path = BNGetUserPluginDirectory() |
| 35 | + core = ctypes.CDLL(os.path.join(_base_path, "libkernelcache.so")) |
| 36 | + |
| 37 | + elif (core_platform == "Windows") or (core_platform.find("CYGWIN_NT") == 0): |
| 38 | + _base_path = BNGetUserPluginDirectory() |
| 39 | + core = ctypes.CDLL(os.path.join(_base_path, "kernelcache.dll")) |
| 40 | + else: |
| 41 | + raise Exception("OS not supported") |
27 | 42 |
|
28 | 43 | def cstr(var) -> Optional[ctypes.c_char_p]: |
29 | 44 | if var is None: |
|
0 commit comments