Created
August 12, 2015 07:31
-
-
Save aquynh/295289cd96866a1e3bab to your computer and use it in GitHub Desktop.
This sample shows how to use MASM syntax for Capstone X86
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Demo for MASM syntax of Capstone Python bindings | |
# By Nguyen Anh Quynnh | |
from __future__ import print_function | |
from capstone import * | |
X86_CODE32 = b"\xba\xcd\xab\x00\x00\x8d\x4c\x32\x08\x81\xc6\x34\x12\x00\x00" | |
md = Cs(CS_ARCH_X86, CS_MODE_32) | |
print(">> Intel syntax:") | |
for insn in md.disasm(X86_CODE32, 0x1000): | |
print("0x%x:\t%s\t%s" % (insn.address, insn.mnemonic, insn.op_str)) | |
print() | |
# switch to MASM syntax | |
md.syntax = CS_OPT_SYNTAX_MASM | |
print(">> MASM syntax:") | |
for insn in md.disasm(X86_CODE32, 0x1000): | |
print("0x%x:\t%s\t%s" % (insn.address, insn.mnemonic, insn.op_str)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Downgrading to 4.0.1 works for capstone.
Keystone also raises the same error for
KS_OPT_SYNTAX_MASM
. Not sure which version to downgrade to.