forked from Vu1nT0tal/firmeye
-
Notifications
You must be signed in to change notification settings - Fork 1
/
firmeye.py
109 lines (91 loc) · 3.53 KB
/
firmeye.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# -*- coding: utf-8 -*-
import ida_idaapi
import ida_kernwin
from firmeye.utility import FEStrMgr
from firmeye.constants import *
from firmeye.logger import FELogger
from firmeye.analysis.static import FEStaticAnalyzer
from firmeye.analysis.dynamic import FEDynamicAnalyzer
from firmeye.hexraystool import FECodePattern
from firmeye.re_assistant import FEReAssist
from firmeye.test import FEFuncTest
MENU_PATH = "Edit/Plugins/"
class Firmeye(ida_idaapi.plugin_t):
help = PLUGIN_HELP
flags = ida_idaapi.PLUGIN_KEEP
wanted_name = PLUGIN_NAME
wanted_hotkey = PLUGIN_HOTKEY
comment = PLUGIN_COMMENT
def __init__(self):
ida_idaapi.plugin_t.__init__(self)
FEStrMgr(minl=1)
act_static = 'firmeye:static_main'
act_dbg_hook = 'firmeye:dynamic_change_debug_hook_mode'
act_pattern = 'firmeye:code_pattern'
act_assist = 'firmeye:reverse_assistant'
act_test = 'firmeye:functional_test'
def _init_actions(self):
action = ida_kernwin.action_desc_t(
self.act_static,
'static analyzer: main menu',
FEStaticAnalyzer(),
'Ctrl+Shift+s',
'静态分析器主菜单', 0)
ida_kernwin.register_action(action)
ida_kernwin.attach_action_to_menu(MENU_PATH, self.act_static, ida_kernwin.SETMENU_APP)
action = ida_kernwin.action_desc_t(
self.act_dbg_hook,
'dynamic analyzer: enable/disable debug hook',
FEDynamicAnalyzer(),
'Ctrl+Shift+d',
'启用/解除DEBUG Hook', 0)
ida_kernwin.register_action(action)
ida_kernwin.attach_action_to_menu(MENU_PATH, self.act_dbg_hook, ida_kernwin.SETMENU_APP)
action = ida_kernwin.action_desc_t(
self.act_pattern,
'code pattern: find code pattern',
FECodePattern(),
'Ctrl+Shift+c',
'代码模式扫描', 0)
ida_kernwin.register_action(action)
ida_kernwin.attach_action_to_menu(MENU_PATH, self.act_pattern, ida_kernwin.SETMENU_APP)
action = ida_kernwin.action_desc_t(
self.act_test,
'reverse assist tools',
FEReAssist(),
'Ctrl+Shift+x',
'逆向辅助工具', 0)
ida_kernwin.register_action(action)
ida_kernwin.attach_action_to_menu(MENU_PATH, self.act_assist, ida_kernwin.SETMENU_APP)
action = ida_kernwin.action_desc_t(
self.act_test,
'functional test',
FEFuncTest(),
'Ctrl+Shift+q',
'功能性测试', 0)
ida_kernwin.register_action(action)
ida_kernwin.attach_action_to_menu(MENU_PATH, self.act_test, ida_kernwin.SETMENU_APP)
def _detach_menu_action(self):
ida_kernwin.detach_action_from_menu(MENU_PATH, self.act_static)
ida_kernwin.detach_action_from_menu(MENU_PATH, self.act_dbg_hook)
ida_kernwin.detach_action_from_menu(MENU_PATH, self.act_pattern)
ida_kernwin.detach_action_from_menu(MENU_PATH, self.act_assist)
ida_kernwin.detach_action_from_menu(MENU_PATH, self.act_test)
def init(self):
try:
self._init_actions()
except Exception as e:
FELogger.erro(e.__str__())
return ida_idaapi.PLUGIN_KEEP
def term(self):
self._detach_menu_action()
def banner(self):
FELogger.console(PLUGIN_HELP)
FELogger.console(BANNER_MSG)
def run(self,arg):
self.banner()
def PLUGIN_ENTRY():
try:
return Firmeye()
except Exception as e:
FELogger.erro(e.__str__())