Main Kit
* Added SecureBoot check to system checklists
* Unmutes audio before launching XMPlay
* New uBlock Origin installation method for Firefox
  * It is installed via the registry, similar to Google Chrome
  * It is now installed for existing profiles
* Added Macs Fan Control
* Disabled Caffeine (see issues #64 & #65)
* Removed Visual C++ 2008 runtimes
* Fixed issues #56 & #60
* Various other minor bug fixes

Linux
* Added AMD CPU microcode and updated Intel CPU microcode
  * Includes current Meltdown/Spectre mitigations
* Lowered failure thresholds for several SMART attributes
* Fixed WizardKit UFD detection
  * The should be auto-excluded from HW-Diags again
* Restored missing photorec-sort script
* Removed HDT from legacy boot menu (see issue #57)
* Fixed issues #55 & #61
* Various other minor bug fixes
This commit is contained in:
2Shirt 2018-11-26 19:14:35 -07:00
commit ac866be092
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
78 changed files with 1409 additions and 768 deletions

View file

@ -279,9 +279,9 @@ rem Create VB script
mkdir "%bin%\tmp" 2>nul
echo Set UAC = CreateObject^("Shell.Application"^) > "%bin%\tmp\Elevate.vbs"
if defined L_NCMD (
echo UAC.ShellExecute "%PYTHON%", """%script%""", "", "runas", 3 >> "%bin%\tmp\Elevate.vbs"
echo UAC.ShellExecute "%PYTHON%", """%script%"" %L_ARGS%", "", "runas", 3 >> "%bin%\tmp\Elevate.vbs"
) else (
echo UAC.ShellExecute "%CON%", "-run ""%PYTHON%"" ""%script%"" -new_console:n", "", "runas", 1 >> "%bin%\tmp\Elevate.vbs"
echo UAC.ShellExecute "%CON%", "-run ""%PYTHON%"" ""%script%"" %L_ARGS% -new_console:n", "", "runas", 1 >> "%bin%\tmp\Elevate.vbs"
)
rem Run
@ -290,9 +290,9 @@ goto Exit
:LaunchPyScriptUser
if defined L_NCMD (
start "" "%PYTHON%" "%script%" || goto ErrorUnknown
start "" "%PYTHON%" "%script%" %L_ARGS% || goto ErrorUnknown
) else (
start "" "%CON%" -run "%PYTHON%" "%script%" -new_console:n || goto ErrorUnknown
start "" "%CON%" -run "%PYTHON%" "%script%" %L_ARGS% -new_console:n || goto ErrorUnknown
)
goto Exit
@ -332,7 +332,7 @@ echo. Executable Working Dir Program Args [L_7ZIP] [L_ELEV] [L__CLI]
echo. Folder Folder '.' [L_7ZIP]
echo. Office Year Product [L_7ZIP]
echo. PSScript Scripts Script [L_7ZIP] [L_ELEV] [L_NCMD]
echo. PyScript Scripts Script [L_7ZIP] [L_ELEV] [L_NCMD]
echo. PyScript Scripts Script Args [L_7ZIP] [L_ELEV] [L_NCMD]
echo. QuickBooks Year Product [L_7ZIP]
echo.
echo.L_7ZIP: Extra arguments for 7-Zip (in the :ExtractCBin label)

View file

@ -17,7 +17,7 @@ call :SetTitle Launcher
rem EXTRA_CODE
:DefineLaunch
:: See %bin%\SCripts\Launch.cmd for details under :Usage label
:: See %bin%\Scripts\Launch.cmd for details under :Usage label
set L_TYPE=
set L_PATH=
set L_ITEM=

View file

@ -10,7 +10,7 @@ from functions.cleanup import *
from functions.data import *
init_global_vars()
os.system('title {}: CBS Cleanup'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\CBS Cleanup.log'.format(**global_vars)
set_log_file('CBS Cleanup.log')
if __name__ == '__main__':
try:

View file

@ -9,7 +9,7 @@ sys.path.append(os.getcwd())
from functions.repairs import *
init_global_vars()
os.system('title {}: Check Disk Tool'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\Check Disk.log'.format(**global_vars)
set_log_file('Check Disk.log')
if __name__ == '__main__':
try:

View file

@ -9,7 +9,7 @@ sys.path.append(os.getcwd())
from functions.repairs import *
init_global_vars()
os.system('title {}: DISM helper Tool'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\DISM helper tool.log'.format(**global_vars)
set_log_file('DISM Helper.log')
if __name__ == '__main__':
try:

View file

@ -2,6 +2,8 @@
from functions.common import *
from operator import itemgetter
# Define other_results for later try_and_print
browser_data = {}
other_results = {
@ -101,16 +103,63 @@ SUPPORTED_BROWSERS = {
},
}
def archive_all_users():
"""Create backups for all browsers for all users."""
users_root = r'{}\Users'.format(global_vars['Env']['SYSTEMDRIVE'])
user_envs = []
# Build list of valid users
for user_name in os.listdir(users_root):
valid_user = True
if user_name in ('Default', 'Default User'):
# Skip default users
continue
user_path = os.path.join(users_root, user_name)
appdata_local = os.path.join(user_path, r'AppData\Local')
appdata_roaming = os.path.join(user_path, r'AppData\Roaming')
valid_user &= os.path.exists(appdata_local)
valid_user &= os.path.exists(appdata_roaming)
if valid_user:
user_envs.append({
'USERNAME': user_name,
'USERPROFILE': user_path,
'APPDATA': appdata_roaming,
'LOCALAPPDATA': appdata_local})
# Backup browsers for all valid users
print_info('Backing up browsers')
for fake_env in sorted(user_envs, key=itemgetter('USERPROFILE')):
print_standard(' {}'.format(fake_env['USERNAME']))
for b_k, b_v in sorted(SUPPORTED_BROWSERS.items()):
if b_k == 'Mozilla Firefox Dev':
continue
source_path = b_v['user_data_path'].format(**fake_env)
if not os.path.exists(source_path):
continue
source_items = source_path + '*'
archive_path = r'{BackupDir}\Browsers ({USERNAME})\{Date}'.format(
**global_vars, **fake_env)
os.makedirs(archive_path, exist_ok=True)
archive_path += r'\{}.7z'.format(b_k)
cmd = [
global_vars['Tools']['SevenZip'],
'a', '-aoa', '-bso0', '-bse0', '-mx=1',
archive_path, source_items]
try_and_print(message='{}...'.format(b_k),
function=run_program, cmd=cmd)
print_standard(' ')
def archive_browser(name):
"""Create backup of Browser saved in the BackupDir."""
source = '{}*'.format(browser_data[name]['user_data_path'])
dest = r'{BackupDir}\Browsers ({USERNAME})'.format(
dest = r'{BackupDir}\Browsers ({USERNAME})\{Date}'.format(
**global_vars, **global_vars['Env'])
archive = r'{}\{}.7z'.format(dest, name)
os.makedirs(dest, exist_ok=True)
cmd = [
global_vars['Tools']['SevenZip'],
'a', '-aoa', '-bso0', '-bse0', '-mx=1',
'-mhe=on', '-p{}'.format(ARCHIVE_PASSWORD),
archive, source]
run_program(cmd)
@ -332,9 +381,11 @@ def get_mozilla_profiles(search_path, dev=False):
return profiles
def install_adblock(indent=8, width=32):
def install_adblock(indent=8, width=32, just_firefox=False):
"""Install adblock for all supported browsers."""
for browser in sorted(browser_data):
if just_firefox and browser_data[browser]['base'] != 'mozilla':
continue
exe_path = browser_data[browser].get('exe_path', None)
function=run_program
if not exe_path:
@ -444,9 +495,11 @@ def reset_browsers(indent=8, width=32):
indent=indent, width=width, function=function,
other_results=other_results, profile=profile)
def scan_for_browsers():
def scan_for_browsers(just_firefox=False):
"""Scan system for any supported browsers."""
for name in sorted(SUPPORTED_BROWSERS):
for name, details in sorted(SUPPORTED_BROWSERS.items()):
if just_firefox and details['base'] != 'mozilla':
continue
try_and_print(message='{}...'.format(name),
function=get_browser_details, cs='Detected',
other_results=other_results, name=name)

View file

@ -16,15 +16,12 @@ def cleanup_adwcleaner():
shutil.move(source_quarantine, dest_name)
# Delete source folder if empty
try:
os.rmdir(source_path)
except OSError:
pass
delete_empty_folders(source_path)
# Main folder
if os.path.exists(source_path):
os.makedirs(global_vars['ProgBackupDir'], exist_ok=True)
dest_name = r'{ProgBackupDir}\AdwCleaner_{Date-Time}'.format(
os.makedirs(global_vars['LogDir'], exist_ok=True)
dest_name = r'{LogDir}\Tools\AdwCleaner'.format(
**global_vars)
dest_name = non_clobber_rename(dest_name)
shutil.move(source_path, dest_name)
@ -70,7 +67,7 @@ def cleanup_cbs(dest_folder):
def cleanup_desktop():
"""Move known backup files and reports into the ClientDir."""
dest_folder = r'{ProgBackupDir}\Desktop_{Date-Time}'.format(**global_vars)
dest_folder = r'{LogDir}\Tools'.format(**global_vars)
os.makedirs(dest_folder, exist_ok=True)
desktop_path = r'{USERPROFILE}\Desktop'.format(**global_vars['Env'])
@ -82,10 +79,51 @@ def cleanup_desktop():
shutil.move(entry.path, dest_name)
# Remove dir if empty
delete_empty_folders(dest_folder)
def delete_empty_folders(folder_path):
"""Delete all empty folders in path (depth first)."""
if not os.path.exists(folder_path) or not os.path.isdir(folder_path):
# Bail early (silently)
return
# Delete empty subfolders first
for item in os.scandir(folder_path):
if item.is_dir():
delete_empty_folders(item.path)
# Remove top folder
try:
os.rmdir(dest_folder)
os.rmdir(folder_path)
except OSError:
pass
def delete_registry_key(hive, key, recurse=False):
"""Delete a registry key and all it's subkeys."""
access = winreg.KEY_ALL_ACCESS
try:
if recurse:
# Delete all subkeys first
with winreg.OpenKeyEx(hive, key, 0, access) as k:
key_info = winreg.QueryInfoKey(k)
for x in range(key_info[0]):
subkey = r'{}\{}'.format(key, winreg.EnumKey(k, 0))
delete_registry_key(hive, subkey)
# Delete key
winreg.DeleteKey(hive, key)
except FileNotFoundError:
# Ignore
pass
def delete_registry_value(hive, key, value):
"""Delete a registry value."""
access = winreg.KEY_ALL_ACCESS
with winreg.OpenKeyEx(hive, key, 0, access) as k:
winreg.DeleteValue(k, value)
if __name__ == '__main__':
print("This file is not meant to be called directly.")
# vim: sts=4 sw=4 ts=4

View file

@ -32,7 +32,8 @@ COLORS = {
'BLUE': '\033[34m'
}
try:
HKU = winreg.HKEY_USERS
HKU = winreg.HKEY_USERS
HKCR = winreg.HKEY_CLASSES_ROOT
HKCU = winreg.HKEY_CURRENT_USER
HKLM = winreg.HKEY_LOCAL_MACHINE
except NameError:
@ -64,12 +65,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."""
@ -155,14 +168,13 @@ def exit_script(return_value=0):
# Remove dirs (if empty)
for dir in ['BackupDir', 'LogDir', 'TmpDir']:
try:
dir = global_vars[dir]
os.rmdir(dir)
os.rmdir(global_vars[dir])
except Exception:
pass
# Open Log (if it exists)
log = global_vars.get('LogFile', '')
if log and os.path.exists(log) and psutil.WINDOWS:
if log and os.path.exists(log) and psutil.WINDOWS and ENABLED_OPEN_LOGS:
try:
extract_item('NotepadPlusPlus', silent=True)
popen_program(
@ -487,6 +499,8 @@ def sleep(seconds=2):
def stay_awake():
"""Prevent the system from sleeping or hibernating."""
# DISABLED due to VCR2008 dependency
return
# Bail if caffeine is already running
for proc in psutil.process_iter():
if proc.name() == 'caffeine.exe':
@ -494,7 +508,7 @@ def stay_awake():
# Extract and run
extract_item('Caffeine', silent=True)
try:
popen_program(global_vars['Tools']['Caffeine'])
popen_program([global_vars['Tools']['Caffeine']])
except Exception:
print_error('ERROR: No caffeine available.')
print_warning('Please set the power setting to High Performance.')
@ -589,9 +603,10 @@ global_vars: {}'''.format(f.read(), sys.argv, global_vars)
CRASH_SERVER['Url'],
global_vars.get('Date-Time', 'Unknown Date-Time'),
filename)
r = requests.put(url, data=data,
headers = {'X-Requested-With': 'XMLHttpRequest'},
auth = (CRASH_SERVER['User'], CRASH_SERVER['Pass']))
r = requests.put(
url, data=data,
headers={'X-Requested-With': 'XMLHttpRequest'},
auth=(CRASH_SERVER['User'], CRASH_SERVER['Pass']))
# Raise exception if upload NS
if not r.ok:
raise Exception
@ -740,6 +755,9 @@ def make_tmp_dirs():
"""Make temp directories."""
os.makedirs(global_vars['BackupDir'], exist_ok=True)
os.makedirs(global_vars['LogDir'], exist_ok=True)
os.makedirs(r'{}\{}'.format(
global_vars['LogDir'], KIT_NAME_FULL), exist_ok=True)
os.makedirs(r'{}\Tools'.format(global_vars['LogDir']), exist_ok=True)
os.makedirs(global_vars['TmpDir'], exist_ok=True)
def set_common_vars():
@ -755,11 +773,9 @@ def set_common_vars():
**global_vars)
global_vars['ClientDir'] = r'{SYSTEMDRIVE}\{prefix}'.format(
prefix=KIT_NAME_SHORT, **global_vars['Env'])
global_vars['BackupDir'] = r'{ClientDir}\Backups\{Date}'.format(
global_vars['BackupDir'] = r'{ClientDir}\Backups'.format(
**global_vars)
global_vars['LogDir'] = r'{ClientDir}\Info\{Date}'.format(
**global_vars)
global_vars['ProgBackupDir'] = r'{ClientDir}\Backups'.format(
global_vars['LogDir'] = r'{ClientDir}\Logs\{Date}'.format(
**global_vars)
global_vars['QuarantineDir'] = r'{ClientDir}\Quarantine'.format(
**global_vars)
@ -782,5 +798,12 @@ def set_linux_vars():
'SevenZip': '7z',
}
def set_log_file(log_name):
"""Sets global var LogFile and creates path as needed."""
folder_path = r'{}\{}'.format(global_vars['LogDir'], KIT_NAME_FULL)
log_file = r'{}\{}'.format(folder_path, log_name)
os.makedirs(folder_path, exist_ok=True)
global_vars['LogFile'] = log_file
if __name__ == '__main__':
print("This file is not meant to be called directly.")

View file

@ -153,7 +153,7 @@ def cleanup_transfer(dest_path):
except Exception:
pass
def find_core_storage_volumes():
def find_core_storage_volumes(device_path=None):
"""Try to create block devices for any Apple CoreStorage volumes."""
corestorage_uuid = '53746f72-6167-11aa-aa11-00306543ecac'
dmsetup_cmd_file = '{TmpDir}/dmsetup_command'.format(**global_vars)
@ -162,6 +162,8 @@ def find_core_storage_volumes():
cmd = [
'lsblk', '--json', '--list', '--paths',
'--output', 'NAME,PARTTYPE']
if device_path:
cmd.append(device_path)
result = run_program(cmd)
json_data = json.loads(result.stdout.decode())
devs = json_data.get('blockdevices', [])
@ -248,7 +250,9 @@ def get_mounted_volumes():
mounted_volumes.extend(item.get('children', []))
return {item['source']: item for item in mounted_volumes}
def mount_volumes(all_devices=True, device_path=None, read_write=False):
def mount_volumes(
all_devices=True, device_path=None,
read_write=False, core_storage=True):
"""Mount all detected filesystems."""
report = {}
cmd = [
@ -257,9 +261,10 @@ def mount_volumes(all_devices=True, device_path=None, read_write=False):
if not all_devices and device_path:
# Only mount volumes for specific device
cmd.append(device_path)
else:
# Check for Apple CoreStorage volumes first
find_core_storage_volumes()
# Check for Apple CoreStorage volumes first
if core_storage:
find_core_storage_volumes(device_path)
# Get list of block devices
result = run_program(cmd)
@ -269,8 +274,11 @@ def mount_volumes(all_devices=True, device_path=None, read_write=False):
# Get list of volumes
volumes = {}
for dev in devs:
if not dev.get('children', []):
volumes.update({dev['name']: dev})
for child in dev.get('children', []):
volumes.update({child['name']: child})
if not child.get('children', []):
volumes.update({child['name']: child})
for grandchild in child.get('children', []):
volumes.update({grandchild['name']: grandchild})
@ -364,12 +372,9 @@ def mount_network_share(server, read_write=False):
username = server['User']
password = server['Pass']
if psutil.WINDOWS:
cmd = r'net use \\{ip}\{share} /user:{username} {password}'.format(
ip = server['IP'],
share = server['Share'],
username = username,
password = password)
cmd = cmd.split(' ')
cmd = [
'net', 'use', r'\\{IP}\{Share}'.format(**server),
'/user:{}'.format(username), password]
warning = r'Failed to mount \\{Name}\{Share}, {IP} unreachable.'.format(
**server)
error = r'Failed to mount \\{Name}\{Share} ({IP})'.format(**server)
@ -416,7 +421,7 @@ def run_fast_copy(items, dest):
raise Exception
cmd = [global_vars['Tools']['FastCopy'], *FAST_COPY_ARGS]
cmd.append(r'/logfile={}\FastCopy.log'.format(global_vars['LogDir']))
cmd.append(r'/logfile={LogDir}\Tools\FastCopy.log'.format(**global_vars))
cmd.extend(items)
cmd.append('/to={}\\'.format(dest))

View file

@ -219,6 +219,7 @@ class DevObj(BaseObj):
sep='_' if self.label else '',
c_label=self.label)
self.prefix = self.prefix.strip().replace(' ', '_')
self.prefix = self.prefix.strip().replace('/', '_')
class DirObj(BaseObj):
@ -391,7 +392,7 @@ class RecoveryState():
self.status_percent = get_formatted_status(
label='Recovered:', data=self.rescued_percent)
self.status_amount = get_formatted_status(
label='', data=human_readable_size(self.rescued))
label='', data=human_readable_size(self.rescued, decimals=2))
# Functions
@ -858,11 +859,14 @@ def run_ddrescue(state, pass_settings):
height_ddrescue = height - height_smart - height_journal
# Show SMART status
smart_dev = state.source_path
if state.source.parent:
smart_dev = state.source.parent
smart_pane = tmux_splitw(
'-bdvl', str(height_smart),
'-PF', '#D',
'watch', '--color', '--no-title', '--interval', '300',
'ddrescue-tui-smart-display', state.source_path)
'ddrescue-tui-smart-display', smart_dev)
# Show systemd journal output
journal_pane = tmux_splitw(

View file

@ -1,5 +1,7 @@
# Wizard Kit: Functions - Diagnostics
import ctypes
from functions.common import *
# STATIC VARIABLES
@ -30,12 +32,71 @@ 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(show_alert=False):
"""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:
if show_alert:
show_alert_box('Secure Boot DISABLED')
raise SecureBootDisabledError
else:
if not ask('ERROR: System appears offline, try again?'):
if ask('Continue anyway?'):
break
else:
abort()
if show_alert:
show_alert_box('Secure Boot status UNKNOWN')
raise SecureBootUnknownError
else:
if boot_mode != 'UEFI':
if (show_alert and
global_vars['OS']['Version'] in ('8', '8.1', '10')):
# OS supports Secure Boot
show_alert_box('Secure Boot DISABLED\n\nOS installed LEGACY')
raise OSInstalledLegacyError
else:
# Check error message
err = result.stderr.decode()
if 'Cmdlet not supported' in err:
if show_alert:
show_alert_box('Secure Boot UNAVAILABLE?')
raise SecureBootNotAvailError
else:
if show_alert:
show_alert_box('Secure Boot ERROR')
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 +122,23 @@ 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
extract_item('NirCmd', silent=True)
run_nircmd('mutesysvolume', '0')
# Open XMPlay
popen_program(cmd)
def run_hitmanpro():
@ -74,7 +147,7 @@ def run_hitmanpro():
cmd = [
global_vars['Tools']['HitmanPro'],
'/quiet', '/noinstall', '/noupload',
r'/log={LogDir}\hitman.xml'.format(**global_vars)]
r'/log={LogDir}\Tools\HitmanPro.txt'.format(**global_vars)]
popen_program(cmd)
def run_process_killer():
@ -92,23 +165,25 @@ def run_rkill():
extract_item('RKill', silent=True)
cmd = [
global_vars['Tools']['RKill'],
'-l', r'{LogDir}\RKill.log'.format(**global_vars),
'-s', '-l', r'{LogDir}\Tools\RKill.log'.format(**global_vars),
'-new_console:n', '-new_console:s33V']
run_program(cmd, check=False)
wait_for_process('RKill')
kill_process('notepad.exe')
# RKill cleanup
desktop_path = r'{USERPROFILE}\Desktop'.format(**global_vars['Env'])
if os.path.exists(desktop_path):
for item in os.scandir(desktop_path):
if re.search(r'^RKill', item.name, re.IGNORECASE):
dest = re.sub(r'^(.*)\.', '\1_{Date-Time}.'.format(
**global_vars), item.name)
dest = r'{ClientDir}\Info\{name}'.format(
dest = r'{LogDir}\Tools\{name}'.format(
name=dest, **global_vars)
dest = non_clobber_rename(dest)
shutil.move(item.path, dest)
def show_alert_box(message, title='Wizard Kit Warning'):
"""Show Windows alert box with message."""
message_box = ctypes.windll.user32.MessageBoxW
message_box(None, message, title, 0x00001030)
if __name__ == '__main__':
print("This file is not meant to be called directly.")

View file

@ -8,37 +8,44 @@ from functions.common import *
# STATIC VARIABLES
ATTRIBUTES = {
'NVMe': {
'critical_warning': {'Error': 1},
'media_errors': {'Error': 1},
'power_on_hours': {'Warning': 12000, 'Error': 18000, 'Ignore': True},
'critical_warning': {'Error': 1},
'media_errors': {'Error': 1},
'power_on_hours': {'Warning': 12000, 'Error': 18000, 'Ignore': True},
'unsafe_shutdowns': {'Warning': 1},
},
'SMART': {
5: {'Error': 1},
9: {'Warning': 12000, 'Error': 18000, 'Ignore': True},
10: {'Warning': 1},
184: {'Error': 1},
187: {'Warning': 1},
188: {'Warning': 1},
196: {'Warning': 1, 'Error': 10, 'Ignore': True},
197: {'Error': 1},
198: {'Error': 1},
199: {'Error': 1, 'Ignore': True},
201: {'Warning': 1},
5: {'Hex': '05', 'Error': 1},
9: {'Hex': '09', 'Warning': 12000, 'Error': 18000, 'Ignore': True},
10: {'Hex': '0A', 'Error': 1},
184: {'Hex': 'B8', 'Error': 1},
187: {'Hex': 'BB', 'Error': 1},
188: {'Hex': 'BC', 'Error': 1},
196: {'Hex': 'C4', 'Error': 1},
197: {'Hex': 'C5', 'Error': 1},
198: {'Hex': 'C6', 'Error': 1},
199: {'Hex': 'C7', 'Error': 1, 'Ignore': True},
201: {'Hex': 'C9', 'Error': 1},
},
}
IO_VARS = {
'Block Size': 512*1024,
'Chunk Size': 16*1024**2,
'Chunk Size': 32*1024**2,
'Minimum Dev Size': 8*1024**3,
'Minimum Test Size': 10*1024**3,
'Alt Test Size Factor': 0.01,
'Progress Refresh Rate': 5,
'Scale 16': [2**(0.6*x)+(16*x) for x in range(1,17)],
'Scale 32': [2**(0.6*x/2)+(16*x/2) for x in range(1,33)],
'Threshold Fail': 65*1024**2,
'Threshold Warn': 135*1024**2,
'Threshold Great': 750*1024**2,
'Scale 8': [2**(0.56*(x+1))+(16*(x+1)) for x in range(8)],
'Scale 16': [2**(0.56*(x+1))+(16*(x+1)) for x in range(16)],
'Scale 32': [2**(0.56*(x+1)/2)+(16*(x+1)/2) for x in range(32)],
'Threshold Graph Fail': 65*1024**2,
'Threshold Graph Warn': 135*1024**2,
'Threshold Graph Great': 750*1024**2,
'Threshold HDD Min': 50*1024**2,
'Threshold HDD High Avg': 75*1024**2,
'Threshold HDD Low Avg': 65*1024**2,
'Threshold SSD Min': 90*1024**2,
'Threshold SSD High Avg': 135*1024**2,
'Threshold SSD Low Avg': 100*1024**2,
'Graph Horizontal': ('', '', '', '', '', '', '', ''),
'Graph Horizontal Width': 40,
'Graph Vertical': (
@ -59,6 +66,7 @@ TESTS = {
'NVMe/SMART': {
'Enabled': False,
'Quick': False,
'Short Test': {},
'Status': {},
},
'badblocks': {
@ -67,38 +75,63 @@ TESTS = {
'Status': {},
},
'iobenchmark': {
'Data': {},
'Enabled': False,
'Results': {},
'Status': {},
},
}
def generate_horizontal_graph(rates):
def generate_horizontal_graph(rates, oneline=False):
"""Generate two-line horizontal graph from rates, returns str."""
line_top = ''
line_bottom = ''
line_1 = ''
line_2 = ''
line_3 = ''
line_4 = ''
for r in rates:
step = get_graph_step(r, scale=16)
step = get_graph_step(r, scale=32)
if oneline:
step = get_graph_step(r, scale=8)
# Set color
r_color = COLORS['CLEAR']
if r < IO_VARS['Threshold Fail']:
if r < IO_VARS['Threshold Graph Fail']:
r_color = COLORS['RED']
elif r < IO_VARS['Threshold Warn']:
elif r < IO_VARS['Threshold Graph Warn']:
r_color = COLORS['YELLOW']
elif r > IO_VARS['Threshold Great']:
elif r > IO_VARS['Threshold Graph Great']:
r_color = COLORS['GREEN']
# Build graph
if step < 8:
line_top += ' '
line_bottom += '{}{}'.format(r_color, IO_VARS['Graph Horizontal'][step])
full_block = '{}{}'.format(r_color, IO_VARS['Graph Horizontal'][-1])
if step >= 24:
line_1 += '{}{}'.format(r_color, IO_VARS['Graph Horizontal'][step-24])
line_2 += full_block
line_3 += full_block
line_4 += full_block
elif step >= 16:
line_1 += ' '
line_2 += '{}{}'.format(r_color, IO_VARS['Graph Horizontal'][step-16])
line_3 += full_block
line_4 += full_block
elif step >= 8:
line_1 += ' '
line_2 += ' '
line_3 += '{}{}'.format(r_color, IO_VARS['Graph Horizontal'][step-8])
line_4 += full_block
else:
line_top += '{}{}'.format(r_color, IO_VARS['Graph Horizontal'][step-8])
line_bottom += '{}{}'.format(r_color, IO_VARS['Graph Horizontal'][-1])
line_top += COLORS['CLEAR']
line_bottom += COLORS['CLEAR']
return '{}\n{}'.format(line_top, line_bottom)
line_1 += ' '
line_2 += ' '
line_3 += ' '
line_4 += '{}{}'.format(r_color, IO_VARS['Graph Horizontal'][step])
line_1 += COLORS['CLEAR']
line_2 += COLORS['CLEAR']
line_3 += COLORS['CLEAR']
line_4 += COLORS['CLEAR']
if oneline:
return line_4
else:
return '\n'.join([line_1, line_2, line_3, line_4])
def get_graph_step(rate, scale=16):
"""Get graph step based on rate and scale, returns int."""
@ -144,7 +177,7 @@ def get_smart_value(smart_data, smart_id):
def get_status_color(s):
"""Get color based on status, returns str."""
color = COLORS['CLEAR']
if s in ['Denied', 'NS', 'OVERRIDE']:
if s in ['Denied', 'ERROR', 'NS', 'OVERRIDE']:
color = COLORS['RED']
elif s in ['Aborted', 'Unknown', 'Working', 'Skipped']:
color = COLORS['YELLOW']
@ -199,16 +232,21 @@ def menu_diags(*args):
action_entries = actions,
spacer = '──────────────────────────')
if selection.isnumeric():
ticket_number = None
if diag_modes[int(selection)-1]['Name'] != 'Quick drive test':
# Save log for non-quick tests
clear_screen()
print_standard(' ')
ticket_number = get_ticket_number()
global_vars['LogDir'] = '{}/Logs/{}'.format(
# Save log for non-quick tests
global_vars['Date-Time'] = time.strftime("%Y-%m-%d_%H%M_%z")
global_vars['LogDir'] = '{}/Logs/{}_{}'.format(
global_vars['Env']['HOME'],
ticket_number if ticket_number else global_vars['Date-Time'])
ticket_number,
global_vars['Date-Time'])
os.makedirs(global_vars['LogDir'], exist_ok=True)
global_vars['LogFile'] = '{}/Hardware Diagnostics.log'.format(
global_vars['LogDir'])
run_tests(diag_modes[int(selection)-1]['Tests'])
run_tests(diag_modes[int(selection)-1]['Tests'], ticket_number)
elif selection == 'A':
run_program(['hw-diags-audio'], check=False, pipe=False)
pause('Press Enter to return to main menu... ')
@ -230,7 +268,7 @@ def menu_diags(*args):
elif selection == 'Q':
break
def run_badblocks():
def run_badblocks(ticket_number):
"""Run a read-only test for all detected disks."""
aborted = False
clear_screen()
@ -292,7 +330,7 @@ def run_badblocks():
run_program('tmux kill-pane -a'.split(), check=False)
pass
def run_iobenchmark():
def run_iobenchmark(ticket_number):
"""Run a read-only test for all detected disks."""
aborted = False
clear_screen()
@ -338,10 +376,10 @@ def run_iobenchmark():
dev_size = int(dev_size)
except:
# Failed to get dev size, requires manual testing instead
TESTS['iobenchmark']['Status'][name] = 'Unknown'
TESTS['iobenchmark']['Status'][name] = 'ERROR'
continue
if dev_size < IO_VARS['Minimum Dev Size']:
TESTS['iobenchmark']['Status'][name] = 'Unknown'
TESTS['iobenchmark']['Status'][name] = 'ERROR'
continue
# Calculate dd values
@ -385,14 +423,16 @@ def run_iobenchmark():
# Run dd read tests
offset = 0
read_rates = []
TESTS['iobenchmark']['Data'][name] = {
'Graph': [],
'Read Rates': []}
for i in range(test_chunks):
i += 1
s = skip_count
c = int(IO_VARS['Chunk Size'] / IO_VARS['Block Size'])
if skip_extra and i % skip_extra == 0:
s += 1
cmd = 'sudo dd bs={b} skip={s} count={c} if=/dev/{n} of={o}'.format(
cmd = 'sudo dd bs={b} skip={s} count={c} if=/dev/{n} of={o} iflag=direct'.format(
b=IO_VARS['Block Size'],
s=offset+s,
c=c,
@ -400,12 +440,18 @@ def run_iobenchmark():
o='/dev/null')
result = run_program(cmd.split())
result_str = result.stderr.decode().replace('\n', '')
read_rates.append(get_read_rate(result_str))
cur_rate = get_read_rate(result_str)
TESTS['iobenchmark']['Data'][name]['Read Rates'].append(
cur_rate)
TESTS['iobenchmark']['Data'][name]['Graph'].append(
'{percent:0.1f} {rate}'.format(
percent=i/test_chunks*100,
rate=int(cur_rate/(1024**2))))
if i % IO_VARS['Progress Refresh Rate'] == 0:
# Update vertical graph
update_io_progress(
percent=i/test_chunks*100,
rate=read_rates[-1],
rate=cur_rate,
progress_file=progress_file)
# Update offset
offset += s + c
@ -415,25 +461,45 @@ def run_iobenchmark():
run_program(['tmux', 'kill-pane', '-t', bottom_pane])
# Build report
h_graph_rates = []
avg_min_max = 'Average read speed: {:3.1f} MB/s (Min: {:3.1f}, Max: {:3.1f})'.format(
sum(TESTS['iobenchmark']['Data'][name]['Read Rates'])/len(
TESTS['iobenchmark']['Data'][name]['Read Rates'])/(1024**2),
min(TESTS['iobenchmark']['Data'][name]['Read Rates'])/(1024**2),
max(TESTS['iobenchmark']['Data'][name]['Read Rates'])/(1024**2))
TESTS['iobenchmark']['Data'][name]['Avg/Min/Max'] = avg_min_max
TESTS['iobenchmark']['Data'][name]['Merged Rates'] = []
pos = 0
width = int(test_chunks / IO_VARS['Graph Horizontal Width'])
for i in range(IO_VARS['Graph Horizontal Width']):
# Append average rate for WIDTH number of rates to new array
h_graph_rates.append(sum(read_rates[pos:pos+width])/width)
TESTS['iobenchmark']['Data'][name]['Merged Rates'].append(sum(
TESTS['iobenchmark']['Data'][name]['Read Rates'][pos:pos+width])/width)
pos += width
report = generate_horizontal_graph(h_graph_rates)
report += '\nRead speed: {:3.1f} MB/s (Min: {:3.1f}, Max: {:3.1f})'.format(
sum(read_rates)/len(read_rates)/(1024**2),
min(read_rates)/(1024**2),
max(read_rates)/(1024**2))
report = generate_horizontal_graph(
TESTS['iobenchmark']['Data'][name]['Merged Rates'])
report += '\n{}'.format(avg_min_max)
TESTS['iobenchmark']['Results'][name] = report
# Set CS/NS
if min(read_rates) <= IO_VARS['Threshold Fail']:
min_read = min(TESTS['iobenchmark']['Data'][name]['Read Rates'])
avg_read = sum(
TESTS['iobenchmark']['Data'][name]['Read Rates'])/len(
TESTS['iobenchmark']['Data'][name]['Read Rates'])
dev_rotational = dev['lsblk'].get('rota', None)
if dev_rotational == "0":
# Use SSD scale
thresh_min = IO_VARS['Threshold SSD Min']
thresh_high_avg = IO_VARS['Threshold SSD High Avg']
thresh_low_avg = IO_VARS['Threshold SSD Low Avg']
else:
# Use HDD scale
thresh_min = IO_VARS['Threshold HDD Min']
thresh_high_avg = IO_VARS['Threshold HDD High Avg']
thresh_low_avg = IO_VARS['Threshold HDD Low Avg']
if min_read <= thresh_min and avg_read <= thresh_high_avg:
TESTS['iobenchmark']['Status'][name] = 'NS'
elif avg_read <= thresh_low_avg:
TESTS['iobenchmark']['Status'][name] = 'NS'
elif min(read_rates) <= IO_VARS['Threshold Warn']:
TESTS['iobenchmark']['Status'][name] = 'Unknown'
else:
TESTS['iobenchmark']['Status'][name] = 'CS'
@ -441,15 +507,14 @@ def run_iobenchmark():
dest_filename = '{}/iobenchmark-{}.log'.format(global_vars['LogDir'], name)
shutil.move(progress_file, dest_filename)
with open(dest_filename.replace('.', '-raw.'), 'a') as f:
for rate in read_rates:
f.write('{} MB/s\n'.format(rate/(1024**2)))
f.write('\n'.join(TESTS['iobenchmark']['Data'][name]['Graph']))
update_progress()
# Done
run_program('tmux kill-pane -a'.split(), check=False)
pass
def run_mprime():
def run_mprime(ticket_number):
"""Run Prime95 for MPRIME_LIMIT minutes while showing the temps."""
aborted = False
print_log('\nStart Prime95 test')
@ -469,13 +534,18 @@ def run_mprime():
try:
for i in range(int(MPRIME_LIMIT)):
clear_screen()
print_standard('Running Prime95 ({} minutes left)'.format(
int(MPRIME_LIMIT)-i))
min_left = int(MPRIME_LIMIT) - i
print_standard('Running Prime95 ({} minute{} left)'.format(
min_left,
's' if min_left != 1 else ''))
print_warning('If running too hot, press CTRL+c to abort the test')
sleep(60)
except KeyboardInterrupt:
# Catch CTRL+C
aborted = True
TESTS['Prime95']['Status'] = 'Aborted'
print_warning('\nAborted.')
update_progress()
# Save "final" temps
run_program(
@ -523,15 +593,7 @@ def run_mprime():
TESTS['Prime95']['CS'] = bool(r)
# Update status
if aborted:
TESTS['Prime95']['Status'] = 'Aborted'
print_warning('\nAborted.')
update_progress()
if TESTS['NVMe/SMART']['Enabled'] or TESTS['badblocks']['Enabled']:
if not ask('Proceed to next test?'):
run_program('tmux kill-pane -a'.split())
raise GenericError
else:
if not aborted:
if TESTS['Prime95']['NS']:
TESTS['Prime95']['Status'] = 'NS'
elif TESTS['Prime95']['CS']:
@ -540,10 +602,21 @@ def run_mprime():
TESTS['Prime95']['Status'] = 'Unknown'
update_progress()
if aborted:
if TESTS['NVMe/SMART']['Enabled'] or TESTS['badblocks']['Enabled']:
if not ask('Proceed to next test?'):
for name in TESTS['NVMe/SMART']['Devices'].keys():
for t in ['NVMe/SMART', 'badblocks', 'iobenchmark']:
cur_status = TESTS[t]['Status'][name]
if cur_status not in ['CS', 'Denied', 'NS']:
TESTS[t]['Status'][name] = 'Aborted'
run_program('tmux kill-pane -a'.split())
raise GenericError
# Done
run_program('tmux kill-pane -a'.split())
def run_nvme_smart():
def run_nvme_smart(ticket_number):
"""Run the built-in NVMe or SMART test for all detected disks."""
aborted = False
clear_screen()
@ -565,6 +638,7 @@ def run_nvme_smart():
# Run
for name, dev in sorted(TESTS['NVMe/SMART']['Devices'].items()):
TESTS['NVMe/SMART']['Short Test'][name] = None
cur_status = TESTS['NVMe/SMART']['Status'][name]
if cur_status == 'OVERRIDE':
# Skipping test per user request
@ -630,18 +704,24 @@ def run_nvme_smart():
'passed', False)
if test_passed:
TESTS['NVMe/SMART']['Status'][name] = 'CS'
TESTS['NVMe/SMART']['Short Test'][name] = 'CS'
else:
TESTS['NVMe/SMART']['Status'][name] = 'NS'
TESTS['NVMe/SMART']['Short Test'][name] = 'NS'
update_progress()
print_standard('Done', timestamp=False)
# Done
run_program('tmux kill-pane -a'.split(), check=False)
def run_tests(tests):
def run_tests(tests, ticket_number=None):
"""Run selected hardware test(s)."""
print_log('Starting Hardware Diagnostics')
print_log('\nRunning tests: {}'.format(', '.join(tests)))
clear_screen()
print_standard('Starting Hardware Diagnostics')
if ticket_number:
print_standard(' For Ticket #{}'.format(ticket_number))
print_standard(' ')
print_standard('Running tests: {}'.format(', '.join(tests)))
# Enable selected tests
for t in ['Prime95', 'NVMe/SMART', 'badblocks', 'iobenchmark']:
TESTS[t]['Enabled'] = t in tests
@ -650,7 +730,6 @@ def run_tests(tests):
# Initialize
if TESTS['NVMe/SMART']['Enabled'] or TESTS['badblocks']['Enabled'] or TESTS['iobenchmark']['Enabled']:
print_standard(' ')
print_standard('Scanning disks...')
scan_disks()
update_progress()
@ -658,22 +737,22 @@ def run_tests(tests):
mprime_aborted = False
if TESTS['Prime95']['Enabled']:
try:
run_mprime()
run_mprime(ticket_number)
except GenericError:
mprime_aborted = True
if not mprime_aborted:
if TESTS['NVMe/SMART']['Enabled']:
run_nvme_smart()
run_nvme_smart(ticket_number)
if TESTS['badblocks']['Enabled']:
run_badblocks()
run_badblocks(ticket_number)
if TESTS['iobenchmark']['Enabled']:
run_iobenchmark()
run_iobenchmark(ticket_number)
# Show results
show_results()
# Open log
if not TESTS['NVMe/SMART']['Quick']:
if not TESTS['NVMe/SMART']['Quick'] and ENABLED_OPEN_LOGS:
try:
popen_program(['nohup', 'leafpad', global_vars['LogFile']], pipe=True)
except Exception:
@ -683,7 +762,6 @@ def run_tests(tests):
def scan_disks(full_paths=False, only_path=None):
"""Scan for disks eligible for hardware testing."""
clear_screen()
# Get eligible disk list
cmd = ['lsblk', '-J', '-O']
@ -703,8 +781,13 @@ def scan_disks(full_paths=False, only_path=None):
TESTS['iobenchmark']['Status'][d['name']] = 'Pending'
else:
# Skip WizardKit devices
wk_label = '{}_LINUX'.format(KIT_NAME_SHORT)
if wk_label not in [c.get('label', '') for c in d.get('children', [])]:
skip_dev=False
wk_label_regex = r'{}_(LINUX|UFD)'.format(KIT_NAME_SHORT)
for c in d.get('children', []):
r = re.search(
wk_label_regex, c.get('label', ''), re.IGNORECASE)
skip_dev = bool(r)
if not skip_dev:
devs[d['name']] = {'lsblk': d}
TESTS['NVMe/SMART']['Status'][d['name']] = 'Pending'
TESTS['badblocks']['Status'][d['name']] = 'Pending'
@ -742,7 +825,12 @@ def scan_disks(full_paths=False, only_path=None):
]
if data.get('NVMe Disk', False):
crit_warn = data['nvme-cli'].get('critical_warning', 1)
data['Quick Health OK'] = True if crit_warn == 0 else False
if crit_warn == 0:
dev_name = data['lsblk']['name']
data['Quick Health OK'] = True
TESTS['NVMe/SMART']['Status'][dev_name] = 'CS'
else:
data['Quick Health OK'] = False
elif set(wanted_smart_list).issubset(data['smartctl'].keys()):
data['SMART Pass'] = data['smartctl'].get('smart_status', {}).get(
'passed', False)
@ -772,7 +860,7 @@ def scan_disks(full_paths=False, only_path=None):
if ask('Run tests on this device anyway?'):
TESTS['NVMe/SMART']['Status'][dev_name] = 'OVERRIDE'
else:
TESTS['NVMe/SMART']['Status'][dev_name] = 'NS'
TESTS['NVMe/SMART']['Status'][dev_name] = 'Skipped'
TESTS['badblocks']['Status'][dev_name] = 'Denied'
TESTS['iobenchmark']['Status'][dev_name] = 'Denied'
print_standard(' ') # In case there's more than one "OVERRIDE" disk
@ -949,13 +1037,13 @@ def update_io_progress(percent, rate, progress_file):
bar_color = COLORS['CLEAR']
rate_color = COLORS['CLEAR']
step = get_graph_step(rate, scale=32)
if rate < IO_VARS['Threshold Fail']:
if rate < IO_VARS['Threshold Graph Fail']:
bar_color = COLORS['RED']
rate_color = COLORS['YELLOW']
elif rate < IO_VARS['Threshold Warn']:
elif rate < IO_VARS['Threshold Graph Warn']:
bar_color = COLORS['YELLOW']
rate_color = COLORS['YELLOW']
elif rate > IO_VARS['Threshold Great']:
elif rate > IO_VARS['Threshold Graph Great']:
bar_color = COLORS['GREEN']
rate_color = COLORS['GREEN']
line = ' {p:5.1f}% {b_color}{b:<4} {r_color}{r:6.1f} Mb/s{c}\n'.format(

View file

@ -68,7 +68,8 @@ def backup_file_list():
def backup_power_plans():
"""Export current power plans."""
os.makedirs(r'{BackupDir}\Power Plans'.format(**global_vars), exist_ok=True)
os.makedirs(r'{BackupDir}\Power Plans\{Date}'.format(
**global_vars), exist_ok=True)
plans = run_program(['powercfg', '/L'])
plans = plans.stdout.decode().splitlines()
plans = [p for p in plans if re.search(r'^Power Scheme', p)]
@ -76,22 +77,24 @@ def backup_power_plans():
guid = re.sub(r'Power Scheme GUID:\s+([0-9a-f\-]+).*', r'\1', p)
name = re.sub(
r'Power Scheme GUID:\s+[0-9a-f\-]+\s+\(([^\)]+)\).*', r'\1', p)
out = r'{BackupDir}\Power Plans\{name}.pow'.format(
out = r'{BackupDir}\Power Plans\{Date}\{name}.pow'.format(
name=name, **global_vars)
if not os.path.exists(out):
cmd = ['powercfg', '-export', out, guid]
run_program(cmd, check=False)
def backup_registry():
def backup_registry(overwrite=False):
"""Backup registry including user hives."""
extract_item('erunt', silent=True)
cmd = [
global_vars['Tools']['ERUNT'],
r'{BackupDir}\Registry'.format(**global_vars),
r'{BackupDir}\Registry\{Date}'.format(**global_vars),
'sysreg',
'curuser',
'otherusers',
'/noprogresswindow']
if overwrite:
cmd.append('/noconfirmdelete')
run_program(cmd)
def get_folder_size(path):
@ -368,26 +371,38 @@ def run_aida64():
'/TEXT', '/SILENT', '/SAFEST']
run_program(cmd, check=False)
def run_bleachbit():
def run_bleachbit(cleaners=None, preview=True):
"""Run BleachBit preview and save log.
This is a preview so no files should be deleted."""
if not os.path.exists(global_vars['LogDir']+r'\BleachBit.log'):
extract_item('BleachBit', silent=True)
cmd = [global_vars['Tools']['BleachBit'], '--preview', '--preset']
out = run_program(cmd, check=False)
# Save stderr
if out.stderr.decode().splitlines():
with open(global_vars['LogDir']+r'\BleachBit.err', 'a',
encoding='utf-8') as f:
for line in out.stderr.decode().splitlines():
f.write(line.strip() + '\n')
# Save stdout
with open(global_vars['LogDir']+r'\BleachBit.log', 'a',
encoding='utf-8') as f:
for line in out.stdout.decode().splitlines():
If preview is True then no files should be deleted."""
error_path = r'{}\Tools\BleachBit.err'.format(global_vars['LogDir'])
log_path = error_path.replace('err', 'log')
extract_item('BleachBit', silent=True)
# Safety check
if not cleaners:
# Disable cleaning and use preset config
cleaners = ['--preset']
preview = True
# Run
cmd = [
global_vars['Tools']['BleachBit'],
'--preview' if preview else '--clean']
cmd.extend(cleaners)
out = run_program(cmd, check=False)
# Save stderr
if out.stderr.decode().splitlines():
with open(error_path, 'a', encoding='utf-8') as f:
for line in out.stderr.decode().splitlines():
f.write(line.strip() + '\n')
# Save stdout
with open(log_path, 'a', encoding='utf-8') as f:
for line in out.stdout.decode().splitlines():
f.write(line.strip() + '\n')
def show_disk_usage(disk):
"""Show free and used space for a specified disk."""
print_standard('{:5}'.format(disk.device.replace('/', ' ')),
@ -459,7 +474,7 @@ def show_os_name():
def show_temp_files_size():
"""Show total size of temp files identified by BleachBit."""
size = None
with open(r'{LogDir}\BleachBit.log'.format(**global_vars), 'r') as f:
with open(r'{LogDir}\Tools\BleachBit.log'.format(**global_vars), 'r') as f:
for line in f.readlines():
if re.search(r'^disk space to be recovered:', line, re.IGNORECASE):
size = re.sub(r'.*: ', '', line.strip())

View file

@ -24,11 +24,11 @@ def run_chkdsk_scan():
raise GenericError
# Save stderr
with open(r'{LogDir}\CHKDSK.err'.format(**global_vars), 'a') as f:
with open(r'{LogDir}\Tools\CHKDSK.err'.format(**global_vars), 'a') as f:
for line in out.stderr.decode().splitlines():
f.write(line.strip() + '\n')
# Save stdout
with open(r'{LogDir}\CHKDSK.log'.format(**global_vars), 'a') as f:
with open(r'{LogDir}\Tools\CHKDSK.log'.format(**global_vars), 'a') as f:
for line in out.stdout.decode().splitlines():
f.write(line.strip() + '\n')
@ -50,7 +50,7 @@ def run_dism(repair=False):
cmd = [
'DISM', '/Online',
'/Cleanup-Image', '/RestoreHealth',
r'/LogPath:"{LogDir}\DISM_RestoreHealth.log"'.format(
r'/LogPath:"{LogDir}\Tools\DISM_RestoreHealth.log"'.format(
**global_vars),
'-new_console:n', '-new_console:s33V']
else:
@ -58,7 +58,7 @@ def run_dism(repair=False):
cmd = [
'DISM', '/Online',
'/Cleanup-Image', '/ScanHealth',
r'/LogPath:"{LogDir}\DISM_ScanHealth.log"'.format(
r'/LogPath:"{LogDir}\Tools\DISM_ScanHealth.log"'.format(
**global_vars),
'-new_console:n', '-new_console:s33V']
run_program(cmd, pipe=False, check=False, shell=True)
@ -67,7 +67,7 @@ def run_dism(repair=False):
cmd = [
'DISM', '/Online',
'/Cleanup-Image', '/CheckHealth',
r'/LogPath:"{LogDir}\DISM_CheckHealth.log"'.format(**global_vars)]
r'/LogPath:"{LogDir}\Tools\DISM_CheckHealth.log"'.format(**global_vars)]
result = run_program(cmd, shell=True).stdout.decode()
# Check result
if 'no component store corruption detected' not in result.lower():
@ -93,11 +93,11 @@ def run_sfc_scan():
'/scannow']
out = run_program(cmd, check=False)
# Save stderr
with open(r'{LogDir}\SFC.err'.format(**global_vars), 'a') as f:
with open(r'{LogDir}\Tools\SFC.err'.format(**global_vars), 'a') as f:
for line in out.stderr.decode('utf-8', 'ignore').splitlines():
f.write(line.strip() + '\n')
# Save stdout
with open(r'{LogDir}\SFC.log'.format(**global_vars), 'a') as f:
with open(r'{LogDir}\Tools\SFC.log'.format(**global_vars), 'a') as f:
for line in out.stdout.decode('utf-8', 'ignore').splitlines():
f.write(line.strip() + '\n')
# Check result
@ -116,7 +116,7 @@ def run_tdsskiller():
**global_vars), exist_ok=True)
cmd = [
global_vars['Tools']['TDSSKiller'],
'-l', r'{LogDir}\TDSSKiller.log'.format(**global_vars),
'-l', r'{LogDir}\Tools\TDSSKiller.log'.format(**global_vars),
'-qpath', r'{QuarantineDir}\TDSSKiller'.format(**global_vars),
'-accepteula', '-accepteulaksn',
'-dcexact', '-tdlfs']

View file

@ -1,8 +1,11 @@
# Wizard Kit: Functions - Setup
from functions.common import *
from functions.update import *
# STATIC VARIABLES
HKU = winreg.HKEY_USERS
HKCR = winreg.HKEY_CLASSES_ROOT
HKCU = winreg.HKEY_CURRENT_USER
HKLM = winreg.HKEY_LOCAL_MACHINE
MOZILLA_FIREFOX_UBO_PATH = r'{}\{}\ublock_origin.xpi'.format(
@ -29,15 +32,22 @@ SETTINGS_CLASSIC_START = {
},
}
SETTINGS_EXPLORER_SYSTEM = {
# Disable Location Tracking
r'Software\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}': {
'DWORD Items': {'SensorPermissionState': 0},
},
r'System\CurrentControlSet\Services\lfsvc\Service\Configuration': {
'Status': {'Value': 0},
},
# Disable Telemetry
r'SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection': {
r'Software\Microsoft\Windows\CurrentVersion\Policies\DataCollection': {
'DWORD Items': {'AllowTelemetry': 0},
},
r'SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection': {
r'Software\Microsoft\Windows\CurrentVersion\Policies\DataCollection': {
'DWORD Items': {'AllowTelemetry': 0},
'WOW64_32': True,
},
r'SOFTWARE\Policies\Microsoft\Windows\DataCollection': {
r'Software\Policies\Microsoft\Windows\DataCollection': {
'DWORD Items': {'AllowTelemetry': 0},
},
# Disable Wi-Fi Sense
@ -47,27 +57,19 @@ SETTINGS_EXPLORER_SYSTEM = {
r'Software\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots': {
'DWORD Items': {'Value': 0},
},
# Disable Location Tracking
r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}': {
'DWORD Items': {'SensorPermissionState': 0},
},
r'System\CurrentControlSet\Services\lfsvc\Service\Configuration': {
'Status': {'Value': 0},
},
}
SETTINGS_EXPLORER_USER = {
# Disable Cortana
r'Software\Microsoft\Personalization\Settings': {
'DWORD Items': {'AcceptedPrivacyPolicy': 0},
# Disable silently installed apps
r'Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager': {
'DWORD Items': {'SilentInstalledAppsEnabled': 0},
},
r'Software\Microsoft\InputPersonalization': {
'DWORD Items': {
'RestrictImplicitTextCollection': 1,
'RestrictImplicitInkCollection': 1
},
# Disable Tips and Tricks
r'Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager': {
'DWORD Items': {'SoftLandingEnabled ': 0},
},
r'Software\Microsoft\InputPersonalization\TrainedDataStore': {
'DWORD Items': {'HarvestContacts': 1},
# Hide People bar
r'Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People': {
'DWORD Items': {'PeopleBand': 0},
},
# Hide Search button / box
r'Software\Microsoft\Windows\CurrentVersion\Search': {
@ -104,10 +106,6 @@ SETTINGS_MOZILLA_FIREFOX_64 = {
},
}
VCR_REDISTS = [
{'Name': 'Visual C++ 2008 SP1 x32...',
'Cmd': [r'2008sp1\x32\vcredist.exe', '/qb! /norestart']},
{'Name': 'Visual C++ 2008 SP1 x64...',
'Cmd': [r'2008sp1\x64\vcredist.exe', '/qb! /norestart']},
{'Name': 'Visual C++ 2010 x32...',
'Cmd': [r'2010sp1\x32\vcredist.exe', '/passive', '/norestart']},
{'Name': 'Visual C++ 2010 x64...',
@ -182,6 +180,35 @@ def config_classicstart():
sleep(1)
popen_program(cs_exe)
def config_explorer_system():
"""Configure Windows Explorer for all users via Registry settings."""
write_registry_settings(SETTINGS_EXPLORER_SYSTEM, all_users=True)
def config_explorer_user():
"""Configure Windows Explorer for current user via Registry settings."""
write_registry_settings(SETTINGS_EXPLORER_USER, all_users=False)
def disable_windows_telemetry():
"""Disable Windows 10 telemetry settings with O&O ShutUp10."""
extract_item('ShutUp10', silent=True)
cmd = [
r'{BinDir}\ShutUp10\OOSU10.exe'.format(**global_vars),
r'{BinDir}\ShutUp10\1201.cfg'.format(**global_vars),
'/quiet']
run_program(cmd)
def update_clock():
"""Set Timezone and sync clock."""
run_program(['tzutil' ,'/s', WINDOWS_TIME_ZONE], check=False)
run_program(['net', 'stop', 'w32ime'], check=False)
run_program(
['w32tm', '/config', '/syncfromflags:manual',
'/manualpeerlist:"us.pool.ntp.org time.nist.gov time.windows.com"',
],
check=False)
run_program(['net', 'start', 'w32ime'], check=False)
run_program(['w32tm', '/resync', '/nowait'], check=False)
def write_registry_settings(settings, all_users=False):
"""Write registry values from custom dict of dicts."""
hive = HKCU
@ -201,26 +228,6 @@ def write_registry_settings(settings, all_users=False):
for name, value in v.get('SZ Items', {}).items():
winreg.SetValueEx(key, name, 0, winreg.REG_SZ, value)
def config_explorer_system():
"""Configure Windows Explorer for all users via Registry settings."""
write_registry_settings(SETTINGS_EXPLORER_SYSTEM, all_users=True)
def config_explorer_user():
"""Configure Windows Explorer for current user via Registry settings."""
write_registry_settings(SETTINGS_EXPLORER_USER, all_users=False)
def update_clock():
"""Set Timezone and sync clock."""
run_program(['tzutil' ,'/s', WINDOWS_TIME_ZONE], check=False)
run_program(['net', 'stop', 'w32ime'], check=False)
run_program(
['w32tm', '/config', '/syncfromflags:manual',
'/manualpeerlist:"us.pool.ntp.org time.nist.gov time.windows.com"',
],
check=False)
run_program(['net', 'start', 'w32ime'], check=False)
run_program(['w32tm', '/resync', '/nowait'], check=False)
# Installations
def install_adobe_reader():
"""Install Adobe Reader."""

View file

@ -138,7 +138,9 @@ def remove_from_kit(item):
item_locations = []
for p in [global_vars['BinDir'], global_vars['CBinDir']]:
item_locations.append(r'{}\{}'.format(p, item))
item_locations.append(r'{}\{}.7z'.format(p, item))
item_locations.append(r'{}\_Drivers\{}'.format(p, item))
item_locations.append(r'{}\_Drivers\{}.7z'.format(p, item))
for item_path in item_locations:
remove_item(item_path)
@ -435,6 +437,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']:
@ -574,6 +599,21 @@ def update_adobe_reader_dc():
download_generic(
dest, 'Adobe Reader DC.exe', SOURCE_URLS['Adobe Reader DC'])
def update_macs_fan_control():
# Prep
dest = r'{}\Installers'.format(
global_vars['BaseDir'])
# Remove existing installer
try:
os.remove(r'{}\Macs Fan Control.exe'.format(dest))
except FileNotFoundError:
pass
# Download
download_generic(
dest, 'Macs Fan Control.exe', SOURCE_URLS['Macs Fan Control'])
def update_office():
# Remove existing folders
remove_from_kit('_Office')

View file

@ -392,8 +392,8 @@ def menu_setup():
windows_version = windows_version)
# Copy WinPE log(s)
source = r'{}\Info'.format(global_vars['ClientDir'])
dest = r'W:\{}\Info'.format(KIT_NAME_SHORT)
source = r'{}\Logs'.format(global_vars['ClientDir'])
dest = r'W:\{}\Logs\WinPE'.format(KIT_NAME_SHORT)
shutil.copytree(source, dest)
# Print summary

View file

@ -67,7 +67,11 @@ def get_feature_string(chip, feature):
for sf in sfs:
name = sf.name[skipname:].decode("utf-8").strip()
val = sensors.get_value(chip, sf.number)
try:
val = sensors.get_value(chip, sf.number)
except Exception:
# Ignore upstream sensor bugs and lie instead
val = -123456789
if 'alarm' in name:
# Skip
continue

View file

@ -33,7 +33,7 @@ for /f "tokens=* usebackq" %%f in (`findstr KIT_NAME_SHORT "%SETTINGS%"`) do (
set "KIT_NAME_SHORT=!_v:~0,-1!"
)
set "client_dir=%systemdrive%\%KIT_NAME_SHORT%"
set "log_dir=%client_dir%\Info\%iso_date%"
set "log_dir=%client_dir%\Logs\%iso_date%"
:Flags
set _backups=
@ -45,7 +45,7 @@ set _transfer=
for %%f in (%*) do (
if /i "%%f" == "/DEBUG" (@echo on)
if /i "%%f" == "/Backups" set _backups=True
if /i "%%f" == "/Info" set _info=True
if /i "%%f" == "/Logs" set _logs=True
if /i "%%f" == "/Office" set _office=True
if /i "%%f" == "/Quarantine" set _quarantine=True
if /i "%%f" == "/QuickBooks" set _quickbooks=True
@ -54,7 +54,9 @@ for %%f in (%*) do (
:CreateDirs
if defined _backups mkdir "%client_dir%\Backups">nul 2>&1
if defined _info mkdir "%client_dir%\Info">nul 2>&1
if defined _logs (
mkdir "%log_dir%\%KIT_NAME_FULL%">nul 2>&1
mkdir "%log_dir%\Tools">nul 2>&1)
if defined _office mkdir "%client_dir%\Office">nul 2>&1
if defined _quarantine mkdir "%client_dir%\Quarantine">nul 2>&1
if defined _quickbooks mkdir "%client_dir%\QuickBooks">nul 2>&1

View file

@ -9,7 +9,7 @@ sys.path.append(os.getcwd())
from functions.setup import *
init_global_vars()
os.system('title {}: SW Bundle Tool'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\Install SW Bundle.log'.format(**global_vars)
set_log_file('Install SW Bundle.log')
if __name__ == '__main__':
try:
@ -62,3 +62,5 @@ if __name__ == '__main__':
pass
except:
major_exception()
# vim: sts=4 sw=4 ts=4

View file

@ -9,7 +9,7 @@ sys.path.append(os.getcwd())
from functions.setup import *
init_global_vars()
os.system('title {}: Install Visual C++ Runtimes'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\Install Visual C++ Runtimes.log'.format(**global_vars)
set_log_file('Install Visual C++ Runtimes.log')
if __name__ == '__main__':
try:

View file

@ -22,7 +22,7 @@ if __name__ == '__main__':
# Mount
if is_connected():
mount_backup_shares()
mount_backup_shares(read_write=True)
else:
# Couldn't connect
print_error('ERROR: No network connectivity.')

15
.bin/Scripts/pacinit Executable file
View file

@ -0,0 +1,15 @@
#!/bin/bash
#
## Wizard Kit: Update pacman settings to usage in live sessions
# Disable custom repo (used at build-time)
sudo sed -i -r "s/^(\[custom\])/#\1/" /etc/pacman.conf
sudo sed -i -r "s/^(SigLevel = Optional TrustAll)/#\1/" /etc/pacman.conf
sudo sed -i -r "s/^(Server = )/#\1/" /etc/pacman.conf
# Disable signature checks
sudo sed -i -r "s/^SigLevel.*/SigLevel = Never/" /etc/pacman.conf
# Refresh package databases
sudo pacman -Sy

150
.bin/Scripts/photorec-sort Executable file
View file

@ -0,0 +1,150 @@
#!/bin/bash
#
## sort photorec results into something usefull
## Set paths
recup_dir="${1%/}"
[ -n "$recup_dir" ] || recup_dir="."
recup_dir="$(realpath "$recup_dir")"
out_dir="$recup_dir/Recovered"
bad_dir="$recup_dir/Corrupt"
## Test path before starting (using current dir if not specified)
for d in $recup_dir/recup*; do
### Source: http://stackoverflow.com/a/6364244
## Check if the glob gets expanded to existing files.
## If not, f here will be exactly the pattern above
## and the exists test will evaluate to false.
[ -e "$d" ] && echo "Found recup folder(s)" || {
echo "ERROR: No recup folders found"
echo "Usage: $0 recup_dir"
exit 1
}
## This is all we needed to know, so we can break after the first iteration
break
done
# Hard link files into folders by type
for d in $recup_dir/recup*; do
if [ -d "$d" ]; then
echo "Linking $d"
pushd $d >/dev/null
find -type f | while read k; do
file="$(basename "$k")"
src="$(realpath "$k")"
ext="$(echo "${file##*.}" | tr '[:upper:]' '[:lower:]')"
ext_dir="$out_dir/$ext"
if [ "${file##*.}" = "$file" ]; then
ext_dir="$out_dir/_MISC_"
elif [ "$ext" = "jpg" ] && [ "${file:0:1}" = "t" ]; then
ext_dir="$out_dir/jpg-thumbnail"
fi
#echo " $file -> $ext_dir"
[ -d "$ext_dir" ] || mkdir -p "$ext_dir"
ln "$src" "$ext_dir"
done
popd >/dev/null
else
echo "ERROR: '$d' not a directory"
fi
done
## Check the files output by photorec for corruption
pushd "$out_dir" >/dev/null
# Check archives with 7-Zip
#for d in 7z bz2 gz lzh lzo rar tar xz zip; do
# if [ -d "$d" ]; then
# echo "Checking $d files"
# pushd "$d" >/dev/null
# for f in *; do
# if ! 7z t "$f" >/dev/null 2>&1; then
# #echo " BAD: $f"
# [ -d "$bad_dir/$d" ] || mkdir -p "$bad_dir/$d"
# mv -n "$f" "$bad_dir/$d/$f"
# fi
# done
# popd >/dev/null
# fi
#done
# Check Audio/Video files with ffprobe
for d in avi flac flv m4a m4p m4v mkv mid mov mp2 mp3 mp4 mpg mpg2 ogg ts vob wav; do
if [ -d "$d" ]; then
echo "Checking $d files"
pushd "$d" >/dev/null
for f in *; do
if ! ffprobe "$f" >/dev/null 2>&1; then
#echo " BAD: $f"
[ -d "$bad_dir/$d" ] || mkdir -p "$bad_dir/$d"
mv -n "$f" "$bad_dir/$d/$f"
fi
done
popd >/dev/null
fi
done
# Check .doc files with antiword
if [ -d "doc" ]; then
echo "Checking doc files"
pushd "doc" >/dev/null
for f in *doc; do
if ! antiword "$f" >/dev/null 2>&1; then
#echo " BAD: $f"
[ -d "$bad_dir/doc" ] || mkdir -p "$bad_dir/doc"
mv -n "$f" "$bad_dir/doc/$f"
fi
done
popd >/dev/null
fi
# Check .docx files with 7z and grep
if [ -d "docx" ]; then
echo "Checking docx files"
pushd "docx" >/dev/null
for f in *docx; do
if ! 7z l "$f" | grep -q -s "word/document.xml"; then
#echo " BAD: $f"
[ -d "$bad_dir/docx" ] || mkdir -p "$bad_dir/docx"
mv -n "$f" "$bad_dir/docx/$f"
fi
done
popd >/dev/null
fi
# Sort pictures by date (only for common camera formats)
for d in jpg mrw orf raf raw rw2 tif x3f; do
if [ -d "$d" ]; then
echo "Sorting $d files by date"
pushd "$d" >/dev/null
for f in *; do
date_dir="$(date -d "$(stat -c %y "$f")" +"%F")"
[ -d "$date_dir" ] || mkdir "$date_dir"
mv -n "$f" "$date_dir/"
done
popd >/dev/null
fi
done
# Sort mov files by encoded date
if [ -d "mov" ]; then
echo "Sorting mov files by date"
pushd "mov" >/dev/null
for f in *mov; do
enc_date="$(mediainfo "$f" | grep -i "Encoded date" | head -1 | sed -r 's/.*: //')"
date_dir="$(date -d "$enc_date" +"%F")"
echo "$date_dir" | grep -E -q -s '^[0-9]{4}-[0-9]{2}-[0-9]{2}$' || date_dir="Unknown Date"
[ -d "$date_dir" ] || mkdir "$date_dir"
mv -n "$f" "$date_dir/"
done
popd >/dev/null
fi
## sort audio files by tags
## sort matroska files by metadata
## return to original dir
popd >/dev/null

View file

@ -18,6 +18,4 @@ if udevil mount $DEVICE; then
else
echo "Failed"
fi
sleep 2s
exit 0

View file

@ -54,7 +54,7 @@ LAUNCHERS = {
'L_PATH': 'FastCopy',
'L_ITEM': 'FastCopy.exe',
'L_ARGS': (
r' /logfile=%log_dir%\FastCopy.log'
r' /logfile=%log_dir%\Tools\FastCopy.log'
r' /cmd=noexist_only'
r' /utf8'
r' /skip_empty_dir'
@ -94,7 +94,7 @@ LAUNCHERS = {
),
'L_ELEV': 'True',
'Extra Code': [
r'call "%bin%\Scripts\init_client_dir.cmd" /Info /Transfer',
r'call "%bin%\Scripts\init_client_dir.cmd" /Logs /Transfer',
],
},
'FastCopy': {
@ -102,7 +102,7 @@ LAUNCHERS = {
'L_PATH': 'FastCopy',
'L_ITEM': 'FastCopy.exe',
'L_ARGS': (
r' /logfile=%log_dir%\FastCopy.log'
r' /logfile=%log_dir%\Tools\FastCopy.log'
r' /cmd=noexist_only'
r' /utf8'
r' /skip_empty_dir'
@ -141,7 +141,7 @@ LAUNCHERS = {
r' /to=%client_dir%\Transfer_%iso_date%\ '
),
'Extra Code': [
r'call "%bin%\Scripts\init_client_dir.cmd" /Info /Transfer',
r'call "%bin%\Scripts\init_client_dir.cmd" /Logs /Transfer',
],
},
'KVRT': {
@ -212,7 +212,6 @@ LAUNCHERS = {
r')',
],
},
},
r'Diagnostics\Extras': {
'AIDA64': {
'L_TYPE': 'Executable',
@ -251,10 +250,10 @@ LAUNCHERS = {
'L_TYPE': 'Executable',
'L_PATH': 'erunt',
'L_ITEM': 'ERUNT.EXE',
'L_ARGS': '%client_dir%\Backups\%iso_date%\Registry sysreg curuser otherusers',
'L_ARGS': '%client_dir%\Backups\Registry\%iso_date% sysreg curuser otherusers',
'L_ELEV': 'True',
'Extra Code': [
r'call "%bin%\Scripts\init_client_dir.cmd" /Info',
r'call "%bin%\Scripts\init_client_dir.cmd" /Logs',
],
},
'HitmanPro': {
@ -262,7 +261,7 @@ LAUNCHERS = {
'L_PATH': 'HitmanPro',
'L_ITEM': 'HitmanPro.exe',
'Extra Code': [
r'call "%bin%\Scripts\init_client_dir.cmd" /Info',
r'call "%bin%\Scripts\init_client_dir.cmd" /Logs',
],
},
'HWiNFO (Sensors)': {
@ -455,11 +454,6 @@ LAUNCHERS = {
'L_ITEM': 'WizTree.exe',
'L_ELEV': 'True',
},
'Update Kit': {
'L_TYPE': 'PyScript',
'L_PATH': 'Scripts',
'L_ITEM': 'update_kit.py',
},
'XMPlay': {
'L_TYPE': 'Executable',
'L_PATH': 'XMPlay',
@ -524,8 +518,10 @@ LAUNCHERS = {
'L_TYPE': 'Executable',
'L_PATH': 'RKill',
'L_ITEM': 'RKill.exe',
'L_ARGS': '-s -l %log_dir%\Tools\RKill.log',
'L_ELEV': 'True',
'Extra Code': [
r'call "%bin%\Scripts\init_client_dir.cmd" /Info',
r'call "%bin%\Scripts\init_client_dir.cmd" /Logs',
],
},
'SFC Scan': {
@ -539,7 +535,7 @@ LAUNCHERS = {
'L_PATH': 'TDSSKiller',
'L_ITEM': 'TDSSKiller.exe',
'L_ARGS': (
r' -l %log_dir%\TDSSKiller.log'
r' -l %log_dir%\Tools\TDSSKiller.log'
r' -qpath %q_dir%'
r' -accepteula'
r' -accepteulaksn'
@ -560,7 +556,8 @@ LAUNCHERS = {
'L_ITEM': 'IObitUninstallerPortable.exe',
},
},
}
},
}
if __name__ == '__main__':
print("This file is not meant to be called directly.")

View file

@ -1,14 +1,15 @@
# Wizard Kit: Settings - Main / Branding
# Features
ENABLED_UPLOAD_DATA = False
ENABLED_OPEN_LOGS = False
ENABLED_TICKET_NUMBERS = False
ENABLED_UPLOAD_DATA = False
# STATIC VARIABLES (also used by BASH and BATCH files)
## NOTE: There are no spaces around the = for easier parsing in BASH and BATCH
# Main Kit
ARCHIVE_PASSWORD='Abracadabra'
KIT_NAME_FULL='Wizard Kit'
KIT_NAME_FULL='WizardKit'
KIT_NAME_SHORT='WK'
SUPPORT_MESSAGE='Please let 2Shirt know by opening an issue on GitHub'
# Live Linux
@ -19,10 +20,10 @@ TECH_PASSWORD='Abracadabra'
OFFICE_SERVER_IP='10.0.0.10'
QUICKBOOKS_SERVER_IP='10.0.0.10'
# Time Zones
LINUX_TIME_ZONE='America/Los_Angeles' # See 'timedatectl list-timezones' for valid values
WINDOWS_TIME_ZONE='Pacific Standard Time' # See 'tzutil /l' for valid values
LINUX_TIME_ZONE='America/Denver' # See 'timedatectl list-timezones' for valid values
WINDOWS_TIME_ZONE='Mountain Standard Time' # See 'tzutil /l' for valid values
# WiFi
WIFI_SSID='SomeWifi'
WIFI_SSID='SomeWiFi'
WIFI_PASSWORD='Abracadabra'
# SERVER VARIABLES

View file

@ -23,6 +23,9 @@ 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',
'Macs Fan Control': 'https://www.crystalidea.com/downloads/macsfancontrol_setup.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 +196,7 @@ 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.")
# vim: sts=4 sw=4 ts=4 tw=0 nowrap

View file

@ -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': {

View file

@ -149,6 +149,36 @@ WINDOWS_BUILDS = {
'17655': ( '10', None, 'Redstone 5', None, 'preview build'),
'17661': ( '10', None, 'Redstone 5', None, 'preview build'),
'17666': ( '10', None, 'Redstone 5', None, 'preview build'),
'17677': ( '10', None, 'Redstone 5', None, 'preview build'),
'17682': ( '10', None, 'Redstone 5', None, 'preview build'),
'17686': ( '10', None, 'Redstone 5', None, 'preview build'),
'17692': ( '10', None, 'Redstone 5', None, 'preview build'),
'17704': ( '10', None, 'Redstone 5', None, 'preview build'),
'17711': ( '10', None, 'Redstone 5', None, 'preview build'),
'17713': ( '10', None, 'Redstone 5', None, 'preview build'),
'17723': ( '10', None, 'Redstone 5', None, 'preview build'),
'17728': ( '10', None, 'Redstone 5', None, 'preview build'),
'17730': ( '10', None, 'Redstone 5', None, 'preview build'),
'17733': ( '10', None, 'Redstone 5', None, 'preview build'),
'17735': ( '10', None, 'Redstone 5', None, 'preview build'),
'17738': ( '10', None, 'Redstone 5', None, 'preview build'),
'17741': ( '10', None, 'Redstone 5', None, 'preview build'),
'17744': ( '10', None, 'Redstone 5', None, 'preview build'),
'17746': ( '10', None, 'Redstone 5', None, 'preview build'),
'17751': ( '10', None, 'Redstone 5', None, 'preview build'),
'17754': ( '10', None, 'Redstone 5', None, 'preview build'),
'17755': ( '10', None, 'Redstone 5', None, 'preview build'),
'17758': ( '10', None, 'Redstone 5', None, 'preview build'),
'17760': ( '10', None, 'Redstone 5', None, 'preview build'),
'17763': ( '10', 'v1809', 'Redstone 5', 'October 2018 Update', 'preview build'),
'18204': ( '10', None, '19H1', None, 'preview build'),
'18214': ( '10', None, '19H1', None, 'preview build'),
'18219': ( '10', None, '19H1', None, 'preview build'),
'18234': ( '10', None, '19H1', None, 'preview build'),
'18237': ( '10', None, '19H1', None, 'preview build'),
'18242': ( '10', None, '19H1', None, 'preview build'),
'18247': ( '10', None, '19H1', None, 'preview build'),
'18252': ( '10', None, '19H1', None, 'preview build'),
}
if __name__ == '__main__':

View file

@ -9,7 +9,7 @@ sys.path.append(os.getcwd())
from functions.repairs import *
init_global_vars()
os.system('title {}: SFC Tool'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\SFC Tool.log'.format(**global_vars)
set_log_file('SFC Tool.log')
if __name__ == '__main__':
try:

View file

@ -14,7 +14,7 @@ from functions.product_keys import *
from functions.setup import *
init_global_vars()
os.system('title {}: System Checklist Tool'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\System Checklist.log'.format(**global_vars)
set_log_file('System Checklist.log')
if __name__ == '__main__':
try:
@ -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))
@ -43,10 +49,13 @@ if __name__ == '__main__':
# Cleanup
print_info('Cleanup')
try_and_print(message='Desktop...',
function=cleanup_desktop, cs='Done')
try_and_print(message='AdwCleaner...',
function=cleanup_adwcleaner, cs='Done', other_results=other_results)
try_and_print(message='Desktop...',
function=cleanup_desktop, cs='Done')
try_and_print(message='{}...'.format(KIT_NAME_FULL),
function=delete_empty_folders, cs='Done',
folder_path=global_vars['ClientDir'])
# Export system info
print_info('Backup System Information')
@ -76,6 +85,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()
@ -99,6 +110,11 @@ if __name__ == '__main__':
sleep(3)
try_and_print(message='Running XMPlay...',
function=run_xmplay, cs='Started', other_results=other_results)
try:
check_secure_boot_status(show_alert=True)
except:
# Only trying to open alert message boxes
pass
# Done
print_standard('\nDone.')
@ -108,3 +124,5 @@ if __name__ == '__main__':
pass
except:
major_exception()
# vim: sts=4 sw=4 ts=4

View file

@ -13,8 +13,54 @@ from functions.product_keys import *
from functions.repairs import *
init_global_vars()
os.system('title {}: System Diagnostics Tool'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\System Diagnostics.log'.format(
**global_vars)
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:
@ -37,8 +83,6 @@ if __name__ == '__main__':
# Sanitize Environment
print_info('Sanitizing Environment')
# try_and_print(message='Killing processes...',
# function=run_process_killer, cs='Done')
try_and_print(message='Running RKill...',
function=run_rkill, cs='Done', other_results=other_results)
try_and_print(message='Running TDSSKiller...',
@ -69,12 +113,18 @@ if __name__ == '__main__':
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)
try_and_print(message='BleachBit report...',
function=run_bleachbit, cs='Done', other_results=other_results)
backup_browsers()
try_and_print(message='File listing...',
function=backup_file_list, cs='Done', other_results=other_results)
@ -120,3 +170,5 @@ if __name__ == '__main__':
pass
except:
major_exception()
# vim: sts=4 sw=4 ts=4

View file

@ -9,7 +9,7 @@ sys.path.append(os.getcwd())
from functions.product_keys import *
init_global_vars()
os.system('title {}: Transferred Key Finder'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\Transferred Keys.log'.format(**global_vars)
set_log_file('Transferred Keys.log')
if __name__ == '__main__':
try:

View file

@ -40,10 +40,11 @@ if __name__ == '__main__':
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='BlueScreenView...', function=update_bluescreenview, 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='HitmanPro...', function=update_hitmanpro, 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
@ -57,6 +58,7 @@ if __name__ == '__main__':
# 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='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)
update_all_ninite(other_results=other_results, width=40)
@ -67,7 +69,7 @@ if __name__ == '__main__':
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='FirefoxExtensions...', function=update_firefox_ublock_origin, 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)
@ -78,7 +80,7 @@ if __name__ == '__main__':
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='TDSSKiller...', function=update_tdsskiller, 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')

View file

@ -11,8 +11,7 @@ from functions.cleanup import *
from functions.setup import *
init_global_vars()
os.system('title {}: User Checklist Tool'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\User Checklist ({USERNAME}).log'.format(
**global_vars, **global_vars['Env'])
set_log_file('User Checklist ({USERNAME}).log'.format(**global_vars['Env']))
if __name__ == '__main__':
try:
@ -84,3 +83,5 @@ if __name__ == '__main__':
pass
except:
major_exception()
# vim: sts=4 sw=4 ts=4

View file

@ -10,7 +10,7 @@ from functions.data import *
from functions.repairs import *
init_global_vars()
os.system('title {}: User Data Transfer Tool'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\User Data Transfer.log'.format(**global_vars)
set_log_file('User Data Transfer.log')
if __name__ == '__main__':
try:

View file

@ -11,7 +11,7 @@ from functions.winpe_menus import *
TOOLS['SevenZip'].pop('64')
init_global_vars()
set_title('{}: Root Menu'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\WinPE.log'.format(**global_vars)
set_log_file('WinPE.log')
if __name__ == '__main__':
try:

View file

@ -4,8 +4,8 @@
<History nbMaxFile="10" inSubMenu="no" customLength="-1" />
<GUIConfigs>
<GUIConfig name="ToolBar" visible="no">standard</GUIConfig>
<GUIConfig name="StatusBar">hide</GUIConfig>
<GUIConfig name="TabBar" dragAndDrop="yes" drawTopBar="yes" drawInactiveTab="yes" reduce="yes" closeButton="yes" doubleClick2Close="no" vertical="no" multiLine="no" hide="yes" quitOnEmpty="no" />
<GUIConfig name="StatusBar">show</GUIConfig>
<GUIConfig name="TabBar" dragAndDrop="yes" drawTopBar="yes" drawInactiveTab="yes" reduce="yes" closeButton="yes" doubleClick2Close="no" vertical="no" multiLine="no" hide="no" quitOnEmpty="yes" />
<GUIConfig name="ScintillaViewsSplitter">vertical</GUIConfig>
<GUIConfig name="UserDefineDlg" position="undocked">hide</GUIConfig>
<GUIConfig name="TabSetting" replaceBySpace="yes" size="4" />
@ -18,7 +18,7 @@
<GUIConfig name="RememberLastSession">no</GUIConfig>
<GUIConfig name="DetectEncoding">yes</GUIConfig>
<GUIConfig name="NewDocDefaultSettings" format="0" encoding="4" lang="0" codepage="-1" openAnsiAsUTF8="yes" />
<GUIConfig name="langsExcluded" gr0="0" gr1="0" gr2="0" gr3="0" gr4="0" gr5="0" gr6="0" gr7="0" langMenuCompact="yes" />
<GUIConfig name="langsExcluded" gr0="0" gr1="0" gr2="0" gr3="0" gr4="0" gr5="0" gr6="0" gr7="0" gr8="0" gr9="0" gr10="0" gr11="0" gr12="0" langMenuCompact="yes" />
<GUIConfig name="Print" lineNumber="yes" printOption="3" headerLeft="" headerMiddle="" headerRight="" footerLeft="" footerMiddle="" footerRight="" headerFontName="" headerFontStyle="0" headerFontSize="0" footerFontName="" footerFontStyle="0" footerFontSize="0" margeLeft="0" margeRight="0" margeTop="0" margeBottom="0" />
<GUIConfig name="Backup" action="0" useCustumDir="no" dir="" isSnapshotMode="no" snapshotBackupTiming="7000" />
<GUIConfig name="TaskList">yes</GUIConfig>
@ -29,7 +29,7 @@
<GUIConfig name="auto-insert" parentheses="no" brackets="no" curlyBrackets="no" quotes="no" doubleQuotes="no" htmlXmlTag="no" />
<GUIConfig name="sessionExt"></GUIConfig>
<GUIConfig name="workspaceExt"></GUIConfig>
<GUIConfig name="MenuBar">hide</GUIConfig>
<GUIConfig name="MenuBar">show</GUIConfig>
<GUIConfig name="Caret" width="1" blinkRate="600" />
<GUIConfig name="ScintillaGlobalSettings" enableMultiSelection="no" />
<GUIConfig name="openSaveDir" value="0" defaultDirPath="" />
@ -37,10 +37,10 @@
<GUIConfig name="wordCharList" useDefault="yes" charsAdded="" />
<GUIConfig name="delimiterSelection" leftmostDelimiter="40" rightmostDelimiter="41" delimiterSelectionOnEntireDocument="no" />
<GUIConfig name="multiInst" setting="0" />
<GUIConfig name="MISC" fileSwitcherWithoutExtColumn="no" backSlashIsEscapeCharacterForSql="yes" newStyleSaveDlg="no" isFolderDroppedOpenFiles="no" />
<GUIConfig name="MISC" fileSwitcherWithoutExtColumn="yes" backSlashIsEscapeCharacterForSql="yes" newStyleSaveDlg="no" isFolderDroppedOpenFiles="no" docPeekOnTab="no" docPeekOnMap="no" />
<GUIConfig name="searchEngine" searchEngineChoice="1" searchEngineCustom="" />
<GUIConfig name="SmartHighLight" matchCase="no" wholeWordOnly="no" useFindSettings="no" onAnotherView="no">yes</GUIConfig>
<GUIConfig name="ScintillaPrimaryView" lineNumberMargin="show" bookMarkMargin="show" indentGuideLine="show" folderMarkStyle="box" lineWrapMethod="aligned" currentLineHilitingShow="show" scrollBeyondLastLine="no" disableAdvancedScrolling="no" wrapSymbolShow="hide" Wrap="no" borderEdge="yes" edge="no" edgeNbColumn="80" zoom="0" zoom2="0" whiteSpaceShow="hide" eolShow="hide" borderWidth="2" smoothFont="no" />
<GUIConfig name="ScintillaPrimaryView" lineNumberMargin="show" bookMarkMargin="show" indentGuideLine="show" folderMarkStyle="box" lineWrapMethod="aligned" currentLineHilitingShow="show" scrollBeyondLastLine="yes" disableAdvancedScrolling="no" wrapSymbolShow="hide" Wrap="no" borderEdge="yes" edge="no" edgeNbColumn="80" zoom="0" zoom2="0" whiteSpaceShow="hide" eolShow="hide" borderWidth="2" smoothFont="no" />
<GUIConfig name="DockingManager" leftWidth="200" rightWidth="200" topHeight="200" bottomHeight="200">
<ActiveTabs cont="0" activeTab="-1" />
<ActiveTabs cont="1" activeTab="-1" />

View file

@ -1,2 +0,0 @@
wk_tmp
wk-repo

View file

@ -22,14 +22,15 @@ menuentry "MemTest86" {
menuentry "Linux" {
icon /EFI/boot/icons/wk_arch.png
loader /arch/boot/x86_64/vmlinuz
initrd /arch/boot/intel_ucode.img
initrd /arch/boot/intel_ucode.img
initrd /arch/boot/amd_ucode.img
initrd /arch/boot/x86_64/archiso.img
options "archisobasedir=arch archisolabel=%ARCHISO_LABEL% quiet copytoram loglevel=3"
options "archisobasedir=arch archisolabel=%ARCHISO_LABEL% copytoram loglevel=3"
submenuentry "Linux (i3)" {
add_options "i3"
}
submenuentry "Linux (CLI)" {
add_options "nox"
add_options "loglevel=4 nomodeset nox"
}
}
#UFD#menuentry "WindowsPE" {

View file

@ -1 +0,0 @@
softdep tg3 pre: broadcom

View file

@ -10,13 +10,11 @@ alias du='du -sch --apparent-size'
alias fix-perms='find -type d -exec chmod 755 "{}" \; && find -type f -exec chmod 644 "{}" \;'
alias hexedit='hexedit --color'
alias hw-info='sudo hw-info | less -S'
alias inxi='echo -e "\e[33mWARNING: inxi is being replaced and will be removed in a future WizardKit release\e[0m"; echo -e " \e[32mReplacements include:\e[0m 'hw-drive-info', 'hw-info', & 'hw-sensors'"; echo ""; inxi'
alias less='less -S'
alias ls='ls --color=auto'
alias mkdir='mkdir -p'
alias mount='sudo mount'
alias mv='mv -nv'
alias pacinit='sudo sed -i -r "s/^SigLevel.*/SigLevel = Never/" /etc/pacman.conf; sudo pacman -Sy'
alias photorec-sort='sudo photorec-sort'
alias photorec='sudo photorec'
alias q1='clear && ls -1'

View file

@ -319,3 +319,5 @@ bar {
status_command i3status
height 26
}
exec --no-startup-id /home/tech/.update_x

View file

@ -1,20 +1,3 @@
#
# These things are run when an Openbox X Session is started.
# You may place a similar script in $HOME/.config/openbox/autostart
# to run user-specific things.
#
#openbox-autostart
# If you want to use GNOME config tools...
#
#if test -x /usr/lib/openbox/gnome-settings-daemon >/dev/null; then
# /usr/lib/openbox/gnome-settings-daemon &
#elif which gnome-settings-daemon >/dev/null 2>&1; then
# gnome-settings-daemon &
#fi
# If you want to use XFCE config tools...
#
#xfce-mcs-manager &
tint2 &
cbatticon --hide-notification &
$HOME/.update_x &

View file

@ -1,16 +0,0 @@
#!/bin/bash
IP="$(ip a show scope global \
| grep inet \
| head -1 \
| sed -r 's#.*inet ([0-9]+.[0-9]+.[0-9]+.[0-9]+.)/.*#\1#')"
HOSTNAME="$(dig +noall +answer +short -x "$IP" \
| head -1 \
| sed 's/\.$//')"
# Set hostname and renew DHCP lease
sudo hostnamectl set-hostname "${HOSTNAME}"
sudo dhclient -r
sleep 1
sudo dhclient

View file

@ -0,0 +1,23 @@
## .update_network ##
#!/bin/env bash
#
## Connect to network and update hostname
# Connect
connect-to-network
sleep 2s
IP="$(ip a show scope global \
| grep inet \
| head -1 \
| sed -r 's#.*inet ([0-9]+.[0-9]+.[0-9]+.[0-9]+.)/.*#\1#')"
HOSTNAME="$(dig +noall +answer +short -x "$IP" \
| grep -v ';' \
| head -1 \
| sed 's/\.$//')"
# Set hostname
if [[ "${HOSTNAME:+x}" ]]; then
sudo hostnamectl set-hostname "${HOSTNAME}"
fi

View file

@ -1,6 +1,6 @@
#!/bin/env bash
#
## Calculate DPI and adjust display settings if necesary
## Calculate DPI, update settings if necessary, then start desktop apps
REGEX_XRANDR='^.* ([0-9]+)x([0-9]+)\+[0-9]+\+[0-9]+.* ([0-9]+)mm x ([0-9]+)mm.*$'
REGEX_URXVT='(URxvt.geometry:\s+).*'
@ -66,3 +66,29 @@ fi
# Update URxvt (Always)
urxvt_geometry="${width_urxvt}x${height_urxvt}+${offset_urxvt}+${offset_urxvt}"
sed -i -r "s/${REGEX_URXVT}/\1${urxvt_geometry}/" "${HOME}/.Xresources"
# Update X
xset s off
xset -dpms
xrdb -merge $HOME/.Xresources
# Start common desktop apps
feh --bg-fill "$HOME/.wallpaper"
compton --backend xrender --xrender-sync --xrender-sync-fence &
sleep 1s
x0vncserver -display :0 -passwordfile $HOME/.vnc/passwd -AlwaysShared &
conky &
nm-applet &
volumeicon &
# Start WM specific apps
if fgrep -q "i3" /proc/cmdline; then
# i3
i3-msg restart
else
# openbox
openbox --restart
tint2 &
cbatticon --hide-notification &
fi

View file

@ -1,19 +1,7 @@
#!/bin/sh
dbus-update-activation-environment --systemd DISPLAY
$HOME/.update_dpi_settings
xrdb -merge $HOME/.Xresources
xset s off
xset -dpms
eval $(ssh-agent)
export SSH_AUTH_SOCK
compton --backend xrender --xrender-sync --xrender-sync-fence &
sleep 1s
conky -d
nm-applet &
volumeicon &
connect-to-network &
$HOME/.update_hostname &
feh --bg-fill "$HOME/.wallpaper" &
x0vncserver -display :0 -passwordfile $HOME/.vnc/passwd -AlwaysShared &
exec openbox-session

View file

@ -1,5 +1,8 @@
setterm -blank 0 -powerdown 0
setterm -blank 0 -powerdown 0 2>/dev/null
if [ "$(fgconsole 2>/dev/null)" -eq "1" ]; then
# Connect to network and update hostname
$HOME/.update_network
# Update settings if using i3
if fgrep -q "i3" /proc/cmdline; then
sed -i -r 's/#(own_window_type override)/\1/' ~/.conkyrc
@ -16,4 +19,3 @@ if [ "$(fgconsole 2>/dev/null)" -eq "1" ]; then
hw-diags cli
fi
fi

View file

@ -2,7 +2,10 @@ DEFAULT select
LABEL select
COM32 boot/syslinux/whichsys.c32
APPEND -pxe- pxe -sys- sys -iso- sys
APPEND -pxe- pxe -sys- sys -iso- iso
LABEL iso
CONFIG boot/syslinux/wk_iso.cfg
LABEL pxe
CONFIG boot/syslinux/wk_pxe.cfg

View file

@ -0,0 +1,6 @@
INCLUDE boot/syslinux/wk_head.cfg
INCLUDE boot/syslinux/wk_iso_linux.cfg
#DISABLED_UPSTREAM_BUG#INCLUDE boot/syslinux/wk_hdt.cfg
INCLUDE boot/syslinux/wk_tail.cfg

View file

@ -0,0 +1,31 @@
LABEL wk_iso_linux
TEXT HELP
A live Linux environment
* HW diagnostics, file-based backups, data recovery, etc
ENDTEXT
MENU LABEL Linux
LINUX boot/x86_64/vmlinuz
INITRD boot/intel_ucode.img,boot/amd_ucode.img,boot/x86_64/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% loglevel=3
LABEL wk_iso_linux_i3
TEXT HELP
A live Linux environment (i3)
* HW diagnostics, file-based backups, data recovery, etc
ENDTEXT
MENU LABEL Linux (i3)
LINUX boot/x86_64/vmlinuz
INITRD boot/intel_ucode.img,boot/amd_ucode.img,boot/x86_64/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% loglevel=3 i3
SYSAPPEND 3
LABEL wk_iso_linux_cli
TEXT HELP
A live Linux environment (CLI)
* HW diagnostics, file-based backups, data recovery, etc
ENDTEXT
MENU LABEL Linux (CLI)
LINUX boot/x86_64/vmlinuz
INITRD boot/intel_ucode.img,boot/amd_ucode.img,boot/x86_64/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% loglevel=4 nomodeset nox
SYSAPPEND 3

View file

@ -3,6 +3,6 @@ MENU BACKGROUND pxelinux.png
INCLUDE boot/syslinux/wk_pxe_linux.cfg
#UFD#INCLUDE boot/syslinux/wk_pxe_winpe.cfg
INCLUDE boot/syslinux/wk_pxe_extras_entry.cfg
#DISABLED_UPSTREAM_BUG#INCLUDE boot/syslinux/wk_hdt.cfg
INCLUDE boot/syslinux/wk_tail.cfg

View file

@ -1,9 +0,0 @@
INCLUDE boot/syslinux/wk_head.cfg
MENU BACKGROUND pxelinux.png
INCLUDE boot/syslinux/wk_pxe_linux.cfg
INCLUDE boot/syslinux/wk_pxe_linux_extras.cfg
#UFD#INCLUDE boot/syslinux/wk_pxe_winpe.cfg
INCLUDE boot/syslinux/wk_hdt.cfg
INCLUDE boot/syslinux/wk_tail.cfg

View file

@ -1,7 +0,0 @@
LABEL wk_pxe_extras
TEXT HELP
Show extra boot options
ENDTEXT
MENU LABEL Extras
KERNEL vesamenu.c32
APPEND boot/syslinux/wk_pxe_extras.cfg

View file

@ -3,8 +3,30 @@ TEXT HELP
A live Linux environment
* HW diagnostics, file-based backups, data recovery, etc
ENDTEXT
MENU LABEL Linux
MENU LABEL Linux (PXE)
LINUX boot/x86_64/vmlinuz
INITRD boot/intel_ucode.img,boot/x86_64/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archiso_http_srv=http://${pxeserver}/ quiet
INITRD boot/intel_ucode.img,boot/amd_ucode.img,boot/x86_64/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archiso_http_srv=http://${pxeserver}/ loglevel=3
SYSAPPEND 3
LABEL wk_http_linux_i3
TEXT HELP
A live Linux environment (i3)
* HW diagnostics, file-based backups, data recovery, etc
ENDTEXT
MENU LABEL Linux (PXE) (i3)
LINUX boot/x86_64/vmlinuz
INITRD boot/intel_ucode.img,boot/amd_ucode.img,boot/x86_64/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archiso_http_srv=http://${pxeserver}/ loglevel=3 i3
SYSAPPEND 3
LABEL wk_http_linux_cli
TEXT HELP
A live Linux environment (CLI)
* HW diagnostics, file-based backups, data recovery, etc
ENDTEXT
MENU LABEL Linux (PXE) (CLI)
LINUX boot/x86_64/vmlinuz
INITRD boot/intel_ucode.img,boot/amd_ucode.img,boot/x86_64/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archiso_http_srv=http://${pxeserver}/ loglevel=4 nomodeset nox
SYSAPPEND 3

View file

@ -1,21 +0,0 @@
LABEL wk_http_linux_i3
TEXT HELP
A live Linux environment (i3)
* HW diagnostics, file-based backups, data recovery, etc
ENDTEXT
MENU LABEL Linux (i3)
LINUX boot/x86_64/vmlinuz
INITRD boot/intel_ucode.img,boot/x86_64/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archiso_http_srv=http://${pxeserver}/ quiet i3
SYSAPPEND 3
LABEL wk_http_linux_cli
TEXT HELP
A live Linux environment (CLI)
* HW diagnostics, file-based backups, data recovery, etc
ENDTEXT
MENU LABEL Linux (CLI)
LINUX boot/x86_64/vmlinuz
INITRD boot/intel_ucode.img,boot/x86_64/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archiso_http_srv=http://${pxeserver}/ nox nomodeset
SYSAPPEND 3

View file

@ -3,6 +3,6 @@ TEXT HELP
A live Windows environment
* Create partition backups, Install Windows, etc
ENDTEXT
MENU LABEL Windows PE
MENU LABEL Windows PE (PXE)
COM32 boot/syslinux/linux.c32
APPEND boot/wimboot gui initrdfile=winpe/x86_64/bootmgr,winpe/x86_64/BCD,winpe/x86_64/boot.sdi,winpe/x86_64/boot.wim

View file

@ -2,6 +2,6 @@ INCLUDE boot/syslinux/wk_head.cfg
INCLUDE boot/syslinux/wk_sys_linux.cfg
#UFD#INCLUDE boot/syslinux/wk_sys_winpe.cfg
INCLUDE boot/syslinux/wk_sys_extras_entry.cfg
#DISABLED_UPSTREAM_BUG#INCLUDE boot/syslinux/wk_hdt.cfg
INCLUDE boot/syslinux/wk_tail.cfg

View file

@ -1,8 +0,0 @@
INCLUDE boot/syslinux/wk_head.cfg
INCLUDE boot/syslinux/wk_sys_linux.cfg
INCLUDE boot/syslinux/wk_sys_linux_extras.cfg
#UFD#INCLUDE boot/syslinux/wk_sys_winpe.cfg
INCLUDE boot/syslinux/wk_hdt.cfg
INCLUDE boot/syslinux/wk_tail.cfg

View file

@ -1,7 +0,0 @@
LABEL wk_sys_extras
TEXT HELP
Show extra boot options
ENDTEXT
MENU LABEL Extras
KERNEL vesamenu.c32
APPEND boot/syslinux/wk_sys_extras.cfg

View file

@ -5,5 +5,27 @@ A live Linux environment
ENDTEXT
MENU LABEL Linux
LINUX boot/x86_64/vmlinuz
INITRD boot/intel_ucode.img,boot/x86_64/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% quiet copytoram loglevel=3
INITRD boot/intel_ucode.img,boot/amd_ucode.img,boot/x86_64/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% copytoram loglevel=3
LABEL wk_linux_i3
TEXT HELP
A live Linux environment (i3)
* HW diagnostics, file-based backups, data recovery, etc
ENDTEXT
MENU LABEL Linux (i3)
LINUX boot/x86_64/vmlinuz
INITRD boot/intel_ucode.img,boot/amd_ucode.img,boot/x86_64/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% copytoram loglevel=3 i3
SYSAPPEND 3
LABEL wk_linux_cli
TEXT HELP
A live Linux environment (CLI)
* HW diagnostics, file-based backups, data recovery, etc
ENDTEXT
MENU LABEL Linux (CLI)
LINUX boot/x86_64/vmlinuz
INITRD boot/intel_ucode.img,boot/amd_ucode.img,boot/x86_64/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% copytoram nox nomodeset
SYSAPPEND 3

View file

@ -1,21 +0,0 @@
LABEL wk_linux_i3
TEXT HELP
A live Linux environment (i3)
* HW diagnostics, file-based backups, data recovery, etc
ENDTEXT
MENU LABEL Linux (i3)
LINUX boot/x86_64/vmlinuz
INITRD boot/intel_ucode.img,boot/x86_64/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% quiet copytoram loglevel=3 i3
SYSAPPEND 3
LABEL wk_linux_cli
TEXT HELP
A live Linux environment (CLI)
* HW diagnostics, file-based backups, data recovery, etc
ENDTEXT
MENU LABEL Linux (CLI)
LINUX boot/x86_64/vmlinuz
INITRD boot/intel_ucode.img,boot/x86_64/archiso.img
APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% copytoram nox nomodeset
SYSAPPEND 3

View file

@ -2,7 +2,6 @@ aic94xx-firmware
bash-pipes
hfsprogs
i3lock-fancy-git
inxi
mprime
nvme-cli
openbox-patched

View file

@ -34,7 +34,6 @@ htop
i3-gaps
i3lock-fancy-git
i3status
inxi
ldns
leafpad
lha

View file

@ -229,7 +229,8 @@ function update_live_env() {
ssh-keygen -b 4096 -C "$username@$hostname" -N "" -f "$SKEL_DIR/.ssh/id_rsa"
echo 'rm /root/.ssh/id*' >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
echo 'rm /root/.zlogin' >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
sed -r '/.*PermitRootLogin.*/d' "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
sed -i -r '/.*PermitRootLogin.*/d' "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
echo "sed -i -r '/.*PermitRootLogin.*/d' /etc/ssh/sshd_config" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
cp "$ROOT_DIR/.linux_items/authorized_keys" "$SKEL_DIR/.ssh/authorized_keys"
# Root user

View file

@ -119,7 +119,7 @@ There's a `build-ufd` script which does the following:
* Mount the device(s) or network share(s) that contain the Linux ISO, WinPE ISO, and Main Kit folder.
* Connect the UFD but don't mount it.
* Get the device name of the UFD.
* You can use $ `inxi -Dxx` or $ `lsblk --fs` to help.
* You can use $ `hw-drive-info` to help.
* $ `sudo build-ufd --ufd-device [device] --linux-iso [path] --main-kit [path] --winpe-iso [path]`
* **2nd Warning**: All data will be erased from the UFD resulting in **DATA LOSS**.
* NOTE: The Main Kit folder will be renamed on the UFD using `$KIT_NAME_FULL`