Permalink
Browse files

a quick script to login with curl and use the cookie with ab

  • Loading branch information...
1 parent 86b0522 commit d5ce04f3c1e3c711dd688584def687d6742c186b @robertbasic committed Nov 9, 2011
Showing with 16 additions and 0 deletions.
  1. +16 −0 ab-login/ab-login
View
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+COOKIE_JAR="/tmp/ab-login-cookie-jar"
+
+echo "Logging in..."
+
+curl -c $COOKIE_JAR -d username=user -d password=h4x0r http://example.com/login
+
+echo "Getting the session id..."
+PHPSESSID=$(cat $COOKIE_JAR | grep PHPSESSID | cut -f 7)
+
+echo "The session id is:"
+echo $PHPSESSID
+echo "=================="
+
+ab -n 10 -c 10 -C PHPSESSID=$PHPSESSID http://example.com/loggedin

0 comments on commit d5ce04f

Please sign in to comment.