python - letter count up algorithm -
first have german, sorry mistakes. here problem:
i have copied algorithm:
letters = list("123456") current in xrange(10): = [i in letters] y in xrange(current): = [x+i in letters x in a] = a[startpoint:] password in a: print password
from reply this: python brute forcefulness algorithm , want utilize algorithm seek out password against amateur brute-force. know there tests in net want create own test.
i finished brute-force-programm, found out algorithm generates 3 letters. 3 letters worked this:
aa, ba, ca, da, ea, fa, usw.
after possibilitys 2 letters trys this:
aaa, baa, caa, daa, eaa, faa, usw.
but if finished 3 letters, begin 2 letters again! why?
i don't realy understand algorithm do, know infinite formula , called recursion formula. understand tryed out this:
letters = list("123456") = [x+i in letters y+x in letters y in letters]
but producing "can't assign operator" error in other forum reply. based on tried out this:
letters = list("123456") = [x+i in letters y+x x in letters y in letters]
but syntax error. whats wrong code? , means "cant assign opperator" error, assign value opperator?
if want products of set utilize itertools product
import itertools min_pw_len,max_pw_len = 4,5 letters = list("123456") my_password = "1122" my_len in range(min_pw_len,max_pw_len): guess in itertools.product(letters,repeat=my_len): if "".join(guess) == my_password: print "found:",guess
as actual question syntax error
a = [x+i in letters y+x x in letters y in letters] ^this problem ... cannot (im not exclusively sure trying do)
im guessign want like
a2 = (x+y x in letters y in letters) #note generator not list a3 = (x+y x in a2 y in letters) a4 = (x+y x in a3 y in letters) ...
python algorithm for-loop brute-force
No comments:
Post a Comment