Stop Drop and Roll

Catégorie: Misc Difficulté: very-easy Flag: HTB{1_wiLl_sT0p_dR0p_4nD_r0Ll_mY_w4Y_oUt!}

Challenge

Description


The Fray: The Video Game is one of the greatest hits of the last... well, we don't remember quite how long. Our "computers" these days can't run much more than that, and it has a tendency to get repetitive...

Explications

Une fois connecté au serveur, on nous demande de transformer et renvoyer les mots donnés en suivant ces règles :

  • GORGE devient STOP

  • PHREAK devient DROP

  • FIRE devient ROLL

  • Joindre les mots avec un -


Script de résolution

from pwnlib.tubes.remote import remote

CONVERSION = {'GORGE': 'STOP', 'PHREAK': 'DROP', 'FIRE': 'ROLL'}

def answer_question(raw: bytes) -> bytes:
    words = raw.decode().splitlines()[-2].split(', ')
    return '-'.join([CONVERSION[word] for word in words]).encode()

def solve(host, port):
    client = remote(host, port)
    client.recvuntil(b'Are you ready? (y/n) ')
    client.sendline(b'y')
    for i in range(500):
        data = client.recvuntil(b'What do you do? ', timeout=1)
        answer = answer_question(data)
        client.sendline(answer)
    flag = client.recvall(timeout=1).decode().split('flag is ')[1].strip()
    print(f'Flag: {flag}')

if __name__ == '__main__':
    solve('83.136.252.82', 38440)

Dernière mise à jour

Cet article vous a-t-il été utile ?