Add export_bitlocker.py script

This commit is contained in:
2Shirt 2022-09-27 23:56:25 -07:00
parent cafdf42a6d
commit 82e0de422b
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 31 additions and 0 deletions

View file

@ -0,0 +1,11 @@
"""WizardKit: Export Bitlocker Tool"""
# vim: sts=2 sw=2 ts=2
import os
import sys
os.chdir(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(os.getcwd())
import wk # pylint: disable=wrong-import-position
wk.os.win.export_bitlocker_info()

View file

@ -30,6 +30,7 @@ from wk.std import (
GenericWarning,
bytes_to_string,
color_string,
input_text,
sleep,
)
@ -73,6 +74,7 @@ RAM_OK = 5.5 * 1024**3 # ~6 GiB assuming a bit of shared memory
RAM_WARNING = 3.5 * 1024**3 # ~4 GiB assuming a bit of shared memory
REG_MSISERVER = r'HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer'
SLMGR = pathlib.Path(f'{os.environ.get("SYSTEMROOT")}/System32/slmgr.vbs')
SYSTEMDRIVE = os.environ.get('SYSTEMDRIVE')
# Activation Functions
@ -166,6 +168,24 @@ def check_4k_alignment(show_alert=False):
raise GenericError('One or more partitions are not 4K aligned')
def export_bitlocker_info():
"""Get Bitlocker info and save to the current directory."""
commands = [
['manage-bde', '-status', SYSTEMDRIVE],
['manage-bde', '-protectors', '-get', SYSTEMDRIVE],
]
# Get filename
file_name = input_text(prompt='Enter filename', allow_empty_response=False)
file_path = pathlib.Path(f'../../Bitlocker_{file_name}.txt').resolve()
# Save info
with open(file_path, 'a') as _f:
for cmd in commands:
proc = run_program(cmd, check=False)
_f.write(f'{proc.stdout}\n\n')
def get_installed_antivirus():
"""Get list of installed antivirus programs, returns list."""
cmd = [