#!/bin/bash # simple wifiutm hotspot autologin # novatech 2007 # change these according to your hotspot ACID_ID=youracid_id ACID_PASS=youracid_pass HOST=10.50.8.250 #gateway ip, please check manually it might changed WIFIURL=https://wireless.utm/aaa/wireless.html?wbaredirect=http://google.com CONNECTED="NO" TRY=1; # Auto Wifi Login Start while [ $CONNECTED != "YES" ];do ping -c 2 -W 3 $HOST &>/dev/null if [ $? -eq 0 ]; then echo "Already Connected : [Ping OK]" CONNECTED="YES" else echo "Not Connected [Reconnecting]" curl --data fname="wba_login" --data username="$ACID_ID" --data key="$ACID_PASS" -k $WIFIURL --connect-timeout 5 > /dev/null 2>&1 sleep 1 # zzZ # double check if we really connected after sending login ping -c 2 -W 2 $HOST &>/dev/null if [ $? -eq 0 ]; then echo Connected [Ping OK] CONNECTED="YES" else echo "Still Not Connected [Retrying]" CONNECTED="NO" fi fi TRY=$(( $TRY + 1 )) if [ $TRY == 5 ];then echo "giving up...." fi done exit 0