Skip to content

Instantly share code, notes, and snippets.

@morimolymoly
Created January 31, 2022 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morimolymoly/7c640ffa0a43866b16abc2e6ceefc0c3 to your computer and use it in GitHub Desktop.
Save morimolymoly/7c640ffa0a43866b16abc2e6ceefc0c3 to your computer and use it in GitHub Desktop.
import capstone
from capstone import *
cs = Cs(CS_ARCH_MIPS, CS_MODE_32 + CS_MODE_BIG_ENDIAN)
cs.detail = True
print(f"Capstone version: {capstone.__version__}")
# 0c1001f5
call_encoding = b'\x0c\x10\x01\xf5' # jal 4007d4 <funcc>
for i in cs.disasm(call_encoding, 0):
print(f"\n0x{i.address:x}\t{i.mnemonic}\t{i.op_str}\t(Groups: {i.groups})")
print(f"Is call? {capstone.CS_GRP_CALL in i.groups}")
print(f"Is jump? {capstone.CS_GRP_JUMP in i.groups}")
@morimolymoly
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment