| 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
Condition0%0/3
$abs and $abs ne $path
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
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | return File::VirusScan::Result->error($@); | |||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | if( 0 == $exitcode | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
0 == $exitcode or 5 == $exitcode or 6 == $exitcode
0 == $exitcode or 5 == $exitcode
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
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | # 1 == scan incomplete | ||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | return File::VirusScan::Result->error('Scanning interrupted'); | |||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | if( 2 == $exitcode | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
2 == $exitcode or 4 == $exitcode
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
| |||||||||||||||||||||||||||||||||||||||||||
| 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"
MC/DC0%0/1
$virus_name ||= "unknown-AVP5-virus"
$virus_name
Truth table0%0/2
A
A= $virus_name
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | return File::VirusScan::Result->virus($virus_name); | |||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | if( 3 == $exitcode | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
3 == $exitcode or 8 == $exitcode
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
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||||||||||||||||