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


Python idaapi.BADADDR属性代码示例

本文整理汇总了Python中idaapi.BADADDR属性的典型用法代码示例。如果您正苦于以下问题:Python idaapi.BADADDR属性的具体用法?Python idaapi.BADADDR怎么用?Python idaapi.BADADDR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在idaapi的用法示例。


在下文中一共展示了idaapi.BADADDR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Addrs

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import BADADDR [as 别名]
def Addrs(*args):
    """
    Enumerate all addresses

    @param <range>: see getrange

    @return: list of all addresses in range

    """
    (first, last)= getrange(args)

    # note: problem when using range(...) for ea>=2^31
    # TODO: problem when last == BADADDR
    ea = first
    while ea!=BADADDR and ea<last:
        yield ea
        ea = idc.NextAddr(ea) 
开发者ID:nlitsme,项目名称:idascripts,代码行数:19,代码来源:enumerators.py

示例2: BytesThat

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import BADADDR [as 别名]
def BytesThat(*args):
    """
    Enumerate array items

    @param <range>: see getrange
    @param callable: function which tests the flags

    @return: list of all addresses where callable(GetFlags(ea)) is True

    """
    (first, last)= getrange(args)
    i= getcallablepos(args)
    if i<0:
        raise Exception("missing callable")

    callable= args[i]

    ea= first
    if ea<last and not callable(idaapi.get_full_flags(ea)):
        ea= idaapi.nextthat(ea, last, callable)
    while ea!=BADADDR and ea<last:
        yield ea
        ea= idaapi.nextthat(ea, last, callable) 
开发者ID:nlitsme,项目名称:idascripts,代码行数:25,代码来源:enumerators.py

示例3: Heads

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import BADADDR [as 别名]
def Heads(*args):
    """
    Enumerate array items

    @param <range>: see getrange

    @return: list of all heads

    """
    (first, last)= getrange(args)

    ea= first
    if ea<last and not idaapi.is_head(idaapi.get_full_flags(ea)):
        ea= idaapi.next_head(ea, last)
    while ea!=BADADDR and ea<last:
        yield ea
        ea= idaapi.next_head(ea, last) 
开发者ID:nlitsme,项目名称:idascripts,代码行数:19,代码来源:enumerators.py

示例4: NotTails

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import BADADDR [as 别名]
def NotTails(*args):
    """
    Enumerate array items

    @param <range>: see getrange

    @return: list of all not-tails

    Note that NotTails includes all Heads plus all undefined bytes

    """
    (first, last)= getrange(args)

    ea= first
    if ea<last and idaapi.is_tail(idaapi.get_full_flags(ea)):
        ea= idaapi.next_not_tail(ea)
    while ea!=BADADDR and ea<last:
        yield ea
        ea= idaapi.next_not_tail(ea) 
开发者ID:nlitsme,项目名称:idascripts,代码行数:21,代码来源:enumerators.py

示例5: Heads

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import BADADDR [as 别名]
def Heads(start=None, end=None):
    """
    Get a list of heads (instructions or data)

    @param start: start address (default: inf.minEA)
    @param end:   end address (default: inf.maxEA)

    @return: list of heads between start and end
    """
    if not start: start = idaapi.cvar.inf.minEA
    if not end:   end = idaapi.cvar.inf.maxEA

    ea = start
    if not idc.isHead(idc.GetFlags(ea)):
        ea = idaapi.next_head(ea, end)
    while ea != idaapi.BADADDR:
        yield ea
        ea = idaapi.next_head(ea, end) 
开发者ID:CvvT,项目名称:dumpDex,代码行数:20,代码来源:idautils.py

示例6: StructMembers

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import BADADDR [as 别名]
def StructMembers(sid):
    """
    Get a list of structure members information (or stack vars if given a frame).

    @param sid: ID of the structure.

    @return: List of tuples (offset, name, size)

    @note: If 'sid' does not refer to a valid structure,
           an exception will be raised.
    @note: This will not return 'holes' in structures/stack frames;
           it only returns defined structure members.
    """
    m = idc.GetFirstMember(sid)
    if m == -1:
        raise Exception("No structure with ID: 0x%x" % sid)
    while (m != idaapi.BADADDR):
        name = idc.GetMemberName(sid, m)
        if name:
            yield (m, name, idc.GetMemberSize(sid, m))
        m = idc.GetStrucNextOff(sid, m) 
开发者ID:CvvT,项目名称:dumpDex,代码行数:23,代码来源:idautils.py

示例7: IsPrevInsnCall

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import BADADDR [as 别名]
def IsPrevInsnCall(ea):
    """
    Given a return address, this function tries to check if previous instruction
    is a CALL instruction
    """
    global CallPattern
    if ea == idaapi.BADADDR or ea < 10:
        return None

    for delta, opcodes in CallPattern:
        # assume caller's ea
        caller = ea + delta
        # get the bytes
        bytes = [x for x in GetDataList(caller, len(opcodes), 1)]
        # do we have a match? is it a call instruction?
        if bytes == opcodes and idaapi.is_call_insn(caller):
            return caller
    return None

# ----------------------------------------------------------------------- 
开发者ID:joxeankoret,项目名称:nightmare,代码行数:22,代码来源:CallStackWalk.py

示例8: read_leb128

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import BADADDR [as 别名]
def read_leb128(ea, signed):
  """ Read LEB128 encoded data
  """
  val = 0
  shift = 0
  while True:
    byte = idc.get_wide_byte(ea)
    val |= (byte & 0x7F) << shift
    shift += 7
    ea += 1
    if (byte & 0x80) == 0:
      break

    if shift > 64:
      DEBUG("Bad leb128 encoding at {0:x}".format(ea - shift/7))
      return idc.BADADDR

  if signed and (byte & 0x40):
    val -= (1<<shift)
  return val, ea 
开发者ID:lifting-bits,项目名称:mcsema,代码行数:22,代码来源:util.py

示例9: fix_addresses

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import BADADDR [as 别名]
def fix_addresses(start=None, end=None):
    """Set missing addresses to start and end of IDB.

    Take a start and end addresses. If an address is None or `BADADDR`,
    return start or end addresses of the IDB instead.

    Args
        start: Start EA. Use `None` to get IDB start.
        end:  End EA. Use `None` to get IDB end.

    Returns:
        (start, end)
    """
    if start in (None, idaapi.BADADDR):
        start = idaapi.cvar.inf.minEA

    if end in (None, idaapi.BADADDR):
        end = idaapi.cvar.inf.maxEA

    return start, end 
开发者ID:tmr232,项目名称:Sark,代码行数:22,代码来源:core.py

示例10: create_struct

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import BADADDR [as 别名]
def create_struct(name):
    """Create a structure.

    Args:
        name: The structure's name

    Returns:
        The sturct ID

    Raises:
        exceptions.SarkStructAlreadyExists: A struct with the same name already exists
        exceptions.SarkCreationFailed:  Struct creation failed
    """
    sid = idaapi.get_struc_id(name)
    if sid != idaapi.BADADDR:
        # The struct already exists.
        raise exceptions.SarkStructAlreadyExists("A struct names {!r} already exists.".format(name))

    sid = idaapi.add_struc(idaapi.BADADDR, name, 0)
    if sid == idaapi.BADADDR:
        raise exceptions.SarkStructCreationFailed("Struct creation failed.")

    return sid 
开发者ID:tmr232,项目名称:Sark,代码行数:25,代码来源:structure.py

示例11: get_struct

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import BADADDR [as 别名]
def get_struct(name):
    """Get a struct by it's name.

    Args:
        name: The name of the struct

    Returns:
        The struct's id

    Raises:
        exceptions.SarkStructNotFound: is the struct does not exist.
    """
    sid = idaapi.get_struc_id(name)
    if sid == idaapi.BADADDR:
        raise exceptions.SarkStructNotFound()

    return sid 
开发者ID:tmr232,项目名称:Sark,代码行数:19,代码来源:structure.py

示例12: _uninstall_load_file

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import BADADDR [as 别名]
def _uninstall_load_file(self):
        """
        Remove the 'File->Load file->Code coverage file...' menu entry.
        """

        # remove the entry from the File-> menu
        result = idaapi.detach_action_from_menu(
            "File/Load file/",
            self.ACTION_LOAD_FILE
        )
        if not result:
            return False

        # unregister the action
        result = idaapi.unregister_action(self.ACTION_LOAD_FILE)
        if not result:
            return False

        # delete the entry's icon
        idaapi.free_custom_icon(self._icon_id_file)
        self._icon_id_file = idaapi.BADADDR

        logger.info("Uninstalled the 'Code coverage file' menu entry") 
开发者ID:gaasedelen,项目名称:lighthouse,代码行数:25,代码来源:ida_integration.py

示例13: _uninstall_load_batch

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import BADADDR [as 别名]
def _uninstall_load_batch(self):
        """
        Remove the 'File->Load file->Code coverage batch...' menu entry.
        """

        # remove the entry from the File-> menu
        result = idaapi.detach_action_from_menu(
            "File/Load file/",
            self.ACTION_LOAD_BATCH
        )
        if not result:
            return False

        # unregister the action
        result = idaapi.unregister_action(self.ACTION_LOAD_BATCH)
        if not result:
            return False

        # delete the entry's icon
        idaapi.free_custom_icon(self._icon_id_batch)
        self._icon_id_batch = idaapi.BADADDR

        logger.info("Uninstalled the 'Code coverage batch' menu entry") 
开发者ID:gaasedelen,项目名称:lighthouse,代码行数:25,代码来源:ida_integration.py

示例14: _uninstall_open_coverage_xref

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import BADADDR [as 别名]
def _uninstall_open_coverage_xref(self):
        """
        Remove the right click 'Coverage Xref' context menu entry.
        """
        self._ui_hooks.unhook()

        # unregister the action
        result = idaapi.unregister_action(self.ACTION_COVERAGE_XREF)
        if not result:
            return False

        # delete the entry's icon
        idaapi.free_custom_icon(self._icon_id_xref)
        self._icon_id_xref = idaapi.BADADDR

        logger.info("Uninstalled the 'Coverage Xref' menu entry") 
开发者ID:gaasedelen,项目名称:lighthouse,代码行数:18,代码来源:ida_integration.py

示例15: activate

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import BADADDR [as 别名]
def activate(self, ctx):
        if self.action == ACTION_HX_REMOVERETTYPE:
            vdui = idaapi.get_widget_vdui(ctx.widget)
            self.remove_rettype(vdui)
            vdui.refresh_ctext()
        elif self.action == ACTION_HX_COPYEA:
            ea = idaapi.get_screen_ea()
            if ea != idaapi.BADADDR:
                copy_to_clip("0x%X" % ea)
                print("Address 0x%X has been copied to clipboard" % ea)
        elif self.action == ACTION_HX_COPYNAME:
            name = idaapi.get_highlight(idaapi.get_current_viewer())[0]
            if name:
                copy_to_clip(name)
                print("%s has been copied to clipboard" % name)
        elif self.action == ACTION_HX_GOTOCLIP:
            loc = parse_location(clip_text())
            print("Goto location 0x%x" % loc)
            idc.jumpto(loc)
        else:
            return 0

        return 1 
开发者ID:L4ys,项目名称:LazyIDA,代码行数:25,代码来源:LazyIDA.py


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