S3 Fuzzer: PRNG Seed and decisiong graph fixes

- Change random seed generator to always spit out ints between 0 and 100,000
- Fix seeds so randomly generated seeds are *actually* the same as those seeds
	read from a file.
- Tweaks to decision graph

Remaining Bugs:
	- Single } encountered in format string
	- _mexe complains about "BadStatusLine"
This commit is contained in:
Kyle Marsh 2011-08-19 15:40:16 -07:00
parent 23fee1476a
commit d2c841d1df
2 changed files with 13 additions and 11 deletions

View file

@ -13,17 +13,19 @@ bucket:
- 13 bucket_get - 13 bucket_get
- 8 bucket_put - 8 bucket_put
- 5 bucket_delete - 5 bucket_delete
- garbage_method - bucket_garbage_method
garbage_method: bucket_garbage_method:
set: set:
method: method:
- '{random 1-100 printable}' - '{random 1-100 printable}'
- '{random 10-100 binary}' - '{random 10-100 binary}'
urlpath: bucket:
- '/{bucket}' - '{bucket_readable}'
- '/{bucket}/{object}' - '{bucket_not_readable}'
- '{random 10-1000 binary}' - '{bucket_writable}'
- '{bucket_not_writable}'
- '2 {garbage}'
choices: choices:
- bucket_get_simple - bucket_get_simple
- bucket_get_filtered - bucket_get_filtered

View file

@ -215,7 +215,7 @@ def randomlist(seed=None):
""" """
rng = random.Random(seed) rng = random.Random(seed)
while True: while True:
yield rng.random() yield rng.randint(0,100000) #100,000 seeds is enough, right?
def populate_buckets(conn, alt): def populate_buckets(conn, alt):
@ -275,7 +275,7 @@ def _main():
request_seeds = None request_seeds = None
if options.seedfile: if options.seedfile:
FH = open(options.seedfile, 'r') FH = open(options.seedfile, 'r')
request_seeds = [float(line) for line in FH.readlines()] request_seeds = [int(line) for line in FH if line != '\n']
print>>OUT, 'Seedfile: %s' %options.seedfile print>>OUT, 'Seedfile: %s' %options.seedfile
print>>OUT, 'Number of requests: %d' %len(request_seeds) print>>OUT, 'Number of requests: %d' %len(request_seeds)
else: else:
@ -298,7 +298,7 @@ def _main():
print>>OUT, "Begin Fuzzing..." print>>OUT, "Begin Fuzzing..."
print>>VERBOSE, '='*80 print>>VERBOSE, '='*80
for request_seed in request_seeds: for request_seed in request_seeds:
print>>OUT, request_seed print>>OUT, '%r' %request_seed
prng = random.Random(request_seed) prng = random.Random(request_seed)
decision = assemble_decision(decision_graph, prng) decision = assemble_decision(decision_graph, prng)
@ -317,13 +317,13 @@ def _main():
except KeyError: except KeyError:
headers = {} headers = {}
response = s3_connection.make_request(method, path, data=body, headers=headers, override_num_retries=0)
print>>VERBOSE, "%s %s" %(method[:100], path[:100]) print>>VERBOSE, "%s %s" %(method[:100], path[:100])
for h, v in headers.iteritems(): for h, v in headers.iteritems():
print>>VERBOSE, "%s: %s" %(h[:50], v[:50]) print>>VERBOSE, "%s: %s" %(h[:50], v[:50])
print>>VERBOSE, "%s\n" % body[:100] print>>VERBOSE, "%s\n" % body[:100]
response = s3_connection.make_request(method, path, data=body, headers=headers, override_num_retries=0)
print>>DEBUG, 'FULL REQUEST' print>>DEBUG, 'FULL REQUEST'
print>>DEBUG, 'Method: %r' %method print>>DEBUG, 'Method: %r' %method
print>>DEBUG, 'Path: %r' %path print>>DEBUG, 'Path: %r' %path