From 1589f12e1f2d7df52da562244f239e66aac34eee Mon Sep 17 00:00:00 2001 From: ifw-fin3sse Date: Fri, 16 May 2025 16:30:38 +0100 Subject: [PATCH 1/2] password manager --- .../password manager code.py | 124 ++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 Folder/20233162_20233227_20230270/password manager code.py diff --git a/Folder/20233162_20233227_20230270/password manager code.py b/Folder/20233162_20233227_20230270/password manager code.py new file mode 100644 index 0000000..b68d6fe --- /dev/null +++ b/Folder/20233162_20233227_20230270/password manager code.py @@ -0,0 +1,124 @@ +import tkinter as tk +from tkinter import messagebox +import json +import random +import string +import secrets + +# PASSWORD GENERATOR +def generate_password(): + length = 12 + categories = { + "uppercase": string.ascii_uppercase, + "lowercase": string.ascii_lowercase, + "digits": string.digits, + "punctuation": string.punctuation + } + + password = [ + secrets.choice(categories["uppercase"]), + secrets.choice(categories["lowercase"]), + secrets.choice(categories["digits"]), + secrets.choice(categories["punctuation"]), + ] + + all_chars = ''.join(categories.values()) + password += [secrets.choice(all_chars) for _ in range(length - 4)] + random.shuffle(password) + + final_password = ''.join(password) + password_entry.delete(0, tk.END) + password_entry.insert(0, final_password) + +# SAVE PASSWORD +def save_password(): + email = email_entry.get() + password = password_entry.get() + + if not email or not password: + messagebox.showwarning("Error", "Please leave no empty fields!") + return + + data = { + email: { + "password": password + } + } + + try: + with open("data.json", "r") as file: + existing_data = json.load(file) + except (FileNotFoundError, json.decoder.JSONDecodeError): + existing_data = {} + + existing_data.update(data) + + with open("data.json", "w") as file: + json.dump(existing_data, file, indent=4) + + email_entry.delete(0, tk.END) + password_entry.delete(0, tk.END) + messagebox.showinfo("Success", "Password saved successfully!") + +# SEARCH PASSWORD +def search_password(): + email = email_entry.get() + try: + with open("data.json", "r") as file: + data = json.load(file) + if email in data: + password = data[email]["password"] + messagebox.showinfo(email, f"Password: {password}") + else: + messagebox.showinfo("Not Found", f"No password found for {email}.") + except FileNotFoundError: + messagebox.showerror("Error", "No data file found.") + +# SHOW ALL PASSWORDS +def show_password_list(): + try: + with open("data.json", "r") as file: + data = json.load(file) + except (FileNotFoundError, json.decoder.JSONDecodeError): + messagebox.showerror("Error", "No data file found.") + return + + list_window = tk.Toplevel(window) + list_window.title("Saved Passwords") + list_window.geometry("500x400") + + scrollbar = tk.Scrollbar(list_window) + scrollbar.pack(side=tk.RIGHT, fill=tk.Y) + + text_area = tk.Text(list_window, wrap="word", yscrollcommand=scrollbar.set) + text_area.pack(expand=True, fill="both") + scrollbar.config(command=text_area.yview) + + for email, details in data.items(): + password = details.get("password", "N/A") + text_area.insert(tk.END, f"Email: {email}\nPassword: {password}\n\n") + +# UI SETUP +window = tk.Tk() +window.title("Password Manager") +window.config(padx=50, pady=50) + +# Labels +tk.Label(text="Email/Username:").grid(row=1, column=0) +tk.Label(text="Password:").grid(row=2, column=0) + +# Entries +email_entry = tk.Entry(width=35) +email_entry.grid(row=1, column=1, columnspan=2) +email_entry.insert(0, "email@example.com") + +password_entry = tk.Entry(width=21) +password_entry.grid(row=2, column=1) + +# Buttons +tk.Button(text="Generate Password", command=generate_password).grid(row=2, column=2) +tk.Button(text="Add", width=36, command=save_password).grid(row=3, column=1, columnspan=2) +tk.Button(text="Search", width=12, command=search_password).grid(row=1, column=2) +tk.Button(text="View All", width=36, command=show_password_list).grid(row=4, column=1, columnspan=2) + +window.mainloop() From b81b5139ee1b244cd2c9e49bcb296573eed23c83 Mon Sep 17 00:00:00 2001 From: ifw-fin3sse Date: Fri, 16 May 2025 16:33:46 +0100 Subject: [PATCH 2/2] added readme --- Folder/20233162_20233227_20230270/README.md | 60 +++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Folder/20233162_20233227_20230270/README.md diff --git a/Folder/20233162_20233227_20230270/README.md b/Folder/20233162_20233227_20230270/README.md new file mode 100644 index 0000000..c7a6c3b --- /dev/null +++ b/Folder/20233162_20233227_20230270/README.md @@ -0,0 +1,60 @@ +# PASSWORD-MANAGER + +A simple project for managing passwords securely. + +## Description + +This project is designed to help users manage and store their passwords safely. The tool provides basic features for adding, retrieving, and managing passwords for various accounts. + +## Features + +- Add new passwords +- Retrieve stored passwords +- Update or delete passwords +- User-friendly interface +- (Add more features as your project grows) + +## Getting Started + +### Prerequisites + +- Python 3.x (if the project is in Python) +- (List any additional dependencies here) + +### Installation + +1. Clone the repository: + ```bash + git clone https://github.com/Aybee23/PASSWORD-MANAGER.git + ``` +2. Navigate to the project directory: + ```bash + cd PASSWORD-MANAGER + ``` +3. (Add additional installation or setup instructions here) + +### Usage + +1. Run the main script: + ```bash + python main.py + ``` +2. Follow the on-screen instructions to manage your passwords. + +## Contributing + +Contributions are welcome! Please open issues or pull requests for suggestions and improvements. + +## License + +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. + +## Author + +- [Abednego Solomon Archibong](https://github.com/Aybee23) +- [Wilson Tamunoibuomie Benjamin](https://github.com/ifw-fin3sse) +- [John-Daniel Chukwunonso Nwogu](https://github.com/John1-creator123) +- + +--- +Feel free to update this README as your project evolves!