Created
January 11, 2020 06:53
-
-
Save leoleoasd/e7a5d6ba5bcd03e996bf886e94620b87 to your computer and use it in GitHub Desktop.
校园网登录, 支持IPV6.
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
#!/usr/bin/env bash | |
# Read username & password from stdin | |
# Suited for public computers where credentials are not saved | |
read -p 'username: ' user | |
read -p 'password: ' -s pwd | |
echo | |
DATE=`date '+%Y-%m-%d %H:%M:%S'` | |
r1=`wget 'https://lgn6.bjut.edu.cn/V6?https://lgn.bjut.edu.cn' -qO- --post-data "DDDDD=$user&upass=$pwd&v46s=0&v6ip=&f4serip=172.30.201.2&0MKKey=" | grep v6ip | sed "s/<input type='hidden' name=DDDDD value='$user'><input type='hidden' name=upass value='$pwd'><input type='hidden' name=0MKKey value='Login'><input type='hidden' name='v6ip' value='//g" | sed "s/'><\/FORM><\/body><\/html>//g" | sed "s/:/%3A/g"` | |
r=`wget 'https://lgn.bjut.edu.cn/' -qO- --post-data "DDDDD=$user&upass=$pwd&0MKKey=Login&v6ip=$r1" | grep 'You have successfully logged into our system.'` | |
if [ "${r}" == '' ]; then | |
echo ${DATE} Failed | |
else | |
if [ "${r1}" == '' ]; then | |
echo ${DATE} Failed | |
else | |
echo ${DATE} Success | |
echo Your IPV6 address: `echo $r1 | sed "s/%3A/:/g"` | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment