line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id$ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# antivirus::clamav Brik |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
package Metabrik::Antivirus::Clamav; |
7
|
1
|
|
|
1
|
|
527
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
28
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use base qw(Metabrik::Shell::Command Metabrik::System::Package); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
422
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub brik_properties { |
13
|
|
|
|
|
|
|
return { |
14
|
0
|
|
|
0
|
1
|
|
revision => '$Revision$', |
15
|
|
|
|
|
|
|
tags => [ qw(unstable) ], |
16
|
|
|
|
|
|
|
author => 'GomoR ', |
17
|
|
|
|
|
|
|
license => 'http://opensource.org/licenses/BSD-3-Clause', |
18
|
|
|
|
|
|
|
attributes => { |
19
|
|
|
|
|
|
|
datadir => [ qw(datadir) ], |
20
|
|
|
|
|
|
|
}, |
21
|
|
|
|
|
|
|
attributes_default => { |
22
|
|
|
|
|
|
|
use_sudo => 0, |
23
|
|
|
|
|
|
|
}, |
24
|
|
|
|
|
|
|
commands => { |
25
|
|
|
|
|
|
|
install => [ ], # Inherited |
26
|
|
|
|
|
|
|
update => [ ], |
27
|
|
|
|
|
|
|
scan => [ qw(target) ], # file or directory |
28
|
|
|
|
|
|
|
}, |
29
|
|
|
|
|
|
|
require_binaries => { |
30
|
|
|
|
|
|
|
'freshclam' => [ ], |
31
|
|
|
|
|
|
|
'clamscan' => [ ], |
32
|
|
|
|
|
|
|
}, |
33
|
|
|
|
|
|
|
need_packages => { |
34
|
|
|
|
|
|
|
ubuntu => [ qw(clamav) ], |
35
|
|
|
|
|
|
|
debian => [ qw(clamav) ], |
36
|
|
|
|
|
|
|
kali => [ qw(clamav) ], |
37
|
|
|
|
|
|
|
}, |
38
|
|
|
|
|
|
|
}; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub update { |
42
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
my $datadir = $self->datadir; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my $cmd = "freshclam"; |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
$self->log->verbose($cmd); |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
return $self->sudo_system($cmd); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub scan { |
54
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
55
|
0
|
|
|
|
|
|
my ($target) = @_; |
56
|
|
|
|
|
|
|
|
57
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('scan', $target) or return; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
my $datadir = $self->datadir; |
60
|
0
|
0
|
0
|
|
|
|
if (! -f $target && ! -d $target) { |
61
|
0
|
|
|
|
|
|
return $self->log->error("scan: target [$target] not found"); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my $cmd = "clamscan -r -l $datadir/out.av -i $target"; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
return $self->system($cmd); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__END__ |