Example #1
0
 def compress_file(self, target_file, destination):
     try:
         target = dominus.readbytes(target_file)
         compressed = dominus.compress(target)
         dominus.writebytes(destination, compressed)
         self.alert_compress_success()
     except Exception:
         raise
Example #2
0
    def decrypt_file(self, target_file, destination):
        try:
            target = dominus.readbytes(target_file)
            compressed = dominus.compress(target)
            dominus.writebytes(destination, compressed)

            infile = dominus.readbytes(target_file)
            uncompressed = dominus.decompress(infile)
            outfile = open(destination + '/out.uncompressed', 'w')
            for bt in uncompressed:
                outfile.write(bt)
            self.alert_decrypt_success()
        except Exception:
            raise
Example #3
0
        print '                             Compression:\n'
        print bcolors.BOLD + 'Use: de_encode_interface.py [When prompted, put the directory for compressed file]' + bcolors.ENDC
    else:
        if len(sys.argv) != 3:
            interactive = 1
            fromdir = raw_input(
                colored('[+][+]', 'green') + bcolors.WARNING +
                ' File to compress dir > ' + bcolors.ENDC)
            tofile = raw_input(
                colored('[+][+]', 'green') + bcolors.WARNING +
                ' Compressed file dir  > ' + bcolors.ENDC)
        else:
            interactive = 0
        print colored(fromdir,
                      'blue')  # Print user input for the compressed directory
        print colored(
            'Your file will be created in this directory:\n' + tofile, 'blue'
        )  # print directory where new decompressed file will be created
        print colored('\nCompressing file....',
                      "yellow")  # Print the process in terminal
        #
        # Print the percentage
        for n in tqdm.tqdm(range(1000)):
            #time.sleep(0.01)
            infile = dominus.readbytes(fromdir)
            compressed = dominus.compress(infile)
            dominus.writebytes(tofile, compressed)
        print colored('\nCompression complete!', 'green')

        if interactive: raw_input('Press Enter key')  # pause if clicked