Fuzzu Video Encryptor – Python GUI to Encrypt & Decrypt Videos
Demo :
Click Video πππ
Features:
-
Embed YouTube Short
-
1-Click Download link to the Python script (if offering)
-
Description section (reuse YouTube one)
-
Keywords-rich paragraph (reuse tags)
-
Call to Action: “Follow FuzzuTech for more insane Python GUI illusions!”
Code :
import tkinter as tk
from tkinter import filedialog, messagebox
from cryptography.fernet import Fernet
import os
class VideoEncryptorGUI:
def __init__(self, root):
self.root = root
self.root.title("Fuzzu Video Encryptor")
self.root.geometry("550x420")
self.root.configure(bg="#121212")
self.file_path = None
self.key_file = "fuzzu_video.key"
self.key = None
# Auto-generate or auto-load key on startup
self.auto_generate_or_load_key()
# GUI Design
tk.Label(root, text="π Fuzzu Video Encryptor", font=("Helvetica", 18, "bold"),
fg="#00ffe1", bg="#121212").pack(pady=20)
tk.Button(root, text="π️ Select Video File", command=self.select_file, bg="#282828",
fg="white", width=30).pack(pady=5)
tk.Button(root, text="π Encrypt Video", command=self.encrypt_video, bg="#4444aa",
fg="white", width=30).pack(pady=5)
tk.Button(root, text="π Decrypt Video", command=self.decrypt_video, bg="#44aa44",
fg="white", width=30).pack(pady=5)
tk.Button(root, text="⚙️ Generate New Key", command=self.generate_key, bg="#aa4444",
fg="white", width=30).pack(pady=5)
tk.Button(root, text="π Load Key", command=self.load_key, bg="#444444",
fg="white", width=30).pack(pady=5)
def auto_generate_or_load_key(self):
if os.path.exists(self.key_file):
with open(self.key_file, "rb") as f:
self.key = f.read()
print("[INFO] Key auto-loaded.")
else:
self.key = Fernet.generate_key()
with open(self.key_file, "wb") as f:
f.write(self.key)
print("[INFO] Key auto-generated and saved.")
def select_file(self):
self.file_path = filedialog.askopenfilename(filetypes=[("Video files", "*.*")])
if self.file_path:
messagebox.showinfo("File Selected", f"Selected:\n{self.file_path}")
def generate_key(self):
self.key = Fernet.generate_key()
with open(self.key_file, "wb") as f:
f.write(self.key)
messagebox.showinfo("Key", "New key generated and saved as fuzzu_video.key")
def load_key(self):
path = filedialog.askopenfilename(filetypes=[("Key Files", "*.key")])
if path:
with open(path, "rb") as f:
self.key = f.read()
messagebox.showinfo("Key Loaded", "Encryption key loaded successfully.")
def encrypt_video(self):
if not self.file_path:
self.select_file()
if not self.file_path:
return
if not self.key:
self.auto_generate_or_load_key()
try:
with open(self.file_path, "rb") as file:
data = file.read()
encrypted = Fernet(self.key).encrypt(data)
enc_path = self.file_path + ".encrypted"
with open(enc_path, "wb") as file:
file.write(encrypted)
messagebox.showinfo("Success", f"Video Encrypted:\n{enc_path}")
except Exception as e:
messagebox.showerror("Error", f"Encryption failed:\n{str(e)}")
def decrypt_video(self):
if not self.file_path:
self.select_file()
if not self.file_path:
return
if not self.key:
self.auto_generate_or_load_key()
# Ensure only encrypted file is selected
if not self.file_path.endswith(".encrypted"):
messagebox.showerror("Error", "Please select a valid '.encrypted' file.")
return
try:
with open(self.file_path, "rb") as file:
encrypted_data = file.read()
decrypted = Fernet(self.key).decrypt(encrypted_data)
original_name = self.file_path.replace(".encrypted", "")
original_ext = os.path.splitext(original_name)[1]
out_path = original_name + "_decrypted" + original_ext
with open(out_path, "wb") as file:
file.write(decrypted)
messagebox.showinfo("Success", f"Decrypted Video:\n{out_path}")
except Exception as e:
messagebox.showerror("Error", f"Decryption failed.\nReason: {str(e)}")
if __name__ == "__main__":
root = tk.Tk()
app = VideoEncryptorGUI(root)
root.mainloop()
Comments
Post a Comment