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 import idaapi
28 import idautils
29 import idc
30
31
33 """
34 This class serves as a generic proxy to the IDA Pro Python API. This is neccessary because while running the
35 plugin, dynamic references to the loaded Python modules get lost when inside functions called by Qt.
36 As a side effect, we can also do central error handling in this proxy class.
37 """
38
40 self.idc = idc
41 self.idaapi = idaapi
42 self.idautils = idautils
43
44 self.SN_NOWARN = self.idc.SN_NOWARN
45 self.SN_NOCHECK = self.idc.SN_NOCHECK
46 self.CIC_ITEM = self.idc.CIC_ITEM
47 self.BAD_ADDR = 0xffffffff
48 self.FF_LABL = self.idc.FF_LABL
49 self.SEARCH_DOWN = 1
50 self.FUNCATTR_END = self.idc.FUNCATTR_END
51 self.FUNC_LIB = self.idaapi.FUNC_LIB
52 self.INF_SHORT_DN = self.idc.INF_SHORT_DN
53
55 return self.idaapi.cvar.inf.minEA
56
59
62
65
66 - def Jump(self, address):
67 return self.idc.Jump(address)
68
71
73 function_chart = []
74 try:
75 function_chart = self.idaapi.FlowChart(function_address)
76 except:
77 if function_address is not None:
78 print ("Trying to resolve an API address in non-function code at location: 0x%x, continuing analysis" \
79 + "...") % function_address
80 else:
81 print ("IdaProxy.FlowChart: Tried to create a FlowChart on None object, skipping function.")
82 return function_chart
83
86
88 return self.idc.AddHotkey(hotkey, function)
89
91 return self.idaapi.get_func(function_address)
92
95
97 return self.idautils.CodeRefsTo(destination, flow)
98
101
104
107
109 return self.idc.SegEnd(address)
110
112 return self.idc.SegName(address)
113
114 - def MakeNameEx(self, address, name, warning_level):
115 return self.idc.MakeNameEx(address, name, warning_level)
116
117 - def Name(self, address):
118 return self.idc.Name(address)
119
121 return self.idc.GetMnem(address)
122
124 type_at_address = self.idc.GetType(address)
125 if type_at_address is not None:
126 return type_at_address
127 else:
128 print ("IdaProxy.FlowChart: No type information for 0x%x available, returning \"\".") % address
129 return ""
130
132 return self.idc.GetOpType(address, index)
133
136
138 return self.idaapi.get_byte(address)
139
142
143 - def Functions(self, start_address=None, end_address=None):
144 return self.idautils.Functions(start_address, end_address)
145
146 - def Heads(self, start_address=None, end_address=None):
147 return self.idautils.Heads(start_address, end_address)
148
150 return self.idautils.XrefsTo(ea, flag)
151
154
157
158 - def SetColor(self, address, location_type, color):
159 return self.idc.SetColor(address, location_type, color)
160
163
166
169
172
175
177 return self.idautils.FuncItems(function_address)
178
179 - def Demangle(self, name, disable_mask):
180 return self.idc.Demangle(name, disable_mask)
181
184