This Python script provides a basic password manager functionality with encryption and secure storage using the AES encryption algorithm. The project utilizes the Crypto library for cryptographic operations and interacts with a MySQL database to store ,update and delete encrypted passwords and related information.
- Python 3.x
- MySQL database
- Crypto
- mysql-connector
- secrets
- string
- getpass
- zlib
Install the required Python libraries using the following command:
pip install pycryptodome mysql-connector-python
- Create a MySQL database named "passwordmanager."
- Set up two tables:
iv_n_key
andpsswrd_manager
. The SQL schema is provided in thedatabase_schema.sql
file.
Open the Jupyter Notebook (Password-Manager-Project.ipynb) and update the database connection details (host, user, password) in the mysql.connector.connect
calls within the functions (fetch_key
, save_to_database
, get_password_from_database
, update_password
, delete_password
).
Run the Jupyter Notebook (Password-Manager-Project.ipynb) in your Python environment:
Password-Manager-Project.ipynb
The notebook provides a command-line interface with options:
- Enter 1 to save a new password
- Enter 2 to generate a password
- Enter 3 to show saved passwords
- Enter 4 to update a password
- Enter 5 to delete a password
- Enter 0 to exit
Follow prompts to perform actions.
-
generate_password(): Generates a random password with a mix of lowercase letters, uppercase letters, digits, and special characters. The password length is randomly chosen between 8 and 14 characters.
-
save_to_database(website, username, password): Encrypts the password and stores it in the MySQL database along with the website and username. If the user's key is not already stored in the database, it generates a new key.
-
get_password_from_database(website, username): Retrieves and decrypts the password from the database based on the specified website and username.
-
update_password(website, username, new_password): Updates the password for a specific website and username in the database.
-
delete_password(website, username): Deletes the password entry for a specific website and username from the database.
-
user_interface(): Provides a simple command-line interface for the user to interact with the password manager. Allows the user to perform actions such as saving, generating, displaying, updating, and deleting passwords.
- Passwords are encrypted using the AES encryption algorithm with CBC mode and PKCS7 padding.
- Key derivation is performed using PBKDF2 with a random salt.
- The script uses a MySQL database to store encrypted passwords and related information.
Note: Ensure that you have secured your MySQL database appropriately, including proper authentication and access controls.
This password manager is intended for educational purposes and may not provide the same level of security as professionally developed and audited password managers. Use it at your own risk.
The Password Manager Project is licensed under the MIT License.