2021-11-22 22:22:01 +00:00
|
|
|
from keystone import *
|
|
|
|
from capstone import *
|
2024-05-25 16:45:07 +00:00
|
|
|
from tools import *
|
2021-11-22 22:22:01 +00:00
|
|
|
import io
|
|
|
|
|
|
|
|
cs = Cs(CS_ARCH_ARM, CS_MODE_THUMB)
|
|
|
|
ks = Ks(KS_ARCH_ARM, KS_MODE_THUMB)
|
|
|
|
|
|
|
|
def ks_to_bytes(ks_code):
|
|
|
|
return b"".join([int.to_bytes(x, 1, "little") for x in ks_code[0]])
|
|
|
|
|
|
|
|
cpsr_to_r0_ins = ks_to_bytes(ks.asm("mrs r0, cpsr"))
|
|
|
|
r1_to_cpsr = ks_to_bytes(ks.asm("msr cpsr_c, r1"))
|