line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SecurityCenter; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
134217
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
58
|
|
4
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
35
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
385
|
use parent 'Net::SecurityCenter::Base'; |
|
2
|
|
|
|
|
253
|
|
|
2
|
|
|
|
|
11
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
854
|
use Net::SecurityCenter::REST; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
528
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.310'; |
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
|
176871
|
my ( $class, $host, $options ) = @_; |
41
|
|
|
|
|
|
|
|
42
|
1
|
50
|
|
|
|
31
|
my $client = Net::SecurityCenter::REST->new( $host, $options ) or return; |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
15
|
my $self = { |
45
|
|
|
|
|
|
|
host => $host, |
46
|
|
|
|
|
|
|
options => $options, |
47
|
|
|
|
|
|
|
client => $client, |
48
|
|
|
|
|
|
|
api => {} |
49
|
|
|
|
|
|
|
}; |
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
10
|
bless $self, $class; |
52
|
|
|
|
|
|
|
|
53
|
1
|
|
|
|
|
9
|
foreach my $method (@api) { |
54
|
19
|
|
|
|
|
65
|
my $api_class = 'Net::SecurityCenter::API::' . join '', map {ucfirst} split /_/, $method; |
|
22
|
|
|
|
|
75
|
|
55
|
19
|
|
|
|
|
989
|
eval "require $api_class"; ## no critic |
56
|
19
|
|
|
|
|
185
|
$self->{api}->{$method} = $api_class->new($client); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
1
|
|
|
|
|
4
|
return $self; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
64
|
|
|
|
|
|
|
# COMMON METHODS |
65
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub login { |
68
|
|
|
|
|
|
|
|
69
|
3
|
|
|
3
|
1
|
18
|
my ( $self, %args ) = @_; |
70
|
|
|
|
|
|
|
|
71
|
3
|
50
|
|
|
|
12
|
$self->client->login(%args) or return; |
72
|
3
|
|
|
|
|
21
|
return 1; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub logout { |
79
|
|
|
|
|
|
|
|
80
|
1
|
|
|
1
|
1
|
4
|
my ($self) = @_; |
81
|
1
|
50
|
|
|
|
6
|
$self->client->logout or return; |
82
|
1
|
|
|
|
|
4
|
return 1; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
87
|
|
|
|
|
|
|
# HELPER METHODS |
88
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
foreach my $method (@api) { |
91
|
|
|
|
|
|
|
|
92
|
2
|
|
|
2
|
|
14
|
no strict 'refs'; ## no critic |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
187
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
*{$method} = sub { |
95
|
37
|
|
|
37
|
|
13345
|
my ($self) = @_; |
96
|
37
|
|
|
|
|
238
|
return $self->{api}->{$method}; |
97
|
|
|
|
|
|
|
}; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
__END__ |