line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SecurityCenter; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
163774
|
use warnings; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
69
|
|
4
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
44
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
493
|
use parent 'Net::SecurityCenter::Base'; |
|
2
|
|
|
|
|
306
|
|
|
2
|
|
|
|
|
10
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
1014
|
use Net::SecurityCenter::REST; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
635
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.300'; |
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
|
|
|
|
|
|
|
user |
30
|
|
|
|
|
|
|
zone |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
34
|
|
|
|
|
|
|
# CONSTRUCTOR |
35
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub new { |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
1
|
1
|
220920
|
my ( $class, $host, $options ) = @_; |
40
|
|
|
|
|
|
|
|
41
|
1
|
50
|
|
|
|
36
|
my $client = Net::SecurityCenter::REST->new( $host, $options ) or return; |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
15
|
my $self = { |
44
|
|
|
|
|
|
|
host => $host, |
45
|
|
|
|
|
|
|
options => $options, |
46
|
|
|
|
|
|
|
client => $client, |
47
|
|
|
|
|
|
|
api => {} |
48
|
|
|
|
|
|
|
}; |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
11
|
bless $self, $class; |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
10
|
foreach my $method (@api) { |
53
|
18
|
|
|
|
|
75
|
my $api_class = 'Net::SecurityCenter::API::' . join '', map {ucfirst} split /_/, $method; |
|
21
|
|
|
|
|
90
|
|
54
|
18
|
|
|
|
|
1169
|
eval "require $api_class"; ## no critic |
55
|
18
|
|
|
|
|
223
|
$self->{api}->{$method} = $api_class->new($client); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
1
|
|
|
|
|
7
|
return $self; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
63
|
|
|
|
|
|
|
# COMMON METHODS |
64
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub login { |
67
|
|
|
|
|
|
|
|
68
|
3
|
|
|
3
|
1
|
26
|
my ( $self, %args ) = @_; |
69
|
|
|
|
|
|
|
|
70
|
3
|
50
|
|
|
|
17
|
$self->client->login(%args) or return; |
71
|
3
|
|
|
|
|
27
|
return 1; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub logout { |
78
|
|
|
|
|
|
|
|
79
|
1
|
|
|
1
|
1
|
4
|
my ($self) = @_; |
80
|
1
|
50
|
|
|
|
5
|
$self->client->logout or return; |
81
|
1
|
|
|
|
|
7
|
return 1; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
86
|
|
|
|
|
|
|
# HELPER METHODS |
87
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
foreach my $method (@api) { |
90
|
|
|
|
|
|
|
|
91
|
2
|
|
|
2
|
|
18
|
no strict 'refs'; ## no critic |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
214
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
*{$method} = sub { |
94
|
35
|
|
|
35
|
|
16522
|
my ($self) = @_; |
95
|
35
|
|
|
|
|
269
|
return $self->{api}->{$method}; |
96
|
|
|
|
|
|
|
}; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
__END__ |