ddwrt固件的cmcc自动登录脚本(附详细使用方法)

NO.1

dos下执行命令:
telnet 192.168.1.1
用户名 root
密码 admin(或者你自己设定的密码)
进入路由后输入以下命令,其中wlanacname、wlanuser、wlanpwd请自己修改
可以从认证页面的URL中得到wlanportal和wlanacname变量

  1. nvram set wlanportal=221.176.1.140
  2. nvram set wlanacname=1000.0775.771.00
  3. nvram set wlanuser=1350000000
  4. nvram set wlanpwd=123456
  5. nvram commit

NO.2

以下这段复制到DD的命令,保存为自定义指令

  1. #!/bin/sh
  2. date "+%Y-%m-%d %H:%M:%S"
  3. #rm -f login_res.html
  4. #rm -f logout_res.html
  5. export PATH=.:$PATH
  6. #echo $PATH
  7. wlanuserip=$(nvram get wan_ipaddr)
  8. echo ${wlanuserip}
  9. wlanportal=$(nvram get wlanportal)
  10. wlanacname=$(nvram get wlanacname)
  11. echo ${wlanportal}
  12. echo ${wlanacname}
  13. wlanuser=$(nvram get wlanuser)
  14. wlanpwd=$(nvram get wlanpwd)
  15. echo ${wlanuser}
  16. echo ${wlanpwd}
  17. if [ ! -e login_res.html ]
  18. then
  19. #login first
  20. wget "http://${wlanportal}/wlan/index.php?wlanacname=${wlanacname}&wlanuserip=${wlanuserip}&actiontype=LOGIN&USER=${wlanuser}&PWD=${wlanpwd}" -O login_res.html
  21. fi
  22. cat login_res.html|grep "cmcccs|login_res"
  23. #logon_res=`cat login_res.html|grep "cmcccs|login_res"|awk -F'|' '{print $3}'`
  24. #echo $logon_res
  25. logonsessid=`cat login_res.html|grep "logonsessid"|awk -F'"' '{print $6}'`
  26. echo $logonsessid
  27. #do a logout
  28. wget "http://${wlanportal}/wlan/index.php?wlanacname=${wlanacname}&wlanuserip=${wlanuserip}&actiontype=LOGOUT&USER=${wlanuser}&logonsessid=$logonsessid" -O logout_res.html
  29. cat logout_res.html|grep "cmcccs|offline_res"
  30. #logout_res=`cat logout_res.html|grep "cmcccs|offline_res"|awk -F'|' '{print $3}'`
  31. #echo $logout_res
  32. logoutsessid=`cat logout_res.html|grep "logonsessid"|awk -F'"' '{print $6}'`
  33. echo $logoutsessid
  34. #and then relogin
  35. wget "http://${wlanportal}/wlan/index.php?wlanacname=${wlanacname}&wlanuserip=${wlanuserip}&actiontype=LOGIN&USER=${wlanuser}&PWD=${wlanpwd}" -O login_res.html
  36. cat login_res.html|grep "cmcccs|login_res"
  37. #logon_res=`cat login_res.html|grep "cmcccs|login_res"|awk -F'|' '{print $3}'`
  38. #echo $logon_res
  39. logonsessid=`cat login_res.html|grep "logonsessid"|awk -F'"' '{print $6}'`
  40. echo $logonsessid
  41. date "+%Y-%m-%d %H:%M:%S"

NO.3

下面这段保存为防火墙指令

  1. /tmp/custom.sh >/tmp/root/relogin.log 2>&1

NO.4

DD-管理-Cron
Cron启用
Cron 附加任务
粘贴以下命令

  1. */3 * * * * root killall wget;wget http://hi.baidu.com/myeyre/blog/item/bb5470cfa42c2637f9dc613b.html -O /dev/null >/tmp/root/keepalive.log 2>&1 &
  2. 1 */6 * * * root /tmp/custom.sh >/tmp/root/relogin.log 2>&1 &

在框框复制代码后记得保存哦

完成后点应用,最后重启你的路由即可

« »

猜你喜欢

热门文章

评论