From 86f17757dbd4ac3f67d1f3ba8001919e335226c1 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Tue, 11 Jun 2019 17:49:10 -0600 Subject: [PATCH] Updated cleanup sections --- .bin/Scripts/functions/cleanup.py | 22 ++++++++++++------ .bin/Scripts/settings/cleanup.py | 37 +++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 .bin/Scripts/settings/cleanup.py diff --git a/.bin/Scripts/functions/cleanup.py b/.bin/Scripts/functions/cleanup.py index 5ee20be1..744ee048 100644 --- a/.bin/Scripts/functions/cleanup.py +++ b/.bin/Scripts/functions/cleanup.py @@ -1,7 +1,9 @@ -# Wizard Kit: Functions - Cleanup - -from functions.common import * +'''Wizard Kit: Functions - Cleanup''' +# pylint: disable=no-name-in-module,wildcard-import +# vim: sts=2 sw=2 ts=2 +from functions.setup import * +from settings.cleanup import * def cleanup_adwcleaner(): """Move AdwCleaner folders into the ClientDir.""" @@ -75,8 +77,7 @@ def cleanup_desktop(): desktop_path = r'{USERPROFILE}\Desktop'.format(**global_vars['Env']) for entry in os.scandir(desktop_path): - # JRT, RKill, Shortcut cleaner - if re.search(r'^(JRT|RKill|sc-cleaner)', entry.name, re.IGNORECASE): + if DESKTOP_ITEMS.search(entry.name): dest_name = r'{}\{}'.format(dest_folder, entry.name) dest_name = non_clobber_rename(dest_name) shutil.move(entry.path, dest_name) @@ -130,7 +131,14 @@ def delete_registry_value(hive, key, value): winreg.DeleteValue(k, value) +def restore_default_uac(): + """Restores default UAC settings via the registry.""" + if global_vars['OS']['Version'] == '10': + write_registry_settings(UAC_DEFAULTS_WIN10, all_users=True) + else: + # Haven't checked Win8 settings, only applying minimum set + write_registry_settings(UAC_DEFAULTS_WIN7, all_users=True) + + if __name__ == '__main__': print("This file is not meant to be called directly.") - -# vim: sts=2 sw=2 ts=2 diff --git a/.bin/Scripts/settings/cleanup.py b/.bin/Scripts/settings/cleanup.py new file mode 100644 index 00000000..2188fc6b --- /dev/null +++ b/.bin/Scripts/settings/cleanup.py @@ -0,0 +1,37 @@ +'''Wizard Kit: Settings - Cleanup''' +# vim: sts=2 sw=2 ts=2 + +import re + +# Regex +DESKTOP_ITEMS = re.compile( + r'^(JRT|RKill|sc-cleaner)', + re.IGNORECASE, + ) + +# Registry +UAC_DEFAULTS_WIN7 = { + r'Software\Microsoft\Windows\CurrentVersion\Policies\System': { + 'DWORD Items': { + 'ConsentPromptBehaviorAdmin': 5, + 'EnableLUA': 1, + 'PromptOnSecureDesktop': 1, + }, + }, + } +UAC_DEFAULTS_WIN10 = { + r'Software\Microsoft\Windows\CurrentVersion\Policies\System': { + 'DWORD Items': { + 'ConsentPromptBehaviorAdmin': 5, + 'ConsentPromptBehaviorUser': 3, + 'EnableInstallerDetection': 1, + 'EnableLUA': 1, + 'EnableVirtualization': 1, + 'PromptOnSecureDesktop': 1, + }, + }, + } + + +if __name__ == '__main__': + print("This file is not meant to be called directly.")