diff --git a/.bin/Scripts/functions/cleanup.py b/.bin/Scripts/functions/cleanup.py index 7caf19dc..2723994b 100644 --- a/.bin/Scripts/functions/cleanup.py +++ b/.bin/Scripts/functions/cleanup.py @@ -1,49 +1,7 @@ # Wizard Kit: Functions - Cleanup from functions.setup import * - -# STATIC VARIABLES -D7_HKCR_CLEANUP = { - r'batfile\shell\!!RunWithParms': {'Recurse': True}, - r'batfile\shell\{0001B4FD-9EA3-4D90-A79E-FD14BA3AB01D}': {'Recurse': True}, - r'cmdfile\shell\!!RunWithParms': {'Recurse': True}, - r'cmdfile\shell\{0001B4FD-9EA3-4D90-A79E-FD14BA3AB01D}': {'Recurse': True}, - r'exefile\shell\!!RunWithParms': {'Recurse': True}, - r'exefile\shell\ResourceHacker': {'Recurse': True}, - r'regfile\shell\!!RunWithParms': {'Recurse': True}, - r'regfile\shell\{0001B4FD-9EA3-4D90-A79E-FD14BA3AB01D}': {'Recurse': True}, - } -D7_HKCU_CLEANUP = { - r'Software\Malwarebytes': {'Recurse': False}, - } -D7_HKLM_CLEANUP = { - r'Software\Emsisoft': {'Recurse': False}, - } -HKU = winreg.HKEY_USERS -HKCR = winreg.HKEY_CLASSES_ROOT -HKCU = winreg.HKEY_CURRENT_USER -HKLM = winreg.HKEY_LOCAL_MACHINE -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, - }, - }, - } +from settings.cleanup import * def cleanup_adwcleaner(): @@ -195,8 +153,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) diff --git a/.bin/Scripts/settings/cleanup.py b/.bin/Scripts/settings/cleanup.py new file mode 100644 index 00000000..fd4a595b --- /dev/null +++ b/.bin/Scripts/settings/cleanup.py @@ -0,0 +1,66 @@ +# Wizard Kit: Settings - Cleanup + +import re +import psutil +try: + import winreg +except ModuleNotFoundError: + if psutil.WINDOWS: + raise + +# d7II +D7_HKCR_CLEANUP = { + r'batfile\shell\!!RunWithParms': {'Recurse': True}, + r'batfile\shell\{0001B4FD-9EA3-4D90-A79E-FD14BA3AB01D}': {'Recurse': True}, + r'cmdfile\shell\!!RunWithParms': {'Recurse': True}, + r'cmdfile\shell\{0001B4FD-9EA3-4D90-A79E-FD14BA3AB01D}': {'Recurse': True}, + r'exefile\shell\!!RunWithParms': {'Recurse': True}, + r'exefile\shell\ResourceHacker': {'Recurse': True}, + r'regfile\shell\!!RunWithParms': {'Recurse': True}, + r'regfile\shell\{0001B4FD-9EA3-4D90-A79E-FD14BA3AB01D}': {'Recurse': True}, + } +D7_HKCU_CLEANUP = { + r'Software\Malwarebytes': {'Recurse': False}, + } +D7_HKLM_CLEANUP = { + r'Software\Emsisoft': {'Recurse': False}, + } + +# Regex +DESKTOP_ITEMS = re.compile( + r'^(JRT|RKill|sc-cleaner|Transfer_Log)', + re.IGNORECASE, + ) + +# Registry +HKU = winreg.HKEY_USERS +HKCR = winreg.HKEY_CLASSES_ROOT +HKCU = winreg.HKEY_CURRENT_USER +HKLM = winreg.HKEY_LOCAL_MACHINE +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.") + +# vim: sts=2 sw=2 ts=2