line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::VirusScan::Engine::Command::FSecure::FSAV; |
2
|
1
|
|
|
1
|
|
49026
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
3
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
4
|
1
|
|
|
1
|
|
3
|
use Carp; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
50
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
271
|
use File::VirusScan::Engine::Command; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
7
|
1
|
|
|
1
|
|
36
|
use vars qw( @ISA ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
8
|
|
|
|
|
|
|
@ISA = qw( File::VirusScan::Engine::Command ); |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
4
|
use Cwd 'abs_path'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
34
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
319
|
use File::VirusScan::Result; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
230
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub default_arguments |
15
|
|
|
|
|
|
|
{ |
16
|
6
|
|
|
6
|
0
|
23
|
return [ qw( --dumb --mime ) ]; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub scan |
20
|
|
|
|
|
|
|
{ |
21
|
1
|
|
|
1
|
1
|
920
|
my ($self, $path) = @_; |
22
|
|
|
|
|
|
|
|
23
|
1
|
50
|
|
|
|
76
|
if(abs_path($path) ne $path) { |
24
|
1
|
|
|
|
|
17
|
return File::VirusScan::Result->error("Path $path is not absolute"); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
my ($exitcode, $scan_response) = eval { $self->_run_commandline_scanner(join(' ', $self->{command}, @{ $self->{args} }, $path, '2>&1')); }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
|
|
|
if($@) { |
30
|
0
|
|
|
|
|
|
return File::VirusScan::Result->error($@); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
if(0 == $exitcode) { |
34
|
0
|
|
|
|
|
|
return File::VirusScan::Result->clean(); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
0
|
0
|
|
|
|
|
if(1 == $exitcode) { |
38
|
0
|
|
|
|
|
|
return File::VirusScan::Result->error('Abnormal termination'); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
|
|
|
if(2 == $exitcode) { |
42
|
0
|
|
|
|
|
|
return File::VirusScan::Result->error('Self-test failed'); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
0
|
0
|
0
|
|
|
|
if(3 == $exitcode || 6 == $exitcode) { |
46
|
0
|
|
|
|
|
|
my ($virus_name) = $scan_response =~ m/infec.*\: (\S+)/i; |
47
|
|
|
|
|
|
|
|
48
|
0
|
0
|
|
|
|
|
if($virus_name eq '') { |
49
|
0
|
|
|
|
|
|
$virus_name = 'unknown-FSAV-virus'; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
return File::VirusScan::Result->virus($virus_name); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
0
|
0
|
|
|
|
|
if(8 == $exitcode) { |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# Suspicious files found |
58
|
0
|
|
|
|
|
|
return File::VirusScan::Result->virus('suspicious'); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
0
|
0
|
|
|
|
|
if(5 == $exitcode) { |
62
|
0
|
|
|
|
|
|
return File::VirusScan::Result->error('Scan interrupted'); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
|
|
|
if(7 == $exitcode) { |
66
|
0
|
|
|
|
|
|
return File::VirusScan::Result->error('Out of memory'); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
return File::VirusScan::Result->error("Unknown return code from fsav: $exitcode"); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
__END__ |