1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
| from triton import *
""" [0907088b] 0x120a8624: "add x9, x24, x8, lsl #1" x24=0x122ca678 x8=0x29 => x9=0x122ca6ca [2a058079] 0x120a8628: "ldrsh x10, [x9, #2]" x10=0x3434 x9=0x122ca6ca => x10=0x70 [29098079] 0x120a862c: "ldrsh x9, [x9, #4]" x9=0x122ca6ca => x9=0x0 [6a6a6af8] 0x120a8630: "ldr x10, [x19, x10]" x19=0x126fa000 x10=0x70 => x10=0xe4fff638 [6b6a69f8] 0x120a8634: "ldr x11, [x19, x9]" x19=0x126fa000 x9=0x0 => x11=0xe4fff670 [090d0011] 0x120a8638: "add w9, w8, #3" w8=0x29 => w9=0x2c [6a0100f9] 0x120a863c: "str x10, [x11]" x10=0xe4fff638 x11=0xe4fff670 => x10=0xe4fff638 """
function = { 0x120a8624: bytes.fromhex('0907088b'), 0x120a8628: bytes.fromhex('2a058079'), 0x120a862c: bytes.fromhex('29098079'), 0x120a8630: bytes.fromhex('6a6a6af8'), 0x120a8634: bytes.fromhex('6b6a69f8'), 0x120a8638: bytes.fromhex('090d0011'), 0x120a863c: bytes.fromhex('6a0100f9') }
if __name__ == '__main__':
ctx = TritonContext(ARCH.AARCH64) ctx.setAstRepresentationMode(AST_REPRESENTATION.PCODE)
ctx.setConcreteRegisterValue(ctx.registers.x8, 0x29) ctx.setConcreteRegisterValue(ctx.registers.x24, 0x122ca678)
ctx.setConcreteMemoryValue(MemoryAccess(0x122ca6cc, CPUSIZE.WORD), 0x7000) ctx.setConcreteMemoryValue(MemoryAccess(0x126fa070, CPUSIZE.QWORD), 0xe4fff638) ctx.setConcreteMemoryValue(MemoryAccess(0x122ca6cc, CPUSIZE.QWORD), 0xe4fff670)
pc = 0x120a8624 while pc in function: inst = Instruction(pc, function[pc]) ctx.processing(inst)
print(inst) for expr in inst.getSymbolicExpressions(): print('\t', expr) pc = ctx.getConcreteRegisterValue(ctx.registers.pc) """ 0x120a8624: add x9, x24, x8, lsl #1 x9_0 = (0x122ca678 + (0x29 << 0x1)) ; ADD(S) operation pc_1 = 0x120a8628 ; Program Counter 0x120a8628: ldrsh x10, [x9, #2] x10_2 = sx(0x30, concat(0xf6, 0x70)) ; LDRSH operation - LOAD access pc_3 = 0x120a862c ; Program Counter 0x120a862c: ldrsh x9, [x9, #4] x9_4 = sx(0x30, concat(0xe4, 0xff)) ; LDRSH operation - LOAD access pc_5 = 0x120a8630 ; Program Counter 0x120a8630: ldr x10, [x19, x10] x10_6 = concat(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0) ; LDR operation - LOAD access pc_7 = 0x120a8634 ; Program Counter 0x120a8634: ldr x11, [x19, x9] x11_8 = concat(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0) ; LDR operation - LOAD access pc_9 = 0x120a8638 ; Program Counter 0x120a8638: add w9, w8, #3 x9_10 = (0x29 + 0x3) ; ADD(S) operation pc_11 = 0x120a863c ; Program Counter 0x120a863c: str x10, [x11] @[0x7:8] = extract(63, 56, x10_6) ; Byte reference - STR operation - STORE access @[0x6:8] = extract(55, 48, x10_6) ; Byte reference - STR operation - STORE access @[0x5:8] = extract(47, 40, x10_6) ; Byte reference - STR operation - STORE access @[0x4:8] = extract(39, 32, x10_6) ; Byte reference - STR operation - STORE access @[0x3:8] = extract(31, 24, x10_6) ; Byte reference - STR operation - STORE access @[0x2:8] = extract(23, 16, x10_6) ; Byte reference - STR operation - STORE access @[0x1:8] = extract(15, 8, x10_6) ; Byte reference - STR operation - STORE access @[0x0:8] = extract(7, 0, x10_6) ; Byte reference - STR operation - STORE access @[0x0:64] = x10_6 ; Original memory access - STR operation - STORE access pc_21 = 0x120a8640 ; Program Counter """
|