Skip to content

Instantly share code, notes, and snippets.

@szczys szczys/randomPass.py
Created Aug 19, 2014

Embed
What would you like to do?
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
You can’t perform that action at this time.