2016-09-15 6 views
1

예를 들어 암호는 아래에 언급 된 다음 순서를 가질 수 있습니다. qwer, 1234, 1qaz, qwe, qaz, qwer, asd, asdf, wsx, wsx, 2wsx, wer, asdf, 1234, zxcv, 5678 qw, qwe, qaz.how 위의 언급 시퀀스가 ​​포함 된 패스워드인지 확인하기위한 간단한 파이썬 코드를 작성 하시겠습니까?암호에 시퀀스가 ​​포함되어 있는지 알아보기위한 파이썬 코드

+0

을 출력합니다. – Guenther

+0

https://stackoverflow.com/questions/34582576/checking-a-string-for-adjacent-characters-on-the-keyboard를 확인하십시오. – TimSC

답변

0

텍스트가 반복적으로 패스워드에 있는지 테스트 할 수 있습니다. 예를 들어 :

bad_strings = ["qwer", "1234", "1qaz", "qwe", "qaz", "qwer"] 
passwords = ["blah347", "password1", "password2", "badqwer", "badqaz"] 

def check_for_bad_password(password): 
    for bad_string in bad_strings: 
     if bad_string in password: 
      return password 

for password in passwords: 
    if check_for_bad_password(password): 
     print(password) 

이 여기 http://stackoverflow.com/help/mcve 질문을하는 방법에 대한 참조 badqwerbadqaz