def add_entry(self): """Add a new service password entry.""" service = input("Service name (e.g., Gmail): ").strip() if not service: print("❌ Service name required.") return username = input("Username/Email: ").strip() gen_choice = input("Generate password? (y/n): ").lower() if gen_choice == 'y': length = int(input("Length (default 16): ") or 16) password = self.generate_password(length) print(f"🔑 Generated password: password") else: password = getpass.getpass("Password: ") notes = input("Optional notes: ").strip() self.data[service] = "username": username, "password": password, "notes": notes self.save() print(f"✅ Entry for 'service' added.")
pip install -r requirements.txt #!/usr/bin/env python3 """ BreeZip Password Manager Securely store and retrieve passwords with AES-256 encryption. """ import os import json import base64 import getpass import secrets import string from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2 from cryptography.hazmat.primitives import hashes from cryptography.hazmat.backends import default_backend breezip password
### **5. Security Notes**
while True: print("\n📌 MENU") print("1. Add new password") print("2. Get password") print("3. List all services") print("4. Delete entry") print("5. Change master password") print("6. Generate random password only") print("7. Exit") choice = input("Choose (1-7): ").strip() def add_entry(self): """Add a new service password entry
def save(self): """Save data to encrypted file.""" if not self.master_password: print("❌ Master password not set.") return json_str = json.dumps(self.data, indent=2) enc_content = self._encrypt(json_str, self.master_password) with open(STORAGE_FILE, "w") as f: f.write(enc_content) print("✅ Data saved securely.") Security Notes** while True: print("\n📌 MENU") print("1
def set_master_password(self): """Initialize or change master password.""" while True: pwd1 = getpass.getpass("New master password: ") pwd2 = getpass.getpass("Confirm master password: ") if pwd1 == pwd2 and len(pwd1) >= 6: self.master_password = pwd1 print("✅ Master password set.") break else: print("❌ Passwords must match and be at least 6 chars.")
