line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Woothee::Misc; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
39
|
use strict; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
221
|
|
4
|
6
|
|
|
6
|
|
30
|
use warnings; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
151
|
|
5
|
6
|
|
|
6
|
|
28
|
use Carp; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
348
|
|
6
|
|
|
|
|
|
|
|
7
|
6
|
|
|
6
|
|
34
|
use Woothee::Util qw/update_map update_category update_version update_os/; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
346
|
|
8
|
6
|
|
|
6
|
|
40
|
use Woothee::DataSet qw/dataset/; |
|
6
|
|
|
|
|
18
|
|
|
6
|
|
|
|
|
5429
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = "v1.10.0"; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub challenge_desktoptools { |
13
|
222
|
|
|
222
|
0
|
403
|
my ($ua, $result) = @_; |
14
|
|
|
|
|
|
|
|
15
|
222
|
|
|
|
|
303
|
my $data; |
16
|
|
|
|
|
|
|
|
17
|
222
|
100
|
|
|
|
1034
|
if (index($ua, "AppleSyndication/") > -1) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
18
|
3
|
|
|
|
|
15
|
$data = dataset("SafariRSSReader"); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
elsif (index($ua, "compatible; Google Desktop/") > -1) { |
21
|
3
|
|
|
|
|
12
|
$data = dataset("GoogleDesktop"); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
elsif (index($ua, "Windows-RSS-Platform") > -1) { |
24
|
3
|
|
|
|
|
12
|
$data = dataset("WindowsRSSReader"); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
222
|
100
|
|
|
|
606
|
return 0 unless $data; |
28
|
|
|
|
|
|
|
|
29
|
9
|
|
|
|
|
37
|
update_map($result, $data); |
30
|
9
|
|
|
|
|
26
|
return 1; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub challenge_smartphone_patterns { |
34
|
168
|
|
|
168
|
0
|
278
|
my ($ua, $result) = @_; |
35
|
|
|
|
|
|
|
|
36
|
168
|
50
|
|
|
|
441
|
if (index($ua, "CFNetwork/") > -1) { |
37
|
0
|
|
|
|
|
0
|
my $data = dataset("iOS"); |
38
|
0
|
|
|
|
|
0
|
update_category($result, $data->{Woothee::DataSet->const('KEY_CATEGORY')}); |
39
|
0
|
|
|
|
|
0
|
update_os($result, $data->{Woothee::DataSet->const('KEY_NAME')}); |
40
|
0
|
|
|
|
|
0
|
return 1; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
168
|
|
|
|
|
381
|
return 0; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub challenge_http_library { |
47
|
165
|
|
|
165
|
0
|
278
|
my ($ua, $result) = @_; |
48
|
|
|
|
|
|
|
|
49
|
165
|
|
|
|
|
247
|
my $data; |
50
|
|
|
|
|
|
|
my $version; |
51
|
|
|
|
|
|
|
|
52
|
165
|
100
|
100
|
|
|
1923
|
if ($ua =~ m{^(?:Apache-HttpClient/|Jakarta Commons-HttpClient/|Java/)}o || $ua =~ m{[- ]HttpClient(/|$)}o) { |
|
|
100
|
100
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
53
|
12
|
|
|
|
|
34
|
$data = dataset("HTTPLibrary"); |
54
|
12
|
|
|
|
|
21
|
$version = "Java"; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
elsif (index($ua, "Java(TM) 2 Runtime Environment,") > -1) { |
57
|
3
|
|
|
|
|
13
|
$data = dataset("HTTPLibrary"); |
58
|
3
|
|
|
|
|
8
|
$version = "Java"; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
elsif ($ua =~ m{^Wget/}o) { |
61
|
3
|
|
|
|
|
13
|
$data = dataset("HTTPLibrary"); |
62
|
3
|
|
|
|
|
8
|
$version = "wget"; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
elsif ($ua =~ m{^curl/}o) { |
65
|
3
|
|
|
|
|
14
|
$data = dataset("HTTPLibrary"); |
66
|
3
|
|
|
|
|
9
|
$version = "curl"; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
elsif ($ua =~ m{^(?:libwww-perl|WWW-Mechanize|LWP::Simple|LWP |lwp-trivial)}o) { |
69
|
15
|
|
|
|
|
48
|
$data = dataset("HTTPLibrary"); |
70
|
15
|
|
|
|
|
31
|
$version = "perl"; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
elsif ($ua =~ m{^(?:Ruby|feedzirra|Typhoeus)}o) { |
73
|
|
|
|
|
|
|
# for feedzirra, see http://github.com/pauldix/feedzirra/tree/master |
74
|
|
|
|
|
|
|
# for Typhoeus, see https://github.com/typhoeus/typhoeus |
75
|
9
|
|
|
|
|
28
|
$data = dataset("HTTPLibrary"); |
76
|
9
|
|
|
|
|
20
|
$version = "ruby"; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
elsif ($ua =~ m{^(?:Python-urllib/|Twisted )}o) { |
79
|
6
|
|
|
|
|
21
|
$data = dataset("HTTPLibrary"); |
80
|
6
|
|
|
|
|
13
|
$version = "python"; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
elsif ($ua =~ m{^(?:PHP|WordPress|CakePHP|PukiWiki|PECL::HTTP)(?:/| |$)}o || $ua =~ m{(?:PEAR |)HTTP_Request(?: class|2)}o) { |
83
|
27
|
|
|
|
|
81
|
$data = dataset("HTTPLibrary"); |
84
|
27
|
|
|
|
|
48
|
$version = "php"; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
165
|
100
|
|
|
|
450
|
return 0 unless $data; |
88
|
|
|
|
|
|
|
|
89
|
78
|
|
|
|
|
220
|
update_map($result, $data); |
90
|
78
|
50
|
|
|
|
277
|
update_version($result, $version) if defined $version; |
91
|
78
|
|
|
|
|
208
|
return 1; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub challenge_maybe_rss_reader { |
95
|
87
|
|
|
87
|
0
|
152
|
my ($ua, $result) = @_; |
96
|
|
|
|
|
|
|
|
97
|
87
|
|
|
|
|
115
|
my $data; |
98
|
|
|
|
|
|
|
|
99
|
87
|
100
|
100
|
|
|
767
|
if ($ua =~ m{rss(?:reader|bar|[-_ /;()]|[ +]*/)}oi || $ua =~ m{headline-reader}oi) { |
|
|
100
|
|
|
|
|
|
100
|
15
|
|
|
|
|
43
|
$data = dataset("VariousRSSReader"); |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
elsif (index($ua, "cococ/") > -1) { |
103
|
3
|
|
|
|
|
13
|
$data = dataset("VariousRSSReader"); |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
87
|
100
|
|
|
|
268
|
return 0 unless $data; |
107
|
|
|
|
|
|
|
|
108
|
18
|
|
|
|
|
55
|
update_map($result, $data); |
109
|
18
|
|
|
|
|
49
|
return 1; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
__END__ |