diff --git a/scripts/check_disk.py b/scripts/check_disk.py index 7e6810c9..1682d94f 100644 --- a/scripts/check_disk.py +++ b/scripts/check_disk.py @@ -23,10 +23,10 @@ def main(): # Run or schedule scan if 'Offline' in selection[0]: - function = wk.os.win.run_chkdsk_offline + function = wk.repairs.win.run_chkdsk_offline msg_good = 'Scheduled' else: - function = wk.os.win.run_chkdsk_online + function = wk.repairs.win.run_chkdsk_online msg_good = 'No issues detected' try_print.run( message=f'CHKDSK ({os.environ.get("SYSTEMDRIVE")})...', diff --git a/scripts/ddrescue-tui.py b/scripts/ddrescue-tui.py index 289b49d9..413e81e6 100755 --- a/scripts/ddrescue-tui.py +++ b/scripts/ddrescue-tui.py @@ -1,11 +1,12 @@ #!/usr/bin/env python3 """Wizard Kit: ddrescue TUI""" +# pylint: disable=invalid-name # vim: sts=2 sw=2 ts=2 -import wk - from docopt import docopt +import wk + if __name__ == '__main__': try: diff --git a/scripts/hw-diags.py b/scripts/hw-diags.py index 1dc17294..c72fd91f 100755 --- a/scripts/hw-diags.py +++ b/scripts/hw-diags.py @@ -1,11 +1,12 @@ #!/usr/bin/env python3 """Wizard Kit: Hardware Diagnostics""" +# pylint: disable=invalid-name # vim: sts=2 sw=2 ts=2 -import wk - from docopt import docopt +import wk + if __name__ == '__main__': try: diff --git a/scripts/outer_scripts_to_review/check_disk.py b/scripts/outer_scripts_to_review/check_disk.py deleted file mode 100644 index fe18650b..00000000 --- a/scripts/outer_scripts_to_review/check_disk.py +++ /dev/null @@ -1,57 +0,0 @@ -# Wizard Kit: Check or repair the %SYSTEMDRIVE% filesystem via CHKDSK - -import os -import sys - -# Init -sys.path.append(os.path.dirname(os.path.realpath(__file__))) -from functions.repairs import * -init_global_vars() -os.system('title {}: Check Disk Tool'.format(KIT_NAME_FULL)) -set_log_file('Check Disk.log') - -if __name__ == '__main__': - try: - stay_awake() - clear_screen() - other_results = { - 'Error': { - 'CalledProcessError': 'Unknown Error', - }, - 'Warning': { - 'GenericRepair': 'Repaired', - 'UnsupportedOSError': 'Unsupported OS', - }} - options = [ - {'Name': 'Run CHKDSK scan (read-only)', 'Repair': False}, - {'Name': 'Schedule CHKDSK scan (offline repair)', 'Repair': True}] - actions = [{'Name': 'Quit', 'Letter': 'Q'}] - selection = menu_select( - '{}: Check Disk Menu\n'.format(KIT_NAME_FULL), - main_entries=options, - action_entries=actions) - print_info('{}: Check Disk Menu\n'.format(KIT_NAME_FULL)) - if selection == 'Q': - abort() - elif selection.isnumeric(): - repair = options[int(selection)-1]['Repair'] - if repair: - cs = 'Scheduled' - else: - cs = 'No issues' - message = 'CHKDSK ({SYSTEMDRIVE})...'.format(**global_vars['Env']) - try_and_print(message=message, function=run_chkdsk, - cs=cs, other_results=other_results, repair=repair) - else: - abort() - - # Done - print_success('Done.') - pause("Press Enter to exit...") - exit_script() - except SystemExit as sys_exit: - exit_script(sys_exit.code) - except: - major_exception() - -# vim: sts=2 sw=2 ts=2 diff --git a/scripts/outer_scripts_to_review/dism.py b/scripts/outer_scripts_to_review/dism.py deleted file mode 100644 index 4de5b788..00000000 --- a/scripts/outer_scripts_to_review/dism.py +++ /dev/null @@ -1,58 +0,0 @@ -# Wizard Kit: Check or repair component store health via DISM - -import os -import sys - -# Init -sys.path.append(os.path.dirname(os.path.realpath(__file__))) -from functions.repairs import * -init_global_vars() -os.system('title {}: DISM helper Tool'.format(KIT_NAME_FULL)) -set_log_file('DISM Helper.log') - -if __name__ == '__main__': - try: - stay_awake() - clear_screen() - other_results = { - 'Error': { - 'CalledProcessError': 'Unknown Error', - }, - 'Warning': { - 'GenericRepair': 'Repaired', - 'UnsupportedOSError': 'Unsupported OS', - }} - disabled = bool(global_vars['OS']['Version'] not in ('8', '8.1', '10')) - options = [ - {'Name': 'Check Health', 'Repair': False, 'Disabled': disabled}, - {'Name': 'Restore Health', 'Repair': True, 'Disabled': disabled}] - actions = [{'Name': 'Quit', 'Letter': 'Q'}] - selection = menu_select( - '{}: DISM Menu\n'.format(KIT_NAME_FULL), - main_entries=options, - action_entries=actions) - print_info('{}: DISM Menu\n'.format(KIT_NAME_FULL)) - if selection == 'Q': - abort() - elif selection.isnumeric(): - repair = options[int(selection)-1]['Repair'] - if repair: - message='DISM RestoreHealth...' - else: - message='DISM ScanHealth...' - try_and_print(message=message, function=run_dism, - cs='No corruption', ns='Corruption detected', - other_results=other_results, repair=repair) - else: - abort() - - # Done - print_success('Done.') - pause("Press Enter to exit...") - exit_script() - except SystemExit as sys_exit: - exit_script(sys_exit.code) - except: - major_exception() - -# vim: sts=2 sw=2 ts=2 diff --git a/scripts/outer_scripts_to_review/install_sw_bundle.py b/scripts/outer_scripts_to_review/install_sw_bundle.py deleted file mode 100644 index 2979362e..00000000 --- a/scripts/outer_scripts_to_review/install_sw_bundle.py +++ /dev/null @@ -1,63 +0,0 @@ -# Wizard Kit: Install the standard SW bundle based on the OS version - -import os -import sys - -# Init -sys.path.append(os.path.dirname(os.path.realpath(__file__))) -from functions.setup import * -init_global_vars() -os.system('title {}: SW Bundle Tool'.format(KIT_NAME_FULL)) -set_log_file('Install SW Bundle.log') - -if __name__ == '__main__': - try: - stay_awake() - clear_screen() - print_info('{}: SW Bundle Tool\n'.format(KIT_NAME_FULL)) - other_results = { - 'Error': { - 'CalledProcessError': 'Unknown Error', - 'FileNotFoundError': 'File not found', - }, - 'Warning': { - 'GenericRepair': 'Repaired', - 'UnsupportedOSError': 'Unsupported OS', - }} - answer_extensions = ask('Install Extensions?') - answer_vcr = ask('Install Visual C++ Runtimes?') - answer_ninite = ask('Install Ninite Bundle?') - if answer_ninite and global_vars['OS']['Version'] in ['7']: - # Vista is dead, not going to check for it - answer_mse = ask('Install MSE?') - else: - answer_mse = False - - print_info('Installing Programs') - if answer_vcr: - install_vcredists() - if answer_ninite: - result = try_and_print(message='Ninite bundle...', - function=install_ninite_bundle, cs='Started', - mse=answer_mse, other_results=other_results) - for proc in result['Out']: - # Wait for all processes to finish - proc.wait() - if answer_extensions: - print_info('Installing Extensions') - try_and_print(message='Classic Shell skin...', - function=install_classicstart_skin, - other_results=other_results) - try_and_print(message='Google Chrome extensions...', - function=install_chrome_extensions) - try_and_print(message='Mozilla Firefox extensions...', - function=install_firefox_extensions, - other_results=other_results) - print_standard('\nDone.') - exit_script() - except SystemExit as sys_exit: - exit_script(sys_exit.code) - except: - major_exception() - -# vim: sts=2 sw=2 ts=2 diff --git a/scripts/outer_scripts_to_review/install_vcredists.py b/scripts/outer_scripts_to_review/install_vcredists.py deleted file mode 100644 index 1cd31d95..00000000 --- a/scripts/outer_scripts_to_review/install_vcredists.py +++ /dev/null @@ -1,35 +0,0 @@ -# Wizard Kit: Install Visual C++ Runtimes - -import os -import sys - -# Init -sys.path.append(os.path.dirname(os.path.realpath(__file__))) -from functions.setup import * -init_global_vars() -os.system('title {}: Install Visual C++ Runtimes'.format(KIT_NAME_FULL)) -set_log_file('Install Visual C++ Runtimes.log') - -if __name__ == '__main__': - try: - stay_awake() - clear_screen() - print_info('{}: Install Visual C++ Runtimes\n'.format(KIT_NAME_FULL)) - other_results = { - 'Error': { - 'CalledProcessError': 'Unknown Error', - }} - - if ask('Install Visual C++ Runtimes?'): - install_vcredists() - else: - abort() - - print_standard('\nDone.') - exit_script() - except SystemExit as sys_exit: - exit_script(sys_exit.code) - except: - major_exception() - -# vim: sts=2 sw=2 ts=2 diff --git a/scripts/outer_scripts_to_review/system_diagnostics.py b/scripts/outer_scripts_to_review/system_diagnostics.py deleted file mode 100644 index b1a1848d..00000000 --- a/scripts/outer_scripts_to_review/system_diagnostics.py +++ /dev/null @@ -1,173 +0,0 @@ -# Wizard Kit: System Diagnostics - -import os -import sys - -# Init -sys.path.append(os.path.dirname(os.path.realpath(__file__))) -from functions.browsers import * -from functions.info import * -from functions.product_keys import * -from functions.repairs import * -from functions.sw_diags import * -init_global_vars() -os.system('title {}: System Diagnostics Tool'.format(KIT_NAME_FULL)) -set_log_file('System Diagnostics.log') - -# Static Variables -BLEACH_BIT_CLEANERS = { - 'Applications': ( - 'adobe_reader.cache', - 'adobe_reader.tmp', - 'amule.tmp', - 'flash.cache', - 'gimp.tmp', - 'hippo_opensim_viewer.cache', - 'java.cache', - 'libreoffice.cache', - 'liferea.cache', - 'miro.cache', - 'openofficeorg.cache', - 'pidgin.cache', - 'secondlife_viewer.Cache', - 'thunderbird.cache', - 'vuze.backup_files', - 'vuze.cache', - 'vuze.tmp', - 'yahoo_messenger.cache', - ), - 'Browsers': ( - 'chromium.cache', - 'chromium.current_session', - 'firefox.cache', - 'firefox.session_restore', - 'google_chrome.cache', - 'google_chrome.session', - 'google_earth.temporary_files', - 'internet_explorer.temporary_files', - 'opera.cache', - 'opera.current_session', - 'safari.cache', - 'seamonkey.cache', - ), - 'System': ( - 'system.clipboard', - 'system.tmp', - 'winapp2_windows.jump_lists', - 'winapp2_windows.ms_search', - 'windows_explorer.run', - 'windows_explorer.search_history', - 'windows_explorer.thumbnails', - ), -} - -if __name__ == '__main__': - try: - stay_awake() - clear_screen() - print_info('{}: System Diagnostics Tool\n'.format(KIT_NAME_FULL)) - ticket_number = get_ticket_number() - other_results = { - 'Error': { - 'CalledProcessError': 'Unknown Error', - 'FileNotFoundError': 'File not found', - }, - 'Warning': { - 'GenericRepair': 'Repaired', - 'UnsupportedOSError': 'Unsupported OS', - }} - if ENABLED_TICKET_NUMBERS: - print_info('Starting System Diagnostics for Ticket #{}\n'.format( - ticket_number)) - - # Sanitize Environment - print_info('Sanitizing Environment') - try_and_print(message='Running RKill...', - function=run_rkill, cs='Done', other_results=other_results) - try_and_print(message='Running TDSSKiller...', - function=run_tdsskiller, cs='Done', other_results=other_results) - - # Re-run if earlier process was stopped. - stay_awake() - - # Start diags - print_info('Starting Background Scans') - check_connection() - try_and_print(message='Running HitmanPro...', - function=run_hitmanpro, cs='Started', other_results=other_results) - try_and_print(message='Running Autoruns...', - function=run_autoruns, cs='Started', other_results=other_results) - - # OS Health Checks - print_info('OS Health Checks') - try_and_print( - message='CHKDSK ({SYSTEMDRIVE})...'.format(**global_vars['Env']), - function=run_chkdsk, other_results=other_results) - try_and_print(message='SFC scan...', - function=run_sfc_scan, other_results=other_results) - try_and_print(message='DISM CheckHealth...', - function=run_dism, other_results=other_results, repair=False) - - # Scan for supported browsers - print_info('Scanning for browsers') - scan_for_browsers() - - # Run BleachBit cleaners - print_info('BleachBit Cleanup') - for k, v in sorted(BLEACH_BIT_CLEANERS.items()): - try_and_print(message=' {}...'.format(k), - function=run_bleachbit, - cs='Done', other_results=other_results, - cleaners=v, preview=True) - - # Export system info - print_info('Backup System Information') - try_and_print(message='AIDA64 reports...', - function=run_aida64, cs='Done', other_results=other_results) - backup_browsers() - try_and_print(message='File listing...', - function=backup_file_list, cs='Done', other_results=other_results) - try_and_print(message='Power plans...', - function=backup_power_plans, cs='Done') - try_and_print(message='Product Keys...', - function=run_produkey, cs='Done', other_results=other_results) - try_and_print(message='Registry...', - function=backup_registry, cs='Done', other_results=other_results) - - # Summary - print_info('Summary') - try_and_print(message='Operating System:', - function=show_os_name, ns='Unknown', silent_function=False) - try_and_print(message='Activation:', - function=show_os_activation, ns='Unknown', silent_function=False) - try_and_print(message='Installed RAM:', - function=show_installed_ram, ns='Unknown', silent_function=False) - show_free_space() - try_and_print(message='Temp Size:', - function=show_temp_files_size, silent_function=False) - try_and_print(message='Installed Antivirus:', - function=get_installed_antivirus, ns='Unknown', - other_results=other_results, print_return=True) - try_and_print(message='Installed Office:', - function=get_installed_office, ns='Unknown', - other_results=other_results, print_return=True) - try_and_print(message='Product Keys:', - function=get_product_keys, ns='Unknown', print_return=True) - - # User data - print_info('User Data') - try: - show_user_data_summary() - except Exception: - print_error(' Unknown error.') - - # Done - print_standard('\nDone.') - pause('Press Enter to exit...') - exit_script() - except SystemExit as sys_exit: - exit_script(sys_exit.code) - except: - major_exception() - -# vim: sts=2 sw=2 ts=2 diff --git a/scripts/outer_scripts_to_review/system_setup.py b/scripts/outer_scripts_to_review/system_setup.py deleted file mode 100644 index 5fa239ab..00000000 --- a/scripts/outer_scripts_to_review/system_setup.py +++ /dev/null @@ -1,355 +0,0 @@ -'''Wizard Kit: System Setup''' -# pylint: disable=wildcard-import,wrong-import-position -# vim: sts=2 sw=2 ts=2 - -import os -import sys - -# Init -sys.path.append(os.path.dirname(os.path.realpath(__file__))) -from collections import OrderedDict -from functions.activation import * -from functions.browsers import * -from functions.cleanup import * -from functions.info import * -from functions.product_keys import * -from functions.setup import * -from functions.sw_diags import * -from functions.windows_updates import * -init_global_vars() -os.system('title {}: System Setup'.format(KIT_NAME_FULL)) -set_log_file('System Setup.log') - - -# STATIC VARIABLES -# pylint: disable=bad-whitespace,line-too-long -OTHER_RESULTS = { - 'Error': { - 'BIOSKeyNotFoundError': 'BIOS KEY NOT FOUND', - 'CalledProcessError': 'UNKNOWN ERROR', - 'FileNotFoundError': 'FILE NOT FOUND', - 'GenericError': 'UNKNOWN ERROR', - 'Not4KAlignedError': 'FALSE', - 'SecureBootDisabledError': 'DISABLED', - 'WindowsUnsupportedError': 'UNSUPPORTED', - }, - 'Warning': { - 'GenericRepair': 'REPAIRED', - 'NoProfilesError': 'NO PROFILES FOUND', - 'NotInstalledError': 'NOT INSTALLED', - 'OSInstalledLegacyError': 'OS INSTALLED LEGACY', - 'SecureBootNotAvailError': 'NOT AVAILABLE', - 'SecureBootUnknownError': 'UNKNOWN', - 'UnsupportedOSError': 'UNSUPPORTED OS', - 'WindowsOutdatedError': 'OUTDATED', - }, - } -SETUP_ACTIONS = OrderedDict({ - # Install software - 'Installing Programs': {'Info': True}, - 'VCR': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': install_vcredists, 'Just run': True,}, - 'LibreOffice': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': install_libreoffice, - 'If answer': 'LibreOffice', 'KWArgs': {'quickstart': False, 'register_mso_types': True, 'use_mso_formats': False, 'vcredist': False}, - }, - 'Ninite bundle': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': install_ninite_bundle, 'KWArgs': {'cs': 'STARTED'},}, - - # Browsers - 'Scanning for browsers': {'Info': True}, - 'Scan': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': scan_for_browsers, 'Just run': True, 'KWArgs': {'skip_ie': True},}, - 'Backing up browsers': {'Info': True}, - 'Backup browsers': {'New': False, 'Dat': True, 'Cur': True, 'HW': False, 'Function': backup_browsers, 'Just run': True,}, - - # Install extensions - 'Installing Extensions': {'Info': True}, - 'Classic Shell skin': {'New': True, 'Dat': True, 'Cur': False, 'HW': False, 'Function': install_classicstart_skin, 'Win10 only': True,}, - 'Chrome extensions': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': install_chrome_extensions,}, - 'Firefox extensions': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': install_firefox_extensions,}, - - # Configure software' - 'Configuring Programs': {'Info': True}, - 'Browser add-ons': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': install_adblock, 'Just run': True, - 'Pause': 'Please enable uBlock Origin for all browsers', - }, - 'Classic Start': {'New': True, 'Dat': True, 'Cur': False, 'HW': False, 'Function': config_classicstart, 'Win10 only': True,}, - 'Config Windows Updates': {'New': True, 'Dat': True, 'Cur': True, 'HW': True, 'Function': config_windows_updates, 'Win10 only': True,}, - 'Enable Windows Updates': {'New': True, 'Dat': True, 'Cur': True, 'HW': True, 'Function': enable_windows_updates, 'KWArgs': {'silent': True},}, - 'Explorer (system)': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': config_explorer_system, 'Win10 only': True,}, - 'Explorer (user)': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': config_explorer_user, 'Win10 only': True,}, - 'Restart Explorer': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': restart_explorer,}, - 'Restore default UAC': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': restore_default_uac,}, - 'Update Clock': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': update_clock,}, - - # Cleanup - 'Cleaning up': {'Info': True}, - 'AdwCleaner': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': cleanup_adwcleaner,}, - 'Desktop': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': cleanup_desktop,}, - 'KIT_NAME_FULL': {'New': True, 'Dat': True, 'Cur': True, 'HW': True, 'Function': delete_empty_folders,}, - - # System Info - 'Exporting system info': {'Info': True}, - 'AIDA64 Report': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': run_aida64,}, - 'File listing': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': backup_file_list,}, - 'Power plans': {'New': True, 'Dat': True, 'Cur': True, 'HW': True, 'Function': backup_power_plans,}, - 'Product Keys': {'New': True, 'Dat': True, 'Cur': True, 'HW': True, 'Function': run_produkey,}, - 'Registry': {'New': True, 'Dat': True, 'Cur': True, 'HW': True, 'Function': backup_registry,}, - - # Show Summary - 'Summary': {'Info': True}, - 'Operating System': {'New': True, 'Dat': True, 'Cur': True, 'HW': True, 'Function': show_os_name, 'KWArgs': {'ns': 'UNKNOWN', 'silent_function': False},}, - 'Activation': {'New': True, 'Dat': True, 'Cur': True, 'HW': True, 'Function': show_os_activation, 'KWArgs': {'ns': 'UNKNOWN', 'silent_function': False},}, - 'BIOS Activation': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': activate_with_bios, 'If not activated': True,}, - 'Secure Boot': {'New': True, 'Dat': True, 'Cur': True, 'HW': True, 'Function': check_secure_boot_status, 'KWArgs': {'show_alert': False},}, - 'Installed RAM': {'New': True, 'Dat': True, 'Cur': True, 'HW': True, 'Function': show_installed_ram, 'KWArgs': {'ns': 'UNKNOWN', 'silent_function': False},}, - 'Temp size': {'New': False, 'Dat': False, 'Cur': True, 'HW': False, 'Function': show_temp_files_size, 'KWArgs': {'ns': 'UNKNOWN', 'silent_function': False},}, - 'Show free space': {'New': True, 'Dat': True, 'Cur': True, 'HW': True, 'Function': show_free_space, 'Just run': True,}, - 'Installed AV': {'New': True, 'Dat': True, 'Cur': True, 'HW': True, 'Function': get_installed_antivirus, 'KWArgs': {'ns': 'UNKNOWN', 'print_return': True},}, - 'Installed Office': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': get_installed_office, 'KWArgs': {'ns': 'UNKNOWN', 'print_return': True},}, - 'Partitions 4K aligned': {'New': True, 'Dat': True, 'Cur': True, 'HW': True, 'Function': check_4k_alignment, 'KWArgs': {'cs': 'TRUE', 'ns': 'FALSE'},}, - - # Open things - 'Opening Programs': {'Info': True}, - 'Device Manager': {'New': True, 'Dat': True, 'Cur': True, 'HW': True, 'Function': open_device_manager, 'KWArgs': {'cs': 'STARTED'},}, - 'HWiNFO sensors': {'New': True, 'Dat': True, 'Cur': True, 'HW': True, 'Function': run_hwinfo_sensors, 'KWArgs': {'cs': 'STARTED'},}, - 'Speed test': {'New': True, 'Dat': True, 'Cur': True, 'HW': True, 'Function': open_speedtest, 'KWArgs': {'cs': 'STARTED'},}, - 'Windows Updates': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': open_windows_updates, 'KWArgs': {'cs': 'STARTED'},}, - 'Windows Activation': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': open_windows_activation, 'If not activated': True, 'KWArgs': {'cs': 'STARTED'},}, - 'Sleep': {'New': True, 'Dat': True, 'Cur': True, 'HW': True, 'Function': sleep, 'Just run': True, 'KWArgs': {'seconds': 3},}, - 'XMPlay': {'New': True, 'Dat': True, 'Cur': True, 'HW': True, 'Function': run_xmplay, 'KWArgs': {'cs': 'STARTED'},}, - }) -SETUP_ACTION_KEYS = ( - 'Function', - 'If not activated', - 'Info', - 'Just run', - 'KWArgs', - 'Pause', - ) -SETUP_QUESTIONS = { - # AV - 'MSE': {'New': None, 'Dat': None, 'Cur': None, 'HW': False, 'Ninite': True}, - - # LibreOffice - 'LibreOffice': {'New': None, 'Dat': None, 'Cur': None, 'HW': False, 'Ninite': True}, - - # Ninite - 'Base': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Ninite': True}, - 'Missing': {'New': False, 'Dat': True, 'Cur': False, 'HW': False, 'Ninite': True}, - 'Standard': {'New': True, 'Dat': True, 'Cur': False, 'HW': False, 'Ninite': True}, - } -# pylint: enable=bad-whitespace,line-too-long - - -# Functions -def check_os_and_abort(): - """Check OS and prompt to abort if not supported.""" - result = try_and_print( - message='OS support status...', - function=check_os_support_status, - cs='GOOD', - ) - if not result['CS'] and 'Unsupported' in result['Error']: - print_warning('OS version not supported by this script') - if not ask('Continue anyway? (NOT RECOMMENDED)'): - abort() - - -def get_actions(setup_mode, answers): - """Get actions to perform based on setup_mode, returns OrderedDict.""" - actions = OrderedDict({}) - for _key, _val in SETUP_ACTIONS.items(): - _action = {} - _if_answer = _val.get('If answer', False) - _win10_only = _val.get('Win10 only', False) - - # Set enabled status - _enabled = _val.get(setup_mode, False) - if _if_answer: - _enabled = _enabled and answers[_if_answer] - if _win10_only: - _enabled = _enabled and global_vars['OS']['Version'] == '10' - _action['Enabled'] = _enabled - - # Set other keys - for _sub_key in SETUP_ACTION_KEYS: - _action[_sub_key] = _val.get(_sub_key, None) - - # Fix KWArgs - if _action.get('KWArgs', {}) is None: - _action['KWArgs'] = {} - - # Handle "special" actions - if _key == 'KIT_NAME_FULL': - # Cleanup WK folders - _key = KIT_NAME_FULL - _action['KWArgs'] = {'folder_path': global_vars['ClientDir']} - elif _key == 'Ninite bundle': - # Add install_ninite_bundle() kwargs - _action['KWArgs'].update({ - kw.lower(): kv for kw, kv in answers.items() - if SETUP_QUESTIONS.get(kw, {}).get('Ninite', False) - }) - elif _key == 'Explorer (user)': - # Explorer settings (user) - _action['KWArgs'] = {'setup_mode': setup_mode} - - # Add to dict - actions[_key] = _action - - return actions - - -def get_answers(setup_mode): - """Get setup answers based on setup_mode and user input, returns dict.""" - answers = {k: v.get(setup_mode, False) for k, v in SETUP_QUESTIONS.items()} - - # Answer setup questions as needed - if answers['MSE'] is None and global_vars['OS']['Version'] == '7': - answers.update(get_av_selection()) - - if answers['LibreOffice'] is None: - answers['LibreOffice'] = ask('Install LibreOffice?') - - return answers - - -def get_av_selection(): - """Get AV selection.""" - av_answers = { - 'MSE': False, - } - av_options = [ - { - 'Name': 'Microsoft Security Essentials', - 'Disabled': global_vars['OS']['Version'] not in ['7'], - }, - ] - actions = [ - {'Name': 'None', 'Letter': 'N'}, - {'Name': 'Quit', 'Letter': 'Q'}, - ] - - # Show menu - selection = menu_select( - 'Please select an option to install', - main_entries=av_options, - action_entries=actions) - if selection.isnumeric(): - index = int(selection) - 1 - if 'Microsoft' in av_options[index]['Name']: - av_answers['MSE'] = True - elif selection == 'Q': - abort() - - return av_answers - - -def get_mode(): - """Get mode via menu_select, returns str.""" - setup_mode = None - mode_options = [ - {'Name': 'New', 'Display Name': 'New / Clean install (no data)'}, - {'Name': 'Dat', 'Display Name': 'Clean install with data migration'}, - {'Name': 'Cur', 'Display Name': 'Original OS (post-repair or overinstall)'}, - {'Name': 'HW', 'Display Name': 'Hardware service (i.e. no software work)'}, - ] - actions = [ - {'Name': 'Quit', 'Letter': 'Q'}, - ] - - # Get selection - selection = menu_select( - 'Please select a setup mode', - main_entries=mode_options, - action_entries=actions) - if selection.isnumeric(): - index = int(selection) - 1 - setup_mode = mode_options[index]['Name'] - elif selection == 'Q': - abort() - - return setup_mode - - -def main(): - """Main function.""" - stay_awake() - clear_screen() - - # Check installed OS - check_os_and_abort() - - # Get setup mode - setup_mode = get_mode() - - # Get answers to setup questions - answers = get_answers(setup_mode) - - # Get actions to perform - actions = get_actions(setup_mode, answers) - - # Perform actions - for action, values in actions.items(): - kwargs = values.get('KWArgs', {}) - - # Print info lines - if values.get('Info', False): - print_info(action) - continue - - # Print disabled actions - if not values.get('Enabled', False): - show_data( - message='{}...'.format(action), - data='DISABLED', - warning=True, - ) - continue - - # Check Windows activation if requested - if values.get('If not activated', False) and windows_is_activated(): - # Skip - continue - - # Run function - if values.get('Just run', False): - values['Function'](**kwargs) - else: - result = try_and_print( - message='{}...'.format(action), - function=values['Function'], - other_results=OTHER_RESULTS, - **kwargs) - - # Wait for Ninite proc(s) - if action == 'Ninite bundle': - print_standard('Waiting for installations to finish...') - try: - for proc in result['Out']: - proc.wait() - except KeyboardInterrupt: - pass - - # Pause - if values.get('Pause', False): - print_standard(values['Pause']) - pause() - - # Show alert box for SecureBoot issues - try: - check_secure_boot_status(show_alert=True) - except Exception: # pylint: disable=broad-except - # Ignoring exceptions since we just want to show the popup - pass - - # Done - pause('Press Enter to exit... ') - - -if __name__ == '__main__': - try: - main() - exit_script() - except SystemExit as sys_exit: - exit_script(sys_exit.code) - except: # pylint: disable=bare-except - major_exception() diff --git a/scripts/outer_scripts_to_review/transferred_keys.py b/scripts/outer_scripts_to_review/transferred_keys.py deleted file mode 100644 index 216f2046..00000000 --- a/scripts/outer_scripts_to_review/transferred_keys.py +++ /dev/null @@ -1,29 +0,0 @@ -# Wizard Kit: Search for product keys in the transfer folder - -import os -import sys - -# Init -sys.path.append(os.path.dirname(os.path.realpath(__file__))) -from functions.product_keys import * -init_global_vars() -os.system('title {}: Transferred Key Finder'.format(KIT_NAME_FULL)) -set_log_file('Transferred Keys.log') - -if __name__ == '__main__': - try: - stay_awake() - clear_screen() - print_info('{}: Transferred Key Finder\n'.format(KIT_NAME_FULL)) - try_and_print(message='Searching for keys...', - function=list_clientdir_keys, print_return=True) - - # Done - print_standard('\nDone.') - exit_script() - except SystemExit as sys_exit: - exit_script(sys_exit.code) - except: - major_exception() - -# vim: sts=2 sw=2 ts=2 diff --git a/scripts/outer_scripts_to_review/update_kit.py b/scripts/outer_scripts_to_review/update_kit.py deleted file mode 100644 index 77f527aa..00000000 --- a/scripts/outer_scripts_to_review/update_kit.py +++ /dev/null @@ -1,143 +0,0 @@ -# Wizard Kit: Download the latest versions of the programs in the kit - -import os -import sys - -# Init -sys.path.append(os.path.dirname(os.path.realpath(__file__))) -from functions.update import * -init_global_vars() -os.system('title {}: Kit Update Tool'.format(KIT_NAME_FULL)) - -if __name__ == '__main__': - try: - clear_screen() - print_info('{}: Kit Update Tool\n'.format(KIT_NAME_FULL)) - other_results = { - 'Error': { - 'CalledProcessError': 'Unknown Error', - }} - - ## Prep ## - update_sdio = ask('Update SDI Origin?') - - ## Download ## - print_success('Downloading tools') - - # Data Recovery - print_info(' Data Recovery') - try_and_print(message='TestDisk / PhotoRec...', function=update_testdisk, other_results=other_results, width=40) - - # Data Transfers - print_info(' Data Transfers') - try_and_print(message='FastCopy...', function=update_fastcopy, other_results=other_results, width=40) - try_and_print(message='wimlib...', function=update_wimlib, other_results=other_results, width=40) - try_and_print(message='XYplorer...', function=update_xyplorer, other_results=other_results, width=40) - - # Diagnostics - print_info(' Diagnostics') - try_and_print(message='AIDA64...', function=update_aida64, other_results=other_results, width=40) - try_and_print(message='Autoruns...', function=update_autoruns, other_results=other_results, width=40) - try_and_print(message='BleachBit...', function=update_bleachbit, other_results=other_results, width=40) - try_and_print(message='Blue Screen View...', function=update_bluescreenview, other_results=other_results, width=40) - try_and_print(message='ERUNT...', function=update_erunt, other_results=other_results, width=40) - try_and_print(message='Hitman Pro...', function=update_hitmanpro, other_results=other_results, width=40) - try_and_print(message='HWiNFO...', function=update_hwinfo, other_results=other_results, width=40) - try_and_print(message='NirCmd...', function=update_nircmd, other_results=other_results, width=40) - try_and_print(message='ProduKey...', function=update_produkey, other_results=other_results, width=40) - - # Drivers - print_info(' Drivers') - try_and_print(message='Intel RST...', function=update_intel_rst, other_results=other_results, width=40) - try_and_print(message='Intel SSD Toolbox...', function=update_intel_ssd_toolbox, other_results=other_results, width=40) - try_and_print(message='Samsing Magician...', function=update_samsung_magician, other_results=other_results, width=40) - if update_sdio: - try_and_print(message='Snappy Driver Installer Origin...', function=update_sdi_origin, other_results=other_results, width=40) - - # Installers - print_info(' Installers') - try_and_print(message='Adobe Reader DC...', function=update_adobe_reader_dc, other_results=other_results, width=40) - try_and_print(message='LibreOffice...', function=update_libreoffice, other_results=other_results, width=40) - try_and_print(message='Macs Fan Control...', function=update_macs_fan_control, other_results=other_results, width=40) - try_and_print(message='MS Office...', function=update_office, other_results=other_results, width=40) - try_and_print(message='Visual C++ Runtimes...', function=update_vcredists, other_results=other_results, width=40) - try_and_print(message='Windows Updates...', function=download_windows_updates, other_results=other_results, width=40) - update_all_ninite(other_results=other_results, width=40) - - # Misc - print_info(' Misc') - try_and_print(message='Caffeine...', function=update_caffeine, other_results=other_results, width=40) - try_and_print(message='Classic Start Skin...', function=update_classic_start_skin, other_results=other_results, width=40) - try_and_print(message='Du...', function=update_du, other_results=other_results, width=40) - try_and_print(message='Everything...', function=update_everything, other_results=other_results, width=40) - try_and_print(message='Firefox Extensions...', function=update_firefox_ublock_origin, other_results=other_results, width=40) - try_and_print(message='PuTTY...', function=update_putty, other_results=other_results, width=40) - try_and_print(message='Notepad++...', function=update_notepadplusplus, other_results=other_results, width=40) - try_and_print(message='WizTree...', function=update_wiztree, other_results=other_results, width=40) - try_and_print(message='XMPlay...', function=update_xmplay, other_results=other_results, width=40) - - # Repairs - print_info(' Repairs') - try_and_print(message='AdwCleaner...', function=update_adwcleaner, other_results=other_results, width=40) - try_and_print(message='KVRT...', function=update_kvrt, other_results=other_results, width=40) - try_and_print(message='RKill...', function=update_rkill, other_results=other_results, width=40) - try_and_print(message='TDSS Killer...', function=update_tdsskiller, other_results=other_results, width=40) - - # Uninstallers - print_info(' Uninstallers') - try_and_print(message='IObit Uninstaller...', function=update_iobit_uninstaller, other_results=other_results, width=40) - - ## Review ## - print_standard('Please review the results and download/extract any missing items to .cbin') - pause('Press Enter to compress the .cbin items') - - ## Compress ## - print_success('Compressing tools') - print_info(' _Drivers') - for item in os.scandir(r'{}\_Drivers'.format(global_vars['CBinDir'])): - if not re.search(r'^(_Drivers|.*7z)$', item.name, re.IGNORECASE): - try_and_print( - message='{}...'.format(item.name), - function=compress_and_remove_item, - other_results = other_results, - width=40, - item = item) - print_info(' .cbin') - for item in os.scandir(global_vars['CBinDir']): - if not re.search(r'^(_Drivers|_include|.*7z)$', item.name, re.IGNORECASE): - try_and_print( - message='{}...'.format(item.name), - function=compress_and_remove_item, - other_results = other_results, - width=40, - item = item) - - ## Generate Launchers - print_success('Generating launchers') - for section in sorted(LAUNCHERS.keys()): - print_info(' {}'.format(section)) - for name, options in sorted(LAUNCHERS[section].items()): - try_and_print(message=name, function=generate_launcher, - section=section, name=name, options=options, - other_results=other_results, width=40) - - # Rename "Copy WizardKit.cmd" (if necessary) - source = r'{}\Scripts\Copy WizardKit.cmd'.format(global_vars['BinDir']) - dest = r'{}\Copy {}.cmd'.format(global_vars['BaseDir'], KIT_NAME_FULL) - if os.path.exists(source): - try: - shutil.move(source, dest) - except Exception: - print_error(' Failed to rename "{}.cmd" to "{}.cmd"'.format( - 'Copy WizardKit', KIT_NAME_FULL)) - - # Done - print_standard('\nDone.') - pause("Press Enter to exit...") - exit_script() - except SystemExit as sys_exit: - exit_script(sys_exit.code) - except: - major_exception() - -# vim: sts=2 sw=2 ts=2 diff --git a/scripts/outer_scripts_to_review/user_data_transfer.py b/scripts/outer_scripts_to_review/user_data_transfer.py deleted file mode 100644 index 60b3c464..00000000 --- a/scripts/outer_scripts_to_review/user_data_transfer.py +++ /dev/null @@ -1,67 +0,0 @@ -# Wizard Kit: Copy user data to the system from a local or network source - -import os -import sys - -# Init -sys.path.append(os.path.dirname(os.path.realpath(__file__))) -from functions.data import * -from functions.repairs import * -init_global_vars() -os.system('title {}: User Data Transfer Tool'.format(KIT_NAME_FULL)) -set_log_file('User Data Transfer.log') - -if __name__ == '__main__': - try: - # Prep - stay_awake() - clear_screen() - print_info('{}: User Data Transfer Tool\n'.format(KIT_NAME_FULL)) - - # Get backup name prefix - ticket_number = get_ticket_number() - if ENABLED_TICKET_NUMBERS: - backup_prefix = ticket_number - else: - backup_prefix = get_simple_string(prompt='Enter backup name prefix') - backup_prefix = backup_prefix.replace(' ', '_') - - # Set destination - folder_path = r'{}\Transfer'.format(KIT_NAME_SHORT) - dest = select_destination(folder_path=folder_path, - prompt='Which disk are we transferring to?') - - # Set source items - source = select_source(backup_prefix) - items = scan_source(source, dest) - - # Transfer - clear_screen() - print_info('Transfer Details:\n') - if ENABLED_TICKET_NUMBERS: - show_data('Ticket:', ticket_number) - show_data('Source:', source.path) - show_data('Destination:', dest) - - if (not ask('Proceed with transfer?')): - umount_backup_shares() - abort() - - print_info('Transferring Data') - transfer_source(source, dest, items) - try_and_print(message='Removing extra files...', - function=cleanup_transfer, cs='Done', dest_path=dest) - umount_backup_shares() - - # Done - try_and_print(message='Running KVRT...', - function=run_kvrt, cs='Started') - print_standard('\nDone.') - pause("Press Enter to exit...") - exit_script() - except SystemExit as sys_exit: - exit_script(sys_exit.code) - except: - major_exception() - -# vim: sts=2 sw=2 ts=2 diff --git a/scripts/outer_scripts_to_review/windows_updates.py b/scripts/outer_scripts_to_review/windows_updates.py deleted file mode 100644 index e29f8c48..00000000 --- a/scripts/outer_scripts_to_review/windows_updates.py +++ /dev/null @@ -1,46 +0,0 @@ -# Wizard Kit: Windows updates - -import os -import sys - -# Init -sys.path.append(os.path.dirname(os.path.realpath(__file__))) -from functions.windows_updates import * -init_global_vars() -os.system('title {}: Windows Updates Tool'.format(KIT_NAME_FULL)) -set_log_file('Windows Updates Tool.log') - -if __name__ == '__main__': - try: - clear_screen() - print_info('{}: Windows Updates Tool\n'.format(KIT_NAME_FULL)) - - # Check args - if '--disable' in sys.argv: - disable_windows_updates() - elif '--enable' in sys.argv: - enable_windows_updates() - else: - print_error('Bad mode.') - abort() - - # Done - exit_script() - except GenericError as err: - # Failed to complete request, show error(s) and prompt tech - print_standard(' ') - for line in str(err).splitlines(): - print_warning(line) - print_standard(' ') - print_error('Error(s) encountered, see above.') - print_standard(' ') - if '--disable' in sys.argv: - print_standard('Please reboot and try again.') - pause('Press Enter to exit... ') - exit_script(1) - except SystemExit as sys_exit: - exit_script(sys_exit.code) - except: - major_exception() - -# vim: sts=2 sw=2 ts=2 diff --git a/scripts/outer_scripts_to_review/winpe_root_menu.py b/scripts/outer_scripts_to_review/winpe_root_menu.py deleted file mode 100644 index 94669609..00000000 --- a/scripts/outer_scripts_to_review/winpe_root_menu.py +++ /dev/null @@ -1,23 +0,0 @@ -# Wizard Kit: WinPE Root Menu - -import os -import sys - -# Init -sys.path.append(os.path.dirname(os.path.realpath(__file__))) -from functions.winpe_menus import * -# Fix 7-Zip name -TOOLS['SevenZip'].pop('64') -init_global_vars() -set_title('{}: Root Menu'.format(KIT_NAME_FULL)) -set_log_file('WinPE.log') - -if __name__ == '__main__': - try: - menu_root() - except SystemExit as sys_exit: - exit_script(sys_exit.code) - except: - major_exception() - -# vim: sts=2 sw=2 ts=2 diff --git a/scripts/sfc_scan.py b/scripts/sfc_scan.py index 02d84f77..b3132f1a 100644 --- a/scripts/sfc_scan.py +++ b/scripts/sfc_scan.py @@ -19,7 +19,7 @@ def main(): print('') # Run - try_print.run('SFC scan...', wk.os.win.run_sfc_scan) + try_print.run('SFC scan...', wk.repairs.win.run_sfc_scan) # Done print('Done')