Updated diags.py
This commit is contained in:
parent
1839edf84d
commit
7f37bc8802
1 changed files with 23 additions and 8 deletions
|
|
@ -38,7 +38,7 @@ def check_connection():
|
|||
else:
|
||||
abort()
|
||||
|
||||
def check_secure_boot_status():
|
||||
def check_secure_boot_status(show_alert=False):
|
||||
"""Checks UEFI Secure Boot status via PowerShell."""
|
||||
boot_mode = get_boot_mode()
|
||||
cmd = ['PowerShell', '-Command', 'Confirm-SecureBootUEFI']
|
||||
|
|
@ -51,18 +51,30 @@ def check_secure_boot_status():
|
|||
# It's on, do nothing
|
||||
return
|
||||
elif 'False' in out:
|
||||
if show_alert:
|
||||
show_alert_box('Secure Boot DISABLED')
|
||||
raise SecureBootDisabledError
|
||||
else:
|
||||
if show_alert:
|
||||
show_alert_box('Secure Boot status UNKNOWN')
|
||||
raise SecureBootUnknownError
|
||||
else:
|
||||
if boot_mode != 'UEFI':
|
||||
if (show_alert and
|
||||
global_vars['OS']['Version'] in ('8', '8.1', '10')):
|
||||
# OS supports Secure Boot
|
||||
show_alert_box('Secure Boot DISABLED\n\nOS installed LEGACY')
|
||||
raise OSInstalledLegacyError
|
||||
else:
|
||||
# Check error message
|
||||
err = result.stderr.decode()
|
||||
if 'Cmdlet not supported' in err:
|
||||
if show_alert:
|
||||
show_alert_box('Secure Boot UNAVAILABLE?')
|
||||
raise SecureBootNotAvailError
|
||||
else:
|
||||
if show_alert:
|
||||
show_alert_box('Secure Boot ERROR')
|
||||
raise GenericError
|
||||
|
||||
def get_boot_mode():
|
||||
|
|
@ -123,7 +135,8 @@ def run_xmplay():
|
|||
r'{BinDir}\XMPlay\music.7z'.format(**global_vars)]
|
||||
|
||||
# Unmute audio first
|
||||
run_nircmd(['mutesysvolume', '0'])
|
||||
extract_item('NirCmd', silent=True)
|
||||
run_nircmd('mutesysvolume', '0')
|
||||
|
||||
# Open XMPlay
|
||||
popen_program(cmd)
|
||||
|
|
@ -134,7 +147,7 @@ def run_hitmanpro():
|
|||
cmd = [
|
||||
global_vars['Tools']['HitmanPro'],
|
||||
'/quiet', '/noinstall', '/noupload',
|
||||
r'/log={LogDir}\hitman.xml'.format(**global_vars)]
|
||||
r'/log={LogDir}\Tools\HitmanPro.txt'.format(**global_vars)]
|
||||
popen_program(cmd)
|
||||
|
||||
def run_process_killer():
|
||||
|
|
@ -152,23 +165,25 @@ def run_rkill():
|
|||
extract_item('RKill', silent=True)
|
||||
cmd = [
|
||||
global_vars['Tools']['RKill'],
|
||||
'-l', r'{LogDir}\RKill.log'.format(**global_vars),
|
||||
'-s', '-l', r'{LogDir}\Tools\RKill.log'.format(**global_vars),
|
||||
'-new_console:n', '-new_console:s33V']
|
||||
run_program(cmd, check=False)
|
||||
wait_for_process('RKill')
|
||||
kill_process('notepad.exe')
|
||||
|
||||
# RKill cleanup
|
||||
desktop_path = r'{USERPROFILE}\Desktop'.format(**global_vars['Env'])
|
||||
if os.path.exists(desktop_path):
|
||||
for item in os.scandir(desktop_path):
|
||||
if re.search(r'^RKill', item.name, re.IGNORECASE):
|
||||
dest = re.sub(r'^(.*)\.', '\1_{Date-Time}.'.format(
|
||||
**global_vars), item.name)
|
||||
dest = r'{ClientDir}\Info\{name}'.format(
|
||||
dest = r'{LogDir}\Tools\{name}'.format(
|
||||
name=dest, **global_vars)
|
||||
dest = non_clobber_rename(dest)
|
||||
shutil.move(item.path, dest)
|
||||
|
||||
def show_alert_box(message, title='Wizard Kit Warning'):
|
||||
"""Show Windows alert box with message."""
|
||||
message_box = ctypes.windll.user32.MessageBoxW
|
||||
message_box(None, message, title, 0x00001030)
|
||||
|
||||
if __name__ == '__main__':
|
||||
print("This file is not meant to be called directly.")
|
||||
|
|
|
|||
Loading…
Reference in a new issue