Remote/Windefend.pm

filter: Statementstmt 100% 9 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 12 / 12 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Remote/Tcpdump.pm ↑ Summary Remote/Windiff.pm »
1 #
2 # $Id$
3 #
4 # remote::windefend Brik
5 #
6 package Metabrik::Remote::Windefend;
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use base qw(Metabrik::Remote::Winexe);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 sub brik_properties {
13 return {
14 revision => '$Revision$',
15 tags => [ qw(unstable) ],
16 author => 'GomoR <GomoR[at]metabrik.org>',
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 my $self = shift;
33 my ($host, $user, $password) = @_;
34  
35 $host ||= $self->host;
36 $user ||= $self->user;
37 $password ||= $self->password;
38 $self->brik_help_set_undef_arg('host', $host) or return;
39 $self->brik_help_set_undef_arg('user', $user) or return;
40 $self->brik_help_set_undef_arg('password', $password) or return;
41  
42 my $cmd = '"powershell.exe Set-MpPreference -DisableRealtimeMonitoring \$true"';
43  
44 return $self->execute_in_background($cmd);
45 }
46  
47 sub enable {
48 my $self = shift;
49 my ($host, $user, $password) = @_;
50  
51 $host ||= $self->host;
52 $user ||= $self->user;
53 $password ||= $self->password;
54 $self->brik_help_set_undef_arg('host', $host) or return;
55 $self->brik_help_set_undef_arg('user', $user) or return;
56 $self->brik_help_set_undef_arg('password', $password) or return;
57  
58 my $cmd = '"powershell.exe Set-MpPreference -DisableRealtimeMonitoring \$false"';
59  
60 return $self->execute_in_background($cmd);
61 }
62  
63 1;
64  
65 __END__
« Remote/Tcpdump.pm ↑ Summary Remote/Windiff.pm »