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)
-
BonginoReport
4 hours agoHeir To George Soros’ Fortune Buys Access to Biden’s WH - Nightly Scroll w/ Hayley Caronia (Ep.55)
26.3K12 -
LIVE
The Jimmy Dore Show
3 hours agoGOP Budget Bill Is a Fiscal TIME BOMB! Israeli Embassy Officials Shooting Questioned! w/ Carol Roth
10,340 watching -
LIVE
Dr Disrespect
7 hours ago🔴LIVE - DR DISRESPECT - WARZONE - 3 SOLO WINS IN 5 HRS!
1,990 watching -
LIVE
Nerdrotic
3 hours ago $5.96 earnedHollywood's Final Reckoning, Mission Impossible 8 REVIEW, Doomsday DELAYED | Friday Night Tights 355
4,271 watching -
LIVE
LFA TV
8 hours agoAmerica’s Golden Age? | TRUMPET DAILY 5.23.25 7PM
127 watching -
LIVE
The Mike Schwartz Show
3 hours agoTHE MIKE SCHWARTZ SHOW with DR. MICHAEL J SCHWARTZ
167 watching -
1:25:27
Kim Iversen
3 hours agoThe Mind Control Tactics Of The Deep State Could Cause You To Commit MURDER
54.2K25 -
1:11:10
Michael Franzese
5 hours agoFrom JFK to Epstein: The Plot That Connects It All
18.9K3 -
1:31:47
Robert Gouveia
2 days agoJudge SHREDS Supreme Court! Trump WARNED on Deportations! Fourth Amendment 9-0 Ruling!
29.8K15 -
DVR
vivafrei
4 hours agoLive w/ Breanna Morello: Pardons for Whitmer Fed-Nappers? Adam Schiff Pulling a Letitia James?
89.8K18