Created
August 8, 2015 13:56
-
-
Save aquynh/fa5c8aaa3cebbe2c8f3d to your computer and use it in GitHub Desktop.
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
# Test op_access feature of Capstone | |
from __future__ import print_function | |
from capstone import * | |
CODE = b"\x8d\x4c\x32\x08\x01\xd8" | |
md = Cs(CS_ARCH_X86, CS_MODE_32) | |
md.detail = True | |
for insn in md.disasm(CODE, 0x1000): | |
print("%s\t%s" % (insn.mnemonic, insn.op_str)) | |
(regs_read, regs_write) = insn.regs_access() | |
if len(regs_read) > 0: | |
print("\tRegisters read:", end="") | |
for r in regs_read: | |
print(" %s" %(insn.reg_name(r)), end="") | |
print() | |
if len(regs_write) > 0: | |
print("\tRegisters modified:", end="") | |
for r in regs_write: | |
print(" %s" %(insn.reg_name(r)), end="") | |
print() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment