-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathISP_2150.py
77 lines (68 loc) · 2.16 KB
/
ISP_2150.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
75
76
77
from password_auth import *
from password_cracker import crack_pwd
# PART-1
def isp_register():
fname = input("First Name:").strip()
lname = input("Last Name:").strip()
email = input("Email:").strip()
uname = input("Username:").strip().lower()
pwd = input("Password:").strip().lower()
status, msg = register(uname, pwd, fname, lname, email)
print(msg)
if not status:
isp_register()
def isp_logon():
uname = input("Username:").lower()
pwd = input("Password:").strip()
status, msg = logon(uname, pwd)
print(msg)
if not status:
isp_logon()
# PART-2
def isp_crack_pwd():
uname = input("Username:").strip().lower()
response = crack_pwd(uname)
if response[0]:
msg = "Password cracked Successfully!!"
password = response[1]
time_taken = response[3]
print(msg)
print("password: "+password+"\nTime taken:"+str(time_taken))
else:
if len(response) == 5:
msg = "Account not found with username " + uname + "!!"
else:
msg = "Unable to crack Password!!"
print(msg)
# PART-3
def isp_validate_pwd():
uname = input("Username:").strip()
response = crack_pwd(uname)
if response[0]:
msg = "Password cracked Successfully!!"
password = response[1]
password_strength = response[2]
print(msg+"\n")
print("Password: "+password+"\nPassword strength: "+password_strength)
else:
if len(response) == 5 and len(response[4]) > 0:
msg = "Account not found with username " + uname + "!!"
else:
msg = "Unable to crack Password!!"
print(msg)
if __name__ == "__main__":
c = True
while c:
print("Enter :\n 1. 1 to Register\n 2. 2 to login\n 3. 3 to crack password\n 4. 4 to validate password")
choice = int(input("Your choice:"))
if choice == 1:
isp_register()
elif choice == 2:
isp_logon()
elif choice == 3:
isp_crack_pwd()
else:
isp_validate_pwd()
cont = input("Do you want to continue?(Y/n):")
if cont.lower() == "n":
c = False