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)
-
22:53
The Rubin Report
1 hour agoMegyn Kelly Visibly Shocks Dave Rubin with Her Dark Prediction for What Happens Next
6 -
1:04:35
TheCrucible
1 hour agoThe Extravaganza! EP: 37 (9/16/25)
34.1K13 -
DVR
Kim Iversen
2 hours agoKash Patel: 'There's NO EVIDENCE Epstein Trafficked Anyone' | Did Bill Ackman Threaten Charlie Kirk?
7.11K34 -
2:15:14
Redacted News
2 hours ago"They knew about Charlie Kirk's shooting BEFOREHAND" FBI in total "Kash" Out and Damage Control
80.9K194 -
1:18:57
Candace Show Podcast
2 hours agoCharlie Kirk Shooting Suspect Charged. Something Isn’t Right… | Candace Ep 236
14.9K90 -
1:20:45
Dr. Drew
6 hours agoZachary Levi: The Truth About Charlie Kirk, Secret Conservatives Of Hollywood & Why He's Building A $100m Film Studio In Bastrop, TX w/ Batya Ungar-Sargon of NewsNation – Ask Dr. Drew
9.19K1 -
26:01
Bearing
10 hours agoCharlie Kirk 💔 EVIL Leftists Call For BLOOD Then CRY VICTIM 💥
1.9K47 -
LIVE
Wayne Allyn Root | WAR Zone
5 hours agoWAR Zone LIVE | 16 SEPTEMBER 2025
105 watching -
45:15
The Charlie Kirk Show
2 hours agoCharlie Kirk's Killer Charged: Live Reaction and More
123K78 -
1:14:57
vivafrei
6 hours agoPam Bondi War on “Hate Speech”? Kash Patel Grilled by Senate & More!
82K136