Created
April 20, 2022 11:27
-
-
Save m2-farzan/de0eb44b050f303f7e1c90ca4d652e1f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USERNAME=your_username | |
PASSWORD=your_password | |
PLATFORM=linux # 'linux' | 'android' | |
# Android: install termux, termux-widgets + termux-api, + pkg install termux-api curl | |
# Linux: install curl, libnotify-bin | |
notify () { | |
if [ "${PLATFORM}" = "linux" ]; then | |
notify-send --hint int:transient:1 "$1" --expire-time=2000 | |
elif [ "${PLATFORM}" = "android" ]; then | |
termux-toast "$1" | |
else | |
echo "$1" | |
fi | |
} | |
if ping -c1 -W1 8.8.8.8; then | |
curl http://linout.iust.ac.ir/logout > /dev/null 2>&1 | |
notify "Logged out." | |
else | |
F1=$(curl -X POST -d "username=${USERNAME}" -d "password=${PASSWORD}" https://its.iust.ac.ir/hotspot/login.php) | |
HASH=$(echo $F1 | grep -oP "[0-9a-f]{32}") | |
curl -X POST -d "username=${USERNAME}" -d "password=${HASH}" http://linout.iust.ac.ir/login > /dev/null 2>&1 | |
notify "Logged in." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment