Merge branch 'dev' of github.com:2Shirt/WizardKit into dev
This commit is contained in:
commit
95c8de0a21
7 changed files with 253 additions and 145 deletions
|
|
@ -64,12 +64,24 @@ class NotInstalledError(Exception):
|
|||
class NoProfilesError(Exception):
|
||||
pass
|
||||
|
||||
class OSInstalledLegacyError(Exception):
|
||||
pass
|
||||
|
||||
class PathNotFoundError(Exception):
|
||||
pass
|
||||
|
||||
class UnsupportedOSError(Exception):
|
||||
pass
|
||||
|
||||
class SecureBootDisabledError(Exception):
|
||||
pass
|
||||
|
||||
class SecureBootNotAvailError(Exception):
|
||||
pass
|
||||
|
||||
class SecureBootUnknownError(Exception):
|
||||
pass
|
||||
|
||||
# General functions
|
||||
def abort():
|
||||
"""Abort script."""
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
# Wizard Kit: Functions - Diagnostics
|
||||
|
||||
import ctypes
|
||||
|
||||
from functions.common import *
|
||||
|
||||
# STATIC VARIABLES
|
||||
|
|
@ -30,12 +32,59 @@ def check_connection():
|
|||
result = try_and_print(message='Ping test...', function=ping, cs='OK')
|
||||
if result['CS']:
|
||||
break
|
||||
if not ask('ERROR: System appears offline, try again?'):
|
||||
if ask('Continue anyway?'):
|
||||
break
|
||||
else:
|
||||
abort()
|
||||
|
||||
def check_secure_boot_status():
|
||||
"""Checks UEFI Secure Boot status via PowerShell."""
|
||||
boot_mode = get_boot_mode()
|
||||
cmd = ['PowerShell', '-Command', 'Confirm-SecureBootUEFI']
|
||||
result = run_program(cmd, check=False)
|
||||
|
||||
# Check results
|
||||
if result.returncode == 0:
|
||||
out = result.stdout.decode()
|
||||
if 'True' in out:
|
||||
# It's on, do nothing
|
||||
return
|
||||
elif 'False' in out:
|
||||
raise SecureBootDisabledError
|
||||
else:
|
||||
if not ask('ERROR: System appears offline, try again?'):
|
||||
if ask('Continue anyway?'):
|
||||
break
|
||||
else:
|
||||
abort()
|
||||
raise SecureBootUnknownError
|
||||
else:
|
||||
if boot_mode != 'UEFI':
|
||||
raise OSInstalledLegacyError
|
||||
else:
|
||||
# Check error message
|
||||
err = result.stderr.decode()
|
||||
if 'Cmdlet not supported' in err:
|
||||
raise SecureBootNotAvailError
|
||||
else:
|
||||
raise GenericError
|
||||
|
||||
def get_boot_mode():
|
||||
"""Check if Windows is booted in UEFI or Legacy mode, returns str."""
|
||||
kernel = ctypes.windll.kernel32
|
||||
firmware_type = ctypes.c_uint()
|
||||
|
||||
# Get value from kernel32 API
|
||||
try:
|
||||
kernel.GetFirmwareType(ctypes.byref(firmware_type))
|
||||
except:
|
||||
# Just set to zero
|
||||
firmware_type = ctypes.c_uint(0)
|
||||
|
||||
# Set return value
|
||||
type_str = 'Unknown'
|
||||
if firmware_type.value == 1:
|
||||
type_str = 'Legacy'
|
||||
elif firmware_type.value == 2:
|
||||
type_str = 'UEFI'
|
||||
|
||||
return type_str
|
||||
|
||||
def run_autoruns():
|
||||
"""Run AutoRuns in the background with VirusTotal checks enabled."""
|
||||
|
|
@ -61,11 +110,22 @@ def run_hwinfo_sensors():
|
|||
f.write('SummaryOnly=0\n')
|
||||
popen_program(global_vars['Tools']['HWiNFO'])
|
||||
|
||||
def run_nircmd(*cmd):
|
||||
"""Run custom NirCmd."""
|
||||
extract_item('NirCmd', silent=True)
|
||||
cmd = [global_vars['Tools']['NirCmd'], *cmd]
|
||||
run_program(cmd, check=False)
|
||||
|
||||
def run_xmplay():
|
||||
"""Run XMPlay to test audio."""
|
||||
extract_item('XMPlay', silent=True)
|
||||
cmd = [global_vars['Tools']['XMPlay'],
|
||||
r'{BinDir}\XMPlay\music.7z'.format(**global_vars)]
|
||||
|
||||
# Unmute audio first
|
||||
run_nircmd(['mutesysvolume', '0'])
|
||||
|
||||
# Open XMPlay
|
||||
popen_program(cmd)
|
||||
|
||||
def run_hitmanpro():
|
||||
|
|
|
|||
|
|
@ -435,6 +435,29 @@ def update_hwinfo():
|
|||
# Cleanup
|
||||
remove_from_temp('HWiNFO.zip')
|
||||
|
||||
def update_nircmd():
|
||||
# Stop running processes
|
||||
for exe in ['nircmdc.exe', 'nircmdc64.exe']:
|
||||
kill_process(exe)
|
||||
|
||||
# Remove existing folders
|
||||
remove_from_kit('NirCmd')
|
||||
|
||||
# Download
|
||||
download_to_temp('nircmd32.zip', SOURCE_URLS['NirCmd32'])
|
||||
download_to_temp('nircmd64.zip', SOURCE_URLS['NirCmd64'])
|
||||
|
||||
# Extract files
|
||||
extract_temp_to_cbin('nircmd64.zip', 'NirCmd', sz_args=['nircmdc.exe'])
|
||||
shutil.move(
|
||||
r'{}\NirCmd\nircmdc.exe'.format(global_vars['CBinDir']),
|
||||
r'{}\NirCmd\nircmdc64.exe'.format(global_vars['CBinDir']))
|
||||
extract_temp_to_cbin('nircmd32.zip', 'NirCmd', sz_args=['nircmdc.exe'])
|
||||
|
||||
# Cleanup
|
||||
remove_from_temp('nircmd32.zip')
|
||||
remove_from_temp('nircmd64.zip')
|
||||
|
||||
def update_produkey():
|
||||
# Stop running processes
|
||||
for exe in ['ProduKey.exe', 'ProduKey64.exe']:
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ SOURCE_URLS = {
|
|||
'Intel SSD Toolbox': r'https://downloadmirror.intel.com/27656/eng/Intel%20SSD%20Toolbox%20-%20v3.5.2.exe',
|
||||
'IOBit_Uninstaller': 'https://portableapps.duckduckgo.com/IObitUninstallerPortable_7.5.0.7.paf.exe',
|
||||
'KVRT': 'http://devbuilds.kaspersky-labs.com/devbuilds/KVRT/latest/full/KVRT.exe',
|
||||
'NirCmd32': 'https://www.nirsoft.net/utils/nircmd.zip',
|
||||
'NirCmd64': 'https://www.nirsoft.net/utils/nircmd-x64.zip',
|
||||
'NotepadPlusPlus': 'https://notepad-plus-plus.org/repository/7.x/7.5.8/npp.7.5.8.bin.minimalist.7z',
|
||||
'Office Deployment Tool 2016': 'https://download.microsoft.com/download/2/7/A/27AF1BE6-DD20-4CB4-B154-EBAB8A7D4A7E/officedeploymenttool_10810.33603.exe',
|
||||
'ProduKey32': 'http://www.nirsoft.net/utils/produkey.zip',
|
||||
|
|
@ -193,6 +195,5 @@ RST_SOURCES = {
|
|||
'SetupRST_16.5.exe': 'https://downloadmirror.intel.com/27984/eng/SetupRST.exe',
|
||||
}
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print("This file is not meant to be called directly.")
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ TOOLS = {
|
|||
'64': r'HWiNFO\HWiNFO64.exe'},
|
||||
'KVRT': {
|
||||
'32': r'KVRT\KVRT.exe'},
|
||||
'NirCmd': {
|
||||
'32': r'NirCmd\nircmdc.exe',
|
||||
'64': r'NirCmd\nircmdc64.exe'},
|
||||
'NotepadPlusPlus': {
|
||||
'32': r'NotepadPlusPlus\notepadplusplus.exe'},
|
||||
'ProduKey': {
|
||||
|
|
|
|||
|
|
@ -24,11 +24,17 @@ if __name__ == '__main__':
|
|||
ticket_number = get_ticket_number()
|
||||
other_results = {
|
||||
'Error': {
|
||||
'CalledProcessError': 'Unknown Error',
|
||||
'BIOSKeyNotFoundError': 'BIOS key not found',
|
||||
'FileNotFoundError': 'File not found',
|
||||
'BIOSKeyNotFoundError': 'BIOS key not found',
|
||||
'CalledProcessError': 'Unknown Error',
|
||||
'FileNotFoundError': 'File not found',
|
||||
'GenericError': 'Unknown Error',
|
||||
'SecureBootDisabledError': 'Disabled',
|
||||
},
|
||||
'Warning': {}}
|
||||
'Warning': {
|
||||
'OSInstalledLegacyError': 'OS installed Legacy',
|
||||
'SecureBootNotAvailError': 'Not available',
|
||||
'SecureBootUnknownError': 'Unknown',
|
||||
}}
|
||||
if ENABLED_TICKET_NUMBERS:
|
||||
print_info('Starting System Checklist for Ticket #{}\n'.format(
|
||||
ticket_number))
|
||||
|
|
@ -76,6 +82,8 @@ if __name__ == '__main__':
|
|||
try_and_print(message='BIOS Activation:',
|
||||
function=activate_with_bios,
|
||||
other_results=other_results)
|
||||
try_and_print(message='Secure Boot Status:',
|
||||
function=check_secure_boot_status, other_results=other_results)
|
||||
try_and_print(message='Installed RAM:',
|
||||
function=show_installed_ram, ns='Unknown', silent_function=False)
|
||||
show_free_space()
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ if __name__ == '__main__':
|
|||
try_and_print(message='ERUNT...', function=update_erunt, other_results=other_results, width=40)
|
||||
try_and_print(message='HitmanPro...', 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
|
||||
|
|
|
|||
Loading…
Reference in a new issue