• 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()));   
                
    			
    			

  • 相关阅读:
    Tempter of the Bone
    CODE[VS]1160 蛇形矩阵
    CODE[VS] 1205 单词翻转
    CODE[VS] 1204 寻找子串位置
    a little sweet~
    我多喜欢你,你会知道
    P1474 货币系统 Money Systems
    P1096 Hanoi双塔问题
    P1209 [USACO1.3]修理牛棚 Barn Repair
    下一秒
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6199649.html
Copyright © 2020-2023  润新知