#!/bin/bash # default username for this model export MODEMUSERNAME=admin # default password for model export MODEMPASSWORD=user12345 export COOKIE=/tmp/cookie_jar export CURL=/usr/bin/curl export PING=/bin/ping export GREP=/bin/grep export CUT=/usr/bin/cut $PING -c 5 google.com > /dev/null 2>&1 if [ $? -ne 0 ] then rm $COOKIE > /dev/null 2>&1 export OUTPUT=`$CURL -v -c $COOKIE 'http://$MODEMUSERNAME:$MODEMPASSWORD@192.168.1.1/resetrouter.html' 2>> /tmp/output` export SESSIONKEY=`echo "$OUTPUT" | $GREP var | $GREP sessionKey | $CUT -d"=" -f2 | $CUT -d"'" -f2` echo "kicking modem with session key $SESSIONKEY" export OUTPUT=`$CURL -v -c $COOKIE "http://$MODEMUSERNAME:$MODEMPASSWORD@192.168.1.1/rebootinfo.cgi?sessionKey=$SESSIONKEY" 2>> /tmp/output` fi