本文整理汇总了Python中distorm3.Decode16Bits方法的典型用法代码示例。如果您正苦于以下问题:Python distorm3.Decode16Bits方法的具体用法?Python distorm3.Decode16Bits怎么用?Python distorm3.Decode16Bits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类distorm3
的用法示例。
在下文中一共展示了distorm3.Decode16Bits方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_instructions
# 需要导入模块: import distorm3 [as 别名]
# 或者: from distorm3 import Decode16Bits [as 别名]
def _get_instructions(self, boot_code):
if self._config.HEX:
return "".join(["{2}".format(o, h, ''.join(c)) for o, h, c in self.Hexdump(boot_code, 0)])
iterable = distorm3.DecodeGenerator(0, boot_code, distorm3.Decode16Bits)
ret = ""
for (offset, size, instruction, hexdump) in iterable:
ret += "{0}".format(instruction)
if instruction == "RET":
hexstuff = "".join(["{2}".format(o, h, ''.join(c)) for o, h, c in self.Hexdump(boot_code[offset + size:], 0)])
ret += hexstuff
break
return ret
示例2: get_disasm_text
# 需要导入模块: import distorm3 [as 别名]
# 或者: from distorm3 import Decode16Bits [as 别名]
def get_disasm_text(self, boot_code, start):
iterable = distorm3.DecodeGenerator(0, boot_code, distorm3.Decode16Bits)
ret = ""
self.code_data = boot_code
for (offset, size, instruction, hexdump) in iterable:
ret += "{0:010x}: {1:<32} {2}\n".format(offset + start, hexdump, instruction)
if instruction == "RET":
self.code_data = boot_code[0:offset + size]
hexstuff = "\n" + "\n".join(["{0:010x}: {1:<48} {2}".format(o, h, ''.join(c)) for o, h, c in self.Hexdump(boot_code[offset + size:], offset + start + size)])
ret += hexstuff
break
return ret
示例3: vbrDisassembly
# 需要导入模块: import distorm3 [as 别名]
# 或者: from distorm3 import Decode16Bits [as 别名]
def vbrDisassembly(self):
l = Decode(0x000, self.vbr, Decode16Bits)
assemblyCode = ""
for (offset, size, instruction, hexdump) in l:
assemblyCode = assemblyCode + "%.8x: %-32s %s" % (offset, hexdump, instruction) + "\n"
with open(os.path.join(self.dest,"vbr_AssemblyCode.txt"), "w") as f:
f.write(assemblyCode)
示例4: boot_loader_disassembly
# 需要导入模块: import distorm3 [as 别名]
# 或者: from distorm3 import Decode16Bits [as 别名]
def boot_loader_disassembly(self):
l = Decode(0x000, self.mbrStruct.bootloaderCode, Decode16Bits)
assembly_code = ""
for (offset, size, instruction, hexdump) in l:
assembly_code = assembly_code + "%.8x: %-32s %s" % (offset, hexdump, instruction) + "\n"
h_file = open(self.path + os.path.sep + "bootLoaderAssemblyCode.txt", "w")
h_file.write(assembly_code)
h_file.close()