simple weak password generator

Tags:

There are times I need to create some easy to remember weak initial passwords for students – here is a quick script

Note that these are not strong passwords as they are the definition of “dictionary” passwords…

import sys
import os
import random

dfile = '/usr/share/dict/web2'

def main():
    for x in range(130):
        winner = False
        MAX = 234936
        suffix = random.randint (10,100)
        while not winner:
            choice = random.randint(1,MAX)
            f = open(dfile)
            for i,l in enumerate(f):
                l = l.strip()
                length = len(l)
                if i < choice:
                    continue
                if length > 3 and length < 7:
                    winner = '%s%d' % (l,suffix)
                    break
        f.close()
        print winner.lower()


if __name__ == '__main__':
    main()

0 comments ↓

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment