Created
August 5, 2011 10:34
-
-
Save sebix/1127282 to your computer and use it in GitHub Desktop.
Small wget-based Script for visits.mastercrew.de
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Small wget-based Script for visits.mastercrew.de | |
DOMAIN="http://visits.mastercrew.de" | |
USERNAME="" | |
PASSWORD="" | |
COOKIEFILE="cookies.wget" | |
LOGFILE="filelog" | |
ERRORFILE=$LOGFILE | |
USERAGENT="Opera/9.80 (X11; Linux i686; U; en) Presto/2.9.168 Version/11.50" | |
NOSAVE=" --keep-session-cookies --load-cookies $COOKIEFILE --inet4-only" # may be slow with IPv6 | |
WGETARGS="$NOSAVE --save-cookies $COOKIEFILE" | |
COUNTER=1 | |
SURFSID= | |
function login() { | |
echo > $COOKIEFILE | |
wget "$DOMAIN/login.php" --post-data "navaction=login&UserID=$USERNAME&Passwort=$PASSWORD" $WGETARGS -O - 2>>$ERRORFILE >> $LOGFILE | |
tail -n 1 $COOKIEFILE | |
} | |
function logout() { | |
wget "$DOMAIN/login.php?page=account&navaction=logout"$WGETARGS -U "$USERAGENT" --referer="$DOMAIN/login.php?page=account" >> $LOGFILE 2>> $ERRORFILE | |
echo > $COOKIEFILE | |
} | |
function surfsid() { | |
SURFSID=`wget "$DOMAIN/view.php?user=$USERNAME" $WGETARGS -U "$USERAGENT" --referer="$DOMAIN/login.php?page=account" -O - 2>>$ERRORFILE | tee -a $LOGFILE` | |
# echo "$SURFSID" | |
SURFSID=`echo "$SURFSID" | grep surfsid | head -n 1 | sed 's/^.*surfsid=//' | sed 's/\"\ margin.*$//'` | |
if [ -z $SURFSID ]; then | |
echo "Got no Surfsid :(" | |
logout | |
exit 1 | |
fi | |
echo "$SURFSID" | |
} | |
function surfbar() { | |
if [ -z $SURFSID ]; then | |
surfsid | |
fi | |
while [ 1 ]; do | |
OUT=`wget "$DOMAIN/surfbar_mitte.php?surfsid=$SURFSID&cnt=$COUNTER" $NOSAVE -U "$USERAGENT" -O - 2>>$ERRORFILE | tee -a $LOGFILE` | |
if [ `echo $OUT | grep -c 'jackpot.php'` == "2" ]; then | |
echo "JACKPOT!" >> log | |
JC=`echo $OUT | grep 'name="jc"' | sed 's/^.*value="//' | sed 's/">.*$//'` | |
wget "$DOMAIN/jackpot.php" $WGETARGS -U "$USERAGENT" --referer="$DOMAIN/surfbar_mitte.php?surfsid=$SURFSID&cnt=$COUNTER" --post-data "surfsid=$SURFSID&art=&jc=$JC&" 2>>$ERRORFILE >>$LOGFILE | |
fi | |
punkte | |
((COUNTER=$COUNTER+1)) | |
sleep 20 | |
done | |
} | |
function punkte() { | |
POINTS=`wget "$DOMAIN/punktestand.php?surfsid=$SURFSID" $WGETARGS -U "$USERAGENT" -O - 2>>punkte | tee -a punkte | tail -n 6 | head -n 2 | tr -d '\r\n'` | |
POINTS=`echo $POINTS | sed 's/<[a-z/]*>//g'` | |
TIME=`date +%R:%S | tr -d '\n'` | |
echo -e "$TIME \t $COUNTER \t $POINTS" | |
} | |
if [ $# -eq 1 ]; then | |
case $1 in | |
login) | |
login | |
;; | |
logout) | |
logout | |
;; | |
surfsid) | |
surfsid | |
;; | |
surfbar) | |
surfbar | |
;; | |
auto) | |
login | |
surfsid | |
surfbar | |
logout | |
;; | |
*) | |
echo "Unknown Command" | |
esac | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment