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


Python idc.Byte方法代码示例

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


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

示例1: read_leb128

# 需要导入模块: import idc [as 别名]
# 或者: from idc import Byte [as 别名]
def read_leb128(ea, signed):
  """ Read LEB128 encoded data
  """
  val = 0
  shift = 0
  while True:
    byte = idc.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

示例2: read_word

# 需要导入模块: import idc [as 别名]
# 或者: from idc import Byte [as 别名]
def read_word(ea, wordsize=WORD_SIZE):
    """Get the word at the given address.

    Words are read using Byte(), Word(), Dword(), or Qword(), as appropriate. Addresses are checked
    using is_mapped(). If the address isn't mapped, then None is returned.
    """
    if not is_mapped(ea, wordsize):
        return None
    if wordsize == 1:
        return idc.Byte(ea)
    if wordsize == 2:
        return idc.Word(ea)
    if wordsize == 4:
        return idc.Dword(ea)
    if wordsize == 8:
        return idc.Qword(ea)
    raise ValueError('Invalid argument: wordsize={}'.format(wordsize)) 
开发者ID:bazad,项目名称:ida_kernelcache,代码行数:19,代码来源:ida_utilities.py

示例3: read_bytes_slowly

# 需要导入模块: import idc [as 别名]
# 或者: from idc import Byte [as 别名]
def read_bytes_slowly(start, end):
  bytestr = []
  for i in xrange(start, end):
    if idc.hasValue(idc.GetFlags(i)):
      bt = idc.Byte(i)
      bytestr.append(chr(bt))
    else:
      bytestr.append("\x00")
  return "".join(bytestr) 
开发者ID:lifting-bits,项目名称:mcsema,代码行数:11,代码来源:util.py

示例4: xor

# 需要导入模块: import idc [as 别名]
# 或者: from idc import Byte [as 别名]
def xor(size, key, buff):
    for index in range(0, size):
        cur_addr = buff + index
        temp = idc.Byte(cur_addr) ^ key
        idc.PatchByte(cur_addr, temp) 
开发者ID:ExpLife0011,项目名称:IDAPython_Note,代码行数:7,代码来源:15_补丁.py

示例5: data

# 需要导入模块: import idc [as 别名]
# 或者: from idc import Byte [as 别名]
def data(self):
    h = self.keleven
    for ea in idautils.FuncItems(self.offset):
      h = self._cycle(h, idc.Byte(ea))
      # go over all additional bytes of any instruction
      for i in range(ea + 1, ea + idc.ItemSize(ea)):
        h = self._cycle(h, idc.Byte(i))
    return h 
开发者ID:nirizr,项目名称:rematch,代码行数:10,代码来源:instruction_hash.py

示例6: data

# 需要导入模块: import idc [as 别名]
# 或者: from idc import Byte [as 别名]
def data(self):
    h = self.keleven
    for ea in idautils.FuncItems(self.offset):
      h = self._cycle(h, idc.Byte(ea))
      # skip additional bytes of any instruction that contains an offset in it
      if idautils.CodeRefsFrom(ea, False) or idautils.DataRefsFrom(ea):
        continue
      for i in range(ea + 1, ea + idc.ItemSize(ea)):
        h = self._cycle(h, idc.Byte(i))
    return h 
开发者ID:nirizr,项目名称:rematch,代码行数:12,代码来源:identity_hash.py

示例7: append_bytes

# 需要导入模块: import idc [as 别名]
# 或者: from idc import Byte [as 别名]
def append_bytes(instr, addr):
    for j in range(instr.size):
        sig.append(Byte(addr))
        addr += 1
    return addr 
开发者ID:eset,项目名称:malware-research,代码行数:7,代码来源:ida_finfisher_vm.py

示例8: fix_vxworks_idb

# 需要导入模块: import idc [as 别名]
# 或者: from idc import Byte [as 别名]
def fix_vxworks_idb(load_address, vx_version, symbol_table_start, symbol_table_end):
        current_image_base = idaapi.get_imagebase()
        symbol_interval = 16
        if vx_version == 6:
            symbol_interval = 20
        symbol_table_start += load_address
        symbol_table_end += load_address
        ea = symbol_table_start
        shift_address = load_address - current_image_base
        while shift_address >= 0x70000000:
            idaapi.rebase_program(0x70000000, 0x0008)
            shift_address -= 0x70000000
        idaapi.rebase_program(shift_address, 0x0008)
        while ea < symbol_table_end:
            # for VxWorks 6 unknown symbol format
            if idc.Byte(ea + symbol_table_end - 2) == 3:
                ea += symbol_interval
                continue
            offset = 4
            if idaapi.IDA_SDK_VERSION >= 700:
                idc.create_strlit(idc.Dword(ea + offset), idc.BADADDR)
            else:
                idc.MakeStr(idc.Dword(ea + offset), idc.BADADDR)
            sName = idc.GetString(idc.Dword(ea + offset), -1, idc.ASCSTR_C)
            print("Found %s in symbol table" % sName)
            if sName:
                sName_dst = idc.Dword(ea + offset + 4)
                if vx_version == 6:
                    sName_type = idc.Dword(ea + offset + 12)
                else:
                    sName_type = idc.Dword(ea + offset + 8)
                idc.MakeName(sName_dst, sName)
                if sName_type in need_create_function:
                    # flags = idc.GetFlags(ea)
                    print("Start fix Function %s at %s" % (sName, hex(sName_dst)))
                    idc.MakeCode(sName_dst)  # might not need
                    idc.MakeFunction(sName_dst, idc.BADADDR)
            ea += symbol_interval
        print("Fix function by symbol table finish.")
        print("Start IDA auto analysis, depending on the size of the firmware this might take a few minutes.")
        idaapi.autoWait() 
开发者ID:PAGalaxyLab,项目名称:vxhunter,代码行数:43,代码来源:vxhunter_ida.py

示例9: getByte

# 需要导入模块: import idc [as 别名]
# 或者: from idc import Byte [as 别名]
def getByte(self, ea):
        if idaapi.IDA_SDK_VERSION < 700:
            return idc.Byte(ea)
        else:
            return idc.get_wide_byte(ea) 
开发者ID:danielplohmann,项目名称:apiscout,代码行数:7,代码来源:IdaProxy.py

示例10: getString

# 需要导入模块: import idc [as 别名]
# 或者: from idc import Byte [as 别名]
def getString(ea, maxLen=0x200):
    '''Returns up to 0x200 bytes, until a null is found'''
    if using_ida7api:
        return getString_ida7(ea, maxLen)
    i = 0
    retList = []
    while i < maxLen:
        b = idc.Byte(ea+i)
        if b == 0x00:
            break
        retList.append(chr(b))
        i += 1
    return ''.join(retList) 
开发者ID:fireeye,项目名称:flare-ida,代码行数:15,代码来源:jayutils.py


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