line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::VirusScan::Engine::Command::Kaspersky::AVP5; |
2
|
1
|
|
|
1
|
|
94665
|
use strict; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
23
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
20
|
|
4
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
334
|
use File::VirusScan::Engine::Command; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
7
|
1
|
|
|
1
|
|
43
|
use vars qw( @ISA ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
38
|
|
8
|
|
|
|
|
|
|
@ISA = qw( File::VirusScan::Engine::Command ); |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use Cwd 'abs_path'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
344
|
use File::VirusScan::Result; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
238
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub default_arguments |
15
|
|
|
|
|
|
|
{ |
16
|
|
|
|
|
|
|
# TODO: should /var/run/aveserver be hardcoded? |
17
|
5
|
|
|
5
|
0
|
33
|
return [ qw( -s -p /var/run/aveserver ) ]; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub scan |
21
|
|
|
|
|
|
|
{ |
22
|
0
|
|
|
0
|
1
|
|
my ($self, $path) = @_; |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
my $abs = abs_path($path); |
25
|
0
|
0
|
0
|
|
|
|
if ($abs && $abs ne $path) { |
26
|
0
|
|
|
|
|
|
$path = $abs; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my ($exitcode, $scan_response) = eval { $self->_run_commandline_scanner(join(' ', $self->{command}, @{ $self->{args} }, $path, '2>&1'), 'INFECTED',); }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
if($@) { |
32
|
0
|
|
|
|
|
|
return File::VirusScan::Result->error($@); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
0
|
|
|
|
if( 0 == $exitcode |
|
|
|
0
|
|
|
|
|
36
|
|
|
|
|
|
|
|| 5 == $exitcode |
37
|
|
|
|
|
|
|
|| 6 == $exitcode) |
38
|
|
|
|
|
|
|
{ |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# 0 == clean |
41
|
|
|
|
|
|
|
# 5 == disinfected |
42
|
|
|
|
|
|
|
# 6 == viruses deleted |
43
|
0
|
|
|
|
|
|
return File::VirusScan::Result->clean(); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
0
|
0
|
|
|
|
|
if(1 == $exitcode) { |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# 1 == scan incomplete |
49
|
0
|
|
|
|
|
|
return File::VirusScan::Result->error('Scanning interrupted'); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
0
|
0
|
0
|
|
|
|
if( 2 == $exitcode |
53
|
|
|
|
|
|
|
|| 4 == $exitcode) |
54
|
|
|
|
|
|
|
{ |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# 2 == "modified or damaged virus" |
57
|
|
|
|
|
|
|
# 4 == virus |
58
|
0
|
|
|
|
|
|
my ($virus_name) = $scan_response =~ m/INFECTED (\S+)/; |
59
|
0
|
|
0
|
|
|
|
$virus_name ||= 'unknown-AVP5-virus'; |
60
|
0
|
|
|
|
|
|
return File::VirusScan::Result->virus($virus_name); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
0
|
0
|
0
|
|
|
|
if( 3 == $exitcode |
64
|
|
|
|
|
|
|
|| 8 == $exitcode) |
65
|
|
|
|
|
|
|
{ |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# 3 == "suspicious" object found |
68
|
|
|
|
|
|
|
# 8 == corrupt objects found (treat as suspicious |
69
|
0
|
|
|
|
|
|
return File::VirusScan::Result->virus('AVP5-suspicious'); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
0
|
0
|
|
|
|
|
if(7 == $exitcode) { |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# 7 == AVPLinux corrupt or infected |
75
|
0
|
|
|
|
|
|
return File::VirusScan::Result->error('AVPLinux corrupt or infected'); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
return File::VirusScan::Result->error("Unknown return code from aveclient: $exitcode"); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
__END__ |