Permalink
Browse files

Merge branch 'master' of github.com:mikegagnon/nginx-overload-handler

  • Loading branch information...
2 parents 952a32c + 4fb1e61 commit a0f13cf1e3fdcd3bba22ef30d01276654e693801 @mikegagnon committed Sep 8, 2012
View
40 doorman_test/osqa_test/doorman_attack.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+#
+# Copyright 2012 HellaSec, LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ==== doorman_legit.sh for mediawiki ====
+#
+# For usage see: ./doorman_legit.sh -h
+#
+# Example usage: ./doorman_legit.sh -s localhost -to 5 -t 20
+#
+
+# $DIR is the absolute path for the directory containing this bash script
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $DIR/../env.sh
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $DIR/env.sh
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+FILENAME_BASE=`echo "attack_$*" | sed 's/\s/_/g' | tr '/' '_'`
+TRACE_FILENAME="$DIR/results/$FILENAME_BASE.csv"
+SUMMARY_FILENAME="$DIR/results/$FILENAME_BASE.json"
+echo $SUMMARY_FILENAME
+
+$DOORMAN_ATTACK --stderr ERROR --trace-filename $TRACE_FILENAME --url 'POST`URL`/account/local/register/`DATA`next=%2F&username=&email=viewx3dtextx26qx3d@yahoo.comx26latlngx3d15854521645943074058&password1=&password2=&bnewaccount=Signup`HEADERS`{"Content-Type":"application/x-www-form-urlencoded"}' --regex OSQA $*
+cat $TRACE_FILENAME | $DOORMAN_ANALYZE > $SUMMARY_FILENAME
+
+echo "done attack"
+
View
46 doorman_test/osqa_test/doorman_legit.sh
@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+#
+# Copyright 2012 HellaSec, LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ==== doorman_legit.sh for mediawiki ====
+#
+# Example usage: ./doorman_legit.sh --id EXPERIMENT_NAME --server SERVER --url FILE --rate 30 --duration 20
+#
+
+# $DIR is the absolute path for the directory containing this bash script
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $DIR/../env.sh
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $DIR/env.sh
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+FILENAME_BASE=`echo "legit_$*" | sed 's/\s/_/g' | tr '/' '_'`
+TRACE_FILENAME="$DIR/results/$FILENAME_BASE.csv"
+SUMMARY_FILENAME="$DIR/results/$FILENAME_BASE.json"
+echo $SUMMARY_FILENAME
+
+$DOORMAN_LEGIT \
+ --stderr ERROR \
+ --url-file $DIR/trace01.txt \
+ --poisson \
+ --timeout 20 \
+ --trace-filename $TRACE_FILENAME \
+ --regex "OSQA" \
+ $*
+
+cat $TRACE_FILENAME | $DOORMAN_ANALYZE > $SUMMARY_FILENAME
+
+echo "done legit"
+
View
23 doorman_test/osqa_test/env.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+#
+# Copyright 2012 HellaSec, LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ==== env.sh for doorman_test for mediawiki ===
+#
+# defines some shell variables
+#
+
+TEST_TIME=120
+
View
5 doorman_test/osqa_test/results/.gitignore
@@ -0,0 +1,5 @@
+# Ignore everything in this directory
+*
+# Except this file
+!.gitignore
+
View
7 doorman_test/puzzle_solver.py
@@ -218,7 +218,6 @@ def __init__(self, logger, queue, server, url, timeout, regex_target, \
# just GET the URL, so you can get a puzzle back, then solve the puzzle, then post with the
# solution
def post(self, headers, data, url):
- print 7
self.logger.debug("%d posting %s %s %s", self.greenlet_id, headers, data, url)
if data == None or url == None:
sys.exit(1)
@@ -227,11 +226,8 @@ def post(self, headers, data, url):
# First issue a GET request for the url without any data or special headers
try:
#headers = {"Content-Type" : "application/x-www-form-urlencoded"}
- print 7.6
req = urllib2.Request("http://%s%s" % (self.server, url), data, headers)
- print 8
response = urllib2.urlopen(req, timeout=self.timeout)
- print 9
except socket.timeout:
latency = time.time() - before
return("timeout", None, None, latency)
@@ -328,12 +324,9 @@ def run(self):
def do_post(self, headers, data, url, is_keyed_url = False):
self.logger.debug("post request %s %s %s %s", headers, data, url, is_keyed_url)
- print 1
if is_keyed_url:
- print 2
(status, category, response, latency) = self.post(headers, data, url)
else:
- print 3
(status, category, response, latency) = self.request(url)
now = time.time()

0 comments on commit a0f13cf

Please sign in to comment.