Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit d5ce04f3c1e3c711dd688584def687d6742c186b 1 parent 86b0522
@robertbasic authored
Showing with 16 additions and 0 deletions.
  1. +16 −0 ab-login/ab-login
View
16 ab-login/ab-login
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.