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

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

测试学校:湖北工业大学

校园网 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

教育网:空着即可

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值