-
Notifications
You must be signed in to change notification settings - Fork 0
/
exploit.py
executable file
·26 lines (21 loc) · 962 Bytes
/
exploit.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
#!/usr/bin/env python
# import kniznice pwntools
from pwn import *
# !!! do tejto funkcie treda doimplementovat exploit podla zadania !!!
# defaultne len vytvori jednoduchy GET request na stranku index.html
# Pomocky (uzitocne podla toho, ktore zranitelnosti sa rozhodnete exploitovat):
# - mozno je vhodne si nastudovat ako vyzera format GET requestu
# - na prekodovanie roznych adries alebo hodnot do binarneho formatu treba pouzit
# funkcie p32(), p64() alebo pack() pre n bitov
# - niektore zranitelnosti si mozu vyzadovat aby payload exploitu
# pouzival URL kodovanie. Na URL kodovanie/dekodovanie ponuka
# kniznica pwntools dvojicu funkcii urldecode()/urlencode()
def build_exploit():
request = "GET /index.html HTTP/1.0\r\n\r\n"
return request
# vytvorenie TCP spojenia pre dvojicu IP:port
conn = remote('localhost', 80)
# odoslanie GET requestu s exploitom na server
conn.send(build_exploit())
conn.recvline()
conn.close()