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