예제 #1
0
    def transmit(self, data_to_transmit):

        # find current directory, make directory for mounting share
        # current directory
        exfil_directory = os.path.join(os.getcwd(), "mount")
        mount_path = exfil_directory + "/"

        # Check to make sure the agent directory exists, and a loot
        # directory for the agent.  If not, make them
        if not os.path.isdir(mount_path):
            os.makedirs(mount_path)

        # Base command to copy file over smb
        smb_command = "smbclient \\\\\\\\" + self.remote_server + "\\\\DATA -N -c \"put "

        # If using a file, copy it, else write to disk and then copy
        if not self.file_transfer:
            smb_file_name = helpers.writeout_text_data(data_to_transmit)
            smb_full_path = helpers.ea_path() + "/" + smb_file_name

            smb_command += smb_file_name + "\""

        else:
            smb_command += self.file_transfer + " " + self.file_name + "\""
            smb_file_name = self.file_transfer

        print smb_command
        os.system(smb_command)

        if not self.file_transfer:
            os.remove(smb_full_path)

        print "[*] File Transmitted!"

        return
예제 #2
0
    def transmit(self, data_to_transmit):

        print "[*] Transmitting data..."

        if not self.file_transfer:
            sftp_file_name = helpers.writeout_text_data(data_to_transmit)
            full_path = helpers.ea_path() + "/" + sftp_file_name

            transport = paramiko.Transport((self.remote_system, self.port))
            transport.connect(username=self.username, password=self.password)
            sftp = paramiko.SFTPClient.from_transport(transport)
            sftp.put(full_path, '/' + sftp_file_name)

            # close sftp connection
            sftp.close()
            transport.close()

            os.remove(sftp_file_name)
        else:
            transport = paramiko.Transport((self.remote_system, self.port))
            transport.connect(username=self.username, password=self.password)
            sftp = paramiko.SFTPClient.from_transport(transport)
            if "/" in self.file_transfer:
                sftp.put(self.file_transfer,
                         '/' + self.file_transfer.split("/")[-1])
            else:
                sftp.put(self.file_transfer, '/' + self.file_transfer)

            # close sftp connection
            sftp.close()
            transport.close()

        print "[*] Data sent!"

        return
예제 #3
0
    def transmit(self, data_to_transmit):

        try:
            ftp = FTP()
            ftp.connect(self.remote_server, self.port)
        except socket.gaierror:
            print "[*] Error: Cannot connect to FTP server.  Checking provided ip!"
            sys.exit()

        try:
            ftp.login(self.username, self.password)
        except error_perm:
            print "[*] Error: Username or password is incorrect!  Please re-run."
            sys.exit()

        if not self.file_transfer:
            ftp_file_name = helpers.writeout_text_data(data_to_transmit)

            ftp.storbinary("STOR " + ftp_file_name,
                           open(helpers.ea_path() + "/" + ftp_file_name))
            os.remove(helpers.ea_path() + "/" + ftp_file_name)
        else:
            ftp.storbinary("STOR " + self.file_transfer,
                           open(self.file_transfer))

        ftp.quit()
        print "[*] File sent!!!"
예제 #4
0
    def transmit(self, data_to_transmit):

        try:
            ftp = FTP(self.remote_server)
        except socket.gaierror:
            print "[*] Error: Cannot connect to FTP server.  Checking provided ip!"
            sys.exit()

        try:
            ftp.login(self.username, self.password)
        except error_perm:
            print "[*] Error: Username or password is incorrect!  Please re-run."
            sys.exit()

        if not self.file_transfer:
            ftp_file_name = helpers.writeout_text_data(data_to_transmit)

            ftp.storlines(
                "STOR " + ftp_file_name, open(helpers.ea_path()
                        + "/" + ftp_file_name))
            os.remove(helpers.ea_path() + "/" + ftp_file_name)
        else:
            ftp.storbinary("STOR " + self.file_transfer, open(self.file_transfer))

        ftp.quit()
        print "[*] File sent!!!"
예제 #5
0
    def transmit(self, data_to_transmit):

        print "[*] Transmitting data..."

        if not self.file_transfer:
            sftp_file_name = helpers.writeout_text_data(data_to_transmit)
            full_path = helpers.ea_path() + "/" + sftp_file_name

            transport = paramiko.Transport(self.remote_system)
            transport.connect(username=self.username, password=self.password)
            sftp = paramiko.SFTPClient.from_transport(transport)
            sftp.put(full_path, '/' + sftp_file_name)

            # close sftp connection
            sftp.close()
            transport.close()

            os.remove(sftp_file_name)
        else:
            transport = paramiko.Transport(self.remote_system)
            transport.connect(username=self.username, password=self.password)
            sftp = paramiko.SFTPClient.from_transport(transport)
            if "/" in self.file_transfer:
                sftp.put(self.file_transfer, '/' + self.file_transfer.split("/")[-1])
            else:
                sftp.put(self.file_transfer, '/' + self.file_transfer)

            # close sftp connection
            sftp.close()
            transport.close()

        print "[*] Data sent!"

        return
예제 #6
0
    def transmit(self, data_to_transmit):

        # find current directory, make directory for mounting share
        # current directory
        exfil_directory = os.path.join(os.getcwd(), "mount")
        mount_path = exfil_directory + "/"

        # Check to make sure the agent directory exists, and a loot
        # directory for the agent.  If not, make them
        if not os.path.isdir(mount_path):
            os.makedirs(mount_path)

        # Base command to copy file over smb
        smb_command = f"smbclient \\\\\\\\{self.remote_server}" + f"\\\\TRANSFER -N -p {self.port} -c \"put "

        # If using a file, copy it, else write to disk and then copy
        if not self.file_transfer:
            smb_file_name = helpers.writeout_text_data(data_to_transmit)
            smb_full_path = helpers.ea_path() + "/" + smb_file_name

            smb_command += smb_file_name + "\""

        else:
            smb_command += self.file_transfer + " " + self.file_name + "\""
            smb_file_name = self.file_transfer

        print(smb_command)
        os.system(smb_command)

        if not self.file_transfer:
            os.remove(smb_full_path)

        print('[*] File Transmitted!')
예제 #7
0
    def negotiatedTransmit(self, data_to_transmit,config=None):

        if config:
            self.username = config["ftp"]["username"]
            self.password = config["ftp"]["password"]
            self.port = int(config["ftp"]["port"])

        print("[+] Sending FTP Data")

        try:
            ftp = FTP()
            ftp.connect(self.remote_server, self.port)
        except socket.gaierror:
            print "[*] Error: Cannot connect to FTP server.  Checking provided ip!"
            sys.exit()

        try:
            ftp.login(self.username, self.password)
        except error_perm:
            print "[*] Error: Username or password is incorrect!  Please re-run."
            sys.exit()

        if not self.file_transfer:
            ftp_file_name = helpers.writeout_text_data(data_to_transmit)

            ftp.storbinary(
                "STOR " + ftp_file_name, open(helpers.ea_path()
                        + "/" + ftp_file_name))
            os.remove(helpers.ea_path() + "/" + ftp_file_name)
        else:
            ftp.storbinary("STOR " + self.file_transfer, open(self.file_transfer))

        ftp.quit()
        print "[*] File sent!!!"
예제 #8
0
    def negotiatedTransmit(self, data_to_transmit,config=None):

        self.username = config["smb"]["username"]
        self.password = config["smb"]["password"]

        print("[+] Sending SMB Data")

        # find current directory, make directory for mounting share
        # current directory
        exfil_directory = os.path.join(os.getcwd(), "mount")
        mount_path = exfil_directory + "/"

        # Check to make sure the agent directory exists, and a loot
        # directory for the agent.  If not, make them
        if not os.path.isdir(mount_path):
            os.makedirs(mount_path)

        # Base command to copy file over smb
        if self.username == "null" and self.password == "null":
            smb_command = "smbclient \\\\\\\\" + self.remote_server + "\\\\DATA -N -c \"put "
        else:
            smb_command = "smbclient \\\\\\\\" + self.remote_server + "\\\\DATA -U " + self.username + " " +self.password +" -c \"put "

        # If using a file, copy it, else write to disk and then copy
        if not self.file_transfer:
            smb_file_name = helpers.writeout_text_data(data_to_transmit)
            smb_full_path = helpers.ea_path() + "/" + smb_file_name

            smb_command += smb_file_name + "\""

        else:
            smb_command += self.file_transfer + " " + self.file_name + "\""
            smb_file_name = self.file_transfer

        print smb_command
        os.system(smb_command)

        if not self.file_transfer:
            os.remove(smb_full_path)

        print "[*] File Transmitted!"

        return
예제 #9
0
    def negotiatedTransmit(self, data_to_transmit, config=None):

        if config:
            self.username = config["sftp"]["username"]
            self.password = config["sftp"]["password"]
            self.port = int(config["sftp"]["port"])

        print "[+] Sending SFTP Data"

        if not self.file_transfer:
            sftp_file_name = helpers.writeout_text_data(data_to_transmit)
            full_path = helpers.ea_path() + "/" + sftp_file_name

            transport = paramiko.Transport((self.remote_system, self.port))
            transport.connect(username=self.username, password=self.password)
            sftp = paramiko.SFTPClient.from_transport(transport)
            sftp.put(full_path, '/' + sftp_file_name)

            # close sftp connection
            sftp.close()
            transport.close()

            os.remove(sftp_file_name)
        else:
            transport = paramiko.Transport((self.remote_system, self.port))
            transport.connect(username=self.username, password=self.password)
            sftp = paramiko.SFTPClient.from_transport(transport)
            if "/" in self.file_transfer:
                sftp.put(self.file_transfer,
                         '/' + self.file_transfer.split("/")[-1])
            else:
                sftp.put(self.file_transfer, '/' + self.file_transfer)

            # close sftp connection
            sftp.close()
            transport.close()

        print "[*] Data sent!"

        return