parent
0cadf54b4d
commit
9672ad0175
2 changed files with 46 additions and 0 deletions
|
|
@ -61,12 +61,14 @@ BASE_MENUS = {
|
||||||
MenuEntry('Reset Windows Policies', 'auto_reset_windows_policies'),
|
MenuEntry('Reset Windows Policies', 'auto_reset_windows_policies'),
|
||||||
),
|
),
|
||||||
'Malware Cleanup': (
|
'Malware Cleanup': (
|
||||||
|
MenuEntry('Disable Defender Scans', 'auto_open_defender_settings'),
|
||||||
MenuEntry('BleachBit', 'auto_bleachbit'),
|
MenuEntry('BleachBit', 'auto_bleachbit'),
|
||||||
MenuEntry('HitmanPro', 'auto_hitmanpro'),
|
MenuEntry('HitmanPro', 'auto_hitmanpro'),
|
||||||
MenuEntry('KVRT', 'auto_kvrt'),
|
MenuEntry('KVRT', 'auto_kvrt'),
|
||||||
MenuEntry('EmsisoftCmd', 'auto_emsisoft_cmd_run'),
|
MenuEntry('EmsisoftCmd', 'auto_emsisoft_cmd_run'),
|
||||||
MenuEntry('Reboot', 'auto_reboot'),
|
MenuEntry('Reboot', 'auto_reboot'),
|
||||||
MenuEntry('EmsisoftCmd (Uninstall)', 'auto_emsisoft_cmd_uninstall'),
|
MenuEntry('EmsisoftCmd (Uninstall)', 'auto_emsisoft_cmd_uninstall'),
|
||||||
|
MenuEntry('Enable Defender Scans', 'auto_open_defender_settings'),
|
||||||
MenuEntry('Windows Defender', 'auto_microsoft_defender'),
|
MenuEntry('Windows Defender', 'auto_microsoft_defender'),
|
||||||
MenuEntry('Remove Custom Power Plan', 'auto_remove_power_plan'),
|
MenuEntry('Remove Custom Power Plan', 'auto_remove_power_plan'),
|
||||||
MenuEntry('Reboot', 'auto_reboot'),
|
MenuEntry('Reboot', 'auto_reboot'),
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ from wk.log import format_log_path, update_log_path
|
||||||
from wk.os.win import (
|
from wk.os.win import (
|
||||||
ARCH,
|
ARCH,
|
||||||
OS_VERSION,
|
OS_VERSION,
|
||||||
|
show_alert_box,
|
||||||
get_timezone,
|
get_timezone,
|
||||||
set_timezone,
|
set_timezone,
|
||||||
reg_delete_value,
|
reg_delete_value,
|
||||||
|
|
@ -203,6 +204,11 @@ def end_session(menus):
|
||||||
reg_delete_value('HKCU', AUTO_REPAIR_KEY, 'SessionStarted')
|
reg_delete_value('HKCU', AUTO_REPAIR_KEY, 'SessionStarted')
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
LOG.error('Ending repair session but session not started.')
|
LOG.error('Ending repair session but session not started.')
|
||||||
|
try:
|
||||||
|
reg_delete_value('HKCU', AUTO_REPAIR_KEY, 'Kill Explorer')
|
||||||
|
except FileNotFoundError:
|
||||||
|
# Ignore if not set
|
||||||
|
pass
|
||||||
for group in menus:
|
for group in menus:
|
||||||
try:
|
try:
|
||||||
cmd = ['reg', 'delete', fr'HKCU\{AUTO_REPAIR_KEY}\{group}', '/f']
|
cmd = ['reg', 'delete', fr'HKCU\{AUTO_REPAIR_KEY}\{group}', '/f']
|
||||||
|
|
@ -272,6 +278,7 @@ def init_run(options):
|
||||||
"""Initialize Auto Repairs Run."""
|
"""Initialize Auto Repairs Run."""
|
||||||
if options['Kill Explorer']['Selected']:
|
if options['Kill Explorer']['Selected']:
|
||||||
atexit.register(start_explorer)
|
atexit.register(start_explorer)
|
||||||
|
reg_set_value('HKCU', AUTO_REPAIR_KEY, 'Kill Explorer', 1, 'DWORD')
|
||||||
TRY_PRINT.run('Killing Explorer...', kill_explorer, msg_good='DONE')
|
TRY_PRINT.run('Killing Explorer...', kill_explorer, msg_good='DONE')
|
||||||
if options['Use Autologon']['Selected'] and not is_autologon_enabled():
|
if options['Use Autologon']['Selected'] and not is_autologon_enabled():
|
||||||
TRY_PRINT.run(
|
TRY_PRINT.run(
|
||||||
|
|
@ -750,6 +757,16 @@ def auto_microsoft_defender(group, name):
|
||||||
save_settings(group, name, result=result)
|
save_settings(group, name, result=result)
|
||||||
|
|
||||||
|
|
||||||
|
def auto_open_defender_settings(group, name):
|
||||||
|
"""Open Windows Defender Threat Settings."""
|
||||||
|
result = TRY_PRINT.run(
|
||||||
|
'Open Windows Defender settings...',
|
||||||
|
open_defender_settings,
|
||||||
|
msg_good='Done',
|
||||||
|
)
|
||||||
|
save_settings(group, name, result=result)
|
||||||
|
|
||||||
|
|
||||||
def auto_reboot(group, name):
|
def auto_reboot(group, name):
|
||||||
"""Reboot the system."""
|
"""Reboot the system."""
|
||||||
save_settings(group, name, done=True, failed=False, message='DONE')
|
save_settings(group, name, done=True, failed=False, message='DONE')
|
||||||
|
|
@ -1390,6 +1407,33 @@ def kill_explorer():
|
||||||
run_program(cmd, check=False)
|
run_program(cmd, check=False)
|
||||||
|
|
||||||
|
|
||||||
|
def open_defender_settings():
|
||||||
|
"""Open Windows Defender Threat Settings."""
|
||||||
|
cmd = ['start', '', 'windowsdefender://threatsettings']
|
||||||
|
message = (
|
||||||
|
'Please adjust Windows Defender settings as appropriate.\n'
|
||||||
|
'Press OK to continue repairs.'
|
||||||
|
)
|
||||||
|
|
||||||
|
# Check Kill Explorer setting
|
||||||
|
kill_explorer_proc = False
|
||||||
|
try:
|
||||||
|
kill_explorer_proc = reg_read_value(
|
||||||
|
'HKCU', AUTO_REPAIR_KEY, 'Kill Explorer',
|
||||||
|
)
|
||||||
|
except FileNotFoundError:
|
||||||
|
# Ignore if not set
|
||||||
|
pass
|
||||||
|
if kill_explorer_proc:
|
||||||
|
# Explorer is needed to open the settings window, relaunch for now
|
||||||
|
start_explorer()
|
||||||
|
sleep(2)
|
||||||
|
run_program(cmd, check=False, shell=True)
|
||||||
|
show_alert_box(message=message, title='Windows Defender: Threat Settings')
|
||||||
|
if kill_explorer_proc:
|
||||||
|
kill_explorer()
|
||||||
|
|
||||||
|
|
||||||
def reboot(timeout=10):
|
def reboot(timeout=10):
|
||||||
"""Reboot the system."""
|
"""Reboot the system."""
|
||||||
atexit.unregister(start_explorer)
|
atexit.unregister(start_explorer)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue