line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::VirusScan::Engine::Command::Sophos::Savscan; |
2
|
1
|
|
|
1
|
|
47281
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
4
|
1
|
|
|
1
|
|
2
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
46
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
269
|
use File::VirusScan::Engine::Command; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
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
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
34
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
278
|
use File::VirusScan::Result; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
255
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub default_arguments |
15
|
|
|
|
|
|
|
{ |
16
|
6
|
|
|
6
|
0
|
38
|
return [qw( -f -mime -all -cab -oe -tnef -archive -ss)]; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub scan |
20
|
|
|
|
|
|
|
{ |
21
|
1
|
|
|
1
|
1
|
1216
|
my ($self, $path) = @_; |
22
|
|
|
|
|
|
|
|
23
|
1
|
50
|
|
|
|
60
|
if(abs_path($path) ne $path) { |
24
|
1
|
|
|
|
|
19
|
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'), qr/(?:>>> Virus)|(?:Password)|(?:Could not check)/,); }; |
|
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('Virus scan interrupted'); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
|
|
|
if(2 == $exitcode) { |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# This is technically an error code, but Sophos chokes |
44
|
|
|
|
|
|
|
# on a lot of M$ docs with this code, so we let it |
45
|
|
|
|
|
|
|
# through... |
46
|
|
|
|
|
|
|
# TODO: Legacy commment from MIMEDefang. Figure this |
47
|
|
|
|
|
|
|
# out and see if this is sane behaviour. |
48
|
0
|
|
|
|
|
|
return File::VirusScan::Result->clean(); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
|
if(3 == $exitcode) { |
52
|
0
|
|
|
|
|
|
my ($virus_name) = $scan_response =~ m/\s*>>> Virus '(\S+)'/; |
53
|
0
|
|
0
|
|
|
|
$virus_name ||= 'unknown-Savscan-virus'; |
54
|
0
|
|
|
|
|
|
return File::VirusScan::Result->virus($virus_name); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
return File::VirusScan::Result->error("Unknown return code from savscan: $exitcode"); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
__END__ |