VirusScan/Engine/Command/Kaspersky/AVP5.pm

filter: Statementstmt 52.1% 24 / 46 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 17 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 88.8% 8 / 9 Podpod 50.0% 1 / 2 totaltotal 33.6% 33 / 98 CC 14 SCAR 49.0
CC
14
Cov
31%
scan
210.0
BEGIN
1.0
BEGIN
1.0
CRAP 134.0
« VirusScan/Engine/Command/NAI/Uvscan.pm ↑ Summary VirusScan/Engine/Command/FPROT/Fpscan.pm »
1 package File::VirusScan::Engine::Command::Kaspersky::AVP5;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use File::VirusScan::Engine::Command;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use vars qw( @ISA );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 @ISA = qw( File::VirusScan::Engine::Command );
9  
10 1 ▶use Cwd 'abs_path';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use File::VirusScan::Result;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 sub default_arguments
15 5 ▶{
Subroutine default_arguments: called CC=1 SCAR=0.0
Pod undocumented
16 # TODO: should /var/run/aveserver be hardcoded?
17 5 return [ qw( -s -p /var/run/aveserver ) ];
18 }
19  
20 sub scan
21 0 ▶{
Subroutine scan: not called CC=14 SCAR=53.5
Pod documented
22 0 my ($self, $path) = @_;
23  
24 0 my $abs = abs_path($path);
25 0 ▶ if ($abs && $abs ne $path) {
Branch: 1 branch
BranchTrueFalseTotal
if ($abs and $abs ne $path) 0 0 0
Condition0%0/3
$abs and $abs ne $path
!ll&&!rl&&r
000
MC/DC0%0/2
$abs and $abs ne $path
$abs $abs ne $path
Truth table0%0/3
A and B
A= $absB= $abs ne $path
ABresult
0X0
100
111
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',); };
30  
31 0 ▶ if($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
32 0 return File::VirusScan::Result->error($@);
33 }
34  
35 0 ▶ if( 0 == $exitcode
Branch: 1 branch
BranchTrueFalseTotal
if (0 == $exitcode or 5 == $exitcode or 6 == $exitcode) 0 0 0
Condition0%0/6
0 == $exitcode or 5 == $exitcode or 6 == $exitcode
l!l&&r!l&&!r
000
0 == $exitcode or 5 == $exitcode
l!l&&r!l&&!r
000
MC/DC0%0/3
0 == $exitcode or 5 == $exitcode or 6 == $exitcode
0 == $exitcode 5 == $exitcode 6 == $exitcode
Truth table0%0/4
A or B or C
A= 0 == $exitcodeB= 5 == $exitcodeC= 6 == $exitcode
ABCresult
1XX1
01X1
0011
0000
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 ▶ if(1 == $exitcode) {
Branch: 1 branch
BranchTrueFalseTotal
if (1 == $exitcode) 0 0 0
47  
48 # 1 == scan incomplete
49 0 return File::VirusScan::Result->error('Scanning interrupted');
50 }
51  
52 0 ▶ if( 2 == $exitcode
Branch: 1 branch
BranchTrueFalseTotal
if (2 == $exitcode or 4 == $exitcode) 0 0 0
Condition0%0/3
2 == $exitcode or 4 == $exitcode
l!l&&r!l&&!r
000
MC/DC0%0/2
2 == $exitcode or 4 == $exitcode
2 == $exitcode 4 == $exitcode
Truth table0%0/3
A or B
A= 2 == $exitcodeB= 4 == $exitcode
ABresult
1X1
011
000
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 ▶ $virus_name ||= 'unknown-AVP5-virus';
Condition0%0/2
$virus_name ||= "unknown-AVP5-virus"
l!l
00
MC/DC0%0/1
$virus_name ||= "unknown-AVP5-virus"
$virus_name
Truth table0%0/2
A
A= $virus_name
Aresult
11
00
60 0 return File::VirusScan::Result->virus($virus_name);
61 }
62  
63 0 ▶ if( 3 == $exitcode
Branch: 1 branch
BranchTrueFalseTotal
if (3 == $exitcode or 8 == $exitcode) 0 0 0
Condition0%0/3
3 == $exitcode or 8 == $exitcode
l!l&&r!l&&!r
000
MC/DC0%0/2
3 == $exitcode or 8 == $exitcode
3 == $exitcode 8 == $exitcode
Truth table0%0/3
A or B
A= 3 == $exitcodeB= 8 == $exitcode
ABresult
1X1
011
000
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 ▶ if(7 == $exitcode) {
Branch: 1 branch
BranchTrueFalseTotal
if (7 == $exitcode) 0 0 0
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 1;
82 __END__
« VirusScan/Engine/Command/NAI/Uvscan.pm ↑ Summary VirusScan/Engine/Command/FPROT/Fpscan.pm »