Premium Only Content

Criptografia de arquivos em Python
Python sem frescura.
Ajude o canal pelo Pix: e1dc2017-053a-4d4f-a018-b35e36527323
Programa que criptografa um arquivo de texto e pode ser recuperado de volta.
Código:
# -*- coding:latin-1 -*-
import time
import getpass, sys
import pyAesCrypt
from os import stat, remove
# encryption/decryption buffer size - 64K
bufferSize = 64 * 1024
escolha = input('digite: \n1- Encript \n2- Decript\nR: ')
password = getpass.getpass('\nDigite a Senha:')
if escolha == '1':
# encrypt
with open("pas.txt", "rb") as fIn:
with open("pas.txt.aes", "wb") as fOut:
pyAesCrypt.encryptStream(fIn, fOut, password, bufferSize)
x = input ('do you want to delete the txt file? y ')
if x != 'y':
print ('\nok')
time.sleep(1)
sys.exit()
remove("pas.txt")
print ('Arquivo removido')
time.sleep(2)
sys.exit()
if escolha == '2':
# get encrypted file size
encFileSize = stat("pas.txt.aes").st_size
# decrypt
with open("pas.txt.aes", "rb") as fIn:
try:
with open("pas.txt", "wb") as fOut:
# decrypt file stream
pyAesCrypt.decryptStream(fIn, fOut, password, bufferSize, encFileSize)
except ValueError:
print ('senha incorreta')
# remove output file on error
remove("pas.txt")
time.sleep(3)
sys.exit()
print ('\n\nEscolha errada')
time.sleep(2)
-
4:35:07
Right Side Broadcasting Network
4 days agoLIVE: VP Vance Attends the U.S. Marine Corps 250th Anniversary Celebration - 10/18/25
34.8K38 -
LIVE
Mally_Mouse
20 hours ago🔥🍺Spicy HYDRATE Saturday!🍺🔥-- Let's Play: Prison Life 2
96 watching -
LIVE
Pepkilla
2 hours agoBattlefield 6 SMG Camo Grind
64 watching -
14:22
Exploring With Nug
9 hours agoThe River Exposed a Secret That No One Was Supposed to See!
14.1K1 -
23:23
MYLUNCHBREAK CHANNEL PAGE
10 hours agoThe Sunken Basilica
68.9K5 -
8:05
Hollywood Exposed
1 hour agoCharlie Sheen STUNS Tucker Carlson With His Shocking Political Confession
1.82K2 -
LIVE
SavageJayGatsby
1 hour ago🔥 Spicy Saturday – Let's Play: Prison Life 2🔥
41 watching -
30:02
The White House
1 hour agoVP JD Vance Delivers Remarks at 250th Anniversary Celebration for the United States Marine Corps
8.35K13 -
LIVE
GamerGril
4 hours agoShould I Get A Zoob Job 💞Dying Light The Beast💞
152 watching -
5:00:18
MattMorseTV
8 hours ago $240.63 earned🔴No Kings "protest" TOTAL CHAOS.🔴
303K465