Last active
May 31, 2023 15:50
-
-
Save xqm32/0ddb572108ccc92fbedd0dae0531e6ab to your computer and use it in GitHub Desktop.
HFUT DrCOM
This file contains hidden or 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/sh | |
username="YOUR_USERNAME" | |
password="YOUR_PASSWORD" | |
content=$(curl -s "http://172.16.200.11") | |
# if [ $(echo "${content}" | hexdump -e '"%_p"' | grep -m 1 -o "tologin") ]; then | |
# echo "tologin" | |
# curl -d "DDDDD=${username}&upass=${password}&0MKKey=123" -s "http://172.16.200.11" > /dev/null | |
if [ ! "${content}" ]; then | |
echo "You must use this script under the campus network" | |
elif [ $(echo "${content}" | grep -m 1 -o "FC_XueShengSuSh") ] || [ $(echo "${content}" | grep -m 1 -o "FCH-HJ_bkl-RG18") ]; then | |
echo "FC_XueShengSuSh or FCH-HJ_bkl-RG18" | |
redirect=$(echo "${content}" | sed -n -E "s/.*'(.*)'.*/\1/p") | |
cookie=$(curl -I -s "${redirect}" | sed -n -E "s/Set-Cookie: (.*;).*/\1/p") | |
curl -b $cookie -d "username=${username}&password=${password}&0MKKey=%B5%C7+%C2%BC&savePWD=0" -s "http://210.45.240.245/post.php" > /dev/null | |
# curl -d "DDDDD=${username}&upass=${password}&0MKKey=123" -s "http://172.16.200.11" > /dev/null | |
elif [ $(echo "${content}" | grep -m 1 -o "HFUT-WiFi") ]; then | |
echo "HFUT-WiFi" | |
redirect=$(echo "${content}" | sed -n -E "s/.*<NextURL>(.*)<\/NextURL>.*/\1/p") | |
parameter=$(echo "${redirect}" | sed -n -E "s/.*\?(.*)/\1/p" | sed -E "s/(wlan|user|ac|nas)/\1_/g") | |
cookie=$(curl -I -s "http://210.45.240.105:801/eportal/?c=Portal&a=page_type_data" | sed -n -E "s/Set-Cookie: (.*;).*/\1/p") | |
curl -b $cookie -s "http://210.45.240.105:801/eportal/?c=Portal&a=login&callback=dr1003&login_method=1&user_account=${username}&user_password=${password}&${parameter}" > /dev/null | |
else | |
echo "You are already logged in" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment