| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
719
|
use File::Temp qw/tempfile/; |
|
|
1
|
|
|
|
|
8842
|
|
|
|
1
|
|
|
|
|
60
|
|
|
2
|
1
|
|
|
1
|
|
6
|
use Webqq::Client::Util qw(console); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
311
|
|
|
3
|
|
|
|
|
|
|
sub Webqq::Client::_get_img_verify_code{ |
|
4
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
5
|
0
|
0
|
|
|
|
|
if ($self->{qq_param}{is_need_img_verifycode} == 0){ |
|
6
|
0
|
|
|
|
|
|
$self->{qq_param}{img_verifycode_source} = 'NONE'; |
|
7
|
0
|
|
|
|
|
|
return 1 ; |
|
8
|
|
|
|
|
|
|
} |
|
9
|
0
|
|
|
|
|
|
my $ua = $self->{ua}; |
|
10
|
0
|
|
|
|
|
|
my $api_url = 'https://ssl.captcha.qq.com/getimage'; |
|
11
|
0
|
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') |
|
12
|
|
|
|
|
|
|
: (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') |
|
13
|
|
|
|
|
|
|
; |
|
14
|
0
|
|
|
|
|
|
my @query_string = ( |
|
15
|
|
|
|
|
|
|
aid => $self->{qq_param}{g_appid}, |
|
16
|
|
|
|
|
|
|
uin => $self->{qq_param}{qq}, |
|
17
|
|
|
|
|
|
|
r => rand(), |
|
18
|
|
|
|
|
|
|
); |
|
19
|
0
|
0
|
|
|
|
|
if($self->{type} eq 'webqq'){ |
|
20
|
0
|
|
|
|
|
|
push @query_string,( |
|
21
|
|
|
|
|
|
|
cap_cd => $self->{qq_param}{cap_cd}, |
|
22
|
|
|
|
|
|
|
); |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my @query_string_pairs; |
|
26
|
0
|
|
|
|
|
|
push @query_string_pairs , shift(@query_string) . "=" . shift(@query_string) while(@query_string) ; |
|
27
|
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
for(my $i=1;$i<=$self->{ua_retry_times};$i++){ |
|
29
|
0
|
|
|
|
|
|
my $response = $ua->get($api_url.'?'.join("&",@query_string_pairs),@headers); |
|
30
|
0
|
0
|
|
|
|
|
if($response->is_success){ |
|
31
|
0
|
|
|
|
|
|
my ($fh, $filename) = tempfile("webqq_img_verfiy_XXXX",SUFFIX =>".jpg",TMPDIR => 1); |
|
32
|
0
|
|
|
|
|
|
binmode $fh; |
|
33
|
0
|
|
|
|
|
|
print $fh $response->content(); |
|
34
|
0
|
|
|
|
|
|
close $fh; |
|
35
|
0
|
0
|
|
|
|
|
if(-t STDIN){ |
|
|
|
0
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
console "请输入图片验证码 [ $filename ]: "; |
|
37
|
0
|
|
|
|
|
|
chomp($self->{qq_param}{verifycode} = ); |
|
38
|
0
|
|
|
|
|
|
$self->{qq_param}{img_verifycode_source} = 'TTY'; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
elsif(ref $self->{on_input_img_verifycode} eq 'CODE'){ |
|
41
|
0
|
|
|
|
|
|
my $code = $self->{on_input_img_verifycode}->($filename); |
|
42
|
0
|
0
|
|
|
|
|
if(defined $code){ |
|
|
0
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
$self->{qq_param}{verifycode} = $code; |
|
44
|
0
|
|
|
|
|
|
$self->{qq_param}{img_verifycode_source} = 'CALLBACK'; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
0
|
|
|
|
|
|
else{console "无法从回调函数中获取有效的验证码,客户端终止\n";$self->stop();} |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
else{ |
|
49
|
0
|
|
|
|
|
|
console "STDIN未连接到tty,无法输入验证码,客户端终止...\n"; |
|
50
|
0
|
|
|
|
|
|
$self->stop(); |
|
51
|
|
|
|
|
|
|
} |
|
52
|
0
|
|
|
|
|
|
return 1; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
} |
|
55
|
0
|
|
|
|
|
|
return 0; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
1; |