scrap-is-not-scrap/sins/disassemble.py

14 lines
309 B
Python

#! /usr/bin/env python3
from capstone import Cs, CS_ARCH_X86, CS_MODE_64
import json
capstone = Cs(CS_ARCH_X86, CS_MODE_64)
def disasm(shellcode: bytes)->str:
opcodes = list()
for opcode in capstone.disasm(shellcode, 0):
opcodes.append([opcode.mnemonic, opcode.op_str])
return opcodes