WarGame/cryptohack.org

cryptohack.org - Network Attacks

m0nd2y 2021. 8. 3. 16:50

#!/usr/bin/env python3

import telnetlib
import json

HOST = "socket.cryptohack.org"
PORT = 11112

tn = telnetlib.Telnet(HOST, PORT)


def readline():
    return tn.read_until(b"\n")

def json_recv():
    line = readline()
    return json.loads(line.decode())

def json_send(hsh):
    request = json.dumps(hsh).encode()
    tn.write(request)


print(readline())
print(readline())
print(readline())
print(readline())


request = {
    "buy": "flag"
}
json_send(request)

response = json_recv()

print(response["flag"])

 

코드를 위와 같이 바꾸어서 flag를 가져오면 된다.

 

 

 

FLAG : crypto{sh0pp1ng_f0r_fl4g5}