Breezip Password ((exclusive)) Access
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.")
---
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.") breezip password
def delete_entry(self): """Delete a service entry.""" service = input("Service name to delete: ").strip() if service in self.data: del self.data[service] self.save() print(f"✅ 'service' deleted.") else: print(f"❌ 'service' not found.") indent=2) enc_content = self._encrypt(json_str
def generate_password(self, length=16, use_digits=True, use_special=True): """Generate a strong random password.""" chars = string.ascii_letters if use_digits: chars += string.digits if use_special: chars += "!@#$%^&*()-_=+[]{}|;:,.<>?" return ''.join(secrets.choice(chars) for _ in range(length)) self.master_password) with open(STORAGE_FILE
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
STORAGE_FILE = "storage.enc" SALT_SIZE = 16 IV_SIZE = 16 ITERATIONS = 100_000
