-
Notifications
You must be signed in to change notification settings - Fork 14
/
gdbscript
49 lines (40 loc) · 1.07 KB
/
gdbscript
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
file kernel
target remote :1234
# Assuming we are here:
# (gdb) x/i $pc
# => 0xffffff80183b6fc6: cli
set $abs_cli = 0xFFFFFF80004DAFC6
set $vm_kernel_slide=*(long *)($pc+0xcf57aa)
printf "$vm_kernel_slide=%p\n", $vm_kernel_slide
set $dark_matter=0xdc000
python
import re
with open("load.log") as fp:
for line in fp:
m = re.search("(0x[0-9a-f]+) .+ keen.BabyKitDriver", line)
if m is not None:
gdb.execute("set $base=$vm_kernel_slide+" + m.group(1))
gdb.execute("add-symbol-file BabyKitDriver.kext/Contents/MacOS/BabyKitDriver $base")
break
else:
raise RuntimeError("No keen.BabyKitDriver in load.log")
end
# BabyKitDriverUserClient::baby_leaveMessage
# b *($base+0x1510)
# c
set $abs_gadget = 0xFFFFFF800035200A
set $gadget = $pc - $abs_cli + $abs_gadget
x/2i $gadget
b *$gadget
set $abs_gadget = 0xFFFFFF8000525C27
set $gadget = $pc - $abs_cli + $abs_gadget
x/2i $gadget
b *$gadget
set $abs_gadget = 0xFFFFFF80004B017C
set $gadget = $pc - $abs_cli + $abs_gadget
x/2i $gadget
b *$gadget
define hook-stop
x/2i $pc
end
c