import hashlib
import itertools
from pwn import *
import string

context.log_level = 'debug'

r=remote("localhost",10001)
strings=r.recvline().decode('utf-8')
alpha_bet = string.ascii_lowercase + string.digits
strlist = itertools.permutations(alpha_bet, 5)
obj = re.search('\w{32}', strings)[0]
obj2 = re.search('\w{15}', strings)[0]

for i in strlist:
    data=i[0]+i[1]+i[2]+i[3]+i[4]+obj2
    data_sha=hashlib.md5(data.encode('utf-8')).hexdigest()
    if(data_sha==obj):
        print(data[:5])
        r.sendline(data[:5].encode())
        break
r.recvline()
r.close()