line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SecurityCenter::API::System; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
726
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
55
|
|
4
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
37
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
8
|
use parent 'Net::SecurityCenter::Base'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
8
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
141
|
use Net::SecurityCenter::Utils qw(:all); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1458
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.310'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
13
|
|
|
|
|
|
|
# METHODS |
14
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub get_status { |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
0
|
1
|
0
|
my ( $self, %args ) = @_; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
0
|
deprecated |
21
|
|
|
|
|
|
|
'"Net::SecurityCenter::API::System->get_status" is DEPRECATED use "Net::SecurityCenter::API::Status->status" instead'; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
0
|
return; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub get_info { |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
0
|
1
|
0
|
my ( $self, %args ) = @_; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
0
|
deprecated |
34
|
|
|
|
|
|
|
'"Net::SecurityCenter::API::Status->get_info" is DEPRECATED use "Net::SecurityCenter::API::Status->info"'; |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
0
|
return $self->info( \%args ); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub info { |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
1
|
1
|
3
|
my ( $self, %args ) = @_; |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
5
|
my $tmpl = { raw => {}, }; |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
5
|
my $params = sc_check_params( $tmpl, \%args ); |
49
|
1
|
|
|
|
|
3
|
my $raw = delete( $params->{'raw'} ); |
50
|
1
|
|
|
|
|
10
|
my $info = $self->client->get('/system'); |
51
|
|
|
|
|
|
|
|
52
|
1
|
50
|
|
|
|
4
|
return if ( !$info ); |
53
|
1
|
50
|
|
|
|
4
|
return $info if ($raw); |
54
|
|
|
|
|
|
|
|
55
|
1
|
|
|
|
|
4
|
return sc_normalize_hash($info); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub debug { |
62
|
|
|
|
|
|
|
|
63
|
3
|
|
|
3
|
1
|
9
|
my ( $self, %args ) = @_; |
64
|
|
|
|
|
|
|
|
65
|
3
|
|
|
|
|
9
|
my $tmpl = { name => {}, id => {}, category => {} }; |
66
|
|
|
|
|
|
|
|
67
|
3
|
|
|
|
|
10
|
my $params = sc_check_params( $tmpl, \%args ); |
68
|
3
|
|
|
|
|
6
|
my $id = delete( $params->{'id'} ); |
69
|
3
|
|
|
|
|
6
|
my $name = delete( $params->{'name'} ); |
70
|
3
|
|
|
|
|
5
|
my $category = delete( $params->{'category'} ); |
71
|
3
|
|
|
|
|
10
|
my $debug = $self->client->get('/system/debug'); |
72
|
|
|
|
|
|
|
|
73
|
3
|
50
|
|
|
|
16
|
return if ( !$debug ); |
74
|
|
|
|
|
|
|
|
75
|
3
|
|
|
|
|
5
|
my $id_results = {}; |
76
|
3
|
|
|
|
|
5
|
my $name_results = {}; |
77
|
3
|
|
|
|
|
4
|
my $category_results = {}; |
78
|
|
|
|
|
|
|
|
79
|
3
|
|
|
|
|
4
|
foreach my $item ( @{$debug} ) { |
|
3
|
|
|
|
|
7
|
|
80
|
|
|
|
|
|
|
|
81
|
216
|
|
|
|
|
345
|
$id_results->{ $item->{id} } = $item; |
82
|
216
|
|
|
|
|
337
|
$name_results->{ $item->{name} } = $item; |
83
|
|
|
|
|
|
|
|
84
|
216
|
100
|
|
|
|
323
|
if ( !defined( $category_results->{ $item->{category} } ) ) { |
85
|
9
|
|
|
|
|
18
|
$category_results->{ $item->{category} } = (); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
216
|
|
|
|
|
224
|
push @{ $category_results->{ $item->{category} } }, $item; |
|
216
|
|
|
|
|
330
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
3
|
50
|
|
|
|
8
|
if ($name) { |
93
|
0
|
|
|
|
|
0
|
return $name_results->{$name}; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
3
|
100
|
|
|
|
6
|
if ($id) { |
97
|
1
|
|
|
|
|
37
|
return $id_results->{$id}; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
2
|
100
|
|
|
|
5
|
if ($category) { |
101
|
1
|
|
|
|
|
37
|
return $category_results->{$category}; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
1
|
|
|
|
|
17
|
return $debug; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub get_diagnostics_info { |
111
|
|
|
|
|
|
|
|
112
|
1
|
|
|
1
|
1
|
4
|
my ( $self, %args ) = @_; |
113
|
|
|
|
|
|
|
|
114
|
1
|
|
|
|
|
4
|
my $tmpl = { raw => {}, }; |
115
|
|
|
|
|
|
|
|
116
|
1
|
|
|
|
|
4
|
my $params = sc_check_params( $tmpl, \%args ); |
117
|
1
|
|
|
|
|
3
|
my $raw = delete( $params->{'raw'} ); |
118
|
1
|
|
|
|
|
4
|
my $info = $self->client->get('/system/diagnostics'); |
119
|
|
|
|
|
|
|
|
120
|
1
|
50
|
|
|
|
4
|
if ( !$info ) { |
121
|
0
|
|
|
|
|
0
|
return; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
1
|
50
|
|
|
|
4
|
if ($raw) { |
125
|
0
|
|
|
|
|
0
|
return $info; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
1
|
|
|
|
|
5
|
return sc_normalize_hash($info); |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub generate_diagnostics_app_status { |
135
|
|
|
|
|
|
|
|
136
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
137
|
0
|
|
|
|
|
|
$self->client->post( '/system/diagnostics/generate', { 'task' => 'appStatus' } ); |
138
|
0
|
|
|
|
|
|
return 1; |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub generate_diagnostics_file { |
145
|
|
|
|
|
|
|
|
146
|
0
|
|
|
0
|
1
|
|
my ( $self, %args ) = @_; |
147
|
|
|
|
|
|
|
|
148
|
0
|
|
|
|
|
|
my $tmpl = { |
149
|
|
|
|
|
|
|
type => { |
150
|
|
|
|
|
|
|
default => ['all'], |
151
|
|
|
|
|
|
|
allow => [ |
152
|
|
|
|
|
|
|
'all', 'apacheLog', 'configuration', 'dependencies', 'dirlist', 'environment', |
153
|
|
|
|
|
|
|
'installLog', 'logs', 'sanitize', 'scans', 'serverConf', 'setup', |
154
|
|
|
|
|
|
|
'sysinfo', 'upgradeLog' |
155
|
|
|
|
|
|
|
] |
156
|
|
|
|
|
|
|
}, |
157
|
|
|
|
|
|
|
}; |
158
|
|
|
|
|
|
|
|
159
|
0
|
|
|
|
|
|
my $params = sc_check_params( $tmpl, \%args ); |
160
|
0
|
|
|
|
|
|
my $options = delete( $params->{'type'} ); |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
return $self->client->post( '/system/diagnostics/generate', |
163
|
0
|
|
|
|
|
|
{ 'task' => 'diagnosticsFile', 'options' => \@{$options} } ); |
|
0
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
sub download_diagnostics { |
170
|
|
|
|
|
|
|
|
171
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
172
|
0
|
|
|
|
|
|
return $self->client->post('/system/diagnostics/download'); |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
1; |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
__END__ |