Skip to content

Instantly share code, notes, and snippets.

@leoleoasd
Created January 11, 2020 06:53
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 leoleoasd/e7a5d6ba5bcd03e996bf886e94620b87 to your computer and use it in GitHub Desktop.
Save leoleoasd/e7a5d6ba5bcd03e996bf886e94620b87 to your computer and use it in GitHub Desktop.
校园网登录, 支持IPV6.
#!/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