import randomalpha_left = ['r', 'q', 'w', 'e', 'r', 't', 'a', 's', 'd', 'f', 'g', 'z', 'x', 'c', 'v', 'b']num_left = ['1', '2', '3', '4', '5', '6']symbols_left = ['`']alpha_right = ['j', 'k', 'l', 'n', 'm', 'h', 'y', 'u', 'o', 'i', 'p']num_right = ['7', '8', '9', '0']symbols_right = [';', "'", '[', ']', '.', ',', '/', '-', '=', '\\']left = [alpha_left, num_left, symbols_left]right = [alpha_right, num_right, symbols_right]def gen_pw ():passwd = ""for i in range (8):if i % 2:cata = left[random.randrange (3)]else:cata = right[random.randrange (3)]passwd += cata[random.randrange (len (cata))]return passwddef check_pw (p):has = [False, False, False]for c in alpha_left:if c in p:has[0] = Truefor c in num_left:if c in p:has[1] = Truefor c in symbols_left:if c in p:has[2] = Truefor c in alpha_right:if c in p:has[0] = Truefor c in num_right:if c in p:has[2] = Truefor c in sym1ols_right:if c in p:has[2] = Trueif False in has:return Noneelse:return ppwlist = []while len (pwlist) < 25:tmp_pw = check_pw (gen_pw ())if tmp_pw:pwlist.append (tmp_pw)print pwlist
Wednesday, May 25, 2011
Very crude password generation
Generates 25 passwords which alternate between the left and right hands for each character, have alphanumerical plus symbols and never require holding down shift. Coded while playing Super Smash Brawl at 3am so I bet there's a million horrible things about it.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment