This challenge is a game running on a server. There is no visibility into the actual code. Connecting shows something like this:
You have gotten 0 of 75 Choice 1 = dcccc1a3bb57e46e14f9c0afec8dd44d0a Choice 2 = 9c5e5fc288d10eaec7e4086dc1b074fd53 Which one is bigger? (1 or 2)
It is seemingly random which is actually bigger, so it is probably a hash of some kind. If you automate playing, you will see there are only 500 unique values, so we can build a bot that can learn the correct answers.
The following script learns the ordering of the items and wins the game:
#!/usr/bin/env python
import socket
history = []
def read(s):
result = ""
while True:
ch = s.recv(1)
if ch == "\n":
# print result
return result
result += ch
def before(a, b):
global order
if (a in order) and (b in order):
if order.index(a) < order.index(b):
return
order.remove(a)
order.insert(order.index(b), a)
return
if a in order:
order.insert(order.index(a) + 1, b)
return
if b in order:
order.insert(order.index(b), a)
return
order.insert(0, a)
order.append(b)
def valid(first, second, i):
global order
global history
if i == 1:
history.append([second, first])
before(second, first)
else:
history.append([first, second])
before(first, second)
def guess(first, second):
global order
if (first in order) and (second in order):
if order.index(first) < order.index(second):
return 2
return 1
if first in order:
if order.index(first) < (len(order) / 2):
return 2
return 1
if second in order:
if order.index(second) < (len(order) / 2):
return 1
return 2
return 1
f = open('database', 'r')
order = []
for line in f.readlines():
if len(line.strip()) > 0:
order.append(line.strip())
f.close()
s = socket.create_connection(("184.73.47.70", 6969))
correct = 0
while True:
line = read(s)
line = read(s)
first = line.split('=')[1].strip()
line = read(s)
second = line.split('=')[1].strip()
# print [first, second]
i = guess(first, second)
read(s)
s.send("%d\n" % i)
read(s)
line = read(s)
if line[0:7] == "Correct":
correct += 1
print "%d correct" % correct
if correct == 75:
break
valid(first, second, i)
else:
print "wrong"
correct = 0
valid(first, second, 3 - i)
for entry in history:
before(entry[0], entry[1])
read(s)
f = open('database', 'w')
for line in order:
f.write("%s\n" % line)
f.close()
while True:
print read(s)
The key is given if 75 correct answers are given in a row. It takes a while for the script to learn enough about the item ordering for this to happen. The key is:
d03snt_3v3ry0n3_md5