Add MBAM sections
This commit is contained in:
parent
b80e73a5ad
commit
9c8c7099e5
3 changed files with 77 additions and 0 deletions
|
|
@ -68,6 +68,9 @@ BASE_MENUS = {
|
||||||
),
|
),
|
||||||
'Manual Steps': (
|
'Manual Steps': (
|
||||||
MenuEntry('AdwCleaner', 'auto_adwcleaner'),
|
MenuEntry('AdwCleaner', 'auto_adwcleaner'),
|
||||||
|
MenuEntry('Malwarebytes (Install)', 'auto_mbam_install'),
|
||||||
|
MenuEntry('Malwarebytes (Run)', 'auto_mbam_run'),
|
||||||
|
MenuEntry('Malwarebytes (Uninstall)', 'auto_mbam_uninstall'),
|
||||||
MenuEntry('IO Bit Uninstaller', 'auto_iobit_uninstaller'),
|
MenuEntry('IO Bit Uninstaller', 'auto_iobit_uninstaller'),
|
||||||
MenuEntry('Enable Windows Updates', 'auto_windows_updates_enable'),
|
MenuEntry('Enable Windows Updates', 'auto_windows_updates_enable'),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ SOURCES = {
|
||||||
'LibreOffice': 'https://download.documentfoundation.org/libreoffice/stable/7.1.2/win/x86_64/LibreOffice_7.1.2_Win_x64.msi',
|
'LibreOffice': 'https://download.documentfoundation.org/libreoffice/stable/7.1.2/win/x86_64/LibreOffice_7.1.2_Win_x64.msi',
|
||||||
'Linux Reader': 'https://www.diskinternals.com/download/Linux_Reader.exe',
|
'Linux Reader': 'https://www.diskinternals.com/download/Linux_Reader.exe',
|
||||||
'Macs Fan Control': 'https://www.crystalidea.com/downloads/macsfancontrol_setup.exe',
|
'Macs Fan Control': 'https://www.crystalidea.com/downloads/macsfancontrol_setup.exe',
|
||||||
|
'MBAM': 'https://downloads.malwarebytes.com/file/mb-windows',
|
||||||
'NirCmd32': 'https://www.nirsoft.net/utils/nircmd.zip',
|
'NirCmd32': 'https://www.nirsoft.net/utils/nircmd.zip',
|
||||||
'NirCmd64': 'https://www.nirsoft.net/utils/nircmd-x64.zip',
|
'NirCmd64': 'https://www.nirsoft.net/utils/nircmd-x64.zip',
|
||||||
'NotepadPlusPlus': 'https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.9.5/npp.7.9.5.portable.minimalist.7z',
|
'NotepadPlusPlus': 'https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.9.5/npp.7.9.5.portable.minimalist.7z',
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,12 @@ PROGRAMFILES_32 = os.environ.get(
|
||||||
'PROGRAMFILES', r'C:\Program Files (x86)',
|
'PROGRAMFILES', r'C:\Program Files (x86)',
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
MBAM_EXE_PATH = 'Malwarebytes/Anti-Malware/mbam.exe'
|
||||||
|
MBAM_PRESERVE_MARKER = 'Preserve-MBAM.marker'
|
||||||
|
MBAM_UNINSTALL_KEY = (
|
||||||
|
r'Software\Microsoft\Windows\CurrentVersion\Uninstall'
|
||||||
|
r'\{35065F43-4BB2-439A-BFF7-0F1014F2E0CD}_is1'
|
||||||
|
)
|
||||||
OS_VERSION = float(platform.win32_ver()[0])
|
OS_VERSION = float(platform.win32_ver()[0])
|
||||||
REG_UAC_DEFAULT_SETTINGS = {
|
REG_UAC_DEFAULT_SETTINGS = {
|
||||||
'HKLM': {
|
'HKLM': {
|
||||||
|
|
@ -705,6 +711,28 @@ def auto_kvrt(group, name):
|
||||||
save_settings(group, name, result=result)
|
save_settings(group, name, result=result)
|
||||||
|
|
||||||
|
|
||||||
|
def auto_mbam_install(group, name):
|
||||||
|
"""Install Malwarebytes."""
|
||||||
|
result = TRY_PRINT.run('Malwarebytes (Install)...', install_mbam)
|
||||||
|
save_settings(group, name, result=result)
|
||||||
|
|
||||||
|
|
||||||
|
def auto_mbam_run(group, name):
|
||||||
|
"""Run Malwarebytes.
|
||||||
|
|
||||||
|
save_settings() is called first since MBAM may kill this script.
|
||||||
|
"""
|
||||||
|
save_settings(group, name, done=True, failed=False, message='DONE')
|
||||||
|
result = TRY_PRINT.run('Malwarebytes (Run)...', run_mbam, msg_good='DONE')
|
||||||
|
save_settings(group, name, result=result)
|
||||||
|
|
||||||
|
|
||||||
|
def auto_mbam_uninstall(group, name):
|
||||||
|
"""Uninstall Malwarebytes."""
|
||||||
|
result = TRY_PRINT.run('Malwarebytes (Uninstall)...', uninstall_mbam)
|
||||||
|
save_settings(group, name, result=result)
|
||||||
|
|
||||||
|
|
||||||
def auto_microsoft_defender(group, name):
|
def auto_microsoft_defender(group, name):
|
||||||
"""Run Microsoft Defender scan."""
|
"""Run Microsoft Defender scan."""
|
||||||
result = TRY_PRINT.run(
|
result = TRY_PRINT.run(
|
||||||
|
|
@ -924,6 +952,22 @@ def install_emsisoft_cmd():
|
||||||
run_tool('EmsisoftCmd', 'EmsisoftCmd', '/S', cbin=True)
|
run_tool('EmsisoftCmd', 'EmsisoftCmd', '/S', cbin=True)
|
||||||
|
|
||||||
|
|
||||||
|
def install_mbam():
|
||||||
|
"""Install Malwarebytes."""
|
||||||
|
marker = set_local_storage_path('.', MBAM_PRESERVE_MARKER)
|
||||||
|
marker.unlink(missing_ok=True)
|
||||||
|
|
||||||
|
# Check for current installation
|
||||||
|
for path in ('ProgramW6432', 'PROGRAMFILES', 'PROGRAMFILES(X86)'):
|
||||||
|
if os.path.exists(f'{os.environ.get(path, "")}/{MBAM_EXE_PATH}'):
|
||||||
|
LOG.info('Previous Malwarebytes installation detected.')
|
||||||
|
marker.touch()
|
||||||
|
break
|
||||||
|
|
||||||
|
# Install / Upgrade
|
||||||
|
run_tool('MBAM', 'MBAM', '/VERYSILENT', '/NORESTART', download=True)
|
||||||
|
|
||||||
|
|
||||||
def run_adwcleaner():
|
def run_adwcleaner():
|
||||||
"""Run AdwCleaner."""
|
"""Run AdwCleaner."""
|
||||||
run_tool('AdwCleaner', 'AdwCleaner', download=True)
|
run_tool('AdwCleaner', 'AdwCleaner', download=True)
|
||||||
|
|
@ -1023,6 +1067,20 @@ def run_kvrt():
|
||||||
log_path.write_text(proc.stdout)
|
log_path.write_text(proc.stdout)
|
||||||
|
|
||||||
|
|
||||||
|
def run_mbam():
|
||||||
|
"""Run Malwarebytes."""
|
||||||
|
exe_path = None
|
||||||
|
|
||||||
|
# Get EXE path
|
||||||
|
for path in ('ProgramW6432', 'PROGRAMFILES'):
|
||||||
|
test_path = get_path_obj(f'{os.environ.get(path, "")}/{MBAM_EXE_PATH}')
|
||||||
|
if test_path.exists():
|
||||||
|
exe_path = str(test_path)
|
||||||
|
|
||||||
|
# Run
|
||||||
|
run_program(exe_path, check=False)
|
||||||
|
|
||||||
|
|
||||||
def run_microsoft_defender(full=True):
|
def run_microsoft_defender(full=True):
|
||||||
"""Run Microsoft Defender scan."""
|
"""Run Microsoft Defender scan."""
|
||||||
reg_key = r'Software\Microsoft\Windows Defender'
|
reg_key = r'Software\Microsoft\Windows Defender'
|
||||||
|
|
@ -1117,6 +1175,21 @@ def uninstall_emsisoft_cmd():
|
||||||
delete_folder(EMSISOFT_INSTALL_PATH, force=True, ignore_errors=True)
|
delete_folder(EMSISOFT_INSTALL_PATH, force=True, ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
|
def uninstall_mbam():
|
||||||
|
"""Uninstall Malwarebytes."""
|
||||||
|
marker = set_local_storage_path('.', MBAM_PRESERVE_MARKER)
|
||||||
|
if marker.exists():
|
||||||
|
marker.unlink()
|
||||||
|
raise GenericWarning('Leaving existing MBAM installation in place.')
|
||||||
|
|
||||||
|
# Uninstall
|
||||||
|
install_path = reg_read_value('HKLM', MBAM_UNINSTALL_KEY, 'InstallLocation')
|
||||||
|
cmd = [
|
||||||
|
fr'{install_path}\mbuns.exe', '/Uninstall', '/VERYSILENT', '/NORESTART',
|
||||||
|
]
|
||||||
|
run_program(cmd)
|
||||||
|
|
||||||
|
|
||||||
def update_emsisoft_cmd():
|
def update_emsisoft_cmd():
|
||||||
"""Update EmsisoftCmd."""
|
"""Update EmsisoftCmd."""
|
||||||
cmd = [f'{EMSISOFT_INSTALL_PATH}/a2cmd.exe', '/update']
|
cmd = [f'{EMSISOFT_INSTALL_PATH}/a2cmd.exe', '/update']
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue