mirror of
https://github.com/cemu-project/idapython.git
synced 2024-11-25 02:26:55 +01:00
109158fabb
- Added AskUsingForm() with embedded forms support (check ex_askusingform.py example and formchooser.py in the SDK) - Added idautils.DecodePreviousInstruction() / DecodePrecedingInstruction() - Added idc.BeginTypeUpdating() / EndTypeUpdating() for fast batch type update operations - Added more IDP callbacks - Added UI_Hooks with a few notification events - Added idaapi.process_ui_action() / idc.ProcessUiAction() - Added netnode.index() to get netnode number - Better handling of ea_t values with bitwise negation - Execute statement hotkey (Ctrl-F3), script timeout, and other options are now configurable with Python.cfg - bugfix: idaapi.msg() / error() and warning() so they don't accept vararg - bugfix: processor_t.id constants were incorrect - bugfix: get_debug_names() was broken with IDA64 - Various bugfixes
43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
#---------------------------------------------------------------------
|
|
# UI hook example
|
|
#
|
|
# (c) Hex-Rays
|
|
#
|
|
# Maintained By: IDAPython Team
|
|
#
|
|
#---------------------------------------------------------------------
|
|
|
|
import idaapi
|
|
|
|
class MyUiHook(idaapi.UI_Hooks):
|
|
def __init__(self):
|
|
idaapi.UI_Hooks.__init__(self)
|
|
self.cmdname = "<no command>"
|
|
|
|
def preprocess(self, name):
|
|
print("IDA preprocessing command: %s" % name)
|
|
self.cmdname = name
|
|
return 0
|
|
|
|
def postprocess(self):
|
|
print("IDA finished processing command: %s" % self.cmdname)
|
|
return 0
|
|
|
|
|
|
#---------------------------------------------------------------------
|
|
# Remove an existing hook on second run
|
|
try:
|
|
ui_hook_stat = "un"
|
|
print("UI hook: checking for hook...")
|
|
uihook
|
|
print("UI hook: unhooking....")
|
|
uihook.unhook()
|
|
del uihook
|
|
except:
|
|
print("UI hook: not installed, installing now....")
|
|
ui_hook_stat = ""
|
|
uihook = MyUiHook()
|
|
uihook.hook()
|
|
|
|
print("UI hook %sinstalled. Run the script again to %sinstall" % (ui_hook_stat, ui_hook_stat))
|