{"id":133,"date":"2025-10-25T10:57:51","date_gmt":"2025-10-25T10:57:51","guid":{"rendered":"https:\/\/codetypingpro.com\/?p=133"},"modified":"2025-10-25T10:57:51","modified_gmt":"2025-10-25T10:57:51","slug":"11-real-world-python-projects-password-manager","status":"publish","type":"post","link":"https:\/\/codetypingpro.com\/?p=133","title":{"rendered":"11 &#8211; Real-World Python Projects &#8211; Password Manager"},"content":{"rendered":"\n<h6 class=\"wp-block-heading\"><\/h6>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83c\udfaf <strong>Project Objective<\/strong><\/h3>\n\n\n\n<p>To build a <strong>secure Password Manager<\/strong> in Python that can <strong>store, retrieve, and generate passwords<\/strong> safely.<br><strong>Skills Demonstrated:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>File handling and data storage<\/li>\n\n\n\n<li>Encryption for sensitive information<\/li>\n\n\n\n<li>GUI for user-friendly interaction (optional)<\/li>\n\n\n\n<li>Random password generation<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Project: Password Manager<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Project Description<\/strong><\/h3>\n\n\n\n<p>The Password Manager app allows users to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Add new passwords<\/strong> with website, username, and password<\/li>\n\n\n\n<li><strong>Retrieve saved passwords<\/strong><\/li>\n\n\n\n<li><strong>Generate strong passwords<\/strong> automatically<\/li>\n\n\n\n<li><strong>Securely store data<\/strong> in an encrypted format<\/li>\n<\/ul>\n\n\n\n<p><strong>Use Cases:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Personal password storage<\/li>\n\n\n\n<li>Generate strong, unique passwords<\/li>\n\n\n\n<li>Safely retrieve credentials when needed<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Python Example Code \u2013 Basic Password Manager (Console Version)<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>import json\nimport random\nimport string\nfrom cryptography.fernet import Fernet\nimport os\n\n# Generate a key (do this once and save it)\nkey_file = \"secret.key\"\nif not os.path.exists(key_file):\n    key = Fernet.generate_key()\n    with open(key_file, \"wb\") as f:\n        f.write(key)\nelse:\n    with open(key_file, \"rb\") as f:\n        key = f.read()\n\ncipher = Fernet(key)\n\n# File to store passwords\npassword_file = \"passwords.json\"\n\n# Load existing passwords\nif os.path.exists(password_file):\n    with open(password_file, \"r\") as f:\n        passwords = json.load(f)\nelse:\n    passwords = {}\n\n# Function to generate random password\ndef generate_password(length=12):\n    chars = string.ascii_letters + string.digits + string.punctuation\n    return ''.join(random.choice(chars) for _ in range(length))\n\n# Add new password\ndef add_password(website, username, pwd=None):\n    if not pwd:\n        pwd = generate_password()\n    encrypted_pwd = cipher.encrypt(pwd.encode()).decode()\n    passwords&#91;website] = {\"username\": username, \"password\": encrypted_pwd}\n    with open(password_file, \"w\") as f:\n        json.dump(passwords, f)\n    print(f\"Password saved for {website}: {pwd}\")\n\n# Retrieve password\ndef get_password(website):\n    if website in passwords:\n        data = passwords&#91;website]\n        decrypted_pwd = cipher.decrypt(data&#91;\"password\"].encode()).decode()\n        print(f\"Website: {website}\\nUsername: {data&#91;'username']}\\nPassword: {decrypted_pwd}\")\n    else:\n        print(\"No password found for this website.\")\n\n# Example usage\nadd_password(\"gmail.com\", \"myemail@gmail.com\")\nget_password(\"gmail.com\")\n<\/code><\/pre>\n\n\n\n<p>\u2705 <strong>Output:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Stores encrypted passwords in <code>passwords.json<\/code><\/li>\n\n\n\n<li>Generates strong random passwords<\/li>\n\n\n\n<li>Retrieves decrypted credentials when needed<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u2705 Key Features<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Generate strong passwords automatically<\/li>\n\n\n\n<li>Encrypt and decrypt passwords securely<\/li>\n\n\n\n<li>Store credentials in JSON file<\/li>\n\n\n\n<li>Retrieve credentials with decryption<\/li>\n\n\n\n<li>Extendable to GUI or web app<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Learning Points<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>File I\/O and JSON handling<\/li>\n\n\n\n<li>Encryption using <code>cryptography<\/code><\/li>\n\n\n\n<li>Random password generation<\/li>\n\n\n\n<li>Basics of secure password storage<\/li>\n\n\n\n<li>Building practical security-focused Python applications<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\ud83c\udfaf Project Objective To build a secure Password Manager in Python that can store, retrieve, and generate passwords safely.Skills Demonstrated: Project: Password Manager Project Description The Password Manager app allows users to: Use Cases: Python Example Code \u2013 Basic Password Manager (Console Version) \u2705 Output: \u2705 Key Features Learning Points<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-133","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/codetypingpro.com\/index.php?rest_route=\/wp\/v2\/posts\/133","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codetypingpro.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codetypingpro.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codetypingpro.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codetypingpro.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=133"}],"version-history":[{"count":1,"href":"https:\/\/codetypingpro.com\/index.php?rest_route=\/wp\/v2\/posts\/133\/revisions"}],"predecessor-version":[{"id":134,"href":"https:\/\/codetypingpro.com\/index.php?rest_route=\/wp\/v2\/posts\/133\/revisions\/134"}],"wp:attachment":[{"href":"https:\/\/codetypingpro.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codetypingpro.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codetypingpro.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}