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
| #!/usr/bin/env python3
#Auther:yooma 2016-08-15 15:00
import sys
import getpass
c = 1
uname = []
while 1:
username = input("Input username:")
password = getpass.getpass("Input password:")
LockFile = open('lock.txt','r')
try:
if username == LockFile.read():
print("%s user locked." % username)
sys.exit(0)
finally:
LockFile.close()
if username == 'yooma' and password == 'yooma':
print("Welcome %s login success!" % username)
break
elif username != 'yooma' or password != 'yooma':
print("Username or password failed,please input again:")
uname.insert(c,username)
s = set(uname)
for i in s:
if c < 4 and uname.count(i) == 3:
LockFile = open('lock.txt','w')
try:
LockFile.write(username)
finally:
LockFile.close()
print("Your account is locked.")
sys.exit(0)
elif c == 3:
print("Input error 3 times,go out.")
sys.exit(0)
c+=1
continue
else:
print("Input error.")
break
|