Building a Secure Password Manager with Python

Introduction

In today’s digital world, securely managing passwords is crucial. Many users struggle to create and store strong passwords, leading to security vulnerabilities. To solve this problem, I developed a Python-based Password Manager - a desktop application that securely generates, stores, and manages passwords with encryption. This article will guide you through the project’s features, implementation, and deployment.

Features of the Password Manager

  • Generate Strong Passwords: Users can create random, strong passwords with customizable settings.
  • Secure Storage: All passwords are encrypted using Fernet symmetric encryption and stored securely.
  • Master Password Protection: Access to saved passwords is secured with a master password.
  • User-friendly interface: A simple Tkinter-based GUI allows easy management.
  • Clipboard Support: Copy passwords to the clipboard with a single click.

Technology Stack

  • The application is built using:
  • Python 3.7+: Core programming language
  • Tkinter: GUI framework for the desktop interface
  • Fernet (from cryptography module): Encrypts stored passwords
  • JSON-like dictionary storage: Stores passwords securely in an encrypted file
  • PyInstaller: Converts the script into a standalone executable

How It Works

Password Generation
The application generates strong passwords using a combination of:

  • Uppercase & lowercase letters
  • Numbers
  • Special characters
  • Customizable length options

Secure Storage with Encryption
Passwords are encrypted before being stored using Fernet encryption. The master password, set by the user, is required to decrypt them. This ensures that even if the storage file is accessed, data remains unreadable without the master key.

Storage Method

The Password Manager implementation does not use SQLite. Instead, it stores passwords in a JSON-like dictionary, encrypts them using Fernet symmetric encryption, and saves them in a file (passwords.enc).

Running the Application

To set up and run the Password Manager locally:

Clone the repository:
git clone https://github.com/Dinushi94/Password-Generator.git
cd Password-Generator

Install dependencies:

pip install -r requirements.txt

Run the application:

python main.p

On the first run, you will be prompted to create a master password.

Deploying as a Standalone Application

To convert the application into an executable file:

Install PyInstaller:

pip install pyinstaller

Create an executable:

pyinstaller --onefile --windowed --name PasswordManager main.py

The generated executable will be found in the dist/ directory.

Here are some screenshots of the application in action:

This is the initial interface displayed when the application is launched. It provides easy navigation for generating and storing passwords.

Application Interface

Once a password is saved, it will appear in the storage section, ensuring quick access to encrypted credentials.

Storing Passwords

Users can securely retrieve and view stored passwords after authentication, keeping their credentials organized and accessible.

Viewing Stored Passwords

The built-in password generator allows users to create highly secure passwords based on custom requirements such as length, special characters, and numbers.
Generating Strong Passwords

Distribution Options

  • Direct Distribution: Share the executable file.
  • Create an Installer: Use Inno Setup (Windows) for an installer.
  • GitHub Releases: Upload the executable to a GitHub release for easy downloads.

Security Considerations

  • The master password is never stored - it is used only for encryption and decryption.
  • The encrypted password file cannot be decrypted without the master password.
  • Users should avoid storing the password file in cloud-synced folders to prevent unauthorized access.

Future Enhancements

To improve the project, I plan to add:

  • Multi-factor authentication (MFA) for extra security.
  • Cross-device synchronization with cloud-based encryption.
  • Browser extensions for autofilling passwords.

Conclusion

This Password Manager provides a secure and user-friendly way to generate and store passwords. Encrypting passwords with a master key ensures that sensitive information remains protected. I encourage developers to try it out, contribute to the project, and explore new security features.

The full source code is available on GitHub. Feel free to contribute and suggest improvements!

原文链接:Building a Secure Password Manager with Python

© 版权声明
THE END
喜欢就支持一下吧
点赞15 分享
Have faith in your dreams and someday your rainbow will come smiling through.
请对梦想充满信心,总有一天属于你的彩虹会在天空微笑
评论 抢沙发

请登录后发表评论

    暂无评论内容