Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
gaasedelen committed Feb 10, 2022
2 parents f41a0db + 4e1cc36 commit 62f034d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
11 changes: 8 additions & 3 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ def install_plugin():
#
# even if the plugin is not in use, the Keystone DLL / lib will be
# loaded into memory by nature of Python imports. we are going to
# try and AGGRESSIVELY unload it such that we can ovewrite it
# try and AGGRESSIVELY unload it such that we can overwrite it
#
# because this is pretty dangerous, we set this flag to ensure the
# patching plugin is completeley neutured and cannot be used in any
# patching plugin is completeley neutered and cannot be used in any
# form until IDA is restarted
#

Expand All @@ -134,7 +134,7 @@ def install_plugin():
print("[!] Please ensure no other instance of IDA are running and try again...")
return False

# remove the rest of the plugin only IF removing Keystone succedded
# remove the rest of the plugin only IF removing Keystone succeeded
shutil.rmtree(patching_directory)

#
Expand Down Expand Up @@ -165,6 +165,11 @@ def install_plugin():
# load the plugin if this was a fresh install
plugin_path = os.path.join(plugins_directory, 'patching.py')
ida_loader.load_plugin(plugin_path)

# if a database appears open, force plugin core to load immediately
if ida_loader.get_path(ida_loader.PATH_TYPE_IDB):
IDA_GLOBAL_SCOPE.patching.core.load()

return True

def remove_keystone(keystone_directory):
Expand Down
7 changes: 5 additions & 2 deletions plugins/patching/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import ida_ua
import ida_auto
import ida_nalt
import ida_bytes
import ida_lines
import ida_idaapi
Expand Down Expand Up @@ -45,8 +46,6 @@ def __init__(self, defer_load=False):
# IDA UI Hooks
self._ui_hooks = UIHooks()
self._ui_hooks.ready_to_run = self.load
self._ui_hooks.populating_widget_popup = self._populating_widget_popup
self._ui_hooks.get_lines_rendering_info = self._highlight_lines
self._ui_hooks.hook()

# IDA 'Processor' Hooks
Expand Down Expand Up @@ -133,6 +132,10 @@ def load(self):
self._ui_hooks.unhook()
return

# enable additional hooks since the plugin is going live
self._ui_hooks.populating_widget_popup = self._populating_widget_popup
self._ui_hooks.get_lines_rendering_info = self._highlight_lines

# finish loading the plugin and integrating its UI elements / actions
self._init_actions()
self._idp_hooks.hook()
Expand Down

0 comments on commit 62f034d

Please sign in to comment.