A Python package for generating and validating strong passwords based on various criteria.
- Generate passwords with customizable settings:
- Include uppercase letters
- Include numbers
- Include special characters
- Specify password length
- Validate password strength to ensure secure password creation.
- Manage passwords by saving them to a file for easy access.
- Generate random passwords with random settings for length, uppercase, numbers, and special characters.
You can clone the repository to your local machine using the following command:
git clone https://github.com/md86mi86/PasswordManager.git
-
Create an instance of the
PasswordManager
class:from PasswordManager import PasswordManager manager = PasswordManager()
-
Generate a password with customizable options:
password = manager.generatePassword(length=12, includeUppercase=True, includeNumbers=True, includeSpecialCharacters=True) print(password)
length
: The length of the generated password (must be an integer).includeUppercase
: Boolean, whether to include uppercase letters in the password (default isFalse
).includeNumbers
: Boolean, whether to include numbers (default isFalse
).includeSpecialCharacters
: Boolean, whether to include special characters (default isFalse
).
-
Validate the strength of a password:
strength = manager.validatePasswordStrength(password) print(strength)
- Returns:
- "Password is very weak"
- "Password is weak"
- "Password is average"
- "Password is good"
- "Password is strong"
- "Password is very strong"
- Returns:
-
Manage passwords by saving them to a file:
manager.managePassword(name="Instagram", username="user123", password="mypassword")
- Saves the following data to a file named
social_media.txt
:{ "social_media": "Instagram", "username": "user123", "password": "mypassword" }
- Prints
Data saved successfully!
upon success.
- Saves the following data to a file named
-
Generate a random password with random settings for length, uppercase, numbers, and special characters:
random_password = manager.randomPassword() print(random_password)
- Generates a password with random choices for length, whether to include uppercase letters, numbers, and special characters.
from PasswordManager import PasswordManager
manager = PasswordManager()
# Generate a password of length 12, including uppercase letters, numbers, and special characters
password = manager.generatePassword(length=12, includeUppercase=True, includeNumbers=True, includeSpecialCharacters=True)
print(f"Generated password: {password}")
# Validate password strength
strength = manager.validatePasswordStrength(password)
print(f"Password strength: {strength}")
# Save the password to a file
manager.managePassword(name="Instagram", username="user123", password=password)
# Generate a random password
random_password = manager.randomPassword()
print(f"Random password: {random_password}")
This project is licensed under the MIT License - see the LICENSE file for details.