Script Code that generates all Passwords - Python


I doubt you have the RAM or the time, but this is a python script I wrote to generate all password combinations in a given range. Outputs results to a .txt file. Just for fun. I ran it on an octa-core Linux box I had for a week and only got to ae----.


from itertools import *
fileOutput=1
minLength=6
maxLength=12
pwList = []
inputstr = "abcdefghijklmnopqrstuvwxyz"
inputstr = inputstr+"0123456789"+inputstr.upper()+"!#$%&'()*+-."
print inputstr
for lenPW in range(minLength,maxLength):
    perms = (p for p in product(inputstr,repeat=lenPW))
    for p in perms:
        print ''.join(p)
        tempString = "".join(p)
        if tempString not in pwList:
            pwList.append(str(tempString))
if fileOutput==1:
    outputFile = open("passwords.txt",'w')
    outputFile.writelines('\n'.join(''.join(items) for items in pwList))

No comments:

Post a Comment