247/CTF — TIPS AND TRICKS

Raj Upadhyay
1 min readSep 2, 2020

--

Question :

Utilise a programming language to interface with the socket and automate solving 500 simple addition problems to receive the flag. Take care when interfacing with unknown remote services — ‘\n’ is not the only way to end a line!

My Solution :

from pwn import * #pip install pwntools
import re
Host="6452548db3f26c16.247ctf.com" #change this accordingly
Port=50038 #change this accordingly
conn = remote(Host,Port)
print(conn.recvline())
print(conn.recvline())
for i in range(500):
try:
print("We are at question : {0}".format(i))
data = conn.recvline().decode("utf-8")
l = re.findall(r'\d+',data)
a = int(l[0])
b = int(l[1])
ans = (str(a+b)+'\r\n').encode("utf-8")
conn.sendline(ans)
conn.recvline()
except Exception as e:
print(e)
print(conn.recvline())
conn.close()

This was my approach to solve this challenge. we can also complete this challenge by using sockets library.

Flag Image

Code Link : https://github.com/raj1997/CTF-Write-up/tree/master/247ctf_com/Tips%20and%20Tricks

--

--

Raj Upadhyay
Raj Upadhyay

Written by Raj Upadhyay

DFIR Consultant || #LoveToPlayCTF #infosec #cybersecurity #4n6

No responses yet