diff --git a/fallout_login.py b/fallout_login.py index 0ce7a43..3fb8db1 100644 --- a/fallout_login.py +++ b/fallout_login.py @@ -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 diff --git a/passwords.txt b/passwords.txt new file mode 100644 index 0000000..1754c5b --- /dev/null +++ b/passwords.txt @@ -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