ubnt解决方案
查看: 23773|回复: 17

新出的TP-link路由器管理密码的登录界面源码

[复制链接]

1

回帖

19

积分

2 小时

在线时间

新兵上阵

注册时间
2014-1-15
金币
17 个
威望
0 个
荣誉
0 个

尚未签到

发表于 2014-1-15 20:18 |显示全部楼层
本帖最后由 kif 于 2014-1-15 20:21 编辑

有大神能分析一下么,有没有啥漏洞?
由于这个论坛的字数限制,只能把代码分开两部分发出,在二楼发剩下的部分代码。
  1. <script type="text/javascript">
  2. var httpAutErrorArray=new Array(
  3. 1,
  4. "",
  5. 0,0 );
  6. </script>
  7. <html><head><title>TL-WR842N</title>
  8. <script type="text/javascript"><!--
  9. function Click(){return false;}
  10. document.oncontextmenu=Click;
  11. function doPrev(){history.go(-1);}
  12. //--></script>

  13. <style type="text/css">
  14. body{
  15.         font-family:"宋体";
  16.         background-color:white;
  17.         margin:0px;
  18.         padding:0px;
  19. }
  20. div.loginBox
  21. {
  22.         display: block;
  23.         position:relative;
  24.         margin-top:10%;        
  25.         text-align:center;
  26. }

  27. div.panelThre{
  28.         margin-top:10px;
  29. }
  30. div.picDiv{
  31.         width:457px;
  32.         height:321px;
  33.         background:url(../login/loginbg.png);
  34.         position:relative;
  35. }
  36. input.pcPassword{
  37.         width:300px;
  38.         height:50px;
  39.         line-height:50px;
  40. }

  41. .topLogo{
  42.         background:url(../login/top_bg.png);
  43.         height:55px;
  44. }

  45. ul{
  46.         padding:40px 0px 0px 0px;
  47.         margin:0px;
  48.         list-style:none;
  49. }
  50. ul li{
  51.         width:341px;
  52.         text-align:left;
  53.         color:#656565;
  54.         font-family:"宋体";
  55.         font-weight:normal;
  56.         font-size:12pt;
  57.         margin-top:10px;
  58.         display:inline-block;
  59.         _display:inline;
  60.         _zoom:1;        
  61. }

  62. .errMsg
  63. {
  64.         color:#fd1515;
  65. }
  66. li.pwLi{        
  67.         height:40px;
  68.         background:url(../login/loginPwd.png);
  69. }

  70. input.text{
  71.         border:0px;
  72.         height:36px;
  73.         width:337px;
  74.         padding:10px 0px;
  75.         margin:2px 0px 0px 2px;
  76.         font-size:14px;
  77.         color:#6a6969;
  78.         font-family:"宋体";
  79.         font-weight:normal;
  80.         background-color:transparent;
  81.         vertical-align:middle;
  82. }
  83. label.loginBtn{
  84.         height:40px;
  85.         display:inline-block;
  86.         width:148px;
  87.         margin-top:20px;
  88.         background:url(../login/loginBtn.png);
  89.         cursor:pointer;
  90.         vertical-align:middle;
  91.         text-align: center;
  92.         color:white;
  93.         font-family:"宋体";
  94.         font-weight:normal;
  95.         font-size:14pt;
  96.         line-height:40px;
  97. }
  98. </style>
  99. <script type="text/javascript">
  100. function Base64Encoding(input)
  101. {
  102.         var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  103.         var output = "";
  104.         var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
  105.         var i = 0;

  106.         input = utf8_encode(input);

  107.         while (i < input.length)
  108.         {

  109.                 chr1 = input.charCodeAt(i++);
  110.                 chr2 = input.charCodeAt(i++);
  111.                 chr3 = input.charCodeAt(i++);

  112.                 enc1 = chr1 >> 2;
  113.                 enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
  114.                 enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
  115.                 enc4 = chr3 & 63;

  116.                 if (isNaN(chr2)) {
  117.                         enc3 = enc4 = 64;
  118.                 } else if (isNaN(chr3)) {
  119.                         enc4 = 64;
  120.                 }

  121.                 output = output +
  122.                 keyStr.charAt(enc1) + keyStr.charAt(enc2) +
  123.                 keyStr.charAt(enc3) + keyStr.charAt(enc4);

  124.         }

  125.         return output;
  126. }

  127. function utf8_encode (string)
  128. {
  129.         string = string.replace(/\r\n/g,"\n");
  130.         var utftext = "";

  131.         for (var n = 0; n < string.length; n++) {

  132.                 var c = string.charCodeAt(n);

  133.                 if (c < 128) {
  134.                         utftext += String.fromCharCode(c);
  135.                 }
  136.                 else if((c > 127) && (c < 2048)) {
  137.                         utftext += String.fromCharCode((c >> 6) | 192);
  138.                         utftext += String.fromCharCode((c & 63) | 128);
  139.                 }
  140.                 else {
  141.                         utftext += String.fromCharCode((c >> 12) | 224);
  142.                         utftext += String.fromCharCode(((c >> 6) & 63) | 128);
  143.                         utftext += String.fromCharCode((c & 63) | 128);
  144.                 }

  145.         }

  146.         return utftext;
  147. }

  148. function CheckUserPsw(szValue)
  149. {
  150.         var reg = /^[\x21-\x7e]+$/;        
  151.         if(!reg.test(szValue))
  152.         {
  153.                 return false;
  154.         }
  155.         return true;
  156. }

  157. var pswLenMsg = "密码长度只能为6-15位。";
  158. var pswInvalid = "密码必须是数字、字母(区分大小写)、符号的组合(空格除外)。";
复制代码

1

回帖

20

积分

0 小时

在线时间

新兵上阵

注册时间
2018-5-3
金币
14 个
威望
1 个
荣誉
0 个
累计签到:1 天
连续签到:0 天
[LV.20]漫游旅程
发表于 2018-5-3 14:30 |显示全部楼层
本帖最后由 dawn9677 于 2018-5-3 15:05 编辑

上午还能用的方法,下午就没用了。。。
回复

使用道具 举报

1

回帖

19

积分

2 小时

在线时间

新兵上阵

注册时间
2014-1-15
金币
17 个
威望
0 个
荣誉
0 个

尚未签到

发表于 2014-1-15 20:18 |显示全部楼层
  1. function CheckPswLength()
  2. {
  3.         if(httpAutErrorArray[0] == 2 )
  4.         {
  5.                 return false;
  6.         }
  7.         var pcPassword = $("pcPassword");
  8.         if(pcPassword.value.length == 0)
  9.         {
  10.                 return false;
  11.         }
  12.         else if(!CheckUserPsw(pcPassword.value))
  13.         {
  14.                 $("errMsg").style.visibility = "visible";
  15.                 $("errMsg").innerHTML = pswInvalid;
  16.                 return false;
  17.         }
  18.         else if(pcPassword.value.length < 6 || pcPassword.value.length > 15)
  19.         {
  20.                 $("errMsg").style.visibility = "visible";
  21.                 $("errMsg").innerHTML = pswLenMsg;
  22.                 return false;
  23.         }
  24.         else
  25.         {
  26.                 $("errMsg").style.visibility = "hidden";
  27.         }
  28.         return true;
  29. }

  30. function setPswDisable(state)
  31. {
  32.         var pcPassword = $("pcPassword");
  33.         pcPassword.style.display = (state)?"none":"";
  34.         var pwLi = $("pwLi");
  35.        
  36.         if(state == true)
  37.         {
  38.                 pwLi.style.background = "url(../login/loginPwdL.png) no-repeat";
  39.         }
  40.         else
  41.         {
  42.                 pwLi.style.background = "url(../login/loginPwd.png) no-repeat";               
  43.                 pcPassword.focus();
  44.         }       
  45. }

  46. function PCWin(event)
  47. {       
  48.         if (event.keyCode == 13)
  49.         {
  50.                 PCSubWin();
  51.         }
  52. }

  53. function PCSubWin()
  54. {
  55.         if(CheckPswLength() == true )
  56.         {
  57.                 var strtemp = location.href;
  58.                 var password = $("pcPassword").value;       
  59.                 var auth = "Basic "+Base64Encoding("admin:"+password);
  60.                 document.cookie = "Authorization="+escape(auth)+";path=/";
  61.                 location.href = strtemp;
  62.         }
  63. }

  64. function w(str)
  65. {
  66.         document.write(str);
  67. }

  68. function $(id)
  69. {
  70.         return document.getElementById(id);
  71. }

  72. function pageLoad()
  73. {
  74.         document.cookie = "Authorization=;path=/";
  75.         var ErrNum = httpAutErrorArray[0];
  76.         switch(ErrNum)
  77.         {
  78.                 case 1:
  79.                         isShowReset = true;
  80.                         $("errMsg").innerHTML = "密码错误,请重新输入。";
  81.                         $("errMsg").style.visibility = "visible";
  82.                         $("resetMsg").style.visibility = "visible";
  83.                         setPswDisable(false);
  84.                 break;
  85.                 case 2:
  86.                         isShowReset = true;
  87.                         $("errMsg").innerHTML = "密码错误已达10次,请两小时后再尝试。";
  88.                         $("errMsg").style.visibility = "visible";
  89.                         $("resetMsg").style.visibility = "visible";
  90.                         setPswDisable(true);       
  91.                 break;
  92.                 case 0:
  93.                 default:
  94.                         isShowReset = false;
  95.                         $("errMsg").style.visibility = "hidden";
  96.                         $("resetMsg").style.visibility= "hidden";
  97.                         setPswDisable(false);       
  98.                 break;
  99.         }
  100.        
  101.         var loginBtn = $("loginBtn");
  102.         loginBtn.onmouseover = function(){
  103.                 loginBtn.style.background = "url(../login/loginBtnH.png)";
  104.         };
  105.         loginBtn.onmouseout = function(){
  106.                 loginBtn.style.background = "url(../login/loginBtn.png)";
  107.         };
  108.        
  109.         $("officialLink").onclick = function(){
  110.                 window.open(httpAutErrorArray[1]);
  111.         };
  112. }

  113. var isShowReset = false;
  114. function showResetMsg()
  115. {
  116.         isShowReset = !isShowReset;
  117.         $("resetMsg").style.visibility = (isShowReset)?"visible":"hidden";
  118. }
  119. </script>
  120. </head>
  121. <body onkeypress="PCWin(event)" onload="pageLoad()">
  122.         <div class="topLogo">
  123.                 <a id="officialLink" href="javascript:;"><img src="../login/top1_1.png" border="0" style="cursor:pointer"></a>
  124.         </div>
  125.         <div class="loginBox">       
  126.                 <div class="panelThre" align="center">
  127.                         <div align="center" class="picDiv" align="center">
  128.                                 <ul>
  129.                                         <li style="font-size:14pt">请输入管理员密码</li>
  130.                                         <li id="pwLi" class="pwLi"><input class="text" id="pcPassword" name="pcPassword" type="password" maxlength="15" oninput="CheckPswLength()" onpropertychange="CheckPswLength()" onkeyup="CheckPswLength()" autocomplete="on"></li>
  131.                                         <li><label id="errMsg" class="errMsg" style="visibility:hidden">密码错误已达10次,请两小时后再尝试。</label></li>
  132.                                         <li><u onclick="showResetMsg();" style="cursor:pointer">忘记密码?</u></li>
  133.                                         <li><label id="resetMsg" style="visibility:hidden" >如忘记密码,请恢复出厂设置,恢复方法:在设备通电情况下,按住Reset按钮保持5秒以上。</label></li>
  134.                                 </ul>
  135.                                 <label id="loginBtn" class="loginBtn" onclick="PCSubWin()">确认</label>
  136.                         </div>
  137.                 </div>
  138.         </div>
  139. </body>
  140. </html>
复制代码
回复

使用道具 举报

123

回帖

194

积分

81 小时

在线时间

上等兵

注册时间
2014-1-1
金币
35 个
威望
2 个
荣誉
1 个
累计签到:15 天
连续签到:0 天
[LV.20]漫游旅程
发表于 2014-1-15 20:22 |显示全部楼层
不懂,帮顶            
回复

使用道具 举报

3518

回帖

3万

积分

2432 小时

在线时间

大校

注册时间
2012-4-5
金币
27542 个
威望
694 个
荣誉
0 个
累计签到:1683 天
连续签到:1 天
[LV.1825]无线元老
发表于 2014-1-15 20:31 |显示全部楼层
不懂,帮顶
回复

使用道具 举报

1万

回帖

2万

积分

3489 小时

在线时间

大校

我不是什么专家

灌水天才雷锋勋章

注册时间
2013-7-23
金币
13842 个
威望
5 个
荣誉
3 个
累计签到:110 天
连续签到:0 天
[LV.200]无线新星
发表于 2014-1-15 20:37 |显示全部楼层
有好几个if,是检查密码对不对的,如果把返回结果和对应的操作换一下也许有戏
最近货少,想要的点QQ
猛击这里查看
QQ聊天
回复

使用道具 举报

1371

回帖

2876

积分

293 小时

在线时间

少校

注册时间
2010-9-26
金币
1434 个
威望
1 个
荣誉
0 个
累计签到:242 天
连续签到:0 天
[LV.365]无线熟人
发表于 2014-1-15 20:54 |显示全部楼层
回复

使用道具 举报

370

回帖

3530

积分

743 小时

在线时间

少校

注册时间
2013-2-4
金币
3084 个
威望
0 个
荣誉
0 个
累计签到:291 天
连续签到:0 天
[LV.365]无线熟人
发表于 2014-1-15 21:51 |显示全部楼层
不懂,帮顶
回复

使用道具 举报

287

回帖

937

积分

218 小时

在线时间

中尉

注册时间
2013-11-2
金币
617 个
威望
0 个
荣誉
0 个
累计签到:68 天
连续签到:0 天
[LV.100]试剑无线
发表于 2014-1-16 04:58 |显示全部楼层
小白路过 思路很好 但是可能性太小吧
回复

使用道具 举报

591

回帖

669

积分

57 小时

在线时间

中尉

注册时间
2013-12-5
金币
9 个
威望
1 个
荣誉
0 个
累计签到:31 天
连续签到:0 天
[LV.50]初入江湖
发表于 2014-1-16 11:06 |显示全部楼层
不懂,帮顶
回复

使用道具 举报

590

回帖

1439

积分

158 小时

在线时间

上尉

注册时间
2012-11-23
金币
828 个
威望
0 个
荣誉
0 个
累计签到:19 天
连续签到:0 天
[LV.20]漫游旅程
发表于 2014-1-20 22:08 来自手机 |显示全部楼层
路过帮顶,顺便赚金币
回复

使用道具 举报

6

回帖

22

积分

12 小时

在线时间

新兵上阵

注册时间
2013-10-12
金币
15 个
威望
0 个
荣誉
0 个
累计签到:1 天
连续签到:0 天
[LV.20]漫游旅程
发表于 2014-3-10 20:03 |显示全部楼层
呵呵,和我遇到的这个路由器一样,暂时破不了的
回复

使用道具 举报

486

回帖

2123

积分

122 小时

在线时间

少校

注册时间
2014-2-18
金币
1596 个
威望
2 个
荣誉
1 个
累计签到:18 天
连续签到:0 天
[LV.20]漫游旅程
发表于 2014-3-10 20:58 |显示全部楼层
呼叫高手
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册 微信登录

本版积分规则

Archiver | 手机版 | 无线门户 ( 粤ICP备11076993号|粤公网安备44010602008359号 ) |网站地图

GMT+8, 2025-7-16 14:51

返回顶部 返回列表