added passwords file

This commit is contained in:
Josh d'Entremont 2015-05-31 16:14:20 -03:00
parent 83d7c31c6e
commit 897faec917
2 changed files with 50 additions and 12 deletions

View file

@ -60,18 +60,16 @@ def getPasswords():
"""
Returns an array of strings to be used as the password and the decoys
"""
# temporarily hard coded for testing
#TODO - move the passwords out of this file and add more arrays
passwords = [
'FEVER',
'SEVER',
'SEWER',
'SEVEN',
'ROVER',
'ERROR',
'HELLO',
'BOXER'
]
groups = []
# read from passwords.txt
with open("passwords.txt") as pwfile:
for line in pwfile:
if not line.strip():
groups.append([])
elif len(groups) > 0:
groups[len(groups) - 1].append(line[:-1])
passwords = groups[random.randint(0, len(groups) - 1)]
random.shuffle(passwords)
return passwords

40
passwords.txt Normal file
View file

@ -0,0 +1,40 @@
# The login program will read groups of passwords from this file and
pick one at random. It ignores any lines until the first blank line,
and then reads all passwords as one group until another blank line
or the end of the file is found.
# Make sure there is exactly one blank line before EVERY group of
passwords, including the first group.
FEVER
SEVER
SEWER
SEVEN
ROVER
ERROR
HELLO
BOXER
NUMBERS
DOLLARS
POPULAR
ROBBERS
NOURISH
CLEANSE
GROUPED
GAINING
WASTING
DUSTERS
LETTING
ENDINGS
FERTILE
SEEKING
CERTAIN
BANDITS
STATING
WANTING
PARTIES
WAITING
STATION
MALTASE
MONSTER