def decrypt_file(file_path, key): with open(file_path, "rb") as file: encrypted_data = file.read() f = Fernet(key) decrypted_data = f.decrypt(encrypted_data) return decrypted_data # Search the entire computer for files with the .handsome extension for root, dirs, files in os.walk("/"): for file in files: if file.endswith(".handsome"): file_path = os.path.join(root, file) # Remove the .handsome extension new_file_name = file[:-8] new_file_path = os.path.join(root, new_file_name) os.rename(file_path, new_file_path) # Decrypt the file decrypted_data = decrypt_file(new_file_path, key) # Write the decrypted data to a new file new_file_path_decrypted = new_file_path + ".decrypted" with open(new_file_path_decrypted, "wb") as file: file.write(decrypted_data)