Asianet dataline Autologin Script for linux
I had created one simple script to make it easy to login using asianet dataline without using any browser.
Requirements
1. Curl (http://bit.ly/bH7jSK)
Tested on Ubuntu
#!/bin/bash
#####################################################################################################
#ASIANET DATALINE AUTOLOGGER SCRIPT
#BY VINOD SURENDRAN
#(SMARTVINU@GMAIL.COM)#####################################################################################################
# Set your consumer Id
customer=TV7000
# Set your Password
password=mypassword#####################################################################################################
######### DONT EDIT BELOW ##########################################################################
#####################################################################################################if [ -n "`ifconfig | grep -A 1 wlan0 | grep "inet addr"`" ];
then
echo “Going to connect ….”
echo “Getting server URL … ”
targetUrl=`curl -v http://www.google.com 2>&1 | grep “Location:”|awk {‘print $3′} | cut -d? -f1`
echo “Got targetUrl as $targetUrl”
echo $targetUrl | grep “mwcp”
if [ $? -ne 0 ]; then
echo “Seems like you are logged in.”
echo “Preparing to logout”
curl https://myaccount.adlkerala.com/login.php –data “username=${customer}&pass=${password}” -c tempCookie
curl https://myaccount.adlkerala.com/disconn.php –data “confirm=1″ -b tempCookie
echo “Logged out.”
rm -f tempCookie
echo “Getting server URL … ”
targetUrl=`curl -v http://www.google.com 2>&1 | grep “Location:”|awk {‘print $3′} | cut -d? -f1`
echo “Got targetUrl as $targetUrl”
fi;curl $targetUrl –data “auth_user=$customer&auth_pass=$password&accept=Login” &> /dev/null
echo “Connected
”
SKIP=0
while truedo
echo “Waiting … ”
COUNT=0
if [ $SKIP -eq 0 ]; then
while true
do
sleep 1
echo -ne \\b\\b\\b\\b\\\b$COUNT
COUNT=`echo $COUNT + 1 | bc `
if [ $COUNT -gt 250 ]; then
break;
fi;
done
fi;
echo
echo “Sending alive … ”
curl $targetUrl –data “alive=y&un=$customer”
if [ $? -eq 0 ]; then
echo “done”
else
echo “failed.retrying … ”
fi;done
else
echo “Wifi not connected”;
fi