本文整理汇总了Python中idc.get_wide_byte方法的典型用法代码示例。如果您正苦于以下问题:Python idc.get_wide_byte方法的具体用法?Python idc.get_wide_byte怎么用?Python idc.get_wide_byte使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idc
的用法示例。
在下文中一共展示了idc.get_wide_byte方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: nextGlobalString
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_wide_byte [as 别名]
def nextGlobalString(self, ea):
"""Find the next possible address for a global string, given the beginning of the current global string.
Args:
ea (int): effective start address of the current global string.
Return Value:
Possible start address for the next global string
"""
str_content = self.getAsciiString(ea)
if str_content is None:
return ea + self._global_alignment
elif idc.get_wide_byte(ea + len(str_content)) != ord('\0'):
return ea + max(self._global_alignment, pad(len(str_content), self._global_alignment))
else:
for offset in range(len(str_content) - 1, -1, -1):
if chr(str_content[offset]) not in string.printable:
return ea + max(self._global_alignment, pad(offset, self._global_alignment))
return ea + self._global_alignment
示例2: read_leb128
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_wide_byte [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
示例3: get_native_function
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_wide_byte [as 别名]
def get_native_function(self):
ecx = idc.get_reg_value("ECX")
esp = idc.get_reg_value("ESP")
method_name = self.get_method_name(esp)
if (idc.get_wide_byte(idc.get_wide_dword(ecx + 8) + 0x38) != 0):
function = idc.get_wide_dword(idc.get_wide_dword(esp + 4) + 0x28)
else:
function = idc.get_wide_dword(idc.get_wide_dword(esp + 4) + 0x24)
print("Resolved native function: 0x%x - %s" % (function, method_name))
if ((method_name not in self.ignore and not self.ignore_all) or
(method_name in self.debug_if_equals) or
(any(x for x in self.debug_if_contains if method_name is not None and x in method_name))):
self.traced.append({"name": method_name, "ea": function, "type": "native", "hit": 0})
idc.add_bpt(function)
示例4: revert_patch
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_wide_byte [as 别名]
def revert_patch(va, nr):
"""Unpatch the opcodes at @va, reverting them to their original value.
Args:
va (numbers.Integral): Address of the location of the patch to revert
nr (numbers.Integral): Number of bytes to scan and revert
Returns:
bool: True if patched bytes were restored
"""
ret = False
orig = [ida_bytes.get_original_byte(va + i) for i in range(nr)]
current = [idc.get_wide_byte(va + i) for i in range(nr)]
for i in range(len(orig)):
if orig[i] != current[i]:
ret = True
idaapi.patch_byte(va + i, orig[i])
return ret
示例5: extractFunctionStartSample
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_wide_byte [as 别名]
def extractFunctionStartSample(self, ea, code_type):
"""Extract features for a "function start" sample.
Args:
ea (int): effective address to be sampled
code_type (int): code type of the wanted sample
Return Value:
feature set (list of byte values)
"""
return list(map(lambda o: idc.get_wide_byte(ea + o), self._classifiers_start_offsets[code_type]))
示例6: extractFunctionEndSample
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_wide_byte [as 别名]
def extractFunctionEndSample(self, ea, code_type):
"""Extract features for a "function end" sample.
Args:
ea (int): effective address to be sampled
code_type (int): code type of the wanted sample
Return Value:
feature set (list of byte values)
"""
return list(map(lambda o: idc.get_wide_byte(ea + o), self._classifiers_end_offsets[code_type]))
示例7: extractFunctionMixedSample
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_wide_byte [as 别名]
def extractFunctionMixedSample(self, ea, code_type):
"""Extract features for a "function start/end" sample.
Args:
ea (int): effective address to be sampled
code_type (int): code type of the wanted sample
Return Value:
feature set (list of byte values)
"""
return list(map(lambda o: idc.get_wide_byte(ea + o), self._classifiers_mixed_offsets[code_type]))
示例8: extractFunctionTypeSample
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_wide_byte [as 别名]
def extractFunctionTypeSample(self, ea):
"""Extract features for a "code type" sample.
Args:
ea (int): effective address to be sampled
Return Value:
feature set (list of byte values)
"""
return list(map(lambda o: idc.get_wide_byte(ea + o), self._classifier_type_offsets))
示例9: read_bytes_slowly
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_wide_byte [as 别名]
def read_bytes_slowly(start, end):
bytestr = []
for i in xrange(start, end):
if idc.has_value(idc.get_full_flags(i)):
bt = idc.get_wide_byte(i)
bytestr.append(chr(bt))
else:
bytestr.append("\x00")
return "".join(bytestr)
示例10: _getbytes
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_wide_byte [as 别名]
def _getbytes(self, start, l=1):
out = []
for ad in range(l):
offset = ad + start + self.base_address
if not is_mapped(offset):
raise IOError("not enough bytes")
out.append(int_to_byte(get_wide_byte(offset)))
return b''.join(out)
示例11: get_guid
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_wide_byte [as 别名]
def get_guid(address):
"""get GUID located by address"""
guid = []
guid.append(idc.get_wide_dword(address))
guid.append(idc.get_wide_word(address + 4))
guid.append(idc.get_wide_word(address + 6))
for addr in range(address + 8, address + 16, 1):
guid.append(idc.get_wide_byte(addr))
return guid
示例12: get_header_idb
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_wide_byte [as 别名]
def get_header_idb():
"""get file header from idb"""
if idc.get_segm_name(0) == 'HEADER':
header = bytearray(
[idc.get_wide_byte(ea) for ea in range(0, idc.get_segm_end(0))])
return header
return bytearray(b'')
示例13: getByte
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_wide_byte [as 别名]
def getByte(self, ea):
if idaapi.IDA_SDK_VERSION < 700:
return idc.Byte(ea)
else:
return idc.get_wide_byte(ea)
示例14: read_byte
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_wide_byte [as 别名]
def read_byte(insn=None):
if (insn):
b = insn.get_next_byte()
else:
b = idc.get_wide_byte(Reader.pos)
Reader.pos += 1
return b
示例15: read_rect_size
# 需要导入模块: import idc [as 别名]
# 或者: from idc import get_wide_byte [as 别名]
def read_rect_size(li):
nbits = idc.get_wide_byte(8) >> 3
return ((5 + 4*nbits) + 7) / 8