本文整理汇总了Python中ida_funcs.get_func方法的典型用法代码示例。如果您正苦于以下问题:Python ida_funcs.get_func方法的具体用法?Python ida_funcs.get_func怎么用?Python ida_funcs.get_func使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ida_funcs
的用法示例。
在下文中一共展示了ida_funcs.get_func方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: function_graph_ir
# 需要导入模块: import ida_funcs [as 别名]
# 或者: from ida_funcs import get_func [as 别名]
def function_graph_ir():
# Get settings
settings = GraphIRForm()
ret = settings.Execute()
if not ret:
return
func = ida_funcs.get_func(idc.get_screen_ea())
func_addr = func.start_ea
build_graph(
func_addr,
settings.cScope.value,
simplify=settings.cOptions.value & OPTION_GRAPH_CODESIMPLIFY,
dontmodstack=settings.cOptions.value & OPTION_GRAPH_DONTMODSTACK,
loadint=settings.cOptions.value & OPTION_GRAPH_LOADMEMINT,
verbose=False
)
return
示例2: _set_tooltip
# 需要导入模块: import ida_funcs [as 别名]
# 或者: from ida_funcs import get_func [as 别名]
def _set_tooltip(self, obj, ev):
cursors = self._plugin.config["cursors"]
if not cursors["funcs"]:
return
obj.setToolTip("")
index = obj.parent().indexAt(ev.pos())
func_ea = int(index.sibling(index.row(), 2).data(), 16)
func = ida_funcs.get_func(func_ea)
# Find the corresponding username
for name, user in self._plugin.core.get_users().items():
if ida_funcs.func_contains(func, user["ea"]):
# Set the tooltip
obj.setToolTip(name)
break
示例3: _hxe_callback
# 需要导入模块: import ida_funcs [as 别名]
# 或者: from ida_funcs import get_func [as 别名]
def _hxe_callback(self, event, *_):
if not self._installed:
return 0
if event == ida_hexrays.hxe_func_printed:
ea = ida_kernwin.get_screen_ea()
func = ida_funcs.get_func(ea)
if func is None:
return
if self._func_ea != func.start_ea:
self._func_ea = func.start_ea
self._labels = HexRaysHooks._get_user_labels(self._func_ea)
self._cmts = HexRaysHooks._get_user_cmts(self._func_ea)
self._iflags = HexRaysHooks._get_user_iflags(self._func_ea)
self._lvar_settings = HexRaysHooks._get_user_lvar_settings(
self._func_ea
)
self._numforms = HexRaysHooks._get_user_numforms(self._func_ea)
self._send_user_labels(func.start_ea)
self._send_user_cmts(func.start_ea)
self._send_user_iflags(func.start_ea)
self._send_user_lvar_settings(func.start_ea)
self._send_user_numforms(func.start_ea)
return 0
示例4: __init__
# 需要导入模块: import ida_funcs [as 别名]
# 或者: from ida_funcs import get_func [as 别名]
def __init__(self, text_max_length=30, **kwargs):
super(QFunctionSelect, self).__init__(**kwargs)
self.text_max = text_max_length
self.func = None
self.label = QtWidgets.QPushButton()
self.label.clicked.connect(self.label_clicked)
self.label.setFlat(True)
self.btn = QtWidgets.QPushButton("...")
self.btn.setMaximumWidth(20)
self.btn.clicked.connect(self.btn_clicked)
current_func = ida_funcs.get_func(idc.ScreenEA())
if current_func:
self.set_func(current_func)
layout = QtWidgets.QHBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self.label)
layout.addWidget(self.btn)
layout.setStretch(0, 1)
self.setLayout(layout)
示例5: data
# 需要导入模块: import ida_funcs [as 别名]
# 或者: from ida_funcs import get_func [as 别名]
def data(self):
sizes_hist = defaultdict(int)
seen = set()
for node in ida_gdl.FlowChart(ida_funcs.get_func(self.offset)):
if node.id in seen:
continue
seen.add(node.id)
node_size = node.endEA - node.startEA
sizes_hist[node_size] += 1
if sum(sizes_hist.values()) < 5:
return None
return sizes_hist
示例6: _get_frame
# 需要导入模块: import ida_funcs [as 别名]
# 或者: from ida_funcs import get_func [as 别名]
def _get_frame(self):
result = False
sp = get_sp_val()
ip = get_ip_val()
if ip and sp:
f = get_func(ip)
if f:
frame = get_frame(f)
if frame:
self.framesize = get_struc_size(frame)
n = frame.memqty
frame_offs = f.frregs + f.frsize
self.ea = sp - get_spd(f, ip) - frame_offs
for i in range(n):
m = frame.get_member(i)
if m:
lvar_name = get_member_name(m.id)
lvar_ea = self.ea + m.soff
lvar_size = m.eoff - m.soff
self.members[lvar_ea] = (lvar_name, m.soff, lvar_size, frame_offs)
result = True
return result
示例7: on_process_buffer
# 需要导入模块: import ida_funcs [as 别名]
# 或者: from ida_funcs import get_func [as 别名]
def on_process_buffer(self, buffers, addr, size, mouse_offs):
colors = []
goffs = 0
for mapped, buf in buffers:
if mapped:
for offs in range(len(buf)):
r = g = b = 0
c = buf[offs] & 0xFF
ea = addr + goffs + offs
f = get_func(ea)
if f:
g = b = c
elif self._is_string(ea):
g = c
else:
r = g = b = c
colors.append((True, qRgb(r, g, b)))
else:
for i in range(len(buf)):
colors.append((False, None))
goffs += len(buf)
return colors
示例8: export_stack_reference
# 需要导入模块: import ida_funcs [as 别名]
# 或者: from ida_funcs import get_func [as 别名]
def export_stack_reference(self, addr):
"""
Exports references to stack variables at the address.
Args:
addr: Integer containing instruction address.
"""
f = idc.get_full_flags(addr)
for op in range(ida_ida.UA_MAXOP):
if idc.is_code(f) == True and ida_bytes.is_stkvar(f, op) == True:
insn = ida_ua.insn_t()
ida_ua.decode_insn(insn, addr)
opnd = insn.ops[op]
# TODO:How to handle opnd.type for stack references
optype = opnd.type
if optype == idc.o_void:
continue
# TODO:How to handle op_t_get_addr for stack references
SV = ida_frame.get_stkvar(insn, opnd, opnd.value)
if SV == None:
continue
(sv, actval) = SV
function = ida_funcs.get_func(addr)
self.start_element(STACK_REFERENCE)
self.write_address_attribute(ADDRESS, addr)
self.write_numeric_attribute(OPERAND_INDEX, op, 10)
offset = opnd.addr
spoff = offset - function.frregs
if offset > 0x7FFFFFFF:
offset -= 0x100000000
if spoff > 0x7FFFFFFF:
spoff -= 0x100000000
self.write_numeric_attribute(STACK_PTR_OFFSET, spoff,
16, True)
if (function.flags & idc.FUNC_FRAME) != 0:
self.write_numeric_attribute(FRAME_PTR_OFFSET,
offset, 16, True)
self.close_tag()
示例9: data
# 需要导入模块: import ida_funcs [as 别名]
# 或者: from ida_funcs import get_func [as 别名]
def data(self, index, role=Qt.DisplayRole):
# Check if disabled by the user
cursors = self._plugin.config["cursors"]
if role == Qt.BackgroundRole and cursors["funcs"]:
func_ea = int(index.sibling(index.row(), 2).data(), 16)
func = ida_funcs.get_func(func_ea)
for user in self._plugin.core.get_users().values():
if ida_funcs.func_contains(func, user["ea"]):
r, g, b = StatusWidget.ida_to_python(user["color"])
return QColor(StatusWidget.python_to_qt(r, g, b))
index = self._model.index(index.row(), index.column())
return self._model.data(index, role)
示例10: __call__
# 需要导入模块: import ida_funcs [as 别名]
# 或者: from ida_funcs import get_func [as 别名]
def __call__(self):
func = ida_funcs.get_func(self.start_ea_func)
ida_funcs.append_func_tail(func, self.start_ea_tail, self.end_ea_tail)
示例11: refresh_pseudocode_view
# 需要导入模块: import ida_funcs [as 别名]
# 或者: from ida_funcs import get_func [as 别名]
def refresh_pseudocode_view(ea):
"""Refreshes the pseudocode view in IDA."""
names = ["Pseudocode-%c" % chr(ord("A") + i) for i in range(5)]
for name in names:
widget = ida_kernwin.find_widget(name)
if widget:
vu = ida_hexrays.get_widget_vdui(widget)
# Check if the address is in the same function
func_ea = vu.cfunc.entry_ea
func = ida_funcs.get_func(func_ea)
if ida_funcs.func_contains(func, ea):
vu.refresh_view(True)
示例12: data
# 需要导入模块: import ida_funcs [as 别名]
# 或者: from ida_funcs import get_func [as 别名]
def data(self):
adjacencies = {}
seen = set()
for node in ida_gdl.FlowChart(ida_funcs.get_func(self.offset)):
if node.id in seen:
continue
seen.add(node.id)
adjacencies[node.id] = [succ.id for succ in node.succs()]
if len(adjacencies) > 1:
return adjacencies
else:
return None
示例13: data
# 需要导入模块: import ida_funcs [as 别名]
# 或者: from ida_funcs import get_func [as 别名]
def data(self):
func = ida_funcs.get_func(self.offset)
def clean(asm):
"""This removes markers of function offsets, including hidden variable
length offsets that are of different length on 32 and 64 bit address IDA.
Otherwise, IDA of different offset lengths will truncate incorrect number
of bytes"""
hex_chars = int(log(ida_idaapi.BADADDR + 1, 2) / 4)
pattern = "\x01\\([0-9a-zA-Z]{%s}(.*?)\x02\\)" % hex_chars
replace = r"\g<1>"
return re.sub(pattern, replace, asm)
# make sure only nodes inside the function are accounted for
# this solves cascaded functions (when multiple functions share same ends)
def node_contained(node):
return (ida_funcs.func_contains(func, node.startEA) and
ida_funcs.func_contains(func, node.endEA - 1))
nodes = filter(node_contained, ida_gdl.FlowChart(func))
node_ids = map(lambda n: n.id, nodes)
nodes_data = []
for node in nodes:
assembly = [clean(ida_lines.generate_disasm_line(ea))
for ea in idautils.Heads(node.startEA, node.endEA)]
successive_nodes = [succ.id
for succ in node.succs()
if succ.id in node_ids]
serialized_node = {'id': node.id, 'type': node.type,
'start': node.startEA, 'end': node.endEA,
'successive': successive_nodes, 'assembly': assembly}
nodes_data.append(serialized_node)
return nodes_data
示例14: get_basic_blocks
# 需要导入模块: import ida_funcs [as 别名]
# 或者: from ida_funcs import get_func [as 别名]
def get_basic_blocks(fva):
"""
return sequence of `BasicBlock` instances for given function.
"""
ret = []
func = ida_funcs.get_func(fva)
if func is None:
return ret
for bb in idaapi.FlowChart(func):
ret.append(BasicBlock(va=bb.startEA, size=bb.endEA - bb.startEA))
return ret
示例15: get_function
# 需要导入模块: import ida_funcs [as 别名]
# 或者: from ida_funcs import get_func [as 别名]
def get_function(va):
"""
return va for first instruction in function that contains given va.
"""
return ida_funcs.get_func(va).startEA