-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathx86.py
More file actions
40 lines (29 loc) · 748 Bytes
/
Copy pathx86.py
File metadata and controls
40 lines (29 loc) · 748 Bytes
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
import unicorn
import capstone
import utils
bits = 32
regs = [
"eax", "ecx", "edx", "ebx",
"esp", "ebp", "esi", "edi",
"eip"
]
unicorn_arch = unicorn.UC_ARCH_X86
unicorn_mode = unicorn.UC_MODE_32
capstone_arch = capstone.CS_ARCH_X86
capstone_mode = capstone.CS_MODE_32
unicorn_regs = {}
capstone_regs = {}
for reg in regs:
unicorn_regs[reg] = getattr(unicorn.x86_const, "UC_X86_REG_" + reg.upper())
capstone_regs[reg] = getattr(capstone.x86_const, "X86_REG_" + reg.upper())
instruction_pointer = "eip"
stack_pointer = "esp"
ip = instruction_pointer
sp = stack_pointer
address_mask = 0xffffffff
page_mask = 0xfffff000
page_size = 0x1000
return_instructions = ["\xc3"]
alignment = 1
pack = utils.p32
unpack = utils.u32