#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p python3 python3Packages.pwntools

import hashlib
from pwn import *

def main():
    addr, port, *_ = "saturn.picoctf.net 57454".split(" ")
    r = remote(addr, int(port))

    for _ in range(3):
        x = r.recvline()
        print(x)
        print(r.recvline())
        digest = hashlib.md5(x.split(b'\'')[1]).hexdigest()
        print(digest)
        r.sendline(digest.encode())
        print(r.recvline())
        print(r.recvline())

    print(r.recvline())

if __name__ == "__main__":
    main()
