Capstone disassembly/disassembler framework: Core (Arm, Arm64, BPF, EVM, M68K, M680X, MOS65xx, Mips, PPC, RISCV, Sparc, SystemZ, TMS320C64x, Web Assembly, X86, X86_64, XCore) + bindings. (bloaty 依赖)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

72 lines
1.8 KiB

# By Dang Hoang Vu <danghvu@gmail.com>, 2014
from libcpp cimport bool
from libc.stdint cimport uint8_t, uint64_t, uint16_t
cdef extern from "<capstone/capstone.h>":
ctypedef size_t csh
ctypedef enum cs_mode:
pass
ctypedef enum cs_arch:
pass
ctypedef struct cs_detail:
pass
ctypedef struct cs_insn:
unsigned int id
uint64_t address
uint16_t size
uint8_t bytes[24]
char mnemonic[32]
char op_str[160]
cs_detail *detail
ctypedef enum cs_err:
pass
ctypedef enum cs_opt_type:
pass
unsigned int cs_version(int *major, int *minor)
bool cs_support(int arch)
cs_err cs_open(cs_arch arch, cs_mode mode, csh *handle)
cs_err cs_close(csh *handle)
cs_err cs_errno(csh handle)
size_t cs_disasm(csh handle,
const uint8_t *code, size_t code_size,
uint64_t address,
size_t count,
cs_insn **insn)
cs_err cs_option(csh handle, cs_opt_type type, size_t value)
void cs_free(cs_insn *insn, size_t count)
const char *cs_reg_name(csh handle, unsigned int reg_id)
const char *cs_insn_name(csh handle, unsigned int insn_id)
const char *cs_group_name(csh handle, unsigned int group_id)
bool cs_insn_group(csh handle, cs_insn *insn, unsigned int group_id)
bool cs_reg_read(csh handle, cs_insn *insn, unsigned int reg_id)
bool cs_reg_write(csh handle, cs_insn *insn, unsigned int reg_id)
int cs_op_count(csh handle, cs_insn *insn, unsigned int op_type)
cs_err cs_regs_access(csh handle, cs_insn *insn, uint16_t *regs_read, uint8_t *read_count, uint16_t *regs_write, uint8_t *write_count)
int cs_op_index(csh handle, cs_insn *insn, unsigned int op_type,
unsigned int position)