Fix error detection in SW Diags
This commit is contained in:
parent
c25a46b49f
commit
3875d4b2bd
1 changed files with 18 additions and 17 deletions
|
|
@ -16,7 +16,6 @@ os.system('title {}: System Diagnostics Tool'.format(KIT_NAME_FULL))
|
||||||
global_vars['LogFile'] = r'{LogDir}\System Diagnostics.log'.format(
|
global_vars['LogFile'] = r'{LogDir}\System Diagnostics.log'.format(
|
||||||
**global_vars)
|
**global_vars)
|
||||||
D7_MODE = 'd7mode' in sys.argv
|
D7_MODE = 'd7mode' in sys.argv
|
||||||
ERRORS = 0
|
|
||||||
|
|
||||||
# Static Variables
|
# Static Variables
|
||||||
BLEACH_BIT_CLEANERS = {
|
BLEACH_BIT_CLEANERS = {
|
||||||
|
|
@ -68,13 +67,15 @@ BLEACH_BIT_CLEANERS = {
|
||||||
|
|
||||||
def check_result(result, other_results):
|
def check_result(result, other_results):
|
||||||
"""Check result for warnings and errors."""
|
"""Check result for warnings and errors."""
|
||||||
|
result_ok = True
|
||||||
if not result['CS']:
|
if not result['CS']:
|
||||||
for warning in other_results.get('Warning', {}).keys():
|
for warning in other_results.get('Warning', {}).keys():
|
||||||
if warning in str(result['Error']):
|
if warning in str(result['Error']):
|
||||||
# Ignore warnings and repair statements
|
# Ignore warnings and repair statements
|
||||||
return
|
return True
|
||||||
# Error is not a warning
|
# Error is not a warning
|
||||||
ERRORS += 1
|
result_ok = False
|
||||||
|
return result_ok
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
|
|
@ -82,6 +83,7 @@ if __name__ == '__main__':
|
||||||
clear_screen()
|
clear_screen()
|
||||||
print_info('{}: System Diagnostics Tool\n'.format(KIT_NAME_FULL))
|
print_info('{}: System Diagnostics Tool\n'.format(KIT_NAME_FULL))
|
||||||
ticket_number = get_ticket_number()
|
ticket_number = get_ticket_number()
|
||||||
|
system_ok = True
|
||||||
other_results = {
|
other_results = {
|
||||||
'Error': {
|
'Error': {
|
||||||
'CalledProcessError': 'Unknown Error',
|
'CalledProcessError': 'Unknown Error',
|
||||||
|
|
@ -94,7 +96,7 @@ if __name__ == '__main__':
|
||||||
if ENABLED_TICKET_NUMBERS:
|
if ENABLED_TICKET_NUMBERS:
|
||||||
print_info('Starting System Diagnostics for Ticket #{}\n'.format(
|
print_info('Starting System Diagnostics for Ticket #{}\n'.format(
|
||||||
ticket_number))
|
ticket_number))
|
||||||
|
|
||||||
# Sanitize Environment
|
# Sanitize Environment
|
||||||
print_info('Sanitizing Environment')
|
print_info('Sanitizing Environment')
|
||||||
if not D7_MODE:
|
if not D7_MODE:
|
||||||
|
|
@ -102,10 +104,10 @@ if __name__ == '__main__':
|
||||||
function=run_rkill, cs='Done', other_results=other_results)
|
function=run_rkill, cs='Done', other_results=other_results)
|
||||||
try_and_print(message='Running TDSSKiller...',
|
try_and_print(message='Running TDSSKiller...',
|
||||||
function=run_tdsskiller, cs='Done', other_results=other_results)
|
function=run_tdsskiller, cs='Done', other_results=other_results)
|
||||||
|
|
||||||
# Re-run if earlier process was stopped.
|
# Re-run if earlier process was stopped.
|
||||||
stay_awake()
|
stay_awake()
|
||||||
|
|
||||||
# Start diags
|
# Start diags
|
||||||
if not D7_MODE:
|
if not D7_MODE:
|
||||||
print_info('Starting Background Scans')
|
print_info('Starting Background Scans')
|
||||||
|
|
@ -114,25 +116,24 @@ if __name__ == '__main__':
|
||||||
function=run_hitmanpro, cs='Started', other_results=other_results)
|
function=run_hitmanpro, cs='Started', other_results=other_results)
|
||||||
try_and_print(message='Running Autoruns...',
|
try_and_print(message='Running Autoruns...',
|
||||||
function=run_autoruns, cs='Started', other_results=other_results)
|
function=run_autoruns, cs='Started', other_results=other_results)
|
||||||
|
|
||||||
# OS Health Checks
|
# OS Health Checks
|
||||||
print_info('OS Health Checks')
|
print_info('OS Health Checks')
|
||||||
result = try_and_print(
|
result = try_and_print(
|
||||||
message='CHKDSK ({SYSTEMDRIVE})...'.format(**global_vars['Env']),
|
message='CHKDSK ({SYSTEMDRIVE})...'.format(**global_vars['Env']),
|
||||||
function=run_chkdsk, other_results=other_results)
|
function=run_chkdsk, other_results=other_results)
|
||||||
check_result(result, other_results)
|
system_ok &= check_result(result, other_results)
|
||||||
result = try_and_print(message='SFC scan...',
|
result = try_and_print(message='SFC scan...',
|
||||||
function=run_sfc_scan, other_results=other_results)
|
function=run_sfc_scan, other_results=other_results)
|
||||||
check_result(result, other_results)
|
system_ok &= check_result(result, other_results)
|
||||||
if D7_MODE:
|
if D7_MODE:
|
||||||
result = try_and_print(message='DISM RestoreHealth...',
|
result = try_and_print(message='DISM RestoreHealth...',
|
||||||
function=run_dism, other_results=other_results, repair=True)
|
function=run_dism, other_results=other_results, repair=True)
|
||||||
check_result(result, other_results)
|
system_ok &= check_result(result, other_results)
|
||||||
else:
|
else:
|
||||||
try_and_print(message='DISM CheckHealth...',
|
try_and_print(message='DISM CheckHealth...',
|
||||||
function=run_dism, other_results=other_results, repair=False)
|
function=run_dism, other_results=other_results, repair=False)
|
||||||
|
|
||||||
|
|
||||||
if D7_MODE:
|
if D7_MODE:
|
||||||
# Archive all browsers for all users
|
# Archive all browsers for all users
|
||||||
archive_all_users()
|
archive_all_users()
|
||||||
|
|
@ -140,7 +141,7 @@ if __name__ == '__main__':
|
||||||
# Scan for supported browsers
|
# Scan for supported browsers
|
||||||
print_info('Scanning for browsers')
|
print_info('Scanning for browsers')
|
||||||
scan_for_browsers()
|
scan_for_browsers()
|
||||||
|
|
||||||
# Run BleachBit cleaners
|
# Run BleachBit cleaners
|
||||||
print_info('BleachBit Cleanup')
|
print_info('BleachBit Cleanup')
|
||||||
for k, v in sorted(BLEACH_BIT_CLEANERS.items()):
|
for k, v in sorted(BLEACH_BIT_CLEANERS.items()):
|
||||||
|
|
@ -148,7 +149,7 @@ if __name__ == '__main__':
|
||||||
function=run_bleachbit,
|
function=run_bleachbit,
|
||||||
cs='Done', other_results=other_results,
|
cs='Done', other_results=other_results,
|
||||||
cleaners=v, preview=bool(not D7_MODE))
|
cleaners=v, preview=bool(not D7_MODE))
|
||||||
|
|
||||||
# Export system info
|
# Export system info
|
||||||
print_info('Backup System Information')
|
print_info('Backup System Information')
|
||||||
try_and_print(message='AIDA64 reports...',
|
try_and_print(message='AIDA64 reports...',
|
||||||
|
|
@ -164,7 +165,7 @@ if __name__ == '__main__':
|
||||||
if not D7_MODE:
|
if not D7_MODE:
|
||||||
try_and_print(message='Registry...',
|
try_and_print(message='Registry...',
|
||||||
function=backup_registry, cs='Done', other_results=other_results)
|
function=backup_registry, cs='Done', other_results=other_results)
|
||||||
|
|
||||||
# Summary
|
# Summary
|
||||||
if not D7_MODE:
|
if not D7_MODE:
|
||||||
print_info('Summary')
|
print_info('Summary')
|
||||||
|
|
@ -185,7 +186,7 @@ if __name__ == '__main__':
|
||||||
other_results=other_results, print_return=True)
|
other_results=other_results, print_return=True)
|
||||||
try_and_print(message='Product Keys:',
|
try_and_print(message='Product Keys:',
|
||||||
function=get_product_keys, ns='Unknown', print_return=True)
|
function=get_product_keys, ns='Unknown', print_return=True)
|
||||||
|
|
||||||
# User data
|
# User data
|
||||||
if not D7_MODE:
|
if not D7_MODE:
|
||||||
print_info('User Data')
|
print_info('User Data')
|
||||||
|
|
@ -193,7 +194,7 @@ if __name__ == '__main__':
|
||||||
show_user_data_summary()
|
show_user_data_summary()
|
||||||
except Exception:
|
except Exception:
|
||||||
print_error(' Unknown error.')
|
print_error(' Unknown error.')
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
if not D7_MODE or ERRORS > 0:
|
if not D7_MODE or ERRORS > 0:
|
||||||
print_standard('\nDone.')
|
print_standard('\nDone.')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue