-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pass_Getter.py
38 lines (34 loc) · 1.04 KB
/
Pass_Getter.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
import sys
import msvcrt
def GetPassWord(prompt = "Enter your password: ", hidden="*"):
password = []
print(prompt, end="")
while 1:
c = msvcrt.getwch()
ascii = ord(c)
if ascii==13:#enter
print("")
pwd = ""
for leters in password:
pwd += leters
return pwd
elif ascii==27:#esc
return None
elif ascii==8 and len(password)!=0:#backspace
sys.stdout.write("\b")
sys.stdout.write(" ")
sys.stdout.write("\b")
sys.stdout.flush()
password = password[0:(len(password)-1)]
elif ascii==224:
arrow = msvcrt.getwch()
else:
password.append(c)
sys.stdout.write(hidden)
sys.stdout.flush()
username = input("Enter your username: ")
pasword = getpassword(prompt="Enter password: ", hidden="*")
if username=="Git" and pasword=="Hub":
print("Authorisation Sucessful")
else:
print("Error")