Miscellaneous

tebak tebakan

HackToday

09 August 2020

Points: 60

Problem :lock:

We get some kind of guessing game, and we need to guess correctly 1111x times.

If we try to guess and get it wrong, it tells us the correct answer

Solution :key:

After doing it a couple more times, it turns out that the answer is always the same depending on the capital letter. Like in the example, letter N will always have Nemesis as the answer.

So we made a script to get the capital letter, and give back the answer that starts with that letter, we found some of the answers manually and then just ran the script and watch the output to get the remaining answers.

import socket
import time
import sys

host = "chall.codepwnda.id"
port = 14011
answers = ['Athena', 'BryanFurran', 'Cleopatra', 'Dionisos', 'EDYRAHMAYADI', 'Fuhrer', 'Gordon', 'Hades', 'Ikarius', 'Jokasta', 'Kaerus', 'Limos', 'Moirae', 'Nemesis', 'Oizys', 'Palioxis', 'Qurea', 'Rhea', 'Skilla', 'Triteia', 'Uranus', 'Venus', 'Wu-kong', 'Xuthus', 'Yellena', 'Zagreus']

def netcat(h, p):
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((h,p))

    res = s.recv(10240)
    print(res)

    for i in range(1115):
        s.send("1")
        s.send("\n")

        time.sleep(0.5)
        res = s.recv(10240)
        print(res)

        pos = res.find("I am ")
        capital = res[pos+5]
        idx = ord(capital)-65

        print("[ ] sending "+str(idx))
        print("[ ] which is "+answers[idx])
        print("[ ] succeeded "+str(i+1)+" times")
        s.send(answers[idx])
        s.send("\n")
        s.send("\n")
        
        time.sleep(0.5)
        res = s.recv(10240)
        print(res)


    while 1:
        input = raw_input().strip()
        s.send(str(input))
        s.send("\n")
        time.sleep(0.5)
        res = s.recv(10240)
        print(res)

netcat(host,port)

Download solve.py

The script is a bit messy, but hey. as long as it works right? :wink:

So the script will give the known answers for around 1115 times just to be safe, then it will “give control” to stdin (we tried to do it automatically but we got broken pipe error :confused:) and then we can manually get the flag.

Flag :checkered_flag:

hacktoday{tebak_tebak_berhadiah_flag_1kEb44t}