__full__ | Breezip Password

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 run(self): """Main CLI loop.""" print("=" * 50) print("🔐 BreeZip Password Manager v1.0") print("=" * 50) if not os.path.exists(STORAGE_FILE): print("First run: Create a master password.") self.set_master_password() else: self.load() if not self.master_password: print("Exiting.") return breezip password

def load(self): """Load encrypted storage file.""" if not os.path.exists(STORAGE_FILE): self.data = {} return try: with open(STORAGE_FILE, "r") as f: enc_content = f.read().strip() if not enc_content: self.data = {} return self.master_password = getpass.getpass("Master password: ") json_str = self._decrypt(enc_content, self.master_password) self.data = json.loads(json_str) except Exception: print("❌ Decryption failed. Wrong master password or corrupted file.") self.data = {} self.master_password = None 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.") List all services") print("4

def get_entry(self): """Retrieve and display a password entry.""" if not self.data: print("⚠️ No entries found.") return service = input("Service name to retrieve: ").strip() entry = self.data.get(service) if not entry: print(f"❌ No entry found for 'service'.") return print(f"\n🔐 Service: service") print(f"👤 Username: entry['username']") print(f"🔑 Password: entry['password']") if entry['notes']: print(f"📝 Notes: entry['notes']") # Optional copy to clipboard (requires pyperclip) try: import pyperclip copy_choice = input("\nCopy password to clipboard? (y/n): ").lower() if copy_choice == 'y': pyperclip.copy(entry['password']) print("✅ Password copied to clipboard.") except ImportError: pass

- The storage file `storage.enc` is encrypted but **not** resistant to offline brute‑force if master password is weak. - Use a **strong master password** (≥12 chars, mixed case, numbers, symbols). - For production, consider adding **key stretching (Argon2)** and **authentication (HMAC)**.

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.")