cryptohack.org - Network Attacks

2021. 8. 3. 16:50WarGame/cryptohack.org

#!/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}

'WarGame > cryptohack.org' 카테고리의 다른 글

cryptohack.org - Manyprime  (0) 2021.08.07
cryptohack.org - Structure of AES  (0) 2021.08.06
cryptohack.org - Modular Inverting  (0) 2021.08.02
cryptohack.org - Great Snakes  (0) 2021.08.01
cryptohack.org - Lazy CBC  (0) 2021.07.30