Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- username="acip"
- password="orbit88l"
- echo $(date)
- rc=$(ping -c 1 openwrt.org > /dev/null && echo 1 || echo 0) #CHECK CONNECTION, 1 | 0
- if [[ $rc == 1 ]]
- then
- echo "Internet Connected"
- else
- wget-ssl -q -O 'portal.html' --no-check-certificate --save-cookies=cookie --keep-session-cookies -c http://webpy.org #GET WIFI.id LOGIN PAGE
- POST_URL=$(cat portal.html | grep 'auth/authnew' | cut -d \" -f 4) #FIND ON DOWNLOADED PAGE FOR KEY 'auth/authnew'
- if [ -n "$POST_URL" ]; then
- i=$((${#POST_URL}-2)) #GET INDEX LAST 2 CHAR
- POST_URL="$(echo ${POST_URL/${POST_URL:$i:2}})" #DELETE LAST 2 CHAR
- POST_URL="$(echo ${POST_URL/${POST_URL:0:6}})" #DELETE FIRST 6 CHAR
- POST_URL="https://welcome2.wifi.id/wms/${POST_URL}" #APPEND URL
- wget -q -O 'response.html' --no-check-certificate --load-cookies=cookie --keep-session-cookies --post-data="password=${password}&username=${username}.sEOY@freeMS&username_=${username}" $POST_URL #SEND DATA LOGIN
- else
- BASE_URL=$(cat portal.html | grep '/wms/' | cut -d \" -f 4)
- BASE_URL="$(echo ${BASE_URL/${BASE_URL:0:7}})"
- # echo $BASE_URL
- if [ -n "$BASE_URL" ]; then
- wget-ssl -q -O 'portal1.html' --no-check-certificate --save-cookies=cookie1 --keep-session-cookies -c ${BASE_URL}
- POST_URL=$(cat portal1.html | grep 'auth/authnew' | cut -d \" -f 4) #FIND ON DOWNLOADED PAGE FOR KEY 'auth/authnew'
- if [ -n "$POST_URL" ]; then
- i=$((${#POST_URL}-2)) #GET INDEX LAST 2 CHAR
- POST_URL="$(echo ${POST_URL/${POST_URL:$i:2}})" #DELETE LAST 2 CHAR
- POST_URL="$(echo ${POST_URL/${POST_URL:0:6}})" #DELETE FIRST 6 CHAR
- POST_URL="https://welcome2.wifi.id/wms/${POST_URL}" #APPEND URL
- wget -q -O 'response.html' --no-check-certificate --load-cookies=cookie1 --keep-session-cookies --post-data="password=${password}&username=${username}.sEOY@freeMS&username_=${username}" $POST_URL #SEND DATA LOGIN
- fi
- else
- echo "Not Detected"
- fi
- fi
- cat response.html #READ RESPONSE
- rm cookie cookie1 portal.html portal1.html response.html
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement