Description
A numbers game
(code50, solved by 406)Description: People either love or hate math. Do you love it? Prove it! You just need to solve a bunch of equations without a mistake.
Service: 188.166.133.53:11027
Resolution
When we connect to the service we get the following:
laxa:Challenges:18:03:38$ nc 188.166.133.53 11027 Hi, I heard that you're good in math. Prove it! Level 1.: x - 2 = 6
So we make the following script:
#!/usr/bin/python
import telnetlib
t = telnetlib.Telnet("188.166.133.53", 11027)
print t.read_until('\n'),
while True:
a = t.read_until('\n')
print a,
data = a.split(' ')
a = int(data[4])
b = int(data[6].strip())
if data[3] == '-':
res = a + b
elif data[3] == '+':
res = b - a
elif data[3] == '*':
res = b / a
elif data[3] == '/':
res = b * a
print res
t.write(str(res) + '\n')
a = t.read_until('\n')
print a,
After solving 100 equations we get the flag:
IW{M4TH_1S_34SY}
[Internetwache CTF 2016] [Code 50 – A numbers game] Write Up