keystone-engine 是一个开源的轻量级多平台、多架构汇编框架,支持 Arm, Arm64 (AArch64/Armv8), Hexagon, Mips, PowerPC, Sparc, SystemZ、 X86 (16/32/64bit). 非常强大!!
我工作中主要用来处理arm、arm64代码,方便用winhex修改
3种安装方法:pip安装:pip install keystone-engine
github:https://github.com/keystone-engine/keystone
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2016-08-20 09:37:02
# @Author : PiaoYun (piaoyunsoft@163.com)
# @Link : http://www.dllhook.com
# @Comment : keystone汇编引擎测试
from __future__ import print_function
from keystone import *
def keystone_test(arch, mode, code, syntax=0):
ks = Ks(arch, mode)
if syntax != 0:
ks.syntax = syntax
encoding, count = ks.asm(code)
print("%s = [ " % code, end='')
for i in encoding