Пример #1
0
    #save
    cprint('Escribiendo fichero...', color='cyan', end='\r')
    s = dt.now()
    g.save('testfile.enc')
    e = dt.now()
    ecprint(['Escritura de fichero ', str(e - s)],
            color=['cyan', 'yellow'],
            template='{} : {}')

#DECRYPT
#g = Giltzarrapo(n_processes = num_process)
g = Giltzarrapo()
#read
cprint('Leyendo fichero...', color='cyan', end='\r')
s = dt.now()
g.readEncrypted('testfile.enc')
e = dt.now()
ecprint(['Lectura de fichero   ', str(e - s)],
        color=['cyan', 'yellow'],
        template='{} : {}')
#decrypt
cprint('Descifrando fichero...', color='cyan', end='\r')
s = dt.now()
g.decrypt(passwd, 'giltza_rsa', passph, selected_block=sb)
e = dt.now()
ecprint(['Descifrado de fichero', str(e - s)],
        color=['cyan', 'yellow'],
        template='{} : {}')
#save
cprint('Escribiendo fichero...', color='cyan', end='\r')
s = dt.now()
Пример #2
0
    #Decrypt the file as one-liner
    Giltzarrapo().readEncrypted(args.infile, authfile=args.auth).decrypt(
        passwd, args.privkey, passphrase,
        selected_block=args.block).save(args.outfile)
else:
    #Encrypt the file step by step
    ecprint('Starting decrypting module...', color='blue')

    #Read the file
    g = Giltzarrapo()
    ecprint([args.infile, os.path.getsize(args.infile)],
            color='yellow',
            template='Reading file : {} ({} Bytes)')
    if args.auth is not None:
        ecprint(args.auth, color='yellow', template='Using auth file : {}')
    g.readEncrypted(args.infile, authfile=args.auth)
    ecprint(len(g.blocks), color='yellow', template='Blocks to decrypt: {}')

    #Find the symetric block (this step is automatically done in the decryption if the block is not provided)
    if args.block is None:
        ecprint('Finding the symetric block...', color='blue')
        args.block = g.findBlock(passwd, args.privkey, passphrase)
        ecprint(args.block,
                color='yellow',
                template='Symetric block found: {}')
    else:
        ecprint(args.block,
                color='yellow',
                template='Preselected symetric block: {}')

    #Decrypt the file