import re # Importing the regular expression module
def check_password_strength(password):
# Minimum length requirement
min_length = 8
# Check password length
if len(password) < min_length:
return "Password is too short. It must be at least 8 characters."
# Check for at least one uppercase letter
if not re.search(r'[A-Z]', password):
return "Password must include at least one uppercase letter."
# Check for at least one lowercase letter
if not re.search(r'[a-z]', password):
return "Password must include at least one lowercase letter."
# Check for at least one digit
if not re.search(r'[0-9]', password):
return "Password must include at least one digit."
# Check for at least one special character
if not re.search(r'[!@#$%^&*(),.?":{}|<>]', password):
return "Password must include at least one special character."
return "Password is strong."
# Example usage
password = input("Enter your password: ")
print(check_password_strength(password))
I developed this Python script to enhance my knowledge and understanding of scripting within the field of cybersecurity. The primary objective was to create a basic yet effective password strength checker, a common tool used to enforce security best practices.
The script evaluates passwords against essential security criteria, such as minimum length, inclusion of uppercase and lowercase letters, digits, and special characters. By using regular expressions to perform these checks, I gained hands-on experience with pattern matching and conditional logic, which are critical skills in cybersecurity.
Through this project, I aimed to deepen my understanding of how to programmatically enforce password policies that help protect against common threats like brute-force and dictionary attacks. This exercise not only improved my scripting abilities but also reinforced my awareness of the importance of strong password management in securing digital environments. By building this tool, I took a practical step towards enhancing my overall cybersecurity skill set.