-s test script to run (property constrictor.script)
-t number of threads to launch (property constrictor.numThreads)
-i number of test iterations per thread (property constrictor.numIterations)
- -d database file (constrictor.property dbFile)
+ -d database file (property constrictor.dbFile)
-p port to listen for controller connections on
-l listen address for incoming controller connections
''' % sys.argv[0]
import os, errno, random
props = Properties.getProperties()
-words = None
+words = []
+default_dictionary = '/usr/share/dict/words'
def init():
global words
props.setProperty('evergreen.orgIDs', str(user.home_ou()))
- words_file = open('/usr/share/dict/words') # add config property
- words = words_file.readlines()
- words_file.close()
+ dict_file = props.getProperty('evergreen.dictionary') or default_dictionary
+ try:
+ words_file = open(dict_file)
+ except Exception:
+ logError("Unable to open dictionary file '%s'" % dict_file)
+ return
+
+ words = words_file.readlines()
+ words_file.close()
def initOsrf():
phrase = ''
for i in range(0, num_words):
- word = words[ int(random.random() * len(words)) ]
+ try:
+ word = words[ int(random.random() * len(words)) ]
+ except IndexError:
+ continue
phrase += '%s ' % word[0:len(word)-1]
return phrase