Skip to content

Commit 8bbab76

Browse files
committed
Change execution to cmd and fix bugs
1 parent 4f5453e commit 8bbab76

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

nxc/modules/bitlocker.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@ def __init__(self, context, connection):
3939

4040
def check_bitlocker_status(self):
4141
# PowerShell command to check BitLocker volumes status.
42-
check_bitlocker_command_str = "Get-BitLockerVolume | Select-Object MountPoint, EncryptionMethod, ProtectionStatus"
42+
check_bitlocker_command_str = 'powershell.exe "Get-BitLockerVolume | Select-Object MountPoint, EncryptionMethod, ProtectionStatus"'
4343

4444
try:
4545
# Executing the PowerShell command to get BitLocker volumes status.
46-
check_bitlocker_command_str_output = self.connection.ps_execute(check_bitlocker_command_str, True)
46+
check_bitlocker_command_str_output = self.connection.execute(check_bitlocker_command_str, True)
4747

48-
if any("'Get-BitLockerVolume' is not recognized" in line for line in check_bitlocker_command_str_output):
48+
if "'Get-BitLockerVolume' is not recognized" in check_bitlocker_command_str_output:
4949
self.context.log.fail("BitLockerVolume not found on target.")
5050
return
5151

5252
# Splitting the output into lines.
53-
lines = str(check_bitlocker_command_str_output).split("\\n")
53+
lines = str(check_bitlocker_command_str_output).splitlines()
5454
data_lines = [line for line in lines if re.match(r"\w:", line)]
5555

5656
for line in data_lines:

0 commit comments

Comments
 (0)