Script:
import capstone
from capstone import *
cs = Cs(CS_ARCH_MIPS, CS_MODE_32)
cs.detail = True
print(f"Capstone version: {capstone.__version__}")
call_encoding = b'\x40\x00\x00\x0c' # jal 0x100
ret_encoding = b'\x08\x00\xe0\x03' # jr $ra
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}")
for i in cs.disasm(ret_encoding, 0):
print(f"\n0x{i.address:x}\t{i.mnemonic}\t{i.op_str}\t(Groups: {i.groups})")
print(f"Is ret? {capstone.CS_GRP_RET in i.groups}")
Output:
Capstone version: 4.0.2
0x0 jal 0x100 (Groups: [137])
Is call? False
0x0 jr $ra (Groups: [137, 1])
Is ret? False
Looks like the latter was identified in #370 (old). This would really be a nice thing to fix for a wide range of binary analyses!
Script:
Output:
Looks like the latter was identified in #370 (old). This would really be a nice thing to fix for a wide range of binary analyses!