Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…f the percentiles
  • Loading branch information...
commit 39c8947ac981da10c3f3bed3e2ed2f3e1fe46c81 1 parent d5fab0a
@deanmalmgren deanmalmgren authored
Showing with 11 additions and 2 deletions.
  1. +7 −1 beeswithmachineguns/bees.py
  2. +4 −1 beeswithmachineguns/main.py
View
8 beeswithmachineguns/bees.py
@@ -324,12 +324,18 @@ def width(self):
else:
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.'
return
View
5 beeswithmachineguns/main.py
@@ -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: '').")
parser.add_option_group(attack_group)
@@ -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':
bees.down()
elif command == 'report':
Please sign in to comment.
Something went wrong with that request. Please try again.