line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Armadito::Agent::Antivirus::Armadito::Task::Scan; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
14792309
|
use strict; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
47
|
|
4
|
1
|
|
|
1
|
|
9
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
65
|
|
5
|
1
|
|
|
1
|
|
497
|
use MIME::Base64; |
|
1
|
|
|
|
|
884
|
|
|
1
|
|
|
|
|
166
|
|
6
|
1
|
|
|
1
|
|
5
|
use base 'Armadito::Agent::Task::Scan'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
436
|
|
7
|
1
|
|
|
1
|
|
383
|
use Armadito::Agent::HTTP::Client::ArmaditoAV; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
9
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub getScanAPIMessage { |
10
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
|
|
|
return "{ 'path' : '" . $self->{job}->{obj}->{scan_path} . "' }"; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub run { |
16
|
0
|
|
|
0
|
1
|
|
my ( $self, %params ) = @_; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
$self = $self->SUPER::run(%params); |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
$self->{logger}->info("Armadito Scan launched."); |
21
|
0
|
|
|
|
|
|
$self->{av_client} = Armadito::Agent::HTTP::Client::ArmaditoAV->new( taskobj => $self ); |
22
|
0
|
|
|
|
|
|
$self->{av_client}->register(); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $response = $self->{av_client}->sendRequest( |
25
|
0
|
|
|
|
|
|
"url" => $self->{av_client}->{server_url} . "/api/scan", |
26
|
|
|
|
|
|
|
message => $self->getScanAPIMessage(), |
27
|
|
|
|
|
|
|
method => "POST" |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
|
die "ArmaditoAV Scan request failed." if ( !$response->is_success() ); |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
$self->{av_client}->pollEvents(); |
33
|
0
|
|
|
|
|
|
$self->{av_client}->unregister(); |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
return $self; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 NAME |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Armadito::Agent::Antivirus::Armadito::Task::Scan - Scan Task for Armadito Antivirus. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 DESCRIPTION |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
This task inherits from L<Armadito::Agent::Task:Scan>. Launch an Armadito Antivirus on-demand scan using AV's API REST protocol and then send a brief report in a json formatted POST request to Armadito plugin for GLPI. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 FUNCTIONS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 run ( $self, %params ) |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Run the task. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 new ( $self, %params ) |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Instanciate Task. |
59
|
|
|
|
|
|
|
|