-
Notifications
You must be signed in to change notification settings - Fork 42
/
Hyara_IDA.py
92 lines (72 loc) · 2.7 KB
/
Hyara_IDA.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
from hyara_lib.integration.ida_api import HyaraIDA
import ida_kernwin
import idaapi
class Hyara_action_handler_t(idaapi.action_handler_t):
def __init__(self, widget):
idaapi.action_handler_t.__init__(self)
self.widget = widget
def activate(self, ctx):
self.widget.setText(hex(idaapi.get_screen_ea()))
return 1
def update(self, ctx):
return idaapi.AST_ENABLE_ALWAYS
class Hooks(ida_kernwin.UI_Hooks):
def __init__(self):
ida_kernwin.UI_Hooks.__init__(self)
def finish_populating_widget_popup(self, widget, popup):
ida_kernwin.attach_action_to_popup(widget, popup, "Hyara:select_start_address", None)
ida_kernwin.attach_action_to_popup(widget, popup, "Hyara:select_end_address", None)
class HyaraWidget(ida_kernwin.PluginForm):
def OnCreate(self, form):
self.parent = self.FormToPyQtWidget(form)
self.HyaraIDA = HyaraIDA()
self.parent.setLayout(self.HyaraIDA.layout)
idaapi.register_action(
ida_kernwin.action_desc_t(
"Hyara:select_start_address",
"Hyara - Select Start Address",
Hyara_action_handler_t(self.HyaraIDA._start_address),
"Ctrl+Shift+S",
"Hyara - Select Start Address",
)
),
idaapi.register_action(
ida_kernwin.action_desc_t(
"Hyara:select_end_address",
"Hyara - Select End Address",
Hyara_action_handler_t(self.HyaraIDA._end_address),
"Ctrl+Shift+E",
"Hyara - Select End Address",
)
),
def OnClose(self, form):
idaapi.unregister_action("Hyara:select_start_address")
idaapi.unregister_action("Hyara:select_end_address")
hooks.unhook()
class HyaraPlugin(idaapi.plugin_t):
# https://www.hex-rays.com/products/ida/support/sdkdoc/group___p_l_u_g_i_n__.html
flags = idaapi.PLUGIN_UNL
comment = "Hyara"
help = "help"
wanted_name = "Hyara"
wanted_hotkey = "Ctrl+Shift+Y"
def init(self):
global hooks
idaapi.msg("[*] Hyara Plugin\n")
hooks = Hooks()
hooks.hook()
return idaapi.PLUGIN_OK
def run(self, arg):
plg = HyaraWidget()
plg.Show("Hyara")
try:
widget_a = ida_kernwin.find_widget("IDA View-A")
widget_Hyara = ida_kernwin.find_widget("Hyara")
if widget_Hyara and widget_a:
ida_kernwin.set_dock_pos("Hyara", "IDA View-A", ida_kernwin.DP_RIGHT)
except:
print("find_widget option is available version 7.0 or later")
def term(self):
pass
def PLUGIN_ENTRY():
return HyaraPlugin()