| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# $Id: Onyphe.pm,v 70c24256e451 2025/03/05 16:13:54 gomor $ |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
package Onyphe; |
|
5
|
1
|
|
|
1
|
|
1083
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
43
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
158
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '4.19.0'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
739
|
use experimental qw(signatures); |
|
|
1
|
|
|
|
|
2095
|
|
|
|
1
|
|
|
|
|
6
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
332
|
use base qw(Class::Gomor::Array); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
196
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @AS = qw(verbose config silent); |
|
15
|
|
|
|
|
|
|
__PACKAGE__->cgBuildAccessorsScalar(\@AS); |
|
16
|
|
|
|
|
|
|
__PACKAGE__->cgBuildIndices; |
|
17
|
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
8
|
use Data::Dumper; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
61
|
|
|
19
|
1
|
|
|
1
|
|
952
|
use File::Slurp qw(read_file); |
|
|
1
|
|
|
|
|
46418
|
|
|
|
1
|
|
|
|
|
196
|
|
|
20
|
1
|
|
|
1
|
|
2255
|
use Config::INI::Tiny; |
|
|
1
|
|
|
|
|
2391
|
|
|
|
1
|
|
|
|
|
660
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
0
|
|
|
0
|
0
|
|
sub version ($self) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
return "ONYPHE Version: $VERSION"; |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
0
|
|
|
0
|
0
|
|
sub init ($self, $file = undef) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
27
|
0
|
|
0
|
|
|
|
$file ||= $ENV{HOME}.'/.onyphe.ini'; |
|
28
|
0
|
0
|
|
|
|
|
if (! -f $file) { |
|
29
|
0
|
|
|
|
|
|
print STDERR "ERROR: init file not found: $file\n"; |
|
30
|
0
|
|
|
|
|
|
return; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my $read = read_file($file); |
|
34
|
0
|
|
|
|
|
|
my $config = Config::INI::Tiny->new->to_hash($read); |
|
35
|
0
|
|
|
|
|
|
$self->config($config); |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Default values: |
|
38
|
0
|
|
0
|
|
|
|
$config->{''}{api_size} ||= 10; |
|
39
|
0
|
|
0
|
|
|
|
$config->{''}{api_maxpage} ||= 1; |
|
40
|
0
|
|
0
|
|
|
|
$config->{''}{api_trackquery} ||= 0; |
|
41
|
0
|
|
0
|
|
|
|
$config->{''}{api_calculated} ||= 0; |
|
42
|
0
|
|
0
|
|
|
|
$config->{''}{api_keepalive} ||= 0; |
|
43
|
0
|
|
0
|
|
|
|
$config->{''}{api_endpoint} ||= 'https://www.onyphe.io/api/v2'; |
|
44
|
0
|
|
0
|
|
|
|
$config->{''}{api_ondemand_endpoint} ||= $config->{''}{api_endpoint}; |
|
45
|
0
|
|
0
|
|
|
|
$config->{''}{api_asd_endpoint} ||= $config->{''}{api_endpoint}; |
|
46
|
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
if ($self->verbose) { |
|
48
|
0
|
|
|
|
|
|
for my $k (keys %{$config->{''}}) { |
|
|
0
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
print STDERR "VERBOSE: config: $k => ".$config->{''}{$k}."\n"; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
0
|
0
|
|
|
|
|
unless (defined($config->{''}{api_key})) { |
|
54
|
0
|
|
|
|
|
|
print STDERR "ERROR: config: needs at least api_url setting:\n"; |
|
55
|
0
|
|
|
|
|
|
print STDERR " api_key = 'XXX'\n"; |
|
56
|
0
|
|
|
|
|
|
return; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
return $self; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__END__ |