-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
membot.asm
48 lines (41 loc) · 923 Bytes
/
membot.asm
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
<% from pwnlib.shellcraft import amd64 %>
<% from pwnlib.shellcraft import common %>
<%page args="readsock = 0, writesock = 1"/>
<%docstring>
Read-write access to a remote process' memory.
Provide a single pointer-width value to determine the operation to perform:
- 0: Exit the loop
- 1: Read data
- 2: Write data
</%docstring>
<%
start = common.label("start")
read = common.label("read")
write = common.label("write")
done = common.label("done")
bkpt = common.label("bkpt")
%>
${start}:
${amd64.linux.readptr(readsock, 'rax')}
test rax, rax
jz ${done}
dec rax
test rax, rax
jz ${read}
dec rax
test rax, rax
jz ${write}
dec rax
test rax, rax
jz ${bkpt}
jmp ${done}
${read}:
${amd64.linux.readloop(readsock)}
jmp ${start}
${write}:
${amd64.linux.writeloop(readsock, writesock)}
jmp ${start}
${bkpt}:
int3
jmp ${start}
${done}: