Update develop
This commit is contained in:
parent
f1b080474e
commit
a47d99c0c2
|
@ -11,39 +11,34 @@ def gen_password(types):
|
||||||
#find the length needed for the password
|
#find the length needed for the password
|
||||||
numb = types.split(" ")
|
numb = types.split(" ")
|
||||||
|
|
||||||
for x in numb[0]:
|
try:
|
||||||
#if any errors are found defualt to 10
|
|
||||||
if x not in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']:
|
|
||||||
numb[0] = 10
|
|
||||||
length = int(numb[0])
|
length = int(numb[0])
|
||||||
|
except ValueError:
|
||||||
|
length = 10
|
||||||
|
|
||||||
needs_def = 0
|
needs_def = 0
|
||||||
#alpha characters
|
#alpha characters
|
||||||
if "alpha" in types or "letter" in types:
|
if "alpha" in types or "letter" in types:
|
||||||
for x in string.ascii_lowercase:
|
okay = okay + string.ascii_lowercase
|
||||||
okay.append(x)
|
|
||||||
#adds capital characters if not told not to
|
#adds capital characters if not told not to
|
||||||
if "no caps" not in types:
|
if "no caps" not in types:
|
||||||
for x in string.ascii_uppercase:
|
okay = okay + string.ascii_uppercase
|
||||||
okay.append(x)
|
|
||||||
else:
|
else:
|
||||||
needs_def = 1
|
needs_def = 1
|
||||||
#adds numbers
|
#adds numbers
|
||||||
if "numeric" in types or "numbers" in types:
|
if "numeric" in types or "numbers" in types:
|
||||||
for x in range(0, 10):
|
okay = okay + [str(x) for x in range(0, 10)]
|
||||||
okay.append(str(x))
|
|
||||||
else:
|
else:
|
||||||
needs_def = 1
|
needs_def = 1
|
||||||
#adds symbols
|
#adds symbols
|
||||||
if "symbols" in types:
|
if "symbols" in types:
|
||||||
sym = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', '_', '+', '[', ']', '{', '}', '\\', '|', ';', ':', "'", '.', '>', ',', '<', '/', '?', '`', '~', '"']
|
sym = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', '_', '+', '[', ']', '{', '}', '\\', '|', ';', ':', "'", '.', '>', ',', '<', '/', '?', '`', '~', '"']
|
||||||
for x in sym:
|
okay = okay + sym
|
||||||
okay.append(x)
|
|
||||||
else:
|
else:
|
||||||
needs_def = 1
|
needs_def = 1
|
||||||
#defaults to lowercase alpha password if no arguments are found
|
#defaults to lowercase alpha password if no arguments are found
|
||||||
if needs_def == 1:
|
if needs_def == 1:
|
||||||
for x in string.ascii_lowercase:
|
okay = okay + [str(x) for x in xrange(0, 10)]
|
||||||
okay.append(x)
|
|
||||||
password = ""
|
password = ""
|
||||||
#generates password
|
#generates password
|
||||||
for x in range(length):
|
for x in range(length):
|
||||||
|
|
Reference in a new issue