import itertools
def bruteForce3 (PasswordIn):
Password =''
while(Password != PasswordIn):
bruteForceLen1(PasswordIn)
bruteForceLen2(PasswordIn)
bruteForceLen3(PasswordIn)
bruteForceLen4(PasswordIn)
bruteForceLen5(PasswordIn)
bruteForceLen6(PasswordIn)
bruteForceLen7(PasswordIn)
bruteForceLen8(PasswordIn)
bruteForceLen9(PasswordIn)
bruteForceLen10(PasswordIn)
print('DONE ',Password, " = ",PasswordIn)
def bruteForceLen1(PasswordIn):
gen = itertools.combinations_with_replacement('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890',1)
for Password in gen:
Password = ''.join(Password)
print(PasswordIn, Password)
def bruteForceLen2(PasswordIn):
gen = itertools.combinations_with_replacement('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890',2)
for Password in gen:
Password = ''.join(Password)
print(PasswordIn, Password)
def bruteForceLen3(PasswordIn):
gen = itertools.combinations_with_replacement('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890',3)
for Password in gen:
Password = ''.join(Password)
print(PasswordIn, Password)
def bruteForceLen4(PasswordIn):
gen = itertools.combinations_with_replacement('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890',4)
for Password in gen:
Password = ''.join(Password)
print(PasswordIn, Password)
def bruteForceLen5(PasswordIn):
gen = itertools.combinations_with_replacement('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890',5)
for Password in gen:
Password = ''.join(Password)
print(PasswordIn, Password)
def bruteForceLen6(PasswordIn):
gen = itertools.combinations_with_replacement('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890',6)
for Password in gen:
Password = ''.join(Password)
print(PasswordIn, Password)
def bruteForceLen7(PasswordIn):
gen = itertools.combinations_with_replacement('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890',7)
for Password in gen:
Password = ''.join(Password)
print(PasswordIn, Password)
def bruteForceLen8(PasswordIn):
gen = itertools.combinations_with_replacement('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890',8)
for Password in gen:
Password = ''.join(Password)
print(PasswordIn, Password)
def bruteForceLen9(PasswordIn):
gen = itertools.combinations_with_replacement('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890',9)
for Password in gen:
Password = ''.join(Password)
print(PasswordIn, Password)
def bruteForceLen10(PasswordIn):
gen = itertools.combinations_with_replacement('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890',10)
for Password in gen:
Password = ''.join(Password)
print(PasswordIn, Password)
質問する
71 次
1 に答える
2
Password
関数でに設定さ''
れbruteForce3
、そのスコープで再度設定されることはありません。関数内のPassword
変数はxLenN
それらの関数に対してローカルであり、ループが継続Password != PasswordIn
するかどうかを決定するテスト()には影響しません。while
ただし、ループは1回のwhile
反復ですべての組み合わせを通過するように設定されています。名前が特定の値に設定されている場合、ループは魔法のwhile
ように壊れることはありません。Password
テストに基づいてwhileループを中断する決定は、各反復が完了したとき(またはcontinue
d from)に行われます。
于 2012-11-25T20:20:14.710 に答える