line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SecurityCenter; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
169519
|
use warnings; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
63
|
|
4
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
44
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
458
|
use parent 'Net::SecurityCenter::Base'; |
|
2
|
|
|
|
|
326
|
|
|
2
|
|
|
|
|
10
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
1012
|
use Net::SecurityCenter::REST; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
639
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.311'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my @api = qw( |
13
|
|
|
|
|
|
|
analysis |
14
|
|
|
|
|
|
|
credential |
15
|
|
|
|
|
|
|
device_info |
16
|
|
|
|
|
|
|
feed |
17
|
|
|
|
|
|
|
file |
18
|
|
|
|
|
|
|
notification |
19
|
|
|
|
|
|
|
plugin |
20
|
|
|
|
|
|
|
plugin_family |
21
|
|
|
|
|
|
|
policy |
22
|
|
|
|
|
|
|
report |
23
|
|
|
|
|
|
|
repository |
24
|
|
|
|
|
|
|
scan |
25
|
|
|
|
|
|
|
scan_result |
26
|
|
|
|
|
|
|
scanner |
27
|
|
|
|
|
|
|
status |
28
|
|
|
|
|
|
|
system |
29
|
|
|
|
|
|
|
ticket |
30
|
|
|
|
|
|
|
user |
31
|
|
|
|
|
|
|
zone |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
35
|
|
|
|
|
|
|
# CONSTRUCTOR |
36
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub new { |
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
1
|
1
|
229484
|
my ( $class, $host, $options ) = @_; |
41
|
|
|
|
|
|
|
|
42
|
1
|
50
|
|
|
|
28
|
my $client = Net::SecurityCenter::REST->new( $host, $options ) or return; |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
16
|
my $self = { |
45
|
|
|
|
|
|
|
host => $host, |
46
|
|
|
|
|
|
|
options => $options, |
47
|
|
|
|
|
|
|
client => $client, |
48
|
|
|
|
|
|
|
api => {} |
49
|
|
|
|
|
|
|
}; |
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
9
|
bless $self, $class; |
52
|
|
|
|
|
|
|
|
53
|
1
|
|
|
|
|
11
|
foreach my $method (@api) { |
54
|
19
|
|
|
|
|
95
|
my $api_class = 'Net::SecurityCenter::API::' . join '', map {ucfirst} split /_/, $method; |
|
22
|
|
|
|
|
111
|
|
55
|
19
|
|
|
|
|
1313
|
eval "require $api_class"; ## no critic |
56
|
19
|
|
|
|
|
234
|
$self->{api}->{$method} = $api_class->new($client); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
1
|
|
|
|
|
11
|
return $self; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
64
|
|
|
|
|
|
|
# COMMON METHODS |
65
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub login { |
68
|
|
|
|
|
|
|
|
69
|
3
|
|
|
3
|
1
|
22
|
my ( $self, %args ) = @_; |
70
|
|
|
|
|
|
|
|
71
|
3
|
50
|
|
|
|
13
|
$self->client->login(%args) or return; |
72
|
3
|
|
|
|
|
26
|
return 1; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub logout { |
79
|
|
|
|
|
|
|
|
80
|
1
|
|
|
1
|
1
|
4
|
my ($self) = @_; |
81
|
1
|
50
|
|
|
|
5
|
$self->client->logout or return; |
82
|
1
|
|
|
|
|
6
|
return 1; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
87
|
|
|
|
|
|
|
# HELPER METHODS |
88
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
foreach my $method (@api) { |
91
|
|
|
|
|
|
|
|
92
|
2
|
|
|
2
|
|
17
|
no strict 'refs'; ## no critic |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
207
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
*{$method} = sub { |
95
|
40
|
|
|
40
|
|
16004
|
my ($self) = @_; |
96
|
40
|
|
|
|
|
357
|
return $self->{api}->{$method}; |
97
|
|
|
|
|
|
|
}; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
__END__ |