當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。