In the world of cybersecurity, millions of attacks happen every year. Many of those attacks are due to users having weak or easy to guess passwords, or using the same passwords to login to multiple sites. Users should always ensure that their passwords are strong and hard to guess in order to prevent losing any sensitive information to any attackers. Passwords should
I first imported the required libraries for this project.
import string
import getpass
import re
Then I added, "getpass" into the Python code which was used to encrypt the password when entered.
password = getpass.getpass("Enter password: ")
I then created the requirements for the passwords.
if len(password) < 10:
print("This password is too short. Your password needs to be at least 10 characters long.")
elif not re.search("[A-Z]", password):
print("Password needs at least one uppercase letter.")
elif not re.search("[a-z]", password):
print("Password needs at least one lowercase letter.")
elif not re.search("[0-9]", password):
print("Password needs at least one number.")
elif not re.search('[!@#$%^&*(),?":{}|<>]', password):
print("Password needs at least one special character.")
else:
print ("Password is good to go.")
The code will prompt the user to enter a password and inform the user on whether the passwords is strong or not.
I noticed that using "getpass" in Python code helped to encrypt the password.
When users enters a password that doesn't meet the requirements, the code will give suggestions on what they should add in their password.
If a user enters a strong password that meets all the requirements, the code will say "Password is good to go."
This was a fun project and I learned more about using strings and adding encryption in Python. Organizations should advise employees to use strong passwords that contain a mix of letters, numbers and special characters to reduce the likelihood of a security breach.