line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
69477
|
use v5.20; |
|
1
|
|
|
|
|
3
|
|
2
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
60
|
|
3
|
1
|
|
|
1
|
|
7
|
use feature 'signatures'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
149
|
|
4
|
1
|
|
|
1
|
|
6
|
no warnings qw(experimental::signatures); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
727
|
use JSON (); |
|
1
|
|
|
|
|
12919
|
|
|
1
|
|
|
|
|
25
|
|
7
|
1
|
|
|
1
|
|
712
|
use HTTP::Tiny; |
|
1
|
|
|
|
|
51342
|
|
|
1
|
|
|
|
|
443
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.0.1'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
package Net::OSV { |
12
|
1
|
|
|
1
|
1
|
847
|
sub new ($class) { |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
2
|
|
13
|
1
|
|
|
|
|
4
|
return bless { ua => _build_user_agent() }, $class; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
0
|
1
|
0
|
sub query ($self, %options) { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
17
|
|
|
|
|
|
|
my $res = $self->{ua}->request( |
18
|
0
|
|
|
|
|
0
|
'POST', |
19
|
|
|
|
|
|
|
'https://api.osv.dev/v1/query', |
20
|
|
|
|
|
|
|
{ content => JSON::encode_json(\%options) }, |
21
|
|
|
|
|
|
|
); |
22
|
0
|
0
|
|
|
|
0
|
return $res->{success} ? (JSON::decode_json($res->{content}))->{vulns}->@* : (); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
0
|
1
|
0
|
sub query_batch ($self, @queries) { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
26
|
0
|
|
|
|
|
0
|
my %options = (queries => \@queries); |
27
|
|
|
|
|
|
|
my $res = $self->{ua}->request( |
28
|
0
|
|
|
|
|
0
|
'POST', |
29
|
|
|
|
|
|
|
'https://api.osv.dev/v1/querybatch', |
30
|
|
|
|
|
|
|
{ content => JSON::encode_json(\%options) }, |
31
|
|
|
|
|
|
|
); |
32
|
0
|
0
|
|
|
|
0
|
return $res->{success} ? (JSON::decode_json($res->{content}))->{results}->@* : (); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
0
|
1
|
0
|
sub vuln ($self, $id) { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
36
|
0
|
|
|
|
|
0
|
my $res = $self->{ua}->request('GET', 'https://api.osv.dev/v1/vulns/' . $id); |
37
|
0
|
0
|
|
|
|
0
|
return $res->{success} ? JSON::decode_json($res->{content}) : undef;; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _build_user_agent { |
41
|
1
|
|
|
1
|
|
6
|
return HTTP::Tiny->new( |
42
|
|
|
|
|
|
|
agent => __PACKAGE__ . '/' . $VERSION, |
43
|
|
|
|
|
|
|
verify_SSL => 1, |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
}; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
__END__ |