本文整理匯總了Python中ida_idaapi.BADADDR屬性的典型用法代碼示例。如果您正苦於以下問題:Python ida_idaapi.BADADDR屬性的具體用法?Python ida_idaapi.BADADDR怎麽用?Python ida_idaapi.BADADDR使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類ida_idaapi
的用法示例。
在下文中一共展示了ida_idaapi.BADADDR屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: uninstall
# 需要導入模塊: import ida_idaapi [as 別名]
# 或者: from ida_idaapi import BADADDR [as 別名]
def uninstall(self):
action_name = self.__class__.__name__
# Detach the action from the chosen menu
result = ida_kernwin.detach_action_from_menu(
self._menu, self._ACTION_ID
)
if not result:
return False
# Un-register the action using its id
result = ida_kernwin.unregister_action(self._ACTION_ID)
if not result:
return False
# Free the custom icon using its id
ida_kernwin.free_custom_icon(self._icon_id)
self._icon_id = ida_idaapi.BADADDR
self._plugin.logger.debug("Uninstalled action %s" % action_name)
return True
示例2: main
# 需要導入模塊: import ida_idaapi [as 別名]
# 或者: from ida_idaapi import BADADDR [as 別名]
def main():
offset = ida_kernwin.ask_addr(0x0, "file offset")
if not offset:
return
ea = ida_loader.get_fileregion_ea(offset)
if ea == ida_idaapi.BADADDR:
print('error: EA for file offset not found')
return
print('EA for file offset: 0x%x' % (ea))
ida_kernwin.jumpto(ea)
示例3: __init__
# 需要導入模塊: import ida_idaapi [as 別名]
# 或者: from ida_idaapi import BADADDR [as 別名]
def __init__(self, plugin, menu, text, tooltip, icon, handler):
super(Action, self).__init__()
self._plugin = plugin
self._menu = menu
self._text = text
self._tooltip = tooltip
self._icon = icon
self._icon_id = ida_idaapi.BADADDR
self._handler = handler
示例4: __init__
# 需要導入模塊: import ida_idaapi [as 別名]
# 或者: from ida_idaapi import BADADDR [as 別名]
def __init__(self, plugin):
super(HexRaysHooks, self).__init__(plugin)
self._available = None
self._installed = False
self._func_ea = ida_idaapi.BADADDR
self._labels = {}
self._cmts = {}
self._iflags = {}
self._lvar_settings = {}
self._numforms = {}
示例5: data
# 需要導入模塊: import ida_idaapi [as 別名]
# 或者: from ida_idaapi import BADADDR [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
示例6: get_base
# 需要導入模塊: import ida_idaapi [as 別名]
# 或者: from ida_idaapi import BADADDR [as 別名]
def get_base(self, ea):
base = ida_idaapi.BADADDR
qty = ida_segment.get_segm_qty()
for i in range(qty):
seg = ida_segment.getnseg(i)
if seg and seg.contains(ea):
base = seg.start_ea
break
return base
# -----------------------------------------------------------------------
示例7: handle_operand
# 需要導入模塊: import ida_idaapi [as 別名]
# 或者: from ida_idaapi import BADADDR [as 別名]
def handle_operand(self, insn, op, isRead):
flags = ida_bytes.get_flags(insn.ea)
is_offs = ida_bytes.is_off(flags, op.n)
dref_flag = ida_xref.dr_R if isRead else ida_xref.dr_W
def_arg = ida_bytes.is_defarg(flags, op.n)
optype = op.type
itype = insn.itype
# create code xrefs
if optype == ida_ua.o_imm:
makeoff = False
if itype in [self.itype_ncall, self.itype_call]:
insn.add_cref(op.value, op.offb, ida_xref.fl_CN)
makeoff = True
#elif itype == self.itype_mov: # e.g., mov #addr, PC
# insn.add_cref(op.value, op.offb, ida_xref.fl_JN)
# makeoff = True
if makeoff and not def_arg:
otype = ida_offset.get_default_reftype(insn.ea)
ida_offset.op_offset(insn.ea, op.n, otype, ida_idaapi.BADADDR, insn.cs)
is_offs = True
if is_offs:
insn.add_off_drefs(op, ida_xref.dr_O, 0)
elif optype == ida_ua.o_near:
if insn.itype in [self.itype_ncall, self.itype_call]:
fl = ida_xref.fl_CN
else:
fl = ida_xref.fl_JN
insn.add_cref(op.addr, op.offb, fl)
# create data xrefs
elif optype == ida_ua.o_mem:
insn.create_op_data(op.addr, op.offb, op.dtype)
insn.add_dref(op.addr, op.offb, dref_flag)
'''
ds = ida_segment.get_segm_by_name('VM_DATA')
start = ds.start_ea
insn.create_op_data(start + op.addr, op.offb, op.dtype)
insn.add_dref(start + op.addr, op.offb, dref_flag)
'''
# ----------------------------------------------------------------------
# The following callbacks are mandatory
#
示例8: notify_out_operand
# 需要導入模塊: import ida_idaapi [as 別名]
# 或者: from ida_idaapi import BADADDR [as 別名]
def notify_out_operand(self, ctx, op):
"""
Generate text representation of an instructon operand.
This function shouldn't change the database, flags or anything else.
All these actions should be performed only by the emu() function.
This function uses out_...() functions from ua.hpp to generate the operand text
Returns: 1-ok, 0-operand is hidden.
"""
optype = op.type
dtype = op.dtype
signed = 0
if optype == ida_ua.o_reg:
if dtype == ida_ua.dt_byte:
#ctx.out_register('b')
ctx.out_keyword('byte ')
elif dtype == ida_ua.dt_word:
#ctx.out_register('w')
ctx.out_keyword('word ')
ctx.out_register(self.reg_names[op.reg])
elif optype == ida_ua.o_phrase:
if dtype == ida_ua.dt_dword:
ctx.out_keyword('dword ptr ')
elif dtype == ida_ua.dt_byte:
ctx.out_keyword('byte ptr ')
elif dtype == ida_ua.dt_word:
ctx.out_keyword('word ptr ')
ctx.out_symbol('[')
ctx.out_register(self.reg_names[op.reg])
ctx.out_symbol(']')
elif optype == ida_ua.o_imm:
ctx.out_symbol('#')
ctx.out_value(op, ida_ua.OOFW_IMM | signed )
elif optype in [ida_ua.o_near, ida_ua.o_mem]:
r = ctx.out_name_expr(op, op.addr, ida_idaapi.BADADDR)
if not r:
ctx.out_tagon(ida_lines.COLOR_ERROR)
ctx.out_long(op.addr, 16)
ctx.out_tagoff(ida_lines.COLOR_ERROR)
ida_problems.remember_problem(ida_problems.PR_NONAME, ctx.insn.ea)
else:
return False
# for Op2 of mov instruction
#if op.specflag1:
# ctx.out_keyword(' as ptr')
return True
# ----------------------------------------------------------------------