5 from __future__
import print_function
8 from xprint
import to_hex
11 X86_CODE32 = b
"\x75\x01"
15 print(
"%s\t" %
to_hex(code,
False), end=
"")
17 for insn
in md.disasm(code, 0x1000):
18 print(
"\t%s\t%s\n" % (insn.mnemonic, insn.op_str))
23 md =
Cs(CS_ARCH_X86, CS_MODE_32)
25 print(
"Disassemble X86 code with default instruction mnemonic")
28 print(
"Now customize engine to change mnemonic from 'JNE' to 'JNZ'")
29 md.mnemonic_setup(X86_INS_JNE,
"jnz")
32 print(
"Reset engine to use the default mnemonic")
33 md.mnemonic_setup(X86_INS_JNE,
None)
36 print(
"ERROR: %s" % e)
39 if __name__ ==
'__main__':
def to_hex(s, prefix_0x=True)