admin管理员组

文章数量:1633915

湖北工业大学校园网自动认证功能

测试学校:湖北工业大学

校园网 Srun 深澜认证登录

支持的深澜认证的版本

V1.18 B20190830
V1.18 B20210607
V1.18 B20210909

基于openwrt

定时任务

*/1 * * * * /root/detect_ping.sh > /root/autologin.log 2&>1

detect_ping.sh

这里使用阿里云dns,很奇怪在没有认证的情况下114.114.114.114的dns可以ping

#ping 的总次数
PING_SUM=3
#ping 的间隔时间,单位秒
SLEEP_SEC=10
#连续重启网卡 REBOOT_CNT 次网络都没有恢复正常,重启软路由
#时间= (SLEEP_SEC * PING_SUM + 20) * REBOOT_CNT
REBOOT_CNT=3
LOG_PATH="/root/autologin.log"
cnt=0
reboot_cnt=0
while :
do
    ping -c 1 -W 1 223.5.5.5 > /dev/null
    ret=$?
    ping -c 1 -W 1 223.6.6.6 > /dev/null
    ret2=$?
    if [[ $ret -eq 0 || $ret2 -eq 0 ]]
    then
	echo -e 'net is ok\n' > $LOG_PATH
        echo -e 'try to exit\n' > $LOG_PATH
        #cnt=0
        #reboot_cnt=0
	exit
    else
        cnt=`expr $cnt + 1`
        echo -n `date '+%Y-%m-%d %H:%M:%S'` >> $LOG_PATH
        printf '-> [%d/%d] Network maybe disconnected,checking again after %d seconds!\r\n' $cnt $PING_SUM $SLEEP_SEC >> $LOG_PATH
        printf '-> [%d/%d] Network maybe disconnected,checking again after %d seconds!\r\n' $cnt $PING_SUM $SLEEP_SEC 
        
        if [ $cnt == $PING_SUM ]
        then
            echo 'try to re curl' >> $LOG_PATH
            echo 'ifup wan!!!'
            sleep 5
            /root/sdusrun login -c /root/config.json > /root/autologin.log 2&>1 
            cnt=0
            #重连后,等待10秒再进行ping检测
            sleep 8
            #网卡重启超过指定次数还没恢复正常,重启软路由
            reboot_cnt=`expr $reboot_cnt + 1`
            if [ $reboot_cnt == $REBOOT_CNT ]
            then
                echo -n `date '+%Y-%m-%d %H:%M:%S reboot!'` >> $LOG_PATH
                echo '-> Network has some problem, lets reboot' >> $LOG_PATH
                echo '-> =============== reboot!'
                reboot
            fi
        fi
    fi    
    sleep $SLEEP_SEC
done

登录配置文件

下载文件

config文件配置参考

需要修改detect_ping.sh

/root/sdusrun login -c /root/config.json > /root/autologin.log 2&>1

更换成自己的目录

需要注意不同学校acidtype参数值可能不一样,可以自行用fiddler4抓包查看

{
    "server": "http://202.114.177.246",
    "strict_bind": false,
    "double_stack": false,
    "retry_delay": 3000,
    "retry_times": 3,
    "n": 200,
    "type": 1,
    "acid": 1,
    "os": "Windows",
    "name": "Windows 98",
    "users": [
        {
            "username": "学号@ctcc",
            "password": "密码",
            "if_name": "eth0.2"
        }
    ]
}

中国电信:ctcc

中国移动:cmcc

中国联通:cucc

教育网:空着即可

本文标签: 湖北工业大学校园网功能