VirusScan/Engine/Command/FPROT/Fpscan.pm

filter: Statementstmt 44.4% 24 / 54 Branchbran 0.0% 0 / 22 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 88.8% 8 / 9 Podpod 50.0% 1 / 2 totaltotal 34.7% 33 / 95 CC 14 SCAR 49.0
CC
14
Cov
30%
scan
210.0
BEGIN
1.0
BEGIN
1.0
CRAP 134.0
« VirusScan/Engine/Command/Kaspersky/AVP5.pm ↑ Summary VirusScan/Engine/Command/FSecure/FSAV.pm »
1 package File::VirusScan::Engine::Command::FPROT::Fpscan;
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 5 return [ qw( --report --archive=5 --scanlevel=4 --heurlevel=3 ) ];
17 }
18  
19 sub scan
20 0 ▶{
Subroutine scan: not called CC=14 SCAR=53.5
Pod documented
21 0 my ($self, $path) = @_;
22  
23 0 my $abs = abs_path($path);
24 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
25 0 $path = $abs;
26 }
27  
28 0 my ($exitcode, $scan_response) = eval { $self->_run_commandline_scanner(join(' ', $self->{command}, @{ $self->{args} }, $path, '2>&1')); };
29  
30 0 ▶ if($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
31 0 return File::VirusScan::Result->error($@);
32 }
33  
34 0 ▶ if(0 == $exitcode) {
Branch: 1 branch
BranchTrueFalseTotal
if (0 == $exitcode) 0 0 0
35 0 return File::VirusScan::Result->clean();
36 }
37  
38 # bit 1 (1) ==> At least one virus-infected object was found (and
39 # remains).
40 0 ▶ if( $exitcode & 0b1 ){
Branch: 1 branch
BranchTrueFalseTotal
if ($exitcode & 1) 0 0 0
41 0 my ($virus_name) = $scan_response =~ m/^\[Found\s+[^\]]*\]\s+<([^ \t\(>]*)/m;
42 0 ▶ $virus_name ||= 'unknown-FPSCAN-virus';
Condition0%0/2
$virus_name ||= "unknown-FPSCAN-virus"
l!l
00
MC/DC0%0/1
$virus_name ||= "unknown-FPSCAN-virus"
$virus_name
Truth table0%0/2
A
A= $virus_name
Aresult
11
00
43 0 return File::VirusScan::Result->virus($virus_name);
44 }
45  
46 # bit 2 (2) ==> At least one suspicious (heuristic match) object
47 # was found (and remains).
48 0 ▶ if ($exitcode & 0b10) {
Branch: 1 branch
BranchTrueFalseTotal
if ($exitcode & 2) 0 0 0
49 0 return File::VirusScan::Result->virus('FPSCAN-suspicious');
50 }
51  
52 # bit 3 (4) ==> Interrupted by user (SIGINT, SIGBREAK).
53 0 ▶ if ($exitcode & 0b100) {
Branch: 1 branch
BranchTrueFalseTotal
if ($exitcode & 4) 0 0 0
54 0 return File::VirusScan::Result->error('Interrupted by user');
55 }
56  
57 # bit 4 (8) ==> Scan restriction caused scan to skip files
58 # (maxdepth directories, maxdepth archives,
59 # exclusion list, etc).
60  
61 0 ▶ if ($exitcode & 0b1000) {
Branch: 1 branch
BranchTrueFalseTotal
if ($exitcode & 8) 0 0 0
62 0 return File::VirusScan::Result->error('Scanning restrictions triggered abort due to skipped files');
63 }
64  
65 # bit 5 (16) ==> Platform error (out of memory, real I/O errors,
66 # insufficient file permission etc.)
67  
68 0 ▶ if ($exitcode & 0b10000) {
Branch: 1 branch
BranchTrueFalseTotal
if ($exitcode & 16) 0 0 0
69 0 return File::VirusScan::Result->error('Platform error (out of memory, I/O errors, etc)');
70 }
71  
72 # bit 6 (32) ==> Internal engine error (whatever the engine fails
73 # at)
74 0 ▶ if ($exitcode & 0b100000) {
Branch: 1 branch
BranchTrueFalseTotal
if ($exitcode & 32) 0 0 0
75 0 return File::VirusScan::Result->error('Internal virus engine error');
76 }
77  
78 # bit 7 (64) ==> At least one object was not scanned (encrypted
79 # file, unsupported/unknown compression method,
80 # corrupted or invalid file).
81 0 ▶ if ($exitcode & 0b1000000) {
Branch: 1 branch
BranchTrueFalseTotal
if ($exitcode & 64) 0 0 0
82 0 return File::VirusScan::Result->error('At least one object not scannable');
83 }
84  
85 # bit 8 (128) ==> At least one object was disinfected (clean now).
86 # Should not happen as we aren't requesting disinfection ( at least
87 # in this version).
88 0 ▶ if ($exitcode & 0b10000000) {
Branch: 1 branch
BranchTrueFalseTotal
if ($exitcode & 128) 0 0 0
89 0 return File::VirusScan::Result->virus('Scanner claims to have cleaned a virus, but cannot in this mode');
90 }
91  
92 0 return File::VirusScan::Result->error("Unknown return code: $exitcode");
93 }
94  
95 1 1;
96 __END__
« VirusScan/Engine/Command/Kaspersky/AVP5.pm ↑ Summary VirusScan/Engine/Command/FSecure/FSAV.pm »