Skip to content

Instantly share code, notes, and snippets.

@szczys
Created August 19, 2014 17:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save szczys/16d1a7f74562df77bcde to your computer and use it in GitHub Desktop.
Save szczys/16d1a7f74562df77bcde to your computer and use it in GitHub Desktop.
namesFile = '/home/mike/Desktop/hgttg.txt'
easyPass = 'ilovehackaday'
hardCount = 10
import random
import string
complexityLimit = 3
with open(namesFile, 'r') as f:
names = f.read().split('\n')
for item in names:
if item != '':
length = random.randint(5,7)
complexity = random.randint(0,complexityLimit)
charset = ''
if complexity == 3:
if hardCount == 10:
hardCount = hardCount-1
#Insert the easyPass the first time we hit this complexity
print item + ";" + easyPass
continue
else:
length = 10
charset = string.digits + string.ascii_letters + '!@#$%^&*()'
hardCount = hardCount-1
if (hardCount < 1):
#stop adding hard passwords so we don't get too many
complexityLimit = 2
elif complexity == 2:
charset = string.ascii_lowercase + string.digits + '!@#$%^&*()'
elif complexity == 1:
charset = string.ascii_lowercase + string.digits
else:
charset = string.ascii_lowercase
print item + ';' + ''.join(random.choice(string.ascii_lowercase + string.digits) for i in range(length))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment