Skip to content

Instantly share code, notes, and snippets.

@wbsdty331
Created October 31, 2018 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wbsdty331/1e8efed8a3f92e46c51abad0df3461d0 to your computer and use it in GitHub Desktop.
Save wbsdty331/1e8efed8a3f92e46c51abad0df3461d0 to your computer and use it in GitHub Desktop.
shell
USER="$SCHOOL_ID%40$ISP"
DETECT=$(curl http://detectportal.firefox.com/success.txt -s)
if [[ $DETECT == "success" ]]; then
echo "The fucking network had been connected early."
exit 1
fi
PORTAL_URL=$(curl http://detectportal.firefox.com/success.txt -Ls | cut -d \' -f 2)
URL_PARAM=`echo "eportal/userV2.do?method=login&param=true&$(echo $PORTAL_URL | cut -d '?' -f 2)"`
SESSION_COOKIE=$(curl "$PORTAL_URL" -Is | grep "JSESSIONID=" | cut -d ';' -f 1 | cut -d ' ' -f 2)
COOKIE="Cookie: EPORTAL_COOKIE_USERNAME=; EPORTAL_COOKIE_PASSWORD=; EPORTAL_AUTO_LAND=false; $SESSION_COOKIE"
ROOT_URL="http://10.150.2.17/"
REAL_URL="$ROOT_URL$URL_PARAM"
DATA="is_auto_land=false&usernameHidden=$USER&username_tip=Username&username=$USER&strTypeAu=&uuidQrCode=&authorMode=&pwd_tip=Password&pwd=$PWD"
RESULT=$(curl -sL "$REAL_URL" -H "$COOKIE" -H 'Content-Type: application/x-www-form-urlencoded' --data "$DATA" --compressed)
if [[ $RESULT == *"d.toLogOut.href"* ]]; then
echo "The fucking network has been connected successfully."
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment