鱼C论坛

 找回密码
 立即注册
查看: 1026|回复: 1

求修改

[复制链接]
发表于 2022-2-12 13:50:51 From FishC Mobile | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
GatherNum = '0123456789'
GatherLetter = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
GatherSymbol = r'~!@#$%^&*()_=-,./?<>;:[]{}\|'


while True:
  psw = input('请输入需要检查的密码组合(Ctrl+C to Cancel):')
  length = len(psw)

#空白或空格判断
  while (psw.isspace() or length == 0):
  psw = input('密码为空或空格,请重新输入:')
  length = len(psw)

  #长度判断
  print(length)
  if length < 8:
  length_l = 1
  elif length >= 8 and length < 16:
  length_l = 2
  else:
  length_l = 3

  charkind = 0
  #数字判断
  for i in psw:
  if i in GatherNum:
    charkind = 1
    break

  #字母判断
  for i in psw:
  if i in GatherLetter:
    charkind += 1
    break

  #特殊字符判断
  for i in psw:
  if i in GatherSymbol:
    charkind += 1
    break

  print(length_l,charkind)
  print('你的密码安全级别为:',end='')
  if length_l == 1 or charkind == 1:
  print('低\n\
@长度太短,或者仅有数字、或者仅有字母')
  
  elif length_l == 3 and charkind == 3 and (psw[0] in GatherLetter):
  print('高\n继续保持您的优秀!!!')
  break
  else:
  print('中')
  print('\t请按以下策略提升密码安全级别:\n\
  \t1. 密码必须由数字、字母及特殊字符中的3种\n\
  \t2. 密码只能由字母开头\n\
  \t3. 密码长度不能低于16位\n')
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2022-2-22 17:12:50 | 显示全部楼层
GatherNum = '0123456789'
GatherLetter = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
GatherSymbol = r'~!@#$%^&*()_=-,./?<>;:[]{}\|'


psw = input('请输入需要检查的密码组合(Ctrl+C to Cancel):')
length = len(psw)

#空白或空格判断
while (psw.isspace() or length == 0):
  psw = input('密码为空或空格,请重新输入:')
  length = len(psw)

#长度判断
print(length)
if length < 8:
    length_l = 1
elif length >= 8 and length < 16:
    length_l = 2
else:
    length_l = 3

charkind = 0
#数字判断
for i in psw:
    if i in GatherNum:
        charkind = 1


#字母判断
for i in psw:
    if i in GatherLetter:
        charkind += 1


#特殊字符判断
for i in psw:
    if i in GatherSymbol:
        charkind += 1


print(length_l,charkind)
print('你的密码安全级别为:',end='')
if length_l == 1 or charkind == 1:
    print('低\n\
@长度太短,或者仅有数字、或者仅有字母')
  
elif length_l == 3 and charkind == 3 and (psw[0] in GatherLetter):
    print('高\n继续保持您的优秀!!!')

else:
    print('中')
    print('\t请按以下策略提升密码安全级别:\n\
    \t1. 密码必须由数字、字母及特殊字符中的3种\n\
    \t2. 密码只能由字母开头\n\
    \t3. 密码长度不能低于16位\n')
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-10-6 06:46

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表