Browse files

added option to optparser for writing the csv file to disk with all o…

…f the percentiles
  • Loading branch information...
deanmalmgren committed Apr 23, 2013
1 parent d5fab0a commit 39c8947ac981da10c3f3bed3e2ed2f3e1fe46c81
Showing with 11 additions and 2 deletions.
  1. +7 −1 beeswithmachineguns/
  2. +4 −1 beeswithmachineguns/
@@ -324,12 +324,18 @@ def width(self):
print 'Mission Assessment: Swarm annihilated target.'
-def attack(url, n, c):
+def attack(url, n, c, csv_filename):
Test the root url of this site.
username, key_name, instance_ids = _read_server_list()
+ if csv_filename:
+ try:
+ stream = open(csv_filename, 'w')
+ except IOError, e:
+ raise IOError("Specified csv_filename='%s' is not writable. Check permissions or specify a different filename and try again." % csv_filename)
if not instance_ids:
print 'No bees are ready to attack.'
@@ -91,6 +91,9 @@ def parse_options():
attack_group.add_option('-c', '--concurrent', metavar="CONCURRENT", nargs=1,
action='store', dest='concurrent', type='int', default=100,
help="The number of concurrent connections to make to the target (default: 100).")
+ attack_group.add_option('-e', '--csv', metavar="FILENAME", nargs=1,
+ action='store', dest='csv_filename', type='string', default='',
+ help="Store the distribution of results in a csv file for all completed bees (default: '').")
@@ -116,7 +119,7 @@ def parse_options():
if NO_TRAILING_SLASH_REGEX.match(options.url):
parser.error('It appears your URL lacks a trailing slash, this will disorient the bees. Please try again with a trailing slash.')
- bees.attack(options.url, options.number, options.concurrent)
+ bees.attack(options.url, options.number, options.concurrent, options.csv_filename)
elif command == 'down':
elif command == 'report':

0 comments on commit 39c8947

Please sign in to comment.