Files
ssof_labs/pa/lab2/chall_pwntools_sockets.py
2025-11-20 19:40:11 +00:00

21 lines
480 B
Python

from pwn import *
HOST = "mustard.stt.rnl.tecnico.ulisboa.pt"
PORT = 25055
conn = remote(HOST, PORT)
line = conn.recvline_contains(b"until").decode('utf-8')
target = line[54:-1]
current = "0"
print("Target:", target)
while target != current:
conn.send(b"MORE\n")
new = conn.recvline_contains(b"Here you have").decode('utf-8')[15:]
current = str(int(current) + int(new))
print("New:", new, "Current:", current)
conn.send(b"FINISH\n")
print(conn.recvall().decode('utf-8'))