| 1 | 1 | ▶ | use Digest::MD5 qw(md5 md5_hex); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 2 | 1 | ▶ | use Webqq::Client::Util qw(console); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 1 | ▶ | use Webqq::Encryption qw(pwd_encrypt pwd_encrypt_js); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 0 | ▶ | sub Webqq::Client::_login1{ | ||||||||||||||||||
|
Subroutine
_login1: not called CC=19 SCAR=59.4
| |||||||||||||||||||||
| 5 | 0 | console "尝试进行登录(阶段1)...\n"; | |||||||||||||||||||
| 6 | 0 | my $self = shift; | |||||||||||||||||||
| 7 | 0 | ▶ | my $encrypt_method = $self->{encrypt_method} || "js"; | ||||||||||||||||||
|
Condition0%0/2
$self->{'encrypt_method'} || 'js'
MC/DC0%0/1
$self->{'encrypt_method'} || 'js'
$self->{'encrypt_method'}
Truth table0%0/2
A
A= $self->{'encrypt_method'}
| |||||||||||||||||||||
| 8 | 0 | my $ua = $self->{ua}; | |||||||||||||||||||
| 9 | 0 | my $api_url = 'https://ssl.ptlogin2.qq.com/login'; | |||||||||||||||||||
| 10 | 0 | ▶ | my @headers = $self->{type} eq 'webqq'? (Referer => 'https://ui.ptlogin2.qq.com/cgi-bin/login?daid=164&target=self&style=5&mibao_css=m_webqq&appid=1003903&enable_qlogin=0&no_verifyimg=1&s_url=http%3A%2F%2Fweb2.qq.com%2Floginproxy.html&f_url=loginerroralert&strong_login=1&login_state=10&t=20140612002') | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 11 | : (Referer => 'https://ui.ptlogin2.qq.com/cgi-bin/login?daid=164&target=self&style=16&mibao_css=m_webqq&appid=501004106&enable_qlogin=0&no_verifyimg=1&s_url=http%3A%2F%2Fw.qq.com%2Fproxy.html&f_url=loginerroralert&strong_login=1&login_state=10&t=20131024001') | ||||||||||||||||||||
| 12 | ; | ||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 0 | my $passwd; | |||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 0 | ▶ | if($self->{type} eq 'webqq'){ | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 17 | 0 | $md5_salt = eval qq{"$self->{qq_param}{md5_salt}"}; | |||||||||||||||||||
| 18 | 0 | $passwd = pack "H*",$self->{qq_param}{pwd}; | |||||||||||||||||||
| 19 | 0 | $passwd = uc md5_hex( uc(md5_hex( $passwd . $md5_salt)) . uc( $self->{qq_param}{verifycode} ) ); | |||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | } | ||||||||||||||||||||
| 22 | else{ | ||||||||||||||||||||
| 23 | 0 | eval{ | |||||||||||||||||||
| 24 | 0 | ▶ | if($encrypt_method eq "perl"){ | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 25 | 0 | $passwd = pwd_encrypt($self->{qq_param}{pwd},$self->{qq_param}{md5_salt},$self->{qq_param}{verifycode},1) ; | |||||||||||||||||||
| 26 | } | ||||||||||||||||||||
| 27 | else{ | ||||||||||||||||||||
| 28 | 0 | $passwd = pwd_encrypt_js($self->{qq_param}{pwd},$self->{qq_param}{md5_salt},$self->{qq_param}{verifycode},1) ; | |||||||||||||||||||
| 29 | } | ||||||||||||||||||||
| 30 | }; | ||||||||||||||||||||
| 31 | 0 | ▶ | if($@){ | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 32 | 0 | console "客户端加密算法执行错误:$@\n"; | |||||||||||||||||||
| 33 | 0 | ▶ | return $encrypt_method eq "perl"?-2:-3; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 34 | } | ||||||||||||||||||||
| 35 | } | ||||||||||||||||||||
| 36 | 0 | ▶ | my $query_string_ul = $self->{type} eq 'webqq'? 'http%3A%2F%2Fweb2.qq.com%2Floginproxy.html%3Flogin2qq%3D1%26webqq_type%3D10' | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 37 | : 'http%3A%2F%2Fw.qq.com%2Fproxy.html%3Flogin2qq%3D1%26webqq_type%3D10' | ||||||||||||||||||||
| 38 | ; | ||||||||||||||||||||
| 39 | 0 | ▶ | my $query_string_action = $self->{type} eq 'webqq' ? '3-14-15279' | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 40 | : '0-23-19230' | ||||||||||||||||||||
| 41 | ; | ||||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | my @query_string = ( | ||||||||||||||||||||
| 45 | u => $self->{qq_param}{qq}, | ||||||||||||||||||||
| 46 | p => $passwd, | ||||||||||||||||||||
| 47 | verifycode => $self->{qq_param}{verifycode}, | ||||||||||||||||||||
| 48 | webqq_type => 10, | ||||||||||||||||||||
| 49 | remember_uin => 1, | ||||||||||||||||||||
| 50 | login2qq => 1, | ||||||||||||||||||||
| 51 | aid => $self->{qq_param}{g_appid}, | ||||||||||||||||||||
| 52 | u1 => $query_string_ul, | ||||||||||||||||||||
| 53 | h => 1, | ||||||||||||||||||||
| 54 | ptredirect => 0, | ||||||||||||||||||||
| 55 | ptlang => 2052, | ||||||||||||||||||||
| 56 | daid => $self->{qq_param}{g_daid}, | ||||||||||||||||||||
| 57 | from_ui => 1, | ||||||||||||||||||||
| 58 | pttype => 1, | ||||||||||||||||||||
| 59 | dumy => undef, | ||||||||||||||||||||
| 60 | fp => 'loginerroralert', | ||||||||||||||||||||
| 61 | action => $query_string_action, | ||||||||||||||||||||
| 62 | mibao_css => $self->{qq_param}{g_mibao_css}, | ||||||||||||||||||||
| 63 | t => 1, | ||||||||||||||||||||
| 64 | g => 1, | ||||||||||||||||||||
| 65 | js_type => 0, | ||||||||||||||||||||
| 66 | js_ver => $self->{qq_param}{g_pt_version}, | ||||||||||||||||||||
| 67 | pt_vcode_v1 => 0, | ||||||||||||||||||||
| 68 | 0 | ▶ | pt_verifysession_v1 => $self->{qq_param}{verifysession} || $self->search_cookie("verifysession"), | ||||||||||||||||||
|
Condition0%0/3
$self->{'qq_param'}{'verifysession'} || $self->search_cookie('verifysession')
MC/DC0%0/2
$self->{'qq_param'}{'verifysession'} || $self->search_cookie('verifysession')
$self->{'qq_param'}{'verifysession'}
$self->search_cookie('verifysession')
Truth table0%0/3
A || B
A= $self->{'qq_param'}{'verifysession'}B= $self->search_cookie('verifysession')
| |||||||||||||||||||||
| 69 | |||||||||||||||||||||
| 70 | ); | ||||||||||||||||||||
| 71 | 0 | ▶ | if($self->{type} eq 'webqq'){ | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 72 | 0 | splice @query_string,-4,0,(pt_uistyle => $self->{qq_param}{g_style}); | |||||||||||||||||||
| 73 | } | ||||||||||||||||||||
| 74 | else{ | ||||||||||||||||||||
| 75 | 0 | splice @query_string,-4,0,(login_sig => $self->{qq_param}{g_login_sig}); | |||||||||||||||||||
| 76 | 0 | splice @query_string,-4,0,(pt_randsalt => $self->{qq_param}{isRandSalt} ); | |||||||||||||||||||
| 77 | } | ||||||||||||||||||||
| 78 | |||||||||||||||||||||
| 79 | 0 | my @query_string_pairs; | |||||||||||||||||||
| 80 | 0 | ▶ | push @query_string_pairs , shift(@query_string) . "=" . shift(@query_string) while(@query_string) ; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 81 | |||||||||||||||||||||
| 82 | 0 | ▶ | for(my $i=1;$i<=$self->{ua_retry_times};$i++){ | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 83 | 0 | my $response = $ua->get($api_url.'?'.join("&",@query_string_pairs),@headers ); | |||||||||||||||||||
| 84 | 0 | ▶ | if($response->is_success){ | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 85 | 0 | ▶ | print $response->content() if $self->{debug}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 86 | 0 | my $content = $response->content(); | |||||||||||||||||||
| 87 | 0 | my %d = (); | |||||||||||||||||||
| 88 | 0 | @d{qw( retcode unknown_1 api_check_sig unknown_2 status uin )} = $content=~/'(.*?)'/g; | |||||||||||||||||||
| 89 | #ptuiCB('4','0','','0','您输入的验证码不正确,请重新输入。', '12345678'); | ||||||||||||||||||||
| 90 | #ptuiCB('3','0','','0','您输入的帐号或密码不正确,请重新输入。', '2735534596'); | ||||||||||||||||||||
| 91 | |||||||||||||||||||||
| 92 | 0 | ▶ | if($d{retcode} == 4){ | ||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||
| 93 | 0 | console "您输入的验证码不正确,需要重新输入...\n"; | |||||||||||||||||||
| 94 | 0 | return -1; | |||||||||||||||||||
| 95 | } | ||||||||||||||||||||
| 96 | elsif($d{retcode} == 3){ | ||||||||||||||||||||
| 97 | 0 | ▶ | if($encrypt_method eq "perl"){ | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 98 | 0 | return -2; | |||||||||||||||||||
| 99 | } | ||||||||||||||||||||
| 100 | else{ | ||||||||||||||||||||
| 101 | 0 | console "您输入的帐号或密码不正确,客户端终止运行...\n"; | |||||||||||||||||||
| 102 | 0 | $self->stop(); | |||||||||||||||||||
| 103 | } | ||||||||||||||||||||
| 104 | } | ||||||||||||||||||||
| 105 | elsif($d{retcode} != 0){ | ||||||||||||||||||||
| 106 | 0 | console "$d{status},客户端终止运行...\n"; | |||||||||||||||||||
| 107 | 0 | $self->stop(); | |||||||||||||||||||
| 108 | } | ||||||||||||||||||||
| 109 | 0 | $self->{qq_param}{api_check_sig} = $d{api_check_sig}; | |||||||||||||||||||
| 110 | 0 | $self->{qq_param}{ptwebqq} = $self->search_cookie('ptwebqq'); | |||||||||||||||||||
| 111 | 0 | return 1; | |||||||||||||||||||
| 112 | } | ||||||||||||||||||||
| 113 | } | ||||||||||||||||||||
| 114 | 0 | return 0; | |||||||||||||||||||
| 115 | } | ||||||||||||||||||||
| 116 | 1 | 1; | |||||||||||||||||||