def main(): password = input('Enter a password to check if it\'s leaked: ') count = check_password(password) if count: print(f'This password is leaked {count} times!') else: print('This password is not leaked \N{grinning face} ')
def Main(): """Run Terminal version of Password Checker""" loop = True print("Welcome to Password Checker") while loop: hash = hash_password(getpass("Enter Password to test: ")) result = check_password(hash) print_output(result) loop = strtobool( input("Do you wish to test another password? " "[Yes, y] / [No, n] ").lower())
def test_password_checker_checks_for_atleast_one_letter_between_a_z(self): results = check_password("12345A#") self.assertEqual("password must have atleast 1 letter between a-z", results)
def test_password_checker_returns_comma_separated_valid_passwords(self): results = check_password("2w3E,ABd1234@1,aF1#,2We3345") self.assertEqual("ABd1234@1", results)
def test_password_checker_checks_for_maximum_length_of_12(self): results = check_password("aA1@asdgxcfer") self.assertEqual("maximum password length 12", results)
def test_password_checker_checks_for_minimum_length_of_6_characters(self): results = check_password("1aAB#") self.assertEqual("minimum length should be 6 characters", results)
def test_checker_checks_for_a_character(self): results = check_password("123abcAAD") self.assertEqual("password must have atleast one character from #$@", results)
def test_password_checker_checks_for_letters_between_A_Z(self): results = check_password("abcd#$12") self.assertEqual("password must have atleast one letter between A-Z", results)
def test_password_checker_checks_for_atleast_one_number_between_0_9(self): results = check_password("abcdC#$") self.assertEqual("password must have atleast one number between 0-9", results)
def friendly_check(password): try: check_password(password) except InvalidPasswordError as exc: print("Invalid password", repr(exc))