• perl 登陆电信猫


    登陆电信猫:
    
    use  LWP::UserAgent;
    use HTTP::Date qw(time2iso str2time time2iso time2isoz);
    use Net::Ping;
    use Socket;
    use Net::SMTP;
    use LWP;
    use LWP::Simple;
    use LWP::UserAgent;
    use HTTP::Cookies;
    use HTTP::Headers;
    use HTTP::Response;
    use Encode;
    use URI::Escape;
    use URI::URL;
    use Data::Dumper;
    my $ua = LWP::UserAgent->new;
    $ua->timeout(5);
    $ua->env_proxy;
    $ua->agent("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0");
     my $cookie_jar = HTTP::Cookies->new(
         file=>'lwp_cookies.txt',
         autosave=>1,
         ignore_discard=>1);
    $ua->cookie_jar($cookie_jar);
    
    	
    my $url='http://192.168.1.1/';
    
    my $response = $ua->get($url);
    
    
    if ($response->is_success) {
    
    $var= $response->content;
    };
    # print $var;
     
     #document.getElementById("Frm_Logintoken").value = "1817837";
    if ($var =~/.*Frm_Logintoken.*values+=s+"(.*?)".*/)
    {print "$1 is $1
    ";
    $Logintoken=$1;
    };
    
    my $login_url='http://192.168.1.1/getpage.gch?pid=1001&logout=1';
    my $res = $ua->post(
                    $login_url,
                    { 
                        'Username'  => 'useradmin',
                        'Password'  => 'pddgf',
                        'Frm_Logintoken'  => $Logintoken,
    					
                        
                    },
    				 [
                    'pid'        => '1001',
                    'logout' => "1"
                    
                ],
    				'User-Agent'=>'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0',
                    'Host'=>'192.168.1.1',
                    'Referer'=>'http://192.168.1.1/getpage.gch?pid=1001&logout=1'	
                );
                my $head =  $res->header('Location');
                #print $res->header('Location');
                print "
    ";
    
               # print $res->status_line . "
    ";
               
    			
    			#sleep (10);
                print $res->as_string();    #获取的是原始内容,包括响应头,响应正文
                
                my $content = $res->content();
    
    			
              # print $content;
    		   print "
    ";
    
    
    
    
    登陆成功:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>F660</title>
    <style >
    * {
    margin: 0 0 0 0;
    padding: 0;
    }
    </style>
    </head>
    <script type="text/javascript">
    function reinitIframe()
    {
    var iframe = document.getElementById("mainFrame");
    try{
    var bHeight = iframe.contentWindow.document.body.scrollHeight;
    var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
    var height = Math.max(bHeight, dHeight);
    iframe.height =  height;
    }catch (ex){}
    }
    window.setInterval("reinitIframe()", 200);
    </script>
    <body align="center">
    <div align="center" style="margin:0 auto;" >
    <table width="808px"  border="0">
    <tr><td>
    
    <iframe width="808px" height="145px" src="top.gch" name="topFrame" scrolling="no" frameborder="0" id="topFrame"></iframe>
    <iframe width="808px" src="template.gch" name="mainFrame" id="mainFrame" scrolling="no" frameborder="0" onload="this.height=400"></iframe>
    
    </td>
    </tr>
    </table>
    </div>
    </body>
    </html>
    
    
    
    
    密码错误,登陆失败信息:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR /xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <META HTTP-EQUIV="pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>F660</title>
    <style type="text/css" media="all">
    <!--
    @import "css/login.css";
    -->
    </style>
    <script language="JavaScript">
    <!--
    javascript:window.history.forward(1);
    -->
    </script>
    <script>
    function bridge_route()
    {
    document.location.href="bridge_route.gch";
    }
    function dosubmit()
    {
    if (document.getElementById("Frm_Username").value == "")
    {
    document.getElementById("errmsg").innerHTML = "用户名称不能为空。";
    document.getElementById("myLayer").style.visibility = "visible" ;
    return;
    }
    else
    {
    document.getElementById("Frm_Logintoken").value = "1826239";
    document.fLogin.submit();
    }
    }
    function simcardregister()
    {
    top.location.href = "getpage.gch?pid=1010";
    }
    function doregister()
    {
    
    top.location.href = "getpage.gch?pid=1010";
    }
    function RegisterOrSuccess()
    {
    var cur_version = 214;
    var Status = 0;
    var Result = 1;
    if((0==Status)&&(1==Result))
    {
    if(212==cur_version)
    {
    top.location.href = "tele_wanregister_reset_password.gch";
    }
    else
    {
    top.location.href = "tele_wanregister_success.gch";
    }
    }
    else
    {
    top.location.href = "getpage.gch?pid=1010";
    }
    }
    function Register4Chongqing()
    {
    var Status = 0;
    var Result = 1;
    var msg = "按要求安装顺序为:先不插入光纤,输入逻辑ID点击注册按钮后再插入光纤进行注册。";
    if(1==Result)
    {
    top.location.href = "tele_wanregister_reset_nopassword.gch";
    }
    else
    {
    if(window.confirm(msg))
    {
    top.location.href = "getpage.gch?pid=1010";
    }
    }
    }
    var time="60";
    function setTime()
    {
    time=time-1;
    document.getElementById("time").innerHTML=time+"秒";
    }
    function setinner(type)
    {
    document.getElementById("myLayer").style.visibility = type ;
    }
    function Transfer_meaning(id,value)
    {
    document.getElementById(id).value=value;
    }
    function onFocus()
    {
    if( document.getElementById("Frm_Username").disabled == false )
    document.getElementById("Frm_Username").focus();
    var Status = 0;
    var Result = 1;
    
    if(Result == 1)
    {
    if(document.getElementById("Submit1") != null)
    {
    document.getElementById("Submit1").disabled = true;
    }
    }
    
    }
    function ChangeLang()
    {
    var lang = "Chinese";
    document.getElementById("_lang").disabled = false;
    if ("English" == lang)
    {
    document.getElementById("_lang").value = "Chinese";
    }
    else if ("Chinese" == lang)
    {
    document.getElementById("_lang").value = "English";
    }
    document.getElementById("Frm_Username").disabled = true;
    document.getElementById("Frm_Password").disabled = true;
    document.fLogin.submit();
    }
    </script>
    </head>
    <body onload="onFocus();">
    <div id="container" class="content">
    <div id="myLayer" onClick="setinner('hidden')" style="position:absolute; 185px; height:91px; z-index:9; left: 250px; top: 10px; background: url(img/pop_up.gif) no-repeat; border: 1px none #000000; visibility: hidden;">
    <div id="Layer1" style="position:absolute; 180px; height:45px; z-index:10; left: 2px; top: 28px;">
    <table width="183" border="0">
    <tr>
    <td width="183">  <font id="errmsg" class="notecontent" ></font><span id="time" style="color:red;display:none;">60秒</span></td><!--秒会写入配置文件中-->
    </tr>
    </table>
    </div>
    <div id="Layer3" style="position:absolute; 140px; height:10px; z-index:11; left: 34px; top: 9px; font-size: 8pt;">
    <font  class="note" id="errnote"> 错误信息</font>
    </div>
    </div>
    <form name="fLogin" id="fLogin" method="post"  onsubmit="return false;" action="">
    <div id="username">
    <input name="Username"  type="text" class="input_username"  size="19"  id="Frm_Username"/>
    </div>
    <div id="password">
    <input name="Password" type="password" class="input_password" size="20"  id="Frm_Password"/>
    </div>
    <div id="login">
    <span style="background-image:../img/login_buttton.gif;background-position: -178px 0;">
    
    <table class="content" border="0" cellpadding="0" cellspacing="0" style="290px;height:26px;"><tr><td style="padding:6px 0 0 120px;">
    <input class="login" type="submit"  id="LoginId"  value="登 录"  onclick="dosubmit()"/>
    
    <input class="login" type="submit"  id="Submit1"  value="设备注册"     onclick="doregister()"/>
    
    </td></tr></table>
    </span>
    </div>
    <INPUT TYPE="hidden" NAME="Frm_Logintoken" ID="Frm_Logintoken" VALUE="">
    </form>
    </div>
    </body>
    <script>
    
    var Lognumber = 2;
    if( Lognumber <= 3)
    {
    var Loginerr = 194;
    if (Loginerr == "-3" )
    {
    document.getElementById("errmsg").innerHTML = "系统忙,请稍后再试。";
    }
    else if(1 == 1 && 1 == 0)
    {
    document.getElementById("errmsg").innerHTML = "用户名或密码错误!";
    }
    else
    {
    document.getElementById("errmsg").innerHTML = "用户信息有误,请重新输入。";
    }
    document.getElementById("myLayer").style.visibility = "visible" ;
    }
    
    if(0 == 3||2==3)
    {
    SetDisable();
    }
    function SetDisable()
    {
    document.getElementById("errmsg").innerHTML = "您的错误登录次数已经达到三次,系统将延时进行校验。";
    document.getElementById("Frm_Username").disabled = true;
    document.getElementById("Frm_Password").disabled = true;
    document.getElementById("LoginId").disabled = true;
    document.getElementById("myLayer").style.visibility = "visible" ;
    document.getElementById("time").style.display = "" ;
    var timeout  = setTimeout("setDisable()",60000);
    var interval = setInterval("setTime()",1000);
    }
    function setDisable()
    {
    document.getElementById("Frm_Username").disabled = false;
    document.getElementById("Frm_Password").disabled = false;
    document.getElementById("LoginId").disabled = false;
    document.getElementById("time").style.display = "none";
    document.getElementById("myLayer").style.visibility = "hidden";
    }
    </script>
    </html>

  • 相关阅读:
    BZOJ 2818: Gcd
    BZOJ 4816: [Sdoi2017]数字表格
    BZOJ 2301: [HAOI2011]Problem b
    BZOJ 2440: [中山市选2011]完全平方数
    BZOJ 2705: [SDOI2012]Longge的问题
    BZOJ 3992: [SDOI2015]序列统计
    BZOJ 3529: [Sdoi2014]数表
    AC日记——小A的糖果 洛谷七月月赛
    AC日记——「HNOI2017」礼物 LiBreOJ 2020
    AC日记——[Hnoi2017]影魔 bzoj 4826
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6199661.html
Copyright © 2020-2023  润新知