π Best Modern Password Manager App – Secure & Store Passwords Easily | Python GUI
Demo :
Click Video πππ
π Features:
✅ Generate Strong Passwords
✅ Save & Retrieve Passwords Securely
✅ AES Encryption for Security
✅ Beautiful GUI with Tkinter
✅ Fully Responsive & Modern Look
requirements.txt
)tksqlite3pycryptodome
main.py
(Run This File)from gui import PasswordManagerGUIif __name__ == "__main__":app = PasswordManagerGUI()app.run()
πΎ 3. Database – database.py
import sqlite3
class Database:
def __init__(self):
self.conn = sqlite3.connect("passwords.db")
self.cursor = self.conn.cursor()
self.create_table()
def create_table(self):
self.cursor.execute("""
CREATE TABLE IF NOT EXISTS passwords (
id INTEGER PRIMARY KEY,
website TEXT NOT NULL,
username TEXT NOT NULL,
password TEXT NOT NULL
)
""")
self.conn.commit()
def save_password(self, website, username, password):
self.cursor.execute("INSERT INTO passwords (website, username, password) VALUES (?, ?, ?)",
(website, username, password))
self.conn.commit()
def get_passwords(self):
self.cursor.execute("SELECT * FROM passwords")
return self.cursor.fetchall()
def close(self):
self.conn.close()
π 4. Encryption – encryption.py
from Crypto.Cipher import AES
import base64
import os
KEY = b'Sixteen byte key'
class Encryption:
@staticmethod
def encrypt(text):
cipher = AES.new(KEY, AES.MODE_EAX)
nonce = cipher.nonce
ciphertext, tag = cipher.encrypt_and_digest(text.encode())
return base64.b64encode(nonce + ciphertext).decode()
@staticmethod
def decrypt(text):
data = base64.b64decode(text)
nonce = data[:16]
ciphertext = data[16:]
cipher = AES.new(KEY, AES.MODE_EAX, nonce=nonce)
return cipher.decrypt(ciphertext).decode()
π¨ 5. GUI – gui.py
import tkinter as tk
import customtkinter as ctk
from tkinter import messagebox
# Initialize App
ctk.set_appearance_mode("dark") # Options: "dark", "light", "system"
ctk.set_default_color_theme("blue") # Themes: "blue", "green", "dark-blue"
app = ctk.CTk()
app.title("Modern Password Manager")
app.geometry("400x300")
app.resizable(False, False)
# Functions
def save_password():
website = website_entry.get()
username = username_entry.get()
password = password_entry.get()
if website and username and password:
with open("passwords.txt", "a") as file:
file.write(f"{website} | {username} | {password}\n")
messagebox.showinfo("Success", "Password Saved Successfully!")
website_entry.delete(0, tk.END)
username_entry.delete(0, tk.END)
password_entry.delete(0, tk.END)
else:
messagebox.showwarning("Warning", "All fields are required!")
def view_passwords():
try:
with open("passwords.txt", "r") as file:
passwords = file.read()
messagebox.showinfo("Saved Passwords", passwords if passwords else "No passwords saved yet!")
except FileNotFoundError:
messagebox.showwarning("Warning", "No saved passwords found!")
# UI Elements
frame = ctk.CTkFrame(app)
frame.pack(pady=20, padx=20, fill="both", expand=True)
ctk.CTkLabel(frame, text="Website:").pack(anchor="w")
website_entry = ctk.CTkEntry(frame, width=300)
website_entry.pack(pady=5)
ctk.CTkLabel(frame, text="Username:").pack(anchor="w")
username_entry = ctk.CTkEntry(frame, width=300)
username_entry.pack(pady=5)
ctk.CTkLabel(frame, text="Password:").pack(anchor="w")
password_entry = ctk.CTkEntry(frame, width=300, show="*")
password_entry.pack(pady=5)
button_frame = ctk.CTkFrame(frame)
button_frame.pack(pady=10)
save_button = ctk.CTkButton(button_frame, text="Save", command=save_password)
save_button.pack(side="left", padx=10)
view_button = ctk.CTkButton(button_frame, text="View", command=view_passwords)
view_button.pack(side="right", padx=10)
app.mainloop()
Comments
Post a Comment