@kiki2005/

password checker

Python

generates and checks passwords then classifies them by strength

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import re
import random
symbols= "[!$%^&*()=+-_]" 
print("Welcome to Password Checker")
def main_menu():
 print("Please enter a number that fits with one of the below.")
 print("1: Password Checker")
 print("2: Password Generator")
 print("3: Quit")
 menuSelection = int(input("choice: "))
 if menuSelection == 1:
   print("""
   Point System:
   ~1 Uppercase Letter = 5 Points
   ~1 Lowercase Letter = 5 Points
   ~1 Digits from 0-9 = 5 Points
  ~1 Special Symbol = 5 Points
  ~If Has All Add 10 Points
  """)
password = input("please enter a password: ")
if len(password)<=8:
  print ("this password is too short")
if len(password)>=24:
  print("this password is too long")
  main_menu()
else:
  point = 0 
  if 8 < len(password) < 24:
        print("Points Added - length")
        point += len(password)
  if re.search("[a-z]", password):
        print("5 Points Added")
        point += 5

  if re.search("[0-9]", password):
        print("5 Points Added")
        point += 5

  if re.search("[A-Z]", password):
        print("5 Points Added")
        point += 5

  if re.search("[!$%^&()_]", password):
        print("5 Points Added")
        point += 5
  

  if point == 25:
        point += 10

  
  if point>=20:
   print ("This a strong password")
   print(point)
  if point<=0:
   print ("This is a weak passord")
   print(point)
   main_menu ()  
if menuSelection == 2:
   print("Password Generator")
   a=("abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!$%^&*()=+")
   passLen = random.randint(12,24)
   newPass =  "".join(random.sample(a,passLen ))
   print(newPass)
   main_menu()
if menuSelection == 3:
   print("Program will now shut down")
   quit()
else:
  print("option not selected")
  main_menu()


main_menu()