zoukankan      html  css  js  c++  java
  • 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 URI::Escape;  
    use File::Temp qw/tempfile/;
    my $ua = LWP::UserAgent->new;
    $ua->timeout(5);
    $ua->env_proxy;
    $ua->agent("Mozilla/8.0");
    my $cookie_jar = HTTP::Cookies->new(
      file=>'lwp_cookies.txt',
      autosave=>1,
      ignore_discard=>1);
    $ua->cookie_jar($cookie_jar);
    
    #$var='https://licai.yingyinglicai.com/index.htm';
    
    
    my $response = $ua->get("http://121.52.220.246:8888/code.aspx");
    
    
    
    if ($response->is_success) {
      $r = $response->decoded_content;   
    # print $response->decoded_content;  # or whatever
    }
    else {
     die $response->status_line;
    };
    
    my ( $fh, $filename ) =
      tempfile( "sms_qrcode_XXXX", SUFFIX => ".jpg", DIR => 'c:\' );
    binmode $fh;
    print $fh $r;
    close $fh;
    my $code=encode("gbk",decode("utf8",'请输入验证码'));
    print "$code.[ $filename ] 
    ";
    
    system("start $filename ");
    
    my $validCode = <STDIN>;
    chomp $validCode ;
    print "$validCode is $validCode
    ";
    
    
     my $login_url = 'http://121.52.220.246:8888/chklogin.aspx';
                    
     my $res = $ua->post($login_url,{
    	                       'account'=>'sc10624',
                              'action'=>'login',
    						  'code'=>$validCode,
                              'password'=>'xx'
    						
                        
                                                    });
    
           my $content = $res->content();
           
                print $res->status_line . "
    ";
                print "11111111111111111111
    ";
                print $res->as_string();                print "11111111111111111111
    ";
              
           my $Sign=uri_escape('【中均】');
    #http://121.52.220.246:8888/checkkeyword.aspx?action=add
           my $str=(rand(1));
    	   my $login_url = 'http://121.52.220.246:8888/checkkeyword.aspx?action=add';	
    	   my $res = $ua->post($login_url,{
    	                       'content'=>uri_escape('ABCDEFG'),
                              'keySign'=>"$str"
    
                                                    });
    	
    print encode("gbk",decode("utf8",$res->as_string())); 
    my $login_url = 'http://121.52.220.246:8888/submitsms.aspx';
    
    #%E3%80%90%E4%B8%AD%E5%9D%87%E3%80%91
                    
           my $res = $ua->post($login_url,{
                              'mobile'=>18072xx,
    						  'mobilenumber'=>1,
    						  'telephonenumber'=>0,
                              'iscall'=>1,
    						   'msgcontent'=>uri_escape('ABCDEFG'),
    						  'checkcontent'=>1,
    						  'countnumber'=>1,
    						 'usign'=>'【中均】',
    						  'useUserSign'=>1,
    						  'forceID'=>'undefined'},
    						  'User-Agent'=>'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0',
                    'Host'=>'121.52.220.246:8888',
                    'Referer'=>'http://121.52.220.246:8888/send.aspx'	,
    				'X-Requested-With'=>'XMLHttpRequest'
    						  
                                                    
                            );
                my $content = $res->content();
                print  encode("gbk",decode("utf8",$content));
                print $res->status_line . "
    ";
                
                print encode("gbk",decode("utf8",$res->as_string()));   
                
    			
    			

  • 相关阅读:
    读书笔记-8《构建之法》
    结对编程收获
    结对编程——四则运算器(UI第十组)
    读书笔记-7《构建之法》
    读书笔记-6《构建之法》
    【现代软件工程】个人总结
    【现代软件工程】6月中旬团队项目心得
    【读书笔记】——《代码大全》(六)
    【现代软件工程】五月团队项目心得
    【读书笔记】——《代码大全》(五)
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350560.html
Copyright © 2011-2022 走看看