-2
好吧,所以我正在測試我在python中製作的蠻力算法。唯一的問題是,當它獲取我希望它獲得的密碼而不是打印出「密碼正確:密碼」時,它會列出其他可能的選項。甚至不會暫停。下面的代碼:蠻力發電機不知道密碼猜到
import itertools
import os
lettersChar = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
numbersChar = '1234567890'
allChar = 'abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ'
def CrackPassword(characters):
realPass = input(' What Password Would You Like To Use : ')
amount = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
for i in amount:
gen = itertools.combinations_with_replacement(characters,i)
for password in gen:
convert = ''.join(password)
if(convert == realPass):
print('Password Is Correct : ' + convert)
os.system('pause')
return True
else:
print('Not Correct : ' + convert)
如果有人可以幫助我走出這將是大加讚賞:d
顯示你在哪裏調用'CrackPassword' –
部分這只是正常使用我'CrackPassword(numbersChar)' – Jeff
它只是CrackPassword(allChar) – wesleyd1124