hashy
hashy

Reputation: 305

get opcode of instruction in capstone python

I understand that the opcodes are provided by myself to capstone for disassembly, but I would like to know what opcode was disassembled to get the provided instruction. Unfortunately, I couldn't find what key of capstone.CsInsn is called to get the opcode.

I tried the following keys, but neither of them is opcode:

for i in md.disasm(data, dataLength):
    print(i.mnemonic, i.address, i.op_str, i.operands, i.id, i.regs_read, i.regs_write, i.groups, type(i))

# returned values: ('fcmovnu', 512, 'st(0), st(2)', [<capstone.x86.X86Op object at 0x000001911AB019C0>, <capstone.x86.X86Op object at 0x000001911AB01E40>], 89, [], [31], [137, 169], <class 'capstone.CsInsn'>)

I just would like to know that \xdb opcode were disassembled to above assembly instructions.

Upvotes: 3

Views: 1057

Answers (1)

user916358
user916358

Reputation: 11

For that purpose you can use i.bytes, so in your case you might use something like i.bytes[0] == 0xdb

Upvotes: 0

Related Questions