#/usr/bin/python
#-*- encoding | utf-8 -*-

from pwn import *
import sys
import os
from struct import pack, unpack

# Packing/Unpacking Stuff #

def pb(v):
  return pack("<B", v)

def pw(v):
  return pack("<H", v)

def pd(v):
  return pack("<I", v)

def pq(v):
  return pack("<Q", v)

def ub(v):
  return unpack("<B", v[0])[0]

def uw(v):
  return unpack("<H", v[:2])[0]

def ud(v):
  return unpack("<I", v[:4])[0]

def uq(v):
  return unpack("<Q", v[:8])[0]


# ELF Manipulation    #
# e = ELF(binaryname) #

def lookupSymbols(e, what):
	return hex(e.symbols[what])

def lookupPLT(e, what):
	return hex(e.plt[what])

def lookupGoT(e, what):
	return hex(e.got[what])

def lookupFunction(e, what):
	return hex(e.functions[what])

def lookupBytes(e, what):
	for address in e.search(what):
		print hex(address)

# Save Payload in txt file #

def savePayload(payload,save):
	with open(save, "rb") as f:
		f.write(payload)

# Need To BF ?

def bruteF(name):

	out = ""
	while(s != "root\n") :
    	p = process([name])
    	p.recvline()
    	# Testing Cmd
    	p.sendline("whoami")

    	# Grep Error
    	try :
        	out = p.recvline()
    	except EOFError :
        	pass
    p.interactive()


def main(argv):

### PUT EXPLOITATION CODE HERE
 
e = ELF()
p = process()

padding = 0

payload = 'A' * padding 

context.clear()
context.log_level = "debug"

s = ssh(host='', port=, user='', password='')
process = s.process([''])


p.interactive()

if __name__ == "__main__":
	sys.exit(main(sys.argv))

