示例#1
0
                    break
                else:
                    continue
        print("Decoding data...\n[IT]Decodifico i dati")
        print(key)
        f = Fernet(key)
        with open(ifile, "rb") as fi:
            for line in fi:
                with open(ofile, "a") as fo:
                    line2 = f.decrypt(line)
                    msg = line2.decode()
                    fo.write(msg)
        print("Removing encrypted file.\n[IT]Rimuovo il file criptato")
        os.remove(ifile)
        f = open("./token.txt", "r+")
        print("Updating token.txt...")
        d = f.readlines()
        f.seek(0)
        for i in d:
            x = i.split()
            y = base64.b64decode(x[2].encode())
            z = y.decode()
            if z != file:
                f.write(i)
        f.truncate()
        f.close()
        del x, y, z
    except:
        print("Errore apertura file")
        exit(1)