line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Armadito::Agent::Antivirus::Eset::Task::State; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
13497987
|
use strict; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
50
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
64
|
|
5
|
1
|
|
|
1
|
|
3
|
use base 'Armadito::Agent::Task::State'; |
|
1
|
|
|
|
|
31
|
|
|
1
|
|
|
|
|
449
|
|
6
|
1
|
|
|
1
|
|
5
|
use Armadito::Agent::Tools::File qw( readFile ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
7
|
1
|
|
|
1
|
|
356
|
use Armadito::Agent::Patterns::Matcher; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub _getDatabasesInfo { |
10
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
|
|
|
my $parser = Armadito::Agent::Patterns::Matcher->new( logger => $self->{logger} ); |
13
|
0
|
|
|
|
|
|
$parser->addPattern( 'install_time', 'InstallTime=(\d+)' ); |
14
|
0
|
|
|
|
|
|
$parser->addPattern( 'global_update_timestamp', 'LastUpdate=(\d+)' ); |
15
|
0
|
|
|
|
|
|
$parser->addPattern( 'last_update_attempt', 'LastUpdateAttempt=(\d+)' ); |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my $data_filepath = "/var/opt/eset/esets/lib/data/data.txt"; |
18
|
0
|
|
|
|
|
|
my $data = readFile( filepath => $data_filepath ); |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
$parser->run( $data, '\n' ); |
21
|
0
|
|
|
|
|
|
return $parser->getResults(); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub run { |
25
|
0
|
|
|
0
|
1
|
|
my ( $self, %params ) = @_; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
$self = $self->SUPER::run(%params); |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $dbinfo = $self->_getDatabasesInfo(); |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
$self->_sendToGLPI($dbinfo); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 NAME |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Armadito::Agent::Antivirus::Eset::Task::State - State Task for ESET Antivirus. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 DESCRIPTION |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
This task inherits from L<Armadito::Agent::Task:State>. Get Antivirus state and then send it in a json formatted POST request to Armadito plugin for GLPI. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 FUNCTIONS |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 run ( $self, %params ) |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Run the task. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 new ( $self, %params ) |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Instanciate Task. |
55
|
|
|
|
|
|
|
|