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


Python idc.SegStart方法代码示例

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


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

示例1: create_call_map

# 需要导入模块: import idc [as 别名]
# 或者: from idc import SegStart [as 别名]
def create_call_map(self, ftype):
        assert_ida_available()
        import idc
        import idautils
        seg_mapping = {idc.SegName(x): (idc.SegStart(x), idc.SegEnd(x)) for x in idautils.Segments()}
        imports = seg_mapping[".idata"] if ftype == PE else seg_mapping['.plt']
        start, stop = seg_mapping[".text"]
        current = start
        while current <= stop:
            inst = current
            if idc.GetMnem(inst) in ["call", "jmp"]:
                value = idc.GetOperandValue(inst, 0)
                name = idc.GetOpnd(inst, 0)
                if imports[0] <= value <= imports[1]:
                    entry = self.config.call_map.add()
                    entry.address = inst
                    entry.name = name
            current = idc.NextHead(current, stop) 
开发者ID:RobinDavid,项目名称:idasec,代码行数:20,代码来源:configuration_file.py

示例2: getFuncRanges

# 需要导入模块: import idc [as 别名]
# 或者: from idc import SegStart [as 别名]
def getFuncRanges(ea, doAllFuncs):
    if using_ida7api:
        return getFuncRanges_ida7(ea, doAllFuncs)
    if doAllFuncs:
        funcs = []
        funcGen = idautils.Functions(idc.SegStart(ea), idc.SegEnd(ea))
        for i in funcGen:
            funcs.append(i)
        funcRanges = []
        for i in range(len(funcs) - 1):
            funcRanges.append( (funcs[i], funcs[i+1]) )
        funcRanges.append( (funcs[-1], idc.SegEnd(ea)) )
        return funcRanges
    else:
        #just get the range of the current function
        fakeRanges = [( idc.GetFunctionAttr(idc.here(), idc.FUNCATTR_START), idc.GetFunctionAttr(idc.here(), idc.FUNCATTR_END)), ]
        return fakeRanges 
开发者ID:fireeye,项目名称:flare-ida,代码行数:19,代码来源:stackstrings.py

示例3: processCode

# 需要导入模块: import idc [as 别名]
# 或者: from idc import SegStart [as 别名]
def processCode(self):
        if (self.params.startAddr==idc.BADADDR) and (self.params.endAddr==idc.BADADDR):

            if using_ida7api:
                self.params.startAddr = idc.get_segm_start(idc.here())
                self.params.endAddr = idc.get_segm_end(idc.here())
            else:
                self.params.startAddr = idc.SegStart(idc.here())
                self.params.endAddr = idc.SegEnd(idc.here())
            logger.info('Processing current segment only: 0x%08x - 0x%08x', self.params.startAddr, self.params.endAddr)
        else:
            logger.info('Processing range 0x%08x - 0x%08x', self.params.startAddr, self.params.endAddr)
        if self.params.searchDwordArray:
            self.lookForDwordArray(self.params.startAddr, self.params.endAddr)
        if self.params.searchPushArgs:
            self.lookForOpArgs(self.params.startAddr, self.params.endAddr) 
开发者ID:fireeye,项目名称:flare-ida,代码行数:18,代码来源:shellcode_hash_search.py

示例4: map_exports

# 需要导入模块: import idc [as 别名]
# 或者: from idc import SegStart [as 别名]
def map_exports(exports, verbose=True):
    """ gets an array of [(vaddress, name),..] and writes it to db"""
    if verbose:
        print "[+] going for %d exports" % (len(exports))
    for addr, export_name in exports:
        print "[+] creating export", export_name
        # check that there are no existing segments in that address
        if idc.SegStart(addr) == idc.BADADDR:
            print "[+] creating seg: 0x%08X: %d" % (addr, 4)
            idc.AddSegEx(addr,
                         addr + 4, 0, 0,
                         idaapi.saRelPara, idaapi.scPub,
                         idc.ADDSEG_FILLGAP)
        elif verbose:
            print "[!] Skipping creation of existing segment.."
        # set it as execuable
        idc.SetSegmentAttr(addr, idc.SEGATTR_PERM, SEGPERM_EXEC)
        if verbose:
            print "[+] making name: %s" % (export_name)
        make_name(addr, export_name) 
开发者ID:deepinstinct,项目名称:dsc_fix,代码行数:22,代码来源:dsc_fix.py

示例5: init_seginfo

# 需要导入模块: import idc [as 别名]
# 或者: from idc import SegStart [as 别名]
def init_seginfo(self):
        #print("seg len:%d\n" % len(list(idautils.Segments())))
        for seg in idautils.Segments():
            segname = idc.SegName(seg)
            if segname.startswith('func_'):
                self.segstarts[idc.SegStart(seg)] = segname
                self.segends[idc.SegEnd(seg)] = segname
                #print("segname:%s\n" % segname)
                #print("add_func() called ret:%d" % add_func(idc.SegStart(seg), idc.SegEnd(seg))) 
开发者ID:feicong,项目名称:lua_re,代码行数:11,代码来源:luac_proc.py

示例6: update_mapping

# 需要导入模块: import idc [as 别名]
# 或者: from idc import SegStart [as 别名]
def update_mapping(self):
        pass
        self.fun_mapping = {idc.GetFunctionName(x): (idaapi.get_func(x).startEA, idaapi.get_func(x).endEA-1) for x in
                            idautils.Functions()}
        self.seg_mapping = {idc.SegName(x): (idc.SegStart(x), idc.SegEnd(x)) for x in idautils.Segments()} 
开发者ID:RobinDavid,项目名称:idasec,代码行数:7,代码来源:idasec_core.py

示例7: is_code

# 需要导入模块: import idc [as 别名]
# 或者: from idc import SegStart [as 别名]
def is_code(ea):
  if is_invalid_ea(ea):
    return False

  seg_ea = idc.SegStart(ea)
  seg_type = idc.GetSegmentAttr(seg_ea, idc.SEGATTR_TYPE)
  return seg_type == idc.SEG_CODE

# A stricter form of `is_code`, where we also check whether IDA thinks something
# is code. IDA is able to identify some things like embedded exception tables
# in the code section as not truly being code. 
开发者ID:lifting-bits,项目名称:mcsema,代码行数:13,代码来源:util.py

示例8: is_invalid_ea

# 需要导入模块: import idc [as 别名]
# 或者: from idc import SegStart [as 别名]
def is_invalid_ea(ea):
  """Returns `True` if `ea` is not valid, i.e. it doesn't point into any
  valid segment."""
  if idc.BADADDR == ea:
    return True

  try:
    idc.GetSegmentAttr(idc.SegStart(ea), idc.SEGATTR_TYPE)
    return False  # If we get here, then it must be a valid ea!
  except:
    return True 
开发者ID:lifting-bits,项目名称:mcsema,代码行数:13,代码来源:util.py

示例9: is_external_segment_by_flags

# 需要导入模块: import idc [as 别名]
# 或者: from idc import SegStart [as 别名]
def is_external_segment_by_flags(ea):
  """Returns `True` if IDA believes that `ea` belongs to an external segment."""
  try:
    seg_ea = idc.SegStart(ea)
    seg_type = idc.GetSegmentAttr(seg_ea, idc.SEGATTR_TYPE)
    if seg_type == idc.SEG_XTRN:
      _EXTERNAL_SEGMENTS.add(seg_ea)
      return True
    else:
      return False
  except:
    return False 
开发者ID:lifting-bits,项目名称:mcsema,代码行数:14,代码来源:util.py

示例10: is_external_segment

# 需要导入模块: import idc [as 别名]
# 或者: from idc import SegStart [as 别名]
def is_external_segment(ea):
  """Returns `True` if the segment containing `ea` looks to be solely containing
  external references."""
  global _NOT_EXTERNAL_SEGMENTS

  seg_ea = idc.SegStart(ea)
  if seg_ea in _NOT_EXTERNAL_SEGMENTS:
    return False

  if seg_ea in _EXTERNAL_SEGMENTS:
    return True

  if is_external_segment_by_flags(ea):
    _EXTERNAL_SEGMENTS.add(seg_ea)
    return True

  ext_types = []
  seg_name = idc.SegName(seg_ea).lower()
  
  if IS_ELF:
    if ".got" in seg_name or ".plt" in seg_name:
      _EXTERNAL_SEGMENTS.add(seg_ea)
      return True

  elif IS_PE:
    if ".idata" == seg_name:  # Import table.
      _EXTERNAL_SEGMENTS.add(seg_ea)
      return True

  _NOT_EXTERNAL_SEGMENTS.add(seg_ea)
  return False 
开发者ID:lifting-bits,项目名称:mcsema,代码行数:33,代码来源:util.py

示例11: is_constructor_segment

# 需要导入模块: import idc [as 别名]
# 或者: from idc import SegStart [as 别名]
def is_constructor_segment(ea):
  """Returns `True` if the segment containing `ea` belongs to global constructor section"""
  seg_ea = idc.SegStart(ea)
  seg_name = idc.SegName(seg_ea).lower()
  if seg_name in [".init_array", ".ctor"]:
    return True
  return False 
开发者ID:lifting-bits,项目名称:mcsema,代码行数:9,代码来源:util.py

示例12: make_xref

# 需要导入模块: import idc [as 别名]
# 或者: from idc import SegStart [as 别名]
def make_xref(from_ea, to_ea, xref_constructor, xref_size):
  """Force the data at `from_ea` to reference the data at `to_ea`."""
  if not idc.GetFlags(to_ea) or is_invalid_ea(to_ea):
    DEBUG("  Not making reference (A) from {:x} to {:x}".format(from_ea, to_ea))
    return

  make_head(from_ea)

  if is_code(from_ea):
    _CREFS_FROM[from_ea].add(to_ea)
    _CREFS_TO[to_ea].add(from_ea)
  else:
    _DREFS_FROM[from_ea].add(to_ea)
    _DREFS_TO[to_ea].add(from_ea)

  # If we can't make a head, then it probably means that we're at the
  # end of the binary, e.g. the last thing in the `.extern` segment.
  if not make_head(from_ea + xref_size):
    assert idc.BADADDR == idc.SegStart(from_ea + xref_size)

  idaapi.do_unknown_range(from_ea, xref_size, idc.DOUNK_EXPAND)
  xref_constructor(from_ea)
  if not is_code_by_flags(from_ea):
    idc.add_dref(from_ea, to_ea, idc.XREF_USER|idc.dr_O)
  else: 
    DEBUG("  Not making reference (B) from {:x} to {:x}".format(from_ea, to_ea)) 
开发者ID:lifting-bits,项目名称:mcsema,代码行数:28,代码来源:util.py

示例13: recover_frame_entries

# 需要导入模块: import idc [as 别名]
# 或者: from idc import SegStart [as 别名]
def recover_frame_entries(seg_ea):
  if seg_ea == idc.BADADDR:
    return

  DEBUG("Recover entries from section : {}".format(idc.SegName(seg_ea)))
  ea = idc.SegStart(seg_ea)
  end_ea = idc.SegEnd(seg_ea)
  while ea != idc.BADADDR and ea < end_ea:
    ea = format_entries(ea) 
开发者ID:lifting-bits,项目名称:mcsema,代码行数:11,代码来源:exception.py

示例14: iter_lines

# 需要导入模块: import idc [as 别名]
# 或者: from idc import SegStart [as 别名]
def iter_lines():
    """
    Iterate through all line addresses in the IDB
    Yields addresses of all lines.
    """
    for ea in idautils.Segments():
        seg_start = idc.SegStart(ea)
        seg_end = idc.SegEnd(ea)

        cur_addr = seg_start
        while (cur_addr < seg_end) and (cur_addr != idaapi.BADADDR):
            yield cur_addr
            cur_addr = idc.NextHead(cur_addr) 
开发者ID:xorpd,项目名称:idsearch,代码行数:15,代码来源:idb_indexer.py

示例15: untag_pointers

# 需要导入模块: import idc [as 别名]
# 或者: from idc import SegStart [as 别名]
def untag_pointers():
    _log(2, 'Starting tagged pointer conversion')
    for seg in idautils.Segments():
        untag_pointers_in_range(idc.SegStart(seg), idc.SegEnd(seg))
    _log(2, 'Tagged pointer conversion complete') 
开发者ID:bazad,项目名称:ida_kernelcache,代码行数:7,代码来源:tagged_pointers.py


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