Updated cleanup functions

* Fixes issue #77
This commit is contained in:
2Shirt 2019-05-06 19:31:43 -06:00
parent a43c705f28
commit 07f2f338a2
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 68 additions and 45 deletions

View file

@ -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)

View file

@ -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