File Coverage

blib/lib/Metabrik/Remote/Windefend.pm
Criterion Covered Total %
statement 9 30 30.0
branch 0 12 0.0
condition 0 18 0.0
subroutine 3 6 50.0
pod 1 3 33.3
total 13 69 18.8


line stmt bran cond sub pod time code
1             #
2             # $Id$
3             #
4             # remote::windefend Brik
5             #
6             package Metabrik::Remote::Windefend;
7 1     1   625 use strict;
  1         2  
  1         30  
8 1     1   5 use warnings;
  1         1  
  1         28  
9              
10 1     1   6 use base qw(Metabrik::Remote::Winexe);
  1         2  
  1         361  
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             host => [ qw(host) ], # Inherited
20             user => [ qw(username) ], # Inherited
21             password => [ qw(password) ], # Inherited
22             domain => [ qw(domain) ], # Inherited
23             },
24             commands => {
25             disable => [ qw(host|OPTIONAL user|OPTIONAL password|OPTIONAL) ],
26             enable => [ qw(host|OPTIONAL user|OPTIONAL password|OPTIONAL) ],
27             },
28             };
29             }
30              
31             sub disable {
32 0     0 0   my $self = shift;
33 0           my ($host, $user, $password) = @_;
34              
35 0   0       $host ||= $self->host;
36 0   0       $user ||= $self->user;
37 0   0       $password ||= $self->password;
38 0 0         $self->brik_help_set_undef_arg('host', $host) or return;
39 0 0         $self->brik_help_set_undef_arg('user', $user) or return;
40 0 0         $self->brik_help_set_undef_arg('password', $password) or return;
41              
42 0           my $cmd = '"powershell.exe Set-MpPreference -DisableRealtimeMonitoring \$true"';
43              
44 0           return $self->execute_in_background($cmd);
45             }
46              
47             sub enable {
48 0     0 0   my $self = shift;
49 0           my ($host, $user, $password) = @_;
50              
51 0   0       $host ||= $self->host;
52 0   0       $user ||= $self->user;
53 0   0       $password ||= $self->password;
54 0 0         $self->brik_help_set_undef_arg('host', $host) or return;
55 0 0         $self->brik_help_set_undef_arg('user', $user) or return;
56 0 0         $self->brik_help_set_undef_arg('password', $password) or return;
57              
58 0           my $cmd = '"powershell.exe Set-MpPreference -DisableRealtimeMonitoring \$false"';
59              
60 0           return $self->execute_in_background($cmd);
61             }
62              
63             1;
64              
65             __END__