パスワードセキュリティチェックのコード
6942 ワード
# :
# 1.
# 2. 8
#
# :
# 1. 、
# 2. 8
#
# :
# 1. 、
# 2.
# 3. 16
def passwd_check():
symbols = r'''`!@#$%^&*()_+-=/*{}[]\|'";:/?,.<>'''
chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
nums = '0123456789'
passwd = input(' :')
#
length = len(passwd)
while (passwd.isspace() or length == 0):
passwd = input(" ( ), :")
length = len(passwd)
if length <= 8:
flag_len = 1
elif 8 < length < 16:
flag_len = 2
else:
flag_len = 3
flag_con = 0
#
for each in passwd:
if each in symbols:
flag_con += 1
break
#
for each in passwd:
if each in chars:
flag_con += 1
break
#
for each in passwd:
if each in nums:
flag_con += 1
break
while 1:
print(" :", end='')
if flag_len == 1 or flag_con == 1:
print(" ")
elif flag_len == 3 and flag_con == 3 and (passwd[0] in chars):
print(" ")
break
else:
print(" ")
break
passwd_check()