当前位置: 首页>>代码示例>>Python>>正文


Python ida_idaapi.BADADDR属性代码示例

本文整理汇总了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 
开发者ID:IDArlingTeam,项目名称:IDArling,代码行数:23,代码来源:actions.py

示例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) 
开发者ID:williballenthin,项目名称:idawilli,代码行数:14,代码来源:goto_file_offset.py

示例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 
开发者ID:IDArlingTeam,项目名称:IDArling,代码行数:12,代码来源:actions.py

示例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 = {} 
开发者ID:IDArlingTeam,项目名称:IDArling,代码行数:12,代码来源:hooks.py

示例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 
开发者ID:nirizr,项目名称:rematch,代码行数:36,代码来源:assembly.py

示例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

# ----------------------------------------------------------------------- 
开发者ID:patois,项目名称:IDACyber,代码行数:13,代码来源:idacyber.py

示例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
    # 
开发者ID:TakahiroHaruyama,项目名称:ida_haru,代码行数:45,代码来源:ida_processor_drv_vm.py

示例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

    # ---------------------------------------------------------------------- 
开发者ID:TakahiroHaruyama,项目名称:ida_haru,代码行数:52,代码来源:ida_processor_drv_vm.py


注:本文中的ida_idaapi.BADADDR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。