You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
488 B
22 lines
488 B
#!/usr/bin/python
|
|
import pwn
|
|
import re
|
|
import time
|
|
|
|
r = pwn.remote('0c2450d17014ac4e.247ctf.com', 50319)
|
|
|
|
while not r.can_recv(0):
|
|
time.sleep(0.5)
|
|
|
|
# can be substituted by True to speed up the process (:
|
|
while r.can_recv(0):
|
|
answ = r.recvline().decode('utf-8')
|
|
ns = re.findall("\d{1,4}", answ)
|
|
if len(ns) == 2:
|
|
sum = int(ns[0]) + int(ns[1])
|
|
ans = bytes(str(sum) + '\r\n', 'utf-8')
|
|
r.send(ans)
|
|
time.sleep(0.05)
|
|
else:
|
|
print(answ)
|