danial2020's picture
Update app.py
3765f9d verified
raw
history blame contribute delete
748 Bytes
from cryptography.fernet import Fernet
import glob
# Your Fernet key
key = b'c9PGl7mpWfZDOCo67ZymRG_mCFZmifdFusN1E5nXs0o='
cipher = Fernet(key)
# Find all Python files in the current directory
files = glob.glob('*.py.enc') # Assuming your files are named with the .enc extension
for file in files:
# Read the encrypted code from the file
with open(file, 'rb') as f:
encrypted_code = f.read()
# Decrypt the code
decrypted_code = cipher.decrypt(encrypted_code)
# Save the decrypted file
decrypted_filename = file[:-4] # Remove the .enc extension
with open(decrypted_filename, 'wb') as f:
f.write(decrypted_code)
# Execute the decrypted code
exec(decrypted_code.decode('utf-8'))