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


Python idaapi.getnseg方法代码示例

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


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

示例1: Segments

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import getnseg [as 别名]
def Segments():
    """
    Get list of segments (sections) in the binary image

    @return: List of segment start addresses.
    """
    for n in xrange(idaapi.get_segm_qty()):
        seg = idaapi.getnseg(n)
        if seg:
            yield seg.startEA 
开发者ID:CvvT,项目名称:dumpDex,代码行数:12,代码来源:idautils.py

示例2: get_functions_ida

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import getnseg [as 别名]
def get_functions_ida():
  #Repeat for list of segments
  for n in xrange(idaapi.get_segm_qty()):
    #Get number of segments
    seg = idaapi.getnseg(n)
    if seg:
      #Get list of functions in that segment
      funcs=idautils.Functions(seg.startEA, seg.endEA)
      for funcname in funcs:
        name = GetFunctionName(funcname)
        print name

#Wait for analysis to complete 
开发者ID:arvinddoraiswamy,项目名称:slid,代码行数:15,代码来源:get_vuln_functions_list.py

示例3: rename_functions_ida

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import getnseg [as 别名]
def rename_functions_ida():
  #Repeat for list of segments
  for n in xrange(idaapi.get_segm_qty()):
    #Get number of segments
    seg = idaapi.getnseg(n)
    if seg:
      #Get list of functions in that segment
      funcs=idautils.Functions(seg.startEA, seg.endEA)
      for funcaddress in funcs:
        name=GetFunctionName(funcaddress)
        if name in functions_in_library:
          MakeNameEx(funcaddress,"glibc_"+name,SN_NOWARN)

#Wait for analysis to complete 
开发者ID:arvinddoraiswamy,项目名称:slid,代码行数:16,代码来源:rename_funcs.py

示例4: rename_functions_ida

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import getnseg [as 别名]
def rename_functions_ida(func_library_map):
  print func_library_map.keys()
  #Repeat for list of segments
  for n in xrange(idaapi.get_segm_qty()):
    #Get number of segments
    seg = idaapi.getnseg(n)
    if seg:
      #Get list of functions in that segment
      funcs=idautils.Functions(seg.startEA, seg.endEA)
      for funcaddress in funcs:
        name=GetFunctionName(funcaddress)
        if func_library_map.has_key(name):
          MakeNameEx(funcaddress,func_library_map[name][1:]+"_"+name,SN_NOWARN)

#Wait for analysis to complete 
开发者ID:arvinddoraiswamy,项目名称:slid,代码行数:17,代码来源:rename_similar_funcs.py

示例5: __init__

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import getnseg [as 别名]
def __init__(self, ea=UseCurrentAddress, name=None, index=None, segment_t=None):
        """Wrapper around IDA segments.

        There are 3 ways to get a segment - by name, ea or index. Only use one.

        Args:
            ea - address in the segment
            name - name of the segment
            index - index of the segment
        """
        if sum((ea not in (self.UseCurrentAddress, None), name is not None, index is not None,
                segment_t is not None,)) > 1:
            raise ValueError((
                                 "Expected only one (ea, name, index or segment_t)."
                                 " Got (ea={!r}, name={!r}, index={!r}, segment_t={!r})"
                             ).format(ea,
                                      name,
                                      index,
                                      segment_t))


        elif segment_t is not None:
            seg = segment_t

        elif name is not None:
            seg = idaapi.get_segm_by_name(name)

        elif index is not None:
            seg = idaapi.getnseg(index)

        elif ea == self.UseCurrentAddress:
            seg = idaapi.getseg(idc.here())

        elif ea is None:
            raise ValueError("`None` is not a valid address. To use the current screen ea, "
                             "use `Function(ea=Function.UseCurrentAddress)` or supply no `ea`.")

        else:
            seg = idaapi.getseg(ea)

        self._segment = seg 
开发者ID:tmr232,项目名称:Sark,代码行数:43,代码来源:segment.py

示例6: search_binary

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import getnseg [as 别名]
def search_binary(binary_string):
    for i in range(idaapi.get_segm_qty()):
        segm = idaapi.getnseg(i)
        current_ea = segm.startEA
        while True:
            current_ea = idaapi.find_binary(current_ea + 1, segm.endEA, binary_string, 16, idaapi.SEARCH_DOWN)
            if current_ea == idaapi.BADADDR:
                break
            return current_ea
    return 0 
开发者ID:eset,项目名称:malware-research,代码行数:12,代码来源:OL_OSX_decryptor.py

示例7: __iterate__

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import getnseg [as 别名]
def __iterate__(**type):
    '''Iterate through each segment defined in the database that match the keywords specified by `type`.'''
    def newsegment(index):
        seg = idaapi.getnseg(index)
        seg.index, _ = index, ui.navigation.set(interface.range.start(seg))
        return seg
    iterable = itertools.imap(newsegment, six.moves.range(idaapi.get_segm_qty()))
    for key, value in six.iteritems(type or builtins.dict(predicate=utils.fconstant(True))):
        iterable = builtins.list(__matcher__.match(key, value, iterable))
    for item in iterable: yield item 
开发者ID:arizvisa,项目名称:ida-minsc,代码行数:12,代码来源:segment.py

示例8: get_padded_bytes

# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import getnseg [as 别名]
def get_padded_bytes(self, size):
        result = "\x00" * size
        ranges_left = [MemoryRange(self.address, self.address + size)]

        segment_count = idaapi.get_segm_qty()
        valid_memory_ranges = []
        for i in range(segment_count):
            segment = idaapi.getnseg(i)
            # Skip segments with unstable data
            if segment.type == idaapi.SEG_XTRN:
                continue
            valid_memory_ranges.append(
                MemoryRange(segment.startEA, segment.endEA)
            )

        while len(ranges_left) > 0:
            # Get a requested memory range and remove it from the list
            current_range = ranges_left.pop()

            intersection = None
            for memory_range in valid_memory_ranges:
                start = max(current_range.start, memory_range.start)
                end = min(current_range.end, memory_range.end)
                if end > start:
                    intersection = MemoryRange(start, end)
                    break

            # No segment can satisfy any part of requested range
            if intersection is None:
                continue

            chunk = idc.GetManyBytes(
                intersection.start, intersection.end - intersection.start
            )
            if chunk is None:
                print(
                    "[librgb] Some bytes are unreadable in %s..%s"
                    % (
                        idc.atoa(intersection.start),
                        idc.atoa(intersection.end),
                    )
                )
                continue

            result = (
                result[0 : intersection.start - self.address]
                + chunk
                + result[intersection.end - self.address :]
            )
            assert len(result) == size

            # If necessary, enqueue ranges unsatisfied by chosen mem segment
            range1 = MemoryRange(current_range.start, intersection.start)
            range2 = MemoryRange(intersection.end, current_range.end)
            if range1.length > 0:
                ranges_left.append(range1)
            if range2.length > 0:
                ranges_left.append(range2)

        assert len(result) == size
        return result 
开发者ID:rr-,项目名称:ida-images,代码行数:63,代码来源:memory_reader.py


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