From 97fa91725e4867a2bbac90fa529cc07a0e05f221 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Sat, 12 May 2018 17:04:47 -0600 Subject: [PATCH 01/46] Better font support for compton and urxvt --- .linux_items/include/airootfs/etc/skel/.xinitrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.linux_items/include/airootfs/etc/skel/.xinitrc b/.linux_items/include/airootfs/etc/skel/.xinitrc index b5460671..78bddfe7 100755 --- a/.linux_items/include/airootfs/etc/skel/.xinitrc +++ b/.linux_items/include/airootfs/etc/skel/.xinitrc @@ -6,7 +6,7 @@ xset s off xset -dpms eval $(ssh-agent) export SSH_AUTH_SOCK -compton --backend xrender & +compton --backend xrender --xrender-sync --xrender-sync-fence & sleep 1s conky -d nm-applet & From ee2bcd5aeafc04c510b40e5f7fec23a64985c0e4 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Sat, 12 May 2018 20:05:32 -0600 Subject: [PATCH 02/46] Refactored OS build detection * Known build data moved to settings/windows_builds.py * OS version statically set in windows_builds.py * Added Insider Previews to recognized builds * Shown in red due to their very short support windows * Windows 8 and Windows 8.1 are now separate versions * Added codenames to Vista and 7 (for fun!) * Unrecognized builds have the CurrentBuild number in the DisplayName --- .bin/Scripts/activate.py | 2 +- .bin/Scripts/dism.py | 2 +- .bin/Scripts/functions/common.py | 92 ++++---------- .bin/Scripts/functions/info.py | 2 +- .bin/Scripts/functions/repairs.py | 4 +- .bin/Scripts/functions/setup.py | 4 +- .bin/Scripts/settings/windows_builds.py | 153 ++++++++++++++++++++++++ .bin/Scripts/system_checklist.py | 2 +- 8 files changed, 182 insertions(+), 79 deletions(-) create mode 100644 .bin/Scripts/settings/windows_builds.py diff --git a/.bin/Scripts/activate.py b/.bin/Scripts/activate.py index 5d17ae2f..3555c46a 100644 --- a/.bin/Scripts/activate.py +++ b/.bin/Scripts/activate.py @@ -29,7 +29,7 @@ if __name__ == '__main__': activation_methods = [ {'Name': 'Activate with BIOS key', 'Function': activate_with_bios}, ] - if global_vars['OS']['Version'] not in ['8', '10']: + if global_vars['OS']['Version'] not in ('8', '8.1', '10'): activation_methods[0]['Disabled'] = True actions = [ {'Name': 'Quit', 'Letter': 'Q'}, diff --git a/.bin/Scripts/dism.py b/.bin/Scripts/dism.py index 4ae2084d..1c88e51b 100644 --- a/.bin/Scripts/dism.py +++ b/.bin/Scripts/dism.py @@ -23,7 +23,7 @@ if __name__ == '__main__': 'GenericRepair': 'Repaired', 'UnsupportedOSError': 'Unsupported OS', }} - disabled = bool(global_vars['OS']['Version'] not in ['8', '10']) + disabled = bool(global_vars['OS']['Version'] not in ('8', '8.1', '10')) options = [ {'Name': 'Check Health', 'Repair': False, 'Disabled': disabled}, {'Name': 'Restore Health', 'Repair': True, 'Disabled': disabled}] diff --git a/.bin/Scripts/functions/common.py b/.bin/Scripts/functions/common.py index 80e064d9..ef918f0f 100644 --- a/.bin/Scripts/functions/common.py +++ b/.bin/Scripts/functions/common.py @@ -18,6 +18,7 @@ from subprocess import CalledProcessError from settings.main import * from settings.tools import * +from settings.windows_builds import * # Global variables global_vars = {} @@ -615,93 +616,42 @@ def check_os(): # Query registry path = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion' with winreg.OpenKey(HKLM, path) as key: - for name in ['CurrentBuild', 'CurrentVersion', 'ProductName']: + for name in ['CurrentBuild', 'ProductName']: try: tmp[name] = winreg.QueryValueEx(key, name)[0] except FileNotFoundError: tmp[name] = 'Unknown' - try: - tmp['CurrentBuild'] = int(tmp['CurrentBuild']) - except ValueError: - # This should be interesting... - tmp['CurrentBuild'] = -1 - try: - tmp['CurrentVersion'] = float(tmp['CurrentVersion']) - except ValueError: - # This should also be interesting... - tmp['CurrentVersion'] = -1 # Check bit depth tmp['Arch'] = 32 if 'PROGRAMFILES(X86)' in global_vars['Env']: tmp['Arch'] = 64 + # Get Windows build info + build_info = WINDOWS_BUILDS.get( + tmp['CurrentBuild'], + ('Unknown', 'Build {}'.format(tmp['CurrentBuild']), None, None, 'unrecognized')) + tmp['Version'] = build_info.pop(0) + tmp['Release'] = build_info.pop(0) + tmp['Codename'] = build_info.pop(0) + tmp['Marketing Name'] = build_info.pop(0) + tmp['Notes'] = build_info.pop(0) + # Set name tmp['Name'] = tmp['ProductName'] - if tmp['CurrentBuild'] == 7601: - tmp['Name'] += ' SP1' # Win 7 - if tmp['CurrentBuild'] == 9600: - tmp['Name'] += ' Update' # Win 8.1u - if tmp['CurrentBuild'] == 10240: - tmp['Name'] += ' Release 1507 "Threshold 1"' - if tmp['CurrentBuild'] == 10586: - tmp['Name'] += ' Release 1511 "Threshold 2"' - if tmp['CurrentBuild'] == 14393: - tmp['Name'] += ' Release 1607 "Redstone 1" / "Anniversary Update"' - if tmp['CurrentBuild'] == 15063: - tmp['Name'] += ' Release 1703 "Redstone 2" / "Creators Update"' - if tmp['CurrentBuild'] == 16299: - tmp['Name'] += ' Release 1709 "Redstone 3" / "Fall Creators Update"' + if tmp['Release']: + tmp['Name'] += ' {}'.format(tmp['Release']) + if tmp['Codename']: + tmp['Name'] += ' "{}"'.format(tmp['Codename']) + if tmp['Marketing Name']: + tmp['Name'] += ' / "{}"'.format(tmp['Marketing Name']) tmp['Name'] = re.sub(r'\s+', ' ', tmp['Name']) - + # Set display name tmp['DisplayName'] = '{} x{}'.format(tmp['Name'], tmp['Arch']) - if tmp['CurrentBuild'] in [7600, 9200, 10240, 10586]: - tmp['DisplayName'] += ' (very outdated)' - elif tmp['CurrentBuild'] in [7601, 9600, 14393, 15063]: - tmp['DisplayName'] += ' (outdated)' - elif tmp['CurrentBuild'] == 16299: - pass # Current Win10 release - else: - tmp['DisplayName'] += ' (unrecognized)' - - # Set version - if tmp['CurrentVersion'] == 6.0: - tmp['Version'] = 'Vista' - elif tmp['CurrentVersion'] == 6.1: - tmp['Version'] = '7' - elif 6.2 <= tmp['CurrentVersion'] <= 6.3: - if tmp['CurrentBuild'] <= 9600: - tmp['Version'] = '8' - elif tmp['CurrentBuild'] >= 10240: - tmp['Version'] = '10' - else: - tmp['Version'] = 'Unknown' + if tmp['Notes']: + tmp['Name'] += ' ({})'.format(tmp['Notes']) - # == vista == - # 6.0.6000 - # 6.0.6001 # SP1 - # 6.0.6002 # SP2 - # ==== 7 ==== - # 6.1.7600 - # 6.1.7601 # SP1 - # 6.1.7602 # Umm.. where'd this come from? - # ==== 8 ==== - # 6.2.9200 - # === 8.1 === - # 6.3.9200 - # === 8.1u == - # 6.3.9600 - # === 10 v1507 "Threshold 1" == - # 6.3.10240 - # === 10 v1511 "Threshold 2" == - # 6.3.10586 - # === 10 v1607 "Redstone 1" "Anniversary Update" == - # 6.3.14393 - # === 10 v1703 "Redstone 2" "Creators Update" == - # 6.3.15063 - # === 10 v1709 "Redstone 3" "Fall Creators Update" == - # 6.3.16299 global_vars['OS'] = tmp def check_tools(): diff --git a/.bin/Scripts/functions/info.py b/.bin/Scripts/functions/info.py index fa3ceab6..fbde1a27 100644 --- a/.bin/Scripts/functions/info.py +++ b/.bin/Scripts/functions/info.py @@ -419,7 +419,7 @@ def show_os_name(): # Show all 32-bit installs as an error message print_error(os_name, timestamp=False) else: - if re.search(r'(unrecognized|very outdated)', os_name, re.IGNORECASE): + if re.search(r'(preview build|unrecognized|unsupported)', os_name, re.IGNORECASE): print_error(os_name, timestamp=False) elif re.search(r'outdated', os_name, re.IGNORECASE): print_warning(os_name, timestamp=False) diff --git a/.bin/Scripts/functions/repairs.py b/.bin/Scripts/functions/repairs.py index bf9c3cdd..e4d5e74f 100644 --- a/.bin/Scripts/functions/repairs.py +++ b/.bin/Scripts/functions/repairs.py @@ -11,7 +11,7 @@ def run_chkdsk(repair=False): def run_chkdsk_scan(): """Run CHKDSK in a "split window" and report errors.""" - if global_vars['OS']['Version'] in ['8', '10']: + if global_vars['OS']['Version'] in ('8', '8.1', '10'): cmd = ['chkdsk', global_vars['Env']['SYSTEMDRIVE'], '/scan', '/perf'] else: cmd = ['chkdsk', global_vars['Env']['SYSTEMDRIVE']] @@ -44,7 +44,7 @@ def run_chkdsk_offline(): def run_dism(repair=False): """Run DISM /RestoreHealth, then /CheckHealth, and then report errors.""" - if global_vars['OS']['Version'] in ['8', '10']: + if global_vars['OS']['Version'] in ('8', '8.1', '10'): if repair: # Restore Health cmd = [ diff --git a/.bin/Scripts/functions/setup.py b/.bin/Scripts/functions/setup.py index bd40f9e5..c6b681a8 100644 --- a/.bin/Scripts/functions/setup.py +++ b/.bin/Scripts/functions/setup.py @@ -220,7 +220,7 @@ def install_chrome_extensions(): def install_classicstart_skin(): """Extract ClassicStart skin to installation folder.""" - if global_vars['OS']['Version'] not in ['8', '10']: + if global_vars['OS']['Version'] not in ('8', '8.1', '10'): raise UnsupportedOSError extract_item('ClassicStartSkin', silent=True) source = r'{BinDir}\ClassicStartSkin\Metro-Win10-Black.skin7'.format( @@ -245,7 +245,7 @@ def install_firefox_extensions(): def install_ninite_bundle(mse=False): """Run Ninite file(s) based on OS version.""" - if global_vars['OS']['Version'] in ['8', '10']: + if global_vars['OS']['Version'] in ('8', '8.1', '10'): # Modern selection popen_program(r'{BaseDir}\Installers\Extras\Bundles\Modern.exe'.format( **global_vars)) diff --git a/.bin/Scripts/settings/windows_builds.py b/.bin/Scripts/settings/windows_builds.py new file mode 100644 index 00000000..4be67d98 --- /dev/null +++ b/.bin/Scripts/settings/windows_builds.py @@ -0,0 +1,153 @@ +# Wizard Kit: Settings - Windows Builds + +WINDOWS_BUILDS = { +# Build Version Release Codename Marketing Name Notes + '6000': ( 'Vista', 'RTM', 'Longhorn', None, 'unsupported'), + '6000': ( 'Vista', 'RTM', 'Longhorn', None, 'unsupported'), + '6001': ( 'Vista', 'SP1', 'Longhorn', None, 'unsupported'), + '6002': ( 'Vista', 'SP2', 'Longhorn', None, 'unsupported'), + + '7600': ( '7', 'RTM', 'Vienna', None, 'unsupported'), + '7601': ( '7', 'SP1', 'Vienna', None, 'outdated'), + + '9200': ( '8', 'RTM', None, None, 'unsupported'), + '9200': ( '8.1', None, 'Blue', None, 'outdated'), + '9600': ( '8.1', None, 'Update', None, None), + + '9841': ( '10', None, 'Threshold 1', None, 'preview build'), + '9860': ( '10', None, 'Threshold 1', None, 'preview build'), + '9879': ( '10', None, 'Threshold 1', None, 'preview build'), + '9926': ( '10', None, 'Threshold 1', None, 'preview build'), + '10041': ( '10', None, 'Threshold 1', None, 'preview build'), + '10049': ( '10', None, 'Threshold 1', None, 'preview build'), + '10061': ( '10', None, 'Threshold 1', None, 'preview build'), + '10074': ( '10', None, 'Threshold 1', None, 'preview build'), + '10122': ( '10', None, 'Threshold 1', None, 'preview build'), + '10130': ( '10', None, 'Threshold 1', None, 'preview build'), + '10158': ( '10', None, 'Threshold 1', None, 'preview build'), + '10159': ( '10', None, 'Threshold 1', None, 'preview build'), + '10162': ( '10', None, 'Threshold 1', None, 'preview build'), + '10166': ( '10', None, 'Threshold 1', None, 'preview build'), + '10240': ( '10', 'v1507', 'Threshold 1', None, 'unsupported'), + '10525': ( '10', None, 'Threshold 2', None, 'preview build'), + '10532': ( '10', None, 'Threshold 2', None, 'preview build'), + '10547': ( '10', None, 'Threshold 2', None, 'preview build'), + '10565': ( '10', None, 'Threshold 2', None, 'preview build'), + '10576': ( '10', None, 'Threshold 2', None, 'preview build'), + '10586': ( '10', 'v1511', 'Threshold 2', 'November Update', 'unsupported'), + '11082': ( '10', None, 'Redstone 1', None, 'preview build'), + '11099': ( '10', None, 'Redstone 1', None, 'preview build'), + '11102': ( '10', None, 'Redstone 1', None, 'preview build'), + '14251': ( '10', None, 'Redstone 1', None, 'preview build'), + '14257': ( '10', None, 'Redstone 1', None, 'preview build'), + '14271': ( '10', None, 'Redstone 1', None, 'preview build'), + '14279': ( '10', None, 'Redstone 1', None, 'preview build'), + '14291': ( '10', None, 'Redstone 1', None, 'preview build'), + '14295': ( '10', None, 'Redstone 1', None, 'preview build'), + '14316': ( '10', None, 'Redstone 1', None, 'preview build'), + '14328': ( '10', None, 'Redstone 1', None, 'preview build'), + '14332': ( '10', None, 'Redstone 1', None, 'preview build'), + '14342': ( '10', None, 'Redstone 1', None, 'preview build'), + '14352': ( '10', None, 'Redstone 1', None, 'preview build'), + '14361': ( '10', None, 'Redstone 1', None, 'preview build'), + '14366': ( '10', None, 'Redstone 1', None, 'preview build'), + '14367': ( '10', None, 'Redstone 1', None, 'preview build'), + '14371': ( '10', None, 'Redstone 1', None, 'preview build'), + '14372': ( '10', None, 'Redstone 1', None, 'preview build'), + '14376': ( '10', None, 'Redstone 1', None, 'preview build'), + '14379': ( '10', None, 'Redstone 1', None, 'preview build'), + '14383': ( '10', None, 'Redstone 1', None, 'preview build'), + '14385': ( '10', None, 'Redstone 1', None, 'preview build'), + '14388': ( '10', None, 'Redstone 1', None, 'preview build'), + '14390': ( '10', None, 'Redstone 1', None, 'preview build'), + '14393': ( '10', 'v1607', 'Redstone 1', 'Anniversary Update', 'unsupported'), + '14901': ( '10', None, 'Redstone 2', None, 'preview build'), + '14905': ( '10', None, 'Redstone 2', None, 'preview build'), + '14915': ( '10', None, 'Redstone 2', None, 'preview build'), + '14926': ( '10', None, 'Redstone 2', None, 'preview build'), + '14931': ( '10', None, 'Redstone 2', None, 'preview build'), + '14936': ( '10', None, 'Redstone 2', None, 'preview build'), + '14942': ( '10', None, 'Redstone 2', None, 'preview build'), + '14946': ( '10', None, 'Redstone 2', None, 'preview build'), + '14951': ( '10', None, 'Redstone 2', None, 'preview build'), + '14955': ( '10', None, 'Redstone 2', None, 'preview build'), + '14959': ( '10', None, 'Redstone 2', None, 'preview build'), + '14965': ( '10', None, 'Redstone 2', None, 'preview build'), + '14971': ( '10', None, 'Redstone 2', None, 'preview build'), + '14986': ( '10', None, 'Redstone 2', None, 'preview build'), + '15002': ( '10', None, 'Redstone 2', None, 'preview build'), + '15007': ( '10', None, 'Redstone 2', None, 'preview build'), + '15014': ( '10', None, 'Redstone 2', None, 'preview build'), + '15019': ( '10', None, 'Redstone 2', None, 'preview build'), + '15025': ( '10', None, 'Redstone 2', None, 'preview build'), + '15031': ( '10', None, 'Redstone 2', None, 'preview build'), + '15042': ( '10', None, 'Redstone 2', None, 'preview build'), + '15046': ( '10', None, 'Redstone 2', None, 'preview build'), + '15048': ( '10', None, 'Redstone 2', None, 'preview build'), + '15055': ( '10', None, 'Redstone 2', None, 'preview build'), + '15058': ( '10', None, 'Redstone 2', None, 'preview build'), + '15060': ( '10', None, 'Redstone 2', None, 'preview build'), + '15061': ( '10', None, 'Redstone 2', None, 'preview build'), + '15063': ( '10', 'v1703', 'Redstone 2', 'Creators Update', 'outdated'), + '16170': ( '10', None, 'Redstone 3', None, 'preview build'), + '16176': ( '10', None, 'Redstone 3', None, 'preview build'), + '16179': ( '10', None, 'Redstone 3', None, 'preview build'), + '16184': ( '10', None, 'Redstone 3', None, 'preview build'), + '16188': ( '10', None, 'Redstone 3', None, 'preview build'), + '16193': ( '10', None, 'Redstone 3', None, 'preview build'), + '16199': ( '10', None, 'Redstone 3', None, 'preview build'), + '16212': ( '10', None, 'Redstone 3', None, 'preview build'), + '16215': ( '10', None, 'Redstone 3', None, 'preview build'), + '16226': ( '10', None, 'Redstone 3', None, 'preview build'), + '16232': ( '10', None, 'Redstone 3', None, 'preview build'), + '16237': ( '10', None, 'Redstone 3', None, 'preview build'), + '16241': ( '10', None, 'Redstone 3', None, 'preview build'), + '16251': ( '10', None, 'Redstone 3', None, 'preview build'), + '16257': ( '10', None, 'Redstone 3', None, 'preview build'), + '16273': ( '10', None, 'Redstone 3', None, 'preview build'), + '16275': ( '10', None, 'Redstone 3', None, 'preview build'), + '16278': ( '10', None, 'Redstone 3', None, 'preview build'), + '16281': ( '10', None, 'Redstone 3', None, 'preview build'), + '16288': ( '10', None, 'Redstone 3', None, 'preview build'), + '16291': ( '10', None, 'Redstone 3', None, 'preview build'), + '16294': ( '10', None, 'Redstone 3', None, 'preview build'), + '16296': ( '10', None, 'Redstone 3', None, 'preview build'), + '16299': ( '10', 'v1709', 'Redstone 3', 'Fall Creators Update', 'outdated'), + '16353': ( '10', None, 'Redstone 4', None, 'preview build'), + '16362': ( '10', None, 'Redstone 4', None, 'preview build'), + '17004': ( '10', None, 'Redstone 4', None, 'preview build'), + '17017': ( '10', None, 'Redstone 4', None, 'preview build'), + '17025': ( '10', None, 'Redstone 4', None, 'preview build'), + '17035': ( '10', None, 'Redstone 4', None, 'preview build'), + '17040': ( '10', None, 'Redstone 4', None, 'preview build'), + '17046': ( '10', None, 'Redstone 4', None, 'preview build'), + '17063': ( '10', None, 'Redstone 4', None, 'preview build'), + '17074': ( '10', None, 'Redstone 4', None, 'preview build'), + '17083': ( '10', None, 'Redstone 4', None, 'preview build'), + '17093': ( '10', None, 'Redstone 4', None, 'preview build'), + '17101': ( '10', None, 'Redstone 4', None, 'preview build'), + '17107': ( '10', None, 'Redstone 4', None, 'preview build'), + '17110': ( '10', None, 'Redstone 4', None, 'preview build'), + '17112': ( '10', None, 'Redstone 4', None, 'preview build'), + '17115': ( '10', None, 'Redstone 4', None, 'preview build'), + '17120': ( '10', None, 'Redstone 4', None, 'preview build'), + '17123': ( '10', None, 'Redstone 4', None, 'preview build'), + '17127': ( '10', None, 'Redstone 4', None, 'preview build'), + '17128': ( '10', None, 'Redstone 4', None, 'preview build'), + '17133': ( '10', None, 'Redstone 4', None, 'preview build'), + '17134': ( '10', 'v1803', 'Redstone 4', 'April 2018 Update', None), + '17604': ( '10', None, 'Redstone 5', None, 'preview build'), + '17618': ( '10', None, 'Redstone 5', None, 'preview build'), + '17623': ( '10', None, 'Redstone 5', None, 'preview build'), + '17627': ( '10', None, 'Redstone 5', None, 'preview build'), + '17634': ( '10', None, 'Redstone 5', None, 'preview build'), + '17639': ( '10', None, 'Redstone 5', None, 'preview build'), + '17643': ( '10', None, 'Redstone 5', None, 'preview build'), + '17650': ( '10', None, 'Redstone 5', None, 'preview build'), + '17655': ( '10', None, 'Redstone 5', None, 'preview build'), + '17661': ( '10', None, 'Redstone 5', None, 'preview build'), + '17666': ( '10', None, 'Redstone 5', None, 'preview build'), +} + +if __name__ == '__main__': + print("This file is not meant to be called directly.") diff --git a/.bin/Scripts/system_checklist.py b/.bin/Scripts/system_checklist.py index 9de65c8a..7de2e52a 100644 --- a/.bin/Scripts/system_checklist.py +++ b/.bin/Scripts/system_checklist.py @@ -70,7 +70,7 @@ if __name__ == '__main__': try_and_print(message='Activation:', function=show_os_activation, ns='Unknown', silent_function=False) if (not windows_is_activated() - and global_vars['OS']['Version'] in ('8', '10')): + and global_vars['OS']['Version'] in ('8', '8.1', '10')): try_and_print(message='BIOS Activation:', function=activate_with_bios, other_results=other_results) From 18c535dcfd43e4c434b1346e1f27b63987974c58 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Sun, 13 May 2018 16:09:07 -0600 Subject: [PATCH 03/46] Bugfix for OS detection * Avoids CurrentBuild collision between Win8 and Win8.1 * Fix DisplayName formatting --- .bin/Scripts/functions/common.py | 14 ++++++++++++-- .bin/Scripts/settings/windows_builds.py | 4 +++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.bin/Scripts/functions/common.py b/.bin/Scripts/functions/common.py index ef918f0f..492a1adb 100644 --- a/.bin/Scripts/functions/common.py +++ b/.bin/Scripts/functions/common.py @@ -616,12 +616,21 @@ def check_os(): # Query registry path = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion' with winreg.OpenKey(HKLM, path) as key: - for name in ['CurrentBuild', 'ProductName']: + for name in ['CurrentBuild', 'CurrentVersion', 'ProductName']: try: tmp[name] = winreg.QueryValueEx(key, name)[0] except FileNotFoundError: tmp[name] = 'Unknown' + # Handle CurrentBuild collision + if tmp['CurrentBuild'] == '9200': + if tmp['CurrentVersion'] == '6.2': + # Windown 8, set to fake build number + tmp['CurrentBuild'] = '9199' + else: + # Windows 8.1, leave alone + pass + # Check bit depth tmp['Arch'] = 32 if 'PROGRAMFILES(X86)' in global_vars['Env']: @@ -631,6 +640,7 @@ def check_os(): build_info = WINDOWS_BUILDS.get( tmp['CurrentBuild'], ('Unknown', 'Build {}'.format(tmp['CurrentBuild']), None, None, 'unrecognized')) + build_info = list(build_info) tmp['Version'] = build_info.pop(0) tmp['Release'] = build_info.pop(0) tmp['Codename'] = build_info.pop(0) @@ -650,7 +660,7 @@ def check_os(): # Set display name tmp['DisplayName'] = '{} x{}'.format(tmp['Name'], tmp['Arch']) if tmp['Notes']: - tmp['Name'] += ' ({})'.format(tmp['Notes']) + tmp['DisplayName'] += ' ({})'.format(tmp['Notes']) global_vars['OS'] = tmp diff --git a/.bin/Scripts/settings/windows_builds.py b/.bin/Scripts/settings/windows_builds.py index 4be67d98..bdac8bf4 100644 --- a/.bin/Scripts/settings/windows_builds.py +++ b/.bin/Scripts/settings/windows_builds.py @@ -10,7 +10,9 @@ WINDOWS_BUILDS = { '7600': ( '7', 'RTM', 'Vienna', None, 'unsupported'), '7601': ( '7', 'SP1', 'Vienna', None, 'outdated'), - '9200': ( '8', 'RTM', None, None, 'unsupported'), + #9199 is a fake build since Win 8 is 6.2.9200 but that collides with Win 8.1 (6.3.9200) + '9199': ( '8', 'RTM', None, None, 'unsupported'), + '9200': ( '8.1', None, 'Blue', None, 'outdated'), '9600': ( '8.1', None, 'Update', None, None), From 79d2af6e0aa2764dcef054400a1df5075305b7b6 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Sun, 13 May 2018 18:20:42 -0600 Subject: [PATCH 04/46] Fix issue #27 Several popen_program() calls were not inside try blocks causing full crashes --- .bin/Scripts/functions/setup.py | 10 ++++++++++ .bin/Scripts/system_checklist.py | 15 ++++++++++----- .bin/Scripts/user_data_transfer.py | 3 ++- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.bin/Scripts/functions/setup.py b/.bin/Scripts/functions/setup.py index c6b681a8..8e873088 100644 --- a/.bin/Scripts/functions/setup.py +++ b/.bin/Scripts/functions/setup.py @@ -268,5 +268,15 @@ def install_vcredists(): os.chdir(prev_dir) +# Misc +def open_device_manager(): + popen_program(['mmc', 'devmgmt.msc']) + +def open_windows_activation(): + popen_program(['slui']) + +def open_windows_updates(): + popen_program(['control', '/name', 'Microsoft.WindowsUpdate']) + if __name__ == '__main__': print("This file is not meant to be called directly.") diff --git a/.bin/Scripts/system_checklist.py b/.bin/Scripts/system_checklist.py index 7de2e52a..d3d6a978 100644 --- a/.bin/Scripts/system_checklist.py +++ b/.bin/Scripts/system_checklist.py @@ -81,13 +81,18 @@ if __name__ == '__main__': function=show_installed_ram, ns='Unknown', silent_function=False) # Play audio, show devices, open Windows updates, and open Activation - popen_program(['mmc', 'devmgmt.msc']) - run_hwinfo_sensors() - popen_program(['control', '/name', 'Microsoft.WindowsUpdate']) + try_and_print(message='Opening Device Manager...', + function=open_device_manager, cs='Started') + try_and_print(message='Opening HWiNFO (Sensors)...', + function=run_hwinfo_sensors, cs='Started') + try_and_print(message='Opening Windows Updates...', + function=open_windows_updates, cs='Started') if not windows_is_activated(): - popen_program('slui') + try_and_print(message='Opening Windows Activation...', + function=open_windows_activation, cs='Started') sleep(3) - run_xmplay() + try_and_print(message='Running XMPlay...', + function=run_xmplay, cs='Started') # Done print_standard('\nDone.') diff --git a/.bin/Scripts/user_data_transfer.py b/.bin/Scripts/user_data_transfer.py index 8616137e..1c787cfe 100644 --- a/.bin/Scripts/user_data_transfer.py +++ b/.bin/Scripts/user_data_transfer.py @@ -43,7 +43,8 @@ if __name__ == '__main__': umount_backup_shares() # Done - run_kvrt() + try_and_print(message='Running KVRT...', + function=run_kvrt, cs='Started') print_standard('\nDone.') pause("Press Enter to exit...") exit_script() From 17dc572c4a1d807aaf99a374b9775da28ae8a6fc Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Sun, 13 May 2018 18:57:27 -0600 Subject: [PATCH 05/46] Added warnings for missing tools --- .bin/Scripts/functions/common.py | 7 ++++++- .bin/Scripts/system_checklist.py | 15 ++++++++------- .bin/Scripts/system_diagnostics.py | 19 ++++++++++--------- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/.bin/Scripts/functions/common.py b/.bin/Scripts/functions/common.py index 492a1adb..050205e7 100644 --- a/.bin/Scripts/functions/common.py +++ b/.bin/Scripts/functions/common.py @@ -470,7 +470,12 @@ def stay_awake(): def get_exception(s): """Get exception by name, returns Exception object.""" - return getattr(sys.modules[__name__], s) + try: + obj = getattr(sys.modules[__name__], s) + except AttributeError: + # Try builtin classes + obj = getattr(sys.modules['builtins'], s) + return obj def try_and_print(message='Trying...', function=None, cs='CS', ns='NS', other_results={}, diff --git a/.bin/Scripts/system_checklist.py b/.bin/Scripts/system_checklist.py index d3d6a978..e3eca0bf 100644 --- a/.bin/Scripts/system_checklist.py +++ b/.bin/Scripts/system_checklist.py @@ -26,6 +26,7 @@ if __name__ == '__main__': 'Error': { 'CalledProcessError': 'Unknown Error', 'BIOSKeyNotFoundError': 'BIOS key not found', + 'FileNotFoundError': 'Program not found', }, 'Warning': {}} print_info('Starting System Checklist for Ticket #{}\n'.format( @@ -44,20 +45,20 @@ if __name__ == '__main__': try_and_print(message='Desktop...', function=cleanup_desktop, cs='Done') try_and_print(message='AdwCleaner...', - function=cleanup_adwcleaner, cs='Done') + function=cleanup_adwcleaner, cs='Done', other_results=other_results) # Export system info print_info('Backup System Information') try_and_print(message='AIDA64 reports...', - function=run_aida64, cs='Done') + function=run_aida64, cs='Done', other_results=other_results) try_and_print(message='File listing...', - function=backup_file_list, cs='Done') + function=backup_file_list, cs='Done', other_results=other_results) try_and_print(message='Power plans...', function=backup_power_plans, cs='Done') - try_and_print(message='Product Keys...', + try_and_print(message='Product Keys...', other_results=other_results, function=run_produkey, cs='Done') try_and_print(message='Registry...', - function=backup_registry, cs='Done') + function=backup_registry, cs='Done', other_results=other_results) # User data print_info('User Data') @@ -84,7 +85,7 @@ if __name__ == '__main__': try_and_print(message='Opening Device Manager...', function=open_device_manager, cs='Started') try_and_print(message='Opening HWiNFO (Sensors)...', - function=run_hwinfo_sensors, cs='Started') + function=run_hwinfo_sensors, cs='Started', other_results=other_results) try_and_print(message='Opening Windows Updates...', function=open_windows_updates, cs='Started') if not windows_is_activated(): @@ -92,7 +93,7 @@ if __name__ == '__main__': function=open_windows_activation, cs='Started') sleep(3) try_and_print(message='Running XMPlay...', - function=run_xmplay, cs='Started') + function=run_xmplay, cs='Started', other_results=other_results) # Done print_standard('\nDone.') diff --git a/.bin/Scripts/system_diagnostics.py b/.bin/Scripts/system_diagnostics.py index 0d10f144..3b1418d0 100644 --- a/.bin/Scripts/system_diagnostics.py +++ b/.bin/Scripts/system_diagnostics.py @@ -25,6 +25,7 @@ if __name__ == '__main__': other_results = { 'Error': { 'CalledProcessError': 'Unknown Error', + 'FileNotFoundError': 'Program not found', }, 'Warning': { 'GenericRepair': 'Repaired', @@ -38,9 +39,9 @@ if __name__ == '__main__': # try_and_print(message='Killing processes...', # function=run_process_killer, cs='Done') try_and_print(message='Running RKill...', - function=run_rkill, cs='Done') + function=run_rkill, cs='Done', other_results=other_results) try_and_print(message='Running TDSSKiller...', - function=run_tdsskiller, cs='Done') + function=run_tdsskiller, cs='Done', other_results=other_results) # Re-run if earlier process was stopped. stay_awake() @@ -49,9 +50,9 @@ if __name__ == '__main__': print_info('Starting Background Scans') check_connection() try_and_print(message='Running HitmanPro...', - function=run_hitmanpro, cs='Started') + function=run_hitmanpro, cs='Started', other_results=other_results) try_and_print(message='Running Autoruns...', - function=run_autoruns, cs='Started') + function=run_autoruns, cs='Started', other_results=other_results) # OS Health Checks print_info('OS Health Checks') @@ -70,18 +71,18 @@ if __name__ == '__main__': # Export system info print_info('Backup System Information') try_and_print(message='AIDA64 reports...', - function=run_aida64, cs='Done') + function=run_aida64, cs='Done', other_results=other_results) try_and_print(message='BleachBit report...', - function=run_bleachbit, cs='Done') + function=run_bleachbit, cs='Done', other_results=other_results) backup_browsers() try_and_print(message='File listing...', - function=backup_file_list, cs='Done') + function=backup_file_list, cs='Done', other_results=other_results) try_and_print(message='Power plans...', function=backup_power_plans, cs='Done') try_and_print(message='Product Keys...', - function=run_produkey, cs='Done') + function=run_produkey, cs='Done', other_results=other_results) try_and_print(message='Registry...', - function=backup_registry, cs='Done') + function=backup_registry, cs='Done', other_results=other_results) # Summary print_info('Summary') From ebffd2a2dd9fc1271de305fb273d6804cabe699e Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Mon, 14 May 2018 07:54:33 -0600 Subject: [PATCH 06/46] Added more missing file warnings * Part of the fix for #27 --- .bin/Scripts/functions/setup.py | 17 ++++++++++++++--- .bin/Scripts/install_sw_bundle.py | 10 +++++++--- .bin/Scripts/system_checklist.py | 2 +- .bin/Scripts/system_diagnostics.py | 2 +- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.bin/Scripts/functions/setup.py b/.bin/Scripts/functions/setup.py index 8e873088..693e84a2 100644 --- a/.bin/Scripts/functions/setup.py +++ b/.bin/Scripts/functions/setup.py @@ -5,6 +5,12 @@ from functions.common import * # STATIC VARIABLES HKCU = winreg.HKEY_CURRENT_USER HKLM = winreg.HKEY_LOCAL_MACHINE +OTHER_RESULTS = { + 'Error': { + 'CalledProcessError': 'Unknown Error', + 'FileNotFoundError': 'File not found', + }, + 'Warning': {}} SETTINGS_CLASSIC_START = { r'Software\IvoSoft\ClassicShell\Settings': {}, r'Software\IvoSoft\ClassicStartMenu': { @@ -212,7 +218,7 @@ def install_adobe_reader(): '/msi', '/norestart', '/quiet', 'ALLUSERS=1', 'EULA_ACCEPT=YES'] - try_and_print(message='Adobe Reader DC...', function=run_program, cmd=cmd) + run_program(cmd) def install_chrome_extensions(): """Update registry to 'install' Google Chrome extensions for all users.""" @@ -235,12 +241,16 @@ def install_firefox_extensions(): """Extract Firefox extensions to installation folder.""" dist_path = r'{PROGRAMFILES}\Mozilla Firefox\distribution\extensions'.format( **global_vars['Env']) + source_path = r'{CBinDir}\FirefoxExtensions.7z'.format(**global_vars) + if not os.path.exists(source_path): + raise FileNotFoundError + # Extract extension(s) to distribution folder cmd = [ global_vars['Tools']['SevenZip'], 'x', '-aos', '-bso0', '-bse0', '-p{ArchivePassword}'.format(**global_vars), '-o{dist_path}'.format(dist_path=dist_path), - r'{CBinDir}\FirefoxExtensions.7z'.format(**global_vars)] + source_path] run_program(cmd) def install_ninite_bundle(mse=False): @@ -264,7 +274,8 @@ def install_vcredists(): prev_dir = os.getcwd() os.chdir(r'{BinDir}\_vcredists'.format(**global_vars)) for vcr in VCR_REDISTS: - try_and_print(message=vcr['Name'], function=run_program, cmd=vcr['Cmd']) + try_and_print(message=vcr['Name'], function=run_program, + cmd=vcr['Cmd'], other_results=OTHER_RESULTS) os.chdir(prev_dir) diff --git a/.bin/Scripts/install_sw_bundle.py b/.bin/Scripts/install_sw_bundle.py index 9f8594b0..d98eb8d2 100644 --- a/.bin/Scripts/install_sw_bundle.py +++ b/.bin/Scripts/install_sw_bundle.py @@ -19,6 +19,7 @@ if __name__ == '__main__': other_results = { 'Error': { 'CalledProcessError': 'Unknown Error', + 'FileNotFoundError': 'File not found', }, 'Warning': { 'GenericRepair': 'Repaired', @@ -36,12 +37,14 @@ if __name__ == '__main__': print_info('Installing Programs') if answer_adobe_reader: - install_adobe_reader() + try_and_print(message='Adobe Reader DC...', + function=install_adobe_reader, other_results=other_results) if answer_vcr: install_vcredists() if answer_ninite: try_and_print(message='Ninite bundle...', - function=install_ninite_bundle, cs='Started', mse=answer_mse) + function=install_ninite_bundle, cs='Started', + mse=answer_mse, other_results=other_results) if answer_extensions: wait_for_process('ninite.exe') print_info('Installing Extensions') @@ -51,7 +54,8 @@ if __name__ == '__main__': try_and_print(message='Google Chrome extensions...', function=install_chrome_extensions) try_and_print(message='Mozilla Firefox extensions...', - function=install_firefox_extensions) + function=install_firefox_extensions, + other_results=other_results) print_standard('\nDone.') exit_script() except SystemExit: diff --git a/.bin/Scripts/system_checklist.py b/.bin/Scripts/system_checklist.py index e3eca0bf..6e0a1fcb 100644 --- a/.bin/Scripts/system_checklist.py +++ b/.bin/Scripts/system_checklist.py @@ -26,7 +26,7 @@ if __name__ == '__main__': 'Error': { 'CalledProcessError': 'Unknown Error', 'BIOSKeyNotFoundError': 'BIOS key not found', - 'FileNotFoundError': 'Program not found', + 'FileNotFoundError': 'File not found', }, 'Warning': {}} print_info('Starting System Checklist for Ticket #{}\n'.format( diff --git a/.bin/Scripts/system_diagnostics.py b/.bin/Scripts/system_diagnostics.py index 3b1418d0..59e31465 100644 --- a/.bin/Scripts/system_diagnostics.py +++ b/.bin/Scripts/system_diagnostics.py @@ -25,7 +25,7 @@ if __name__ == '__main__': other_results = { 'Error': { 'CalledProcessError': 'Unknown Error', - 'FileNotFoundError': 'Program not found', + 'FileNotFoundError': 'File not found', }, 'Warning': { 'GenericRepair': 'Repaired', From e751696307da55cf799359b30d1b30a655eee166 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Mon, 14 May 2018 08:01:09 -0600 Subject: [PATCH 07/46] Avoid crash if VCR+ installers are missing --- .bin/Scripts/functions/setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.bin/Scripts/functions/setup.py b/.bin/Scripts/functions/setup.py index 693e84a2..d08692b5 100644 --- a/.bin/Scripts/functions/setup.py +++ b/.bin/Scripts/functions/setup.py @@ -272,7 +272,11 @@ def install_vcredists(): """Install all supported Visual C++ runtimes.""" extract_item('_vcredists', silent=True) prev_dir = os.getcwd() - os.chdir(r'{BinDir}\_vcredists'.format(**global_vars)) + try: + os.chdir(r'{BinDir}\_vcredists'.format(**global_vars)) + except FileNotFoundError: + # Ignored since the loop below will report the errors + pass for vcr in VCR_REDISTS: try_and_print(message=vcr['Name'], function=run_program, cmd=vcr['Cmd'], other_results=OTHER_RESULTS) From 8ea17268c7869790ef0f6a33b6b19704a2944861 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Mon, 14 May 2018 09:32:42 -0600 Subject: [PATCH 08/46] Fixed local sources for user_data_transfer * Added support for local images and root folders --- .bin/Scripts/functions/data.py | 52 +++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/.bin/Scripts/functions/data.py b/.bin/Scripts/functions/data.py index b7306a9d..93ab07ce 100644 --- a/.bin/Scripts/functions/data.py +++ b/.bin/Scripts/functions/data.py @@ -16,6 +16,9 @@ class LocalDisk(): def is_dir(self): # Should always be true return True + def is_file(self): + # Should always be false + return False class SourceItem(): def __init__(self, name, path): @@ -404,7 +407,13 @@ def scan_source(source_obj, dest_path, rel_path='', interactive=True): root_items = [] item_list = list_source_items(source_obj, rel_path) for item in item_list: - if REGEX_INCL_ROOT_ITEMS.search(item.name): + if REGEX_WINDOWS_OLD.search(item.name): + item.name = '{}{}{}'.format( + rel_path, + os.sep if rel_path else '', + item.name) + win_olds.append(item) + elif REGEX_INCL_ROOT_ITEMS.search(item.name): print_success('Auto-Selected: {}'.format(item.path)) root_items.append('{}'.format(item.path)) elif not REGEX_EXCL_ROOT_ITEMS.search(item.name): @@ -424,12 +433,6 @@ def scan_source(source_obj, dest_path, rel_path='', interactive=True): interactive = False if answer in ['Yes', 'All']: root_items.append('{}'.format(item.path)) - if REGEX_WINDOWS_OLD.search(item.name): - item.name = '{}{}{}'.format( - rel_path, - os.sep if rel_path else '', - item.name) - win_olds.append(item) if root_items: selected_items.append({ 'Message': '{}{}Root Items...'.format( @@ -446,7 +449,8 @@ def scan_source(source_obj, dest_path, rel_path='', interactive=True): rel_path, ' ' if rel_path else ''), 'Items': [font_obj.path], - 'Destination': dest_path}) + 'Destination': '{}{}Windows'.format( + dest_path, os.sep)}) # Registry registry_items = [] @@ -461,13 +465,14 @@ def scan_source(source_obj, dest_path, rel_path='', interactive=True): rel_path, ' ' if rel_path else ''), 'Items': registry_items.copy(), - 'Destination': dest_path}) + 'Destination': '{}{}Windows{}System32'.format( + dest_path, os.sep, os.sep)}) # Windows.old(s) for old in win_olds: selected_items.extend(scan_source( source_obj, - dest_path, + '{}{}{}'.format(dest_path, os.sep, old.name), rel_path=old.name, interactive=False)) @@ -630,6 +635,31 @@ def select_source(ticket_number): ' Local', d.mountpoint), 'Sort': d.mountpoint, 'Source': LocalDisk(d)}) + # Check for images and subfolders + for item in os.scandir(d.mountpoint): + if REGEX_WIM_FILE.search(item.name): + try: + size = human_readable_size(item.stat().st_size) + except Exception: + size = ' ? ?' # unknown + local_sources.append({ + 'Disabled': bool(not is_valid_wim_file(item)), + 'Name': r'{:9}| Image-Based: {:>7} {}{}'.format( + ' Local', size, d.mountpoint, item.name), + 'Sort': r'{}{}'.format(d.mountpoint, item.name), + 'Source': item}) + elif REGEX_EXCL_ROOT_ITEMS.search(item.name): + pass + elif REGEX_EXCL_ITEMS.search(item.name): + pass + elif item.is_dir(): + # Add folder to local_sources + local_sources.append({ + 'Name': r'{:9}| File-Based: [DIR] {}{}'.format( + ' Local', d.mountpoint, item.name), + 'Sort': r'{}{}'.format(d.mountpoint, item.name), + 'Source': item}) + set_thread_error_mode(silent=False) # Return to normal # Build Menu @@ -736,7 +766,7 @@ def transfer_source(source_obj, dest_path, selected_items): function=run_wimextract, cs='Done', source=source_obj.path, items=group['Items'], - dest=group['Destination']) + dest=dest_path) else: print_error('ERROR: Unsupported image: {}'.format(source_obj.path)) raise GenericError From 6868988cec49a3cabb725637809aa9bf8cd4ad75 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Mon, 14 May 2018 12:11:38 -0600 Subject: [PATCH 09/46] Added antivirus check to the system_checklist * Fixes issue #31 --- .bin/Scripts/functions/info.py | 30 ++++++++++++++++++++++++++++++ .bin/Scripts/system_checklist.py | 6 +++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/.bin/Scripts/functions/info.py b/.bin/Scripts/functions/info.py index fbde1a27..b81a4922 100644 --- a/.bin/Scripts/functions/info.py +++ b/.bin/Scripts/functions/info.py @@ -116,6 +116,36 @@ def get_folder_size(path): size = human_readable_size(size) return size +def get_installed_antivirus(): + """Get list of installed Antivirus programs.""" + programs = [] + cmd = ['WMIC', r'/namespace:\\root\SecurityCenter2', + 'path', 'AntivirusProduct', + 'get', 'displayName', '/value'] + out = run_program(cmd) + out = out.stdout.decode().strip() + products = out.splitlines() + products = [p.split('=')[1] for p in products if p] + for prod in sorted(products): + # Get product state and check if it's enabled + # credit: https://jdhitsolutions.com/blog/powershell/5187/get-antivirus-product-status-with-powershell/ + cmd = ['WMIC', r'/namespace:\\root\SecurityCenter2', + 'path', 'AntivirusProduct', + 'where', 'displayName="{}"'.format(prod), + 'get', 'productState', '/value'] + out = run_program(cmd) + out = out.stdout.decode().strip() + state = out.split('=')[1] + state = hex(int(state)) + if str(state)[3:5] != '10': + programs.append('[Disabled] {}'.format(prod)) + else: + programs.append(prod) + + if len(programs) == 0: + programs = ['No programs found'] + return programs + def get_installed_office(): """Get list of installed Office programs.""" programs = [] diff --git a/.bin/Scripts/system_checklist.py b/.bin/Scripts/system_checklist.py index 6e0a1fcb..e0f217ed 100644 --- a/.bin/Scripts/system_checklist.py +++ b/.bin/Scripts/system_checklist.py @@ -75,8 +75,12 @@ if __name__ == '__main__': try_and_print(message='BIOS Activation:', function=activate_with_bios, other_results=other_results) + try_and_print(message='Installed Antivirus:', + function=get_installed_antivirus, ns='Unknown', + other_results=other_results, print_return=True) try_and_print(message='Installed Office:', - function=get_installed_office, ns='Unknown', print_return=True) + function=get_installed_office, ns='Unknown', + other_results=other_results, print_return=True) show_free_space() try_and_print(message='Installed RAM:', function=show_installed_ram, ns='Unknown', silent_function=False) From 0902a7997f30eac0e5d994e08213bb4b24532e1f Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Mon, 14 May 2018 12:58:06 -0600 Subject: [PATCH 10/46] Moved SafeMode sections into functions/safemode.py * Allows for better descriptions of the actions being taken * Allowd for better error handling * Fixes issue #34 --- .bin/Scripts/functions/safemode.py | 36 ++++++++++++++++++++++++++++++ .bin/Scripts/safemode_enter.py | 32 +++++++++++--------------- .bin/Scripts/safemode_exit.py | 30 +++++++++++-------------- 3 files changed, 62 insertions(+), 36 deletions(-) create mode 100644 .bin/Scripts/functions/safemode.py diff --git a/.bin/Scripts/functions/safemode.py b/.bin/Scripts/functions/safemode.py new file mode 100644 index 00000000..9f44aa04 --- /dev/null +++ b/.bin/Scripts/functions/safemode.py @@ -0,0 +1,36 @@ +# Wizard Kit: Functions - SafeMode + +from functions.common import * + +# STATIC VARIABLES +REG_MSISERVER = r'HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer' + +def disable_safemode_msi(): + """Disable MSI access under safemode.""" + cmd = ['reg', 'delete', REG_MSISERVER, '/f'] + run_program(cmd) + +def disable_safemode(): + """Edit BCD to remove safeboot value.""" + cmd = ['bcdedit', '/deletevalue', '{default}', 'safeboot'] + run_program(cmd) + +def enable_safemode_msi(): + """Enable MSI access under safemode.""" + cmd = ['reg', 'add', REG_MSISERVER, '/f'] + run_program(cmd) + cmd = ['reg', 'add', REG_MSISERVER, '/ve', + '/t', 'REG_SZ', '/d', 'Service', '/f'] + run_program(cmd) + +def enable_safemode(): + """Edit BCD to set safeboot as default.""" + cmd = ['bcdedit', '/set', '{default}', 'safeboot', 'network'] + run_program(cmd) + +def reboot(delay=3): + cmd = ['shutdown', '-r', '-t', '{}'.format(delay)] + run_program(cmd, check=False) + +if __name__ == '__main__': + print("This file is not meant to be called directly.") diff --git a/.bin/Scripts/safemode_enter.py b/.bin/Scripts/safemode_enter.py index 825e7352..c3213cb9 100644 --- a/.bin/Scripts/safemode_enter.py +++ b/.bin/Scripts/safemode_enter.py @@ -3,13 +3,10 @@ import os import sys -# STATIC VARIABLES -REG_MSISERVER = r'HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer' - # Init os.chdir(os.path.dirname(os.path.realpath(__file__))) sys.path.append(os.getcwd()) -from functions.common import * +from functions.safemode import * init_global_vars() os.system('title {}: SafeMode Tool'.format(KIT_NAME_FULL)) @@ -17,26 +14,23 @@ if __name__ == '__main__': try: clear_screen() print_info('{}: SafeMode Tool\n'.format(KIT_NAME_FULL)) + other_results = { + 'Error': {'CalledProcessError': 'Unknown Error'}, + 'Warning': {}} + if not ask('Enable booting to SafeMode (with Networking)?'): abort() - # Edit BCD to set safeboot as default - cmd = ['bcdedit', '/set', '{default}', 'safeboot', 'network'] - run_program(cmd, check=False) - - # Enable MSI access under safemode - cmd = ['reg', 'add', REG_MSISERVER, '/f'] - run_program(cmd, check=False) - cmd = ['reg', 'add', REG_MSISERVER, '/ve', - '/t', 'REG_SZ', '/d', 'Service', '/f'] - run_program(cmd, check=False) - - ## Done ## - pause('Press Enter to reboot...') - cmd = ['shutdown', '-r', '-t', '3'] - run_program(cmd, check=False) + # Configure SafeMode + try_and_print(message='Set BCD option...', + function=enable_safemode, other_results=other_results) + try_and_print(message='Enable MSI in SafeMode...', + function=enable_safemode_msi, other_results=other_results) # Done + print_standard('\nDone.') + pause('Press Enter to reboot...') + reboot() exit_script() except SystemExit: pass diff --git a/.bin/Scripts/safemode_exit.py b/.bin/Scripts/safemode_exit.py index 267aac60..1449cff5 100644 --- a/.bin/Scripts/safemode_exit.py +++ b/.bin/Scripts/safemode_exit.py @@ -3,13 +3,10 @@ import os import sys -# STATIC VARIABLES -REG_MSISERVER = r'HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer' - # Init os.chdir(os.path.dirname(os.path.realpath(__file__))) sys.path.append(os.getcwd()) -from functions.common import * +from functions.safemode import * init_global_vars() os.system('title {}: SafeMode Tool'.format(KIT_NAME_FULL)) @@ -17,24 +14,23 @@ if __name__ == '__main__': try: clear_screen() print_info('{}: SafeMode Tool\n'.format(KIT_NAME_FULL)) + other_results = { + 'Error': {'CalledProcessError': 'Unknown Error'}, + 'Warning': {}} + if not ask('Disable booting to SafeMode?'): abort() - # Edit BCD to remove safeboot value - for boot in ['{current}', '{default}']: - cmd = ['bcdedit', '/deletevalue', boot, 'safeboot'] - run_program(cmd, check=False) - - # Disable MSI access under safemode - cmd = ['reg', 'delete', REG_MSISERVER, '/f'] - run_program(cmd, check=False) - - ## Done ## - pause('Press Enter to reboot...') - cmd = ['shutdown', '-r', '-t', '3'] - run_program(cmd, check=False) + # Configure SafeMode + try_and_print(message='Remove BCD option...', + function=disable_safemode, other_results=other_results) + try_and_print(message='Disable MSI in SafeMode...', + function=disable_safemode_msi, other_results=other_results) # Done + print_standard('\nDone.') + pause('Press Enter to reboot...') + reboot() exit_script() except SystemExit: pass From 2305c047deca53ae8aea357e012d514072343868 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Wed, 16 May 2018 15:11:42 -0600 Subject: [PATCH 11/46] Adjusted live Linux packages * Switched to broadcom-wl-dkms * Hopefully it doesn't break everything... * Removed several unwanted packages (for example: modem/dialup packages) * Fixes issue #30 * Packages to be added are now tracked in .linux_items/packages/live_add * Packages to be removed are now tracked in .linux_items/packages/live_remove --- .linux_items/packages/{live => live_add} | 1 + .linux_items/packages/live_remove | 21 +++++++++++++++++++++ Build Linux | 6 ++++-- 3 files changed, 26 insertions(+), 2 deletions(-) rename .linux_items/packages/{live => live_add} (98%) create mode 100644 .linux_items/packages/live_remove diff --git a/.linux_items/packages/live b/.linux_items/packages/live_add similarity index 98% rename from .linux_items/packages/live rename to .linux_items/packages/live_add index 0bf86276..ae5e433e 100644 --- a/.linux_items/packages/live +++ b/.linux_items/packages/live_add @@ -6,6 +6,7 @@ bash-pipes bc bluez bluez-utils +broadcom-wl-dkms cbatticon chntpw cmatrix diff --git a/.linux_items/packages/live_remove b/.linux_items/packages/live_remove new file mode 100644 index 00000000..5e090d49 --- /dev/null +++ b/.linux_items/packages/live_remove @@ -0,0 +1,21 @@ +arch-install-scripts +b43-fwcutter +broadcom-wl +darkhttpd +gpm +grml-zsh-config +grub +irssi +mc +openvpn +ppp +pptpclient +refind-efi +rp-pppoe +smartmontools +speedtouch +testdisk +vim-minimal +vpnc +wvdial +xl2tpd diff --git a/Build Linux b/Build Linux index 3a50b9af..6ee0f169 100755 --- a/Build Linux +++ b/Build Linux @@ -189,8 +189,10 @@ function update_live_env() { echo "127.0.1.1 $hostname.localdomain $hostname" >> "$LIVE_DIR/airootfs/etc/hosts" # Live packages - sed -i -r 's/^(b43|clonezilla|gpm|grml|refind|testdisk|vim)/#\1/' "$LIVE_DIR/packages.both" - cat "$ROOT_DIR/.linux_items/packages/live" >> "$LIVE_DIR/packages.both" + while read -r p; do + sed -i "/$p/d" "$LIVE_DIR/packages.both" + done < "$ROOT_DIR/.linux_items/packages/live_remove" + cat "$ROOT_DIR/.linux_items/packages/live_add" >> "$LIVE_DIR/packages.both" echo "[custom]" >> "$LIVE_DIR/pacman.conf" echo "SigLevel = Optional TrustAll" >> "$LIVE_DIR/pacman.conf" echo "Server = file://$REPO_DIR" >> "$LIVE_DIR/pacman.conf" From 96e008bec738ac0d3258c4182fa6d34f80bbdf39 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Wed, 16 May 2018 16:04:50 -0600 Subject: [PATCH 12/46] Switch back to broadcom-wl * Forgot that DKMS requires the Linux headers and that would bloat the image --- .linux_items/packages/live_add | 1 - .linux_items/packages/live_remove | 1 - 2 files changed, 2 deletions(-) diff --git a/.linux_items/packages/live_add b/.linux_items/packages/live_add index ae5e433e..0bf86276 100644 --- a/.linux_items/packages/live_add +++ b/.linux_items/packages/live_add @@ -6,7 +6,6 @@ bash-pipes bc bluez bluez-utils -broadcom-wl-dkms cbatticon chntpw cmatrix diff --git a/.linux_items/packages/live_remove b/.linux_items/packages/live_remove index 5e090d49..9feb3c02 100644 --- a/.linux_items/packages/live_remove +++ b/.linux_items/packages/live_remove @@ -1,6 +1,5 @@ arch-install-scripts b43-fwcutter -broadcom-wl darkhttpd gpm grml-zsh-config From f7d55306bec2806a968961348b134bc4630b36d7 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Thu, 17 May 2018 15:11:36 -0600 Subject: [PATCH 13/46] Adjusted packages * Added ARandR * Added GPicView * Added XArchiver * Switched to Evince over MuPDF --- .linux_items/packages/live_add | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.linux_items/packages/live_add b/.linux_items/packages/live_add index 0bf86276..a297ca05 100644 --- a/.linux_items/packages/live_add +++ b/.linux_items/packages/live_add @@ -1,6 +1,7 @@ aic94xx-firmware alsa-utils antiword +arandr arc-gtk-theme bash-pipes bc @@ -12,16 +13,19 @@ cmatrix colordiff compton conky +cpio curl dmidecode dos2unix dunst e2fsprogs +evince feh ffmpeg firefox gnome-keyring gparted +gpicview-gtk3 gsmartcontrol hardinfo hexedit @@ -33,17 +37,18 @@ i3status inxi ldns leafpad +lha libewf libinput linux-firmware lm_sensors +lzip mdadm mediainfo mesa-demos mkvtoolnix-cli mprime mpv -mupdf ncdu network-manager-applet networkmanager @@ -80,6 +85,8 @@ ttf-inconsolata udevil udisks2 ufw +unarj +unrar unzip util-linux veracrypt @@ -89,6 +96,7 @@ virtualbox-guest-utils volumeicon wd719x-firmware wimlib +xarchiver xf86-input-libinput xf86-video-amdgpu xf86-video-fbdev @@ -99,4 +107,5 @@ xorg-xdpyinfo xorg-xev xorg-xinit xorg-xinput +zip zsh From f1700e5ba9f15fca6635714938ca0646805bbd74 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Thu, 17 May 2018 15:13:26 -0600 Subject: [PATCH 14/46] Adjusted app associations in Thunar --- .../airootfs/etc/skel/.config/mimeapps.list | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.linux_items/include/airootfs/etc/skel/.config/mimeapps.list b/.linux_items/include/airootfs/etc/skel/.config/mimeapps.list index e8beceeb..5b4a6b92 100644 --- a/.linux_items/include/airootfs/etc/skel/.config/mimeapps.list +++ b/.linux_items/include/airootfs/etc/skel/.config/mimeapps.list @@ -1,25 +1,27 @@ [Added Associations] -application/pdf=mupdf.desktop; +application/pdf=evince.desktop; application/vnd.adobe.flash.movie=mpv.desktop; application/vnd.ms-asf=mpv.desktop; +application/x-desktop=leafpad.desktop; audio/flac=mpv.desktop; audio/mp4=mpv.desktop; audio/mpeg=mpv.desktop; audio/x-vorbis+ogg=mpv.desktop; -image/bmp=ristretto.desktop; -image/gif=ristretto.desktop; -image/jpeg=ristretto.desktop; -image/png=ristretto.desktop; -image/vnd.microsoft.icon=ristretto.desktop; +image/bmp=gpicview.desktop; +image/gif=gpicview.desktop; +image/jpeg=gpicview.desktop; +image/png=gpicview.desktop; +image/vnd.microsoft.icon=gpicview.desktop; inode/directory=exo-file-manager.desktop -text/plain=mousepad.desktop; +text/plain=leafpad.desktop; +text/x-log=leafpad.desktop; video/mp4=mpv.desktop; video/mpeg=mpv.desktop; video/quicktime=mpv.desktop; video/x-flv=mpv.desktop; video/x-matroska=mpv.desktop; -video/x-msvideo=mpv.desktop; video/x-ms-wmv=mpv.desktop; +video/x-msvideo=mpv.desktop; x-scheme-handler/http=exo-web-browser.desktop x-scheme-handler/https=exo-web-browser.desktop x-scheme-handler/trash=exo-file-manager.desktop From 1c3520806caee4601a44b7c0d197cb6f2c4dbb2d Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Thu, 17 May 2018 15:17:14 -0600 Subject: [PATCH 15/46] Avoid nohup.out creation --- .bin/Scripts/functions/hw_diags.py | 2 +- .bin/Scripts/mount-all-volumes | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.bin/Scripts/functions/hw_diags.py b/.bin/Scripts/functions/hw_diags.py index 5da13e7b..1ece188c 100644 --- a/.bin/Scripts/functions/hw_diags.py +++ b/.bin/Scripts/functions/hw_diags.py @@ -503,7 +503,7 @@ def run_tests(tests): # Open log if not TESTS['NVMe/SMART']['Quick']: try: - popen_program(['nohup', 'leafpad', global_vars['LogFile']]) + popen_program(['nohup', 'leafpad', global_vars['LogFile']], pipe=True) except Exception: print_error('ERROR: Failed to open log: {}'.format( global_vars['LogFile'])) diff --git a/.bin/Scripts/mount-all-volumes b/.bin/Scripts/mount-all-volumes index fdc76046..b547e6b6 100755 --- a/.bin/Scripts/mount-all-volumes +++ b/.bin/Scripts/mount-all-volumes @@ -29,7 +29,7 @@ if __name__ == '__main__': print_standard('\nDone.') if 'gui' in sys.argv: pause("Press Enter to exit...") - popen_program(['nohup', 'thunar', '/media']) + popen_program(['nohup', 'thunar', '/media'], pipe=True) exit_script() except SystemExit: pass From 598dea32c7bbe1ef1c66b31552a20cd4b92c9f2a Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Thu, 17 May 2018 15:32:38 -0600 Subject: [PATCH 16/46] Save logs to tech's $HOME instead of root's --- .bin/Scripts/build-ufd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bin/Scripts/build-ufd b/.bin/Scripts/build-ufd index 06ad45b9..c7e4df82 100755 --- a/.bin/Scripts/build-ufd +++ b/.bin/Scripts/build-ufd @@ -436,7 +436,7 @@ function ask() { # VARIABLES DEST_DEV="${arg_u}" DEST_PAR="${DEST_DEV}1" -LOG_FILE="${HOME}/build-ufd_${DEST_DEV##*/}_$(date +%Y-%m-%d_%H%M_%z).log" +LOG_FILE="$(getent passwd tech | cut -d: -f6)/build-ufd_${DEST_DEV##*/}_$(date +%Y-%m-%d_%H%M_%z).log" MAIN_PY="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/settings/main.py" RSYNC_ARGS="-hrtuvS --modify-window=1 --progress" MAIN_KIT="$(realpath "${arg_m:-}" 2>/dev/null || true)" From 223155b8429fa5d5b8ec765c8d8d86c8bf9877a4 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Thu, 17 May 2018 16:26:07 -0600 Subject: [PATCH 17/46] Abort on failed download(s) * Fixes #29 --- .bin/Scripts/build_kit.ps1 | 2 +- .bin/Scripts/build_pe.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.bin/Scripts/build_kit.ps1 b/.bin/Scripts/build_kit.ps1 index 778c6bb8..25373389 100644 --- a/.bin/Scripts/build_kit.ps1 +++ b/.bin/Scripts/build_kit.ps1 @@ -34,7 +34,7 @@ function DownloadFile ($Path, $Name, $Url) { } catch { Write-Host (" ERROR: Failed to download file." ) -ForegroundColor "Red" - $DownloadErrors += 1 + $global:DownloadErrors += 1 } } function FindDynamicUrl ($SourcePage, $RegEx) { diff --git a/.bin/Scripts/build_pe.ps1 b/.bin/Scripts/build_pe.ps1 index a040a207..e5a92de3 100644 --- a/.bin/Scripts/build_pe.ps1 +++ b/.bin/Scripts/build_pe.ps1 @@ -70,7 +70,7 @@ function DownloadFile ($Path, $Name, $Url) { } catch { Write-Host (" ERROR: Failed to download file." ) -ForegroundColor "Red" - $DownloadErrors += 1 + $global:DownloadErrors += 1 } } function FindDynamicUrl ($SourcePage, $RegEx) { From 5ea499d6ffd9b28e88ed3f64c37f5ce0425ea4ed Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Thu, 17 May 2018 17:09:22 -0600 Subject: [PATCH 18/46] Assign volume letters before finding source image * Fixes issue #33 --- .bin/Scripts/functions/winpe_menus.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.bin/Scripts/functions/winpe_menus.py b/.bin/Scripts/functions/winpe_menus.py index bdbfc11c..750f88a0 100644 --- a/.bin/Scripts/functions/winpe_menus.py +++ b/.bin/Scripts/functions/winpe_menus.py @@ -264,13 +264,14 @@ def menu_setup(): windows_version = select_windows_version() # Find Windows image + # NOTE: Reassign volume letters to ensure all devices are scanned + try_and_print( + message = 'Assigning volume letters...', + function = assign_volume_letters, + other_results = other_results) windows_image = find_windows_image(windows_version) # Scan disks - try_and_print( - message = 'Assigning letters...', - function = assign_volume_letters, - other_results = other_results) result = try_and_print( message = 'Getting disk info...', function = scan_disks, From 3114b72178cf821234ebe5becb8792d10c30001e Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Thu, 17 May 2018 17:57:45 -0600 Subject: [PATCH 19/46] Add ticket toggle var and get_simple_string func * get_simple_string() will be used for backup prefixes --- .bin/Scripts/functions/common.py | 11 +++++++++++ .bin/Scripts/settings/main.py | 1 + 2 files changed, 12 insertions(+) diff --git a/.bin/Scripts/functions/common.py b/.bin/Scripts/functions/common.py index 050205e7..ed1d1938 100644 --- a/.bin/Scripts/functions/common.py +++ b/.bin/Scripts/functions/common.py @@ -196,6 +196,8 @@ def extract_item(item, filter='', silent=False): def get_ticket_number(): """Get TicketNumber from user, save in LogDir, and return as str.""" + if not ENABLED_TICKET_NUMBERS: + return None ticket_number = None while ticket_number is None: _input = input('Enter ticket number: ') @@ -208,6 +210,15 @@ def get_ticket_number(): f.write(ticket_number) return ticket_number +def get_simple_string(prompt='Enter string'): + """Get string from user (only alphanumeric/space chars) and return as str.""" + simple_string = None + while simple_string is None: + _input = input('{}: '.format(prompt)) + if re.match(r'^(\w|-| )+$', _input, re.ASCII): + simple_string = _input.strip() + return simple_string + def human_readable_size(size, decimals=0): """Convert size in bytes to a human-readable format and return a str.""" # Prep string formatting diff --git a/.bin/Scripts/settings/main.py b/.bin/Scripts/settings/main.py index 86b0fcee..c49da96e 100644 --- a/.bin/Scripts/settings/main.py +++ b/.bin/Scripts/settings/main.py @@ -2,6 +2,7 @@ # Features ENABLED_UPLOAD_DATA = False +ENABLED_TICKET_NUMBERS = False # STATIC VARIABLES (also used by BASH and BATCH files) ## NOTE: There are no spaces around the = for easier parsing in BASH and BATCH From bec947262b8bd9147317a002d78dea588b9f4786 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Thu, 17 May 2018 18:03:53 -0600 Subject: [PATCH 20/46] Updated WinPE sections --- .bin/Scripts/functions/backup.py | 6 +++--- .bin/Scripts/functions/winpe_menus.py | 14 ++++++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.bin/Scripts/functions/backup.py b/.bin/Scripts/functions/backup.py index fe0935fb..a787a0ed 100644 --- a/.bin/Scripts/functions/backup.py +++ b/.bin/Scripts/functions/backup.py @@ -32,7 +32,7 @@ def fix_path(path): """Replace invalid filename characters with underscores.""" return REGEX_BAD_PATH_NAMES.sub('_', path) -def prep_disk_for_backup(destination, disk, ticket_number): +def prep_disk_for_backup(destination, disk, backup_prefix): """Gather details about the disk and its partitions. This includes partitions that can't be backed up, @@ -71,10 +71,10 @@ def prep_disk_for_backup(destination, disk, ticket_number): par['Image Name'] = par['Name'] if par['Name'] else 'Unknown' if 'IP' in destination: par['Image Path'] = r'\\{}\{}\{}'.format( - destination['IP'], destination['Share'], ticket_number) + destination['IP'], destination['Share'], backup_prefix) else: par['Image Path'] = r'{}:\{}'.format( - ticket_number, destination['Letter']) + destination['Letter'], backup_prefix) par['Image Path'] += r'\{}_{}.wim'.format( par['Number'], par['Image Name']) par['Image Path'] = fix_path(par['Image Path']) diff --git a/.bin/Scripts/functions/winpe_menus.py b/.bin/Scripts/functions/winpe_menus.py index 750f88a0..c5d6dd99 100644 --- a/.bin/Scripts/functions/winpe_menus.py +++ b/.bin/Scripts/functions/winpe_menus.py @@ -75,10 +75,14 @@ def menu_backup(): }} set_title('{}: Backup Menu'.format(KIT_NAME_FULL)) - # Set ticket Number + # Set backup prefix clear_screen() print_standard('{}\n'.format(global_vars['Title'])) ticket_number = get_ticket_number() + if ENABLED_TICKET_NUMBERS: + backup_prefix = ticket_number + else: + backup_prefix = get_simple_string(prompt='Enter backup name prefix') # Mount backup shares mount_backup_shares(read_write=True) @@ -107,12 +111,13 @@ def menu_backup(): raise GenericAbort # "Prep" disk - prep_disk_for_backup(destination, disk, ticket_number) + prep_disk_for_backup(destination, disk, dest_prefix) # Display details for backup task clear_screen() print_info('Create Backup - Details:\n') - show_data(message='Ticket:', data=ticket_number) + if ENABLED_TICKET_NUMBERS: + show_data(message='Ticket:', data=ticket_number) show_data( message = 'Source:', data = '[{}] ({}) {} {}'.format( @@ -293,7 +298,8 @@ def menu_setup(): # Display details for setup task clear_screen() print_info('Setup Windows - Details:\n') - show_data(message='Ticket:', data=ticket_number) + if ENABLED_TICKET_NUMBERS: + show_data(message='Ticket:', data=ticket_number) show_data(message='Installing:', data=windows_version['Name']) show_data( message = 'Boot Method:', From db09236b262ac35a7f7ea7a9f6a87123e624e791 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Thu, 17 May 2018 18:06:26 -0600 Subject: [PATCH 21/46] Updated user_data_transfer sections --- .bin/Scripts/functions/data.py | 40 +++++++++++++++--------------- .bin/Scripts/user_data_transfer.py | 15 +++++++++-- 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/.bin/Scripts/functions/data.py b/.bin/Scripts/functions/data.py index 93ab07ce..5e06a188 100644 --- a/.bin/Scripts/functions/data.py +++ b/.bin/Scripts/functions/data.py @@ -534,21 +534,21 @@ def select_destination(folder_path, prompt='Select destination'): return path -def select_source(ticket_number): - """Select backup from those found on the BACKUP_SERVERS for the ticket.""" +def select_source(backup_prefix): + """Select backup from those found on the BACKUP_SERVERS matching the prefix.""" selected_source = None local_sources = [] remote_sources = [] sources = [] mount_backup_shares(read_write=False) - # Check for ticket folders on servers + # Check for prefix folders on servers for server in BACKUP_SERVERS: if server['Mounted']: print_standard('Scanning {}...'.format(server['Name'])) for d in os.scandir(r'\\{IP}\{Share}'.format(**server)): if (d.is_dir() - and d.name.lower().startswith(ticket_number.lower())): + and d.name.lower().startswith(backup_prefix.lower())): # Add folder to remote_sources remote_sources.append({ 'Name': '{:9}| File-Based: [DIR] {}'.format( @@ -558,19 +558,19 @@ def select_source(ticket_number): 'Source': d}) # Check for images and subfolders - for ticket_path in remote_sources.copy(): - for item in os.scandir(ticket_path['Source'].path): + for prefix_path in remote_sources.copy(): + for item in os.scandir(prefix_path['Source'].path): if item.is_dir(): # Add folder to remote_sources remote_sources.append({ 'Name': r'{:9}| File-Based: [DIR] {}\{}'.format( - ticket_path['Server']['Name'], # Server - ticket_path['Source'].name, # Ticket folder + prefix_path['Server']['Name'], # Server + prefix_path['Source'].name, # Prefix folder item.name, # Sub-folder ), - 'Server': ticket_path['Server'], + 'Server': prefix_path['Server'], 'Sort': r'{}\{}'.format( - ticket_path['Source'].name, # Ticket folder + prefix_path['Source'].name, # Prefix folder item.name, # Sub-folder ), 'Source': item}) @@ -586,15 +586,15 @@ def select_source(ticket_number): remote_sources.append({ 'Disabled': bool(not is_valid_wim_file(subitem)), 'Name': r'{:9}| Image-Based: {:>7} {}\{}\{}'.format( - ticket_path['Server']['Name'], # Server + prefix_path['Server']['Name'], # Server size, # Size (duh) - ticket_path['Source'].name, # Ticket folder + prefix_path['Source'].name, # Prefix folder item.name, # Sub-folder subitem.name, # Image file ), - 'Server': ticket_path['Server'], + 'Server': prefix_path['Server'], 'Sort': r'{}\{}\{}'.format( - ticket_path['Source'].name, # Ticket folder + prefix_path['Source'].name, # Prefix folder item.name, # Sub-folder subitem.name, # Image file ), @@ -608,14 +608,14 @@ def select_source(ticket_number): remote_sources.append({ 'Disabled': bool(not is_valid_wim_file(item)), 'Name': r'{:9}| Image-Based: {:>7} {}\{}'.format( - ticket_path['Server']['Name'], # Server + prefix_path['Server']['Name'], # Server size, # Size (duh) - ticket_path['Source'].name, # Ticket folder + prefix_path['Source'].name, # Prefix folder item.name, # Image file ), - 'Server': ticket_path['Server'], + 'Server': prefix_path['Server'], 'Sort': r'{}\{}'.format( - ticket_path['Source'].name, # Ticket folder + prefix_path['Source'].name, # Prefix folder item.name, # Image file ), 'Source': item}) @@ -682,8 +682,8 @@ def select_source(ticket_number): else: selected_source = sources[int(selection)-1]['Source'] else: - print_error('ERROR: No backups found for ticket: {}.'.format( - ticket_number)) + print_error('ERROR: No backups found using prefix: {}.'.format( + backup_prefix)) umount_backup_shares() pause("Press Enter to exit...") exit_script() diff --git a/.bin/Scripts/user_data_transfer.py b/.bin/Scripts/user_data_transfer.py index 1c787cfe..e0339f20 100644 --- a/.bin/Scripts/user_data_transfer.py +++ b/.bin/Scripts/user_data_transfer.py @@ -18,17 +18,28 @@ if __name__ == '__main__': stay_awake() clear_screen() print_info('{}: User Data Transfer Tool\n'.format(KIT_NAME_FULL)) + + # Get backup name prefix ticket_number = get_ticket_number() + if ENABLED_TICKET_NUMBERS: + backup_prefix = ticket_number + else: + backup_prefix = get_simple_string(prompt='Enter backup name prefix') + + # Set destination folder_path = r'{}\Transfer'.format(KIT_NAME_SHORT) dest = select_destination(folder_path=folder_path, prompt='Which disk are we transferring to?') - source = select_source(ticket_number) + + # Set source items + source = select_source(backup_prefix) items = scan_source(source, dest) # Transfer clear_screen() print_info('Transfer Details:\n') - show_data('Ticket:', ticket_number) + if ENABLED_TICKET_NUMBERS: + show_data('Ticket:', ticket_number) show_data('Source:', source.path) show_data('Destination:', dest) From 02054a804711800fefb4fd09a7139f36d9329a6e Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Thu, 17 May 2018 18:07:18 -0600 Subject: [PATCH 22/46] Updated system checklist and diagnostic scripts --- .bin/Scripts/system_checklist.py | 7 +++++-- .bin/Scripts/system_diagnostics.py | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.bin/Scripts/system_checklist.py b/.bin/Scripts/system_checklist.py index e0f217ed..c24e9fb1 100644 --- a/.bin/Scripts/system_checklist.py +++ b/.bin/Scripts/system_checklist.py @@ -29,8 +29,11 @@ if __name__ == '__main__': 'FileNotFoundError': 'File not found', }, 'Warning': {}} - print_info('Starting System Checklist for Ticket #{}\n'.format( - ticket_number)) + if ENABLED_TICKET_NUMBERS: + print_info('Starting System Checklist for Ticket #{}\n'.format( + ticket_number)) + else: + print_info('Starting System Checklist\n') # Configure print_info('Configure') diff --git a/.bin/Scripts/system_diagnostics.py b/.bin/Scripts/system_diagnostics.py index 59e31465..518eee8c 100644 --- a/.bin/Scripts/system_diagnostics.py +++ b/.bin/Scripts/system_diagnostics.py @@ -31,8 +31,11 @@ if __name__ == '__main__': 'GenericRepair': 'Repaired', 'UnsupportedOSError': 'Unsupported OS', }} - print_info('Starting System Diagnostics for Ticket #{}\n'.format( - ticket_number)) + if ENABLED_TICKET_NUMBERS: + print_info('Starting System Diagnostics for Ticket #{}\n'.format( + ticket_number)) + else: + print_info('Starting System Diagnostics\n') # Sanitize Environment print_info('Sanitizing Environment') From 5902a51f9e4f3fc34e5ba37be806edb8023a7e60 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Thu, 17 May 2018 18:15:39 -0600 Subject: [PATCH 23/46] Save build-ufd logs in ${SUDO_USER}'s $HOME/Logs --- .bin/Scripts/build-ufd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.bin/Scripts/build-ufd b/.bin/Scripts/build-ufd index c7e4df82..a94bfe20 100755 --- a/.bin/Scripts/build-ufd +++ b/.bin/Scripts/build-ufd @@ -436,13 +436,14 @@ function ask() { # VARIABLES DEST_DEV="${arg_u}" DEST_PAR="${DEST_DEV}1" -LOG_FILE="$(getent passwd tech | cut -d: -f6)/build-ufd_${DEST_DEV##*/}_$(date +%Y-%m-%d_%H%M_%z).log" +LOG_FILE="$(getent passwd "$SUDO_USER" | cut -d: -f6)/Logs/build-ufd_${DEST_DEV##*/}_$(date +%Y-%m-%d_%H%M_%z).log" MAIN_PY="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/settings/main.py" RSYNC_ARGS="-hrtuvS --modify-window=1 --progress" MAIN_KIT="$(realpath "${arg_m:-}" 2>/dev/null || true)" LINUX_ISO="$(realpath "${arg_l:-}" 2>/dev/null || true)" WINPE_ISO="$(realpath "${arg_w:-}" 2>/dev/null || true)" EXTRA_DIR="$(realpath "${arg_e:-}" 2>/dev/null || true)" +mkdir -p "$(dirname "$LOG_FILE")" # COLORS CLEAR="\e[0m" From b997a523853c62c2452d8281ade11b586fc2831f Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Thu, 17 May 2018 18:17:36 -0600 Subject: [PATCH 24/46] Updated hw-diags section * Use date_time instead of ticket_number if disabled --- .bin/Scripts/functions/hw_diags.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.bin/Scripts/functions/hw_diags.py b/.bin/Scripts/functions/hw_diags.py index 1ece188c..63942ed2 100644 --- a/.bin/Scripts/functions/hw_diags.py +++ b/.bin/Scripts/functions/hw_diags.py @@ -125,9 +125,9 @@ def menu_diags(*args): if diag_modes[int(selection)-1]['Name'] != 'Quick drive test': # Save log for non-quick tests ticket_number = get_ticket_number() - global_vars['LogDir'] = '{}/Tickets/{}'.format( + global_vars['LogDir'] = '{}/Logs/{}'.format( global_vars['Env']['HOME'], - ticket_number) + ticket_number if ticket_number else global_vars['Date-Time']) os.makedirs(global_vars['LogDir'], exist_ok=True) global_vars['LogFile'] = '{}/Hardware Diagnostics.log'.format( global_vars['LogDir']) From 27953bde5acdb45283ec4dfcabce518415c7f761 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Thu, 17 May 2018 20:54:45 -0600 Subject: [PATCH 25/46] Update backup/restore code * Added support for local backups * Added volume label detection for local backups * Replace spaces in backup_prefix with underscores --- .bin/Scripts/functions/backup.py | 51 +++++++++++++++++++++++++-- .bin/Scripts/functions/winpe_menus.py | 13 ++++--- .bin/Scripts/user_data_transfer.py | 1 + 3 files changed, 58 insertions(+), 7 deletions(-) diff --git a/.bin/Scripts/functions/backup.py b/.bin/Scripts/functions/backup.py index a787a0ed..e33cea2c 100644 --- a/.bin/Scripts/functions/backup.py +++ b/.bin/Scripts/functions/backup.py @@ -1,5 +1,7 @@ # Wizard Kit: Functions - Backup +import ctypes + from functions.disk import * # Regex @@ -30,7 +32,39 @@ def backup_partition(disk, par): def fix_path(path): """Replace invalid filename characters with underscores.""" - return REGEX_BAD_PATH_NAMES.sub('_', path) + local_drive = path[1:2] == ':' + new_path = REGEX_BAD_PATH_NAMES.sub('_', path) + if local_drive: + new_path = '{}:{}'.format(new_path[0:1], new_path[2:]) + return new_path + +def get_volume_display_name(mountpoint): + """Get display name from volume mountpoint and label, returns str.""" + name = mountpoint + try: + kernel32 = ctypes.windll.kernel32 + vol_name_buffer = ctypes.create_unicode_buffer(1024) + fs_name_buffer = ctypes.create_unicode_buffer(1024) + serial_number = None + max_component_length = None + file_system_flags = None + + vol_info = kernel32.GetVolumeInformationW( + ctypes.c_wchar_p(mountpoint), + vol_name_buffer, + ctypes.sizeof(vol_name_buffer), + serial_number, + max_component_length, + file_system_flags, + fs_name_buffer, + ctypes.sizeof(fs_name_buffer) + ) + + name = '{} "{}"'.format(name, vol_name_buffer.value) + except: + pass + + return name def prep_disk_for_backup(destination, disk, backup_prefix): """Gather details about the disk and its partitions. @@ -114,7 +148,20 @@ def select_backup_destination(auto_select=True): actions = [ {'Name': 'Main Menu', 'Letter': 'M'}, ] - + + # Add local disks + for d in psutil.disk_partitions(): + if re.search(r'^{}'.format(global_vars['Env']['SYSTEMDRIVE']), d.mountpoint, re.IGNORECASE): + # Skip current OS drive + pass + elif 'fixed' in d.opts: + # Skip DVD, etc + destinations.append({ + 'Name': 'Local Disk - {}'.format( + get_volume_display_name(d.mountpoint)), + 'Letter': re.sub(r'^(\w):\\.*$', r'\1', d.mountpoint), + }) + # Size check for dest in destinations: if 'IP' in dest: diff --git a/.bin/Scripts/functions/winpe_menus.py b/.bin/Scripts/functions/winpe_menus.py index c5d6dd99..6d8d10bc 100644 --- a/.bin/Scripts/functions/winpe_menus.py +++ b/.bin/Scripts/functions/winpe_menus.py @@ -83,7 +83,14 @@ def menu_backup(): backup_prefix = ticket_number else: backup_prefix = get_simple_string(prompt='Enter backup name prefix') + backup_prefix = backup_prefix.replace(' ', '_') + # Assign drive letters + try_and_print( + message = 'Assigning letters...', + function = assign_volume_letters, + other_results = other_results) + # Mount backup shares mount_backup_shares(read_write=True) @@ -91,10 +98,6 @@ def menu_backup(): destination = select_backup_destination(auto_select=False) # Scan disks - try_and_print( - message = 'Assigning letters...', - function = assign_volume_letters, - other_results = other_results) result = try_and_print( message = 'Getting disk info...', function = scan_disks, @@ -111,7 +114,7 @@ def menu_backup(): raise GenericAbort # "Prep" disk - prep_disk_for_backup(destination, disk, dest_prefix) + prep_disk_for_backup(destination, disk, backup_prefix) # Display details for backup task clear_screen() diff --git a/.bin/Scripts/user_data_transfer.py b/.bin/Scripts/user_data_transfer.py index e0339f20..ce572f69 100644 --- a/.bin/Scripts/user_data_transfer.py +++ b/.bin/Scripts/user_data_transfer.py @@ -25,6 +25,7 @@ if __name__ == '__main__': backup_prefix = ticket_number else: backup_prefix = get_simple_string(prompt='Enter backup name prefix') + backup_prefix = backup_prefix.replace(' ', '_') # Set destination folder_path = r'{}\Transfer'.format(KIT_NAME_SHORT) From e305b3e60f91ef1d860d0e1a45fbc3756330dd4f Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Thu, 17 May 2018 20:56:55 -0600 Subject: [PATCH 26/46] Add warning for missing archive in extract_item() --- .bin/Scripts/functions/common.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.bin/Scripts/functions/common.py b/.bin/Scripts/functions/common.py index ed1d1938..f5a2ef95 100644 --- a/.bin/Scripts/functions/common.py +++ b/.bin/Scripts/functions/common.py @@ -190,6 +190,9 @@ def extract_item(item, filter='', silent=False): print_standard('Extracting "{item}"...'.format(item=item)) try: run_program(cmd) + except FileNotFoundError: + if not silent: + print_warning('WARNING: Archive not found') except subprocess.CalledProcessError: if not silent: print_warning('WARNING: Errors encountered while exctracting data') From 50a200535e99c51bca1179b7d007005bca687cb6 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Thu, 17 May 2018 20:59:57 -0600 Subject: [PATCH 27/46] Fix log dir permissions --- .bin/Scripts/build-ufd | 1 + 1 file changed, 1 insertion(+) diff --git a/.bin/Scripts/build-ufd b/.bin/Scripts/build-ufd index a94bfe20..cabc7ba0 100755 --- a/.bin/Scripts/build-ufd +++ b/.bin/Scripts/build-ufd @@ -444,6 +444,7 @@ LINUX_ISO="$(realpath "${arg_l:-}" 2>/dev/null || true)" WINPE_ISO="$(realpath "${arg_w:-}" 2>/dev/null || true)" EXTRA_DIR="$(realpath "${arg_e:-}" 2>/dev/null || true)" mkdir -p "$(dirname "$LOG_FILE")" +chown "$SUDO_USER:$SUDO_USER" -R "$(dirname "$LOG_FILE")" # COLORS CLEAR="\e[0m" From 1d3be750b44a589c6c6b019405a62e6fc69a450f Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Thu, 17 May 2018 21:39:33 -0600 Subject: [PATCH 28/46] Bump tool versions --- .bin/Scripts/build_kit.ps1 | 10 +++++----- .bin/Scripts/build_pe.ps1 | 26 +++++++++++++------------- .bin/Scripts/settings/sources.py | 7 ++++--- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/.bin/Scripts/build_kit.ps1 b/.bin/Scripts/build_kit.ps1 index 25373389..dafaa2c8 100644 --- a/.bin/Scripts/build_kit.ps1 +++ b/.bin/Scripts/build_kit.ps1 @@ -78,11 +78,11 @@ if ($MyInvocation.InvocationName -ne ".") { $Path = $Temp # 7-Zip - DownloadFile -Path $Path -Name "7z-installer.msi" -Url "http://www.7-zip.org/a/7z1801.msi" - DownloadFile -Path $Path -Name "7z-extra.7z" -Url "http://www.7-zip.org/a/7z1801-extra.7z" + DownloadFile -Path $Path -Name "7z-installer.msi" -Url "https://www.7-zip.org/a/7z1805.msi" + DownloadFile -Path $Path -Name "7z-extra.7z" -Url "https://www.7-zip.org/a/7z1805-extra.7z" # ConEmu - $Url = "https://github.com/Maximus5/ConEmu/releases/download/v18.02.06/ConEmuPack.180206.7z" + $Url = "https://github.com/Maximus5/ConEmu/releases/download/v18.05.06/ConEmuPack.180506.7z" DownloadFile -Path $Path -Name "ConEmuPack.7z" -Url $Url # Notepad++ @@ -90,9 +90,9 @@ if ($MyInvocation.InvocationName -ne ".") { DownloadFile -Path $Path -Name "npp.7z" -Url $Url # Python - $Url = "https://www.python.org/ftp/python/3.6.4/python-3.6.4-embed-win32.zip" + $Url = "https://www.python.org/ftp/python/3.6.5/python-3.6.5-embed-win32.zip" DownloadFile -Path $Path -Name "python32.zip" -Url $Url - $Url = "https://www.python.org/ftp/python/3.6.4/python-3.6.4-embed-amd64.zip" + $Url = "https://www.python.org/ftp/python/3.6.5/python-3.6.5-embed-amd64.zip" DownloadFile -Path $Path -Name "python64.zip" -Url $Url # Python: psutil diff --git a/.bin/Scripts/build_pe.ps1 b/.bin/Scripts/build_pe.ps1 index e5a92de3..e2f614c4 100644 --- a/.bin/Scripts/build_pe.ps1 +++ b/.bin/Scripts/build_pe.ps1 @@ -130,16 +130,16 @@ if ($MyInvocation.InvocationName -ne ".") { ## Download Tools ## $ToolSources = @( # 7-Zip - @("7z-installer.msi", "http://www.7-zip.org/a/7z1801.msi"), - @("7z-extra.7z", "http://www.7-zip.org/a/7z1801-extra.7z"), + @("7z-installer.msi", "https://www.7-zip.org/a/7z1805.msi"), + @("7z-extra.7z", "https://www.7-zip.org/a/7z1805-extra.7z"), # Blue Screen View - @("bluescreenview64.zip", "http://www.nirsoft.net/utils/bluescreenview-x64.zip"), @("bluescreenview32.zip", "http://www.nirsoft.net/utils/bluescreenview.zip"), + @("bluescreenview64.zip", "http://www.nirsoft.net/utils/bluescreenview-x64.zip"), # ConEmu - @("ConEmuPack.7z", "https://github.com/Maximus5/ConEmu/releases/download/v18.02.06/ConEmuPack.180206.7z"), + @("ConEmuPack.7z", "https://github.com/Maximus5/ConEmu/releases/download/v18.05.06/ConEmuPack.180506.7z"), # Fast Copy - @("fastcopy64.zip", "http://ftp.vector.co.jp/69/93/2323/FastCopy341_x64.zip"), @("fastcopy32.zip", "http://ftp.vector.co.jp/69/93/2323/FastCopy341.zip"), + @("fastcopy64.zip", "http://ftp.vector.co.jp/69/93/2323/FastCopy341_x64.zip"), # HWiNFO @("hwinfo.zip", "http://app.oldfoss.com:81/download/HWiNFO/hwi_582.zip"), # Killer Network Drivers @@ -148,19 +148,19 @@ if ($MyInvocation.InvocationName -ne ".") { ("http://www.killernetworking.com"+(FindDynamicUrl "http://www.killernetworking.com/driver-downloads/item/killer-drivers-inf" "Download Killer-Ethernet").replace('&', '&')) ), # Notepad++ - @("npp_amd64.7z", "https://notepad-plus-plus.org/repository/7.x/7.5.6/npp.7.5.6.bin.minimalist.x64.7z"), @("npp_x86.7z", "https://notepad-plus-plus.org/repository/7.x/7.5.6/npp.7.5.6.bin.minimalist.7z"), + @("npp_amd64.7z", "https://notepad-plus-plus.org/repository/7.x/7.5.6/npp.7.5.6.bin.minimalist.x64.7z"), # NT Password Editor @("ntpwed.zip", "http://cdslow.org.ru/files/ntpwedit/ntpwed07.zip"), # Prime95 - @("prime95_64.zip", "http://www.mersenne.org/ftp_root/gimps/p95v294b8.win64.zip"), @("prime95_32.zip", "http://www.mersenne.org/ftp_root/gimps/p95v294b7.win32.zip"), + @("prime95_64.zip", "http://www.mersenne.org/ftp_root/gimps/p95v294b8.win64.zip"), # ProduKey - @("produkey64.zip", "http://www.nirsoft.net/utils/produkey-x64.zip"), @("produkey32.zip", "http://www.nirsoft.net/utils/produkey.zip"), + @("produkey64.zip", "http://www.nirsoft.net/utils/produkey-x64.zip"), # Python - @("python64.zip", "https://www.python.org/ftp/python/3.6.4/python-3.6.4-embed-amd64.zip"), - @("python32.zip", "https://www.python.org/ftp/python/3.6.4/python-3.6.4-embed-win32.zip"), + @("python32.zip", "https://www.python.org/ftp/python/3.6.5/python-3.6.5-embed-win32.zip"), + @("python64.zip", "https://www.python.org/ftp/python/3.6.5/python-3.6.5-embed-amd64.zip"), # Python: psutil @( "psutil64.whl", @@ -171,14 +171,14 @@ if ($MyInvocation.InvocationName -ne ".") { (FindDynamicUrl "https://pypi.org/project/psutil/" "href=.*-cp36-cp36m-win32.whl") ), # Q-Dir - @("qdir64.zip", "https://www.softwareok.com/Download/Q-Dir_Portable_x64.zip"), @("qdir32.zip", "https://www.softwareok.com/Download/Q-Dir_Portable.zip"), + @("qdir64.zip", "https://www.softwareok.com/Download/Q-Dir_Portable_x64.zip"), # TestDisk / PhotoRec - @("testdisk64.zip", "https://www.cgsecurity.org/testdisk-7.1-WIP.win64.zip"), @("testdisk32.zip", "https://www.cgsecurity.org/testdisk-7.1-WIP.win.zip"), + @("testdisk64.zip", "https://www.cgsecurity.org/testdisk-7.1-WIP.win64.zip"), # wimlib-imagex - @("wimlib64.zip", "https://wimlib.net/downloads/wimlib-1.12.0-windows-x86_64-bin.zip"), @("wimlib32.zip", "https://wimlib.net/downloads/wimlib-1.12.0-windows-i686-bin.zip") + @("wimlib64.zip", "https://wimlib.net/downloads/wimlib-1.12.0-windows-x86_64-bin.zip"), ) foreach ($Tool in $ToolSources) { DownloadFile -Path $Temp -Name $Tool[0] -Url $Tool[1] diff --git a/.bin/Scripts/settings/sources.py b/.bin/Scripts/settings/sources.py index 2dddc86c..f1782ded 100644 --- a/.bin/Scripts/settings/sources.py +++ b/.bin/Scripts/settings/sources.py @@ -2,7 +2,7 @@ SOURCE_URLS = { 'AIDA64': 'http://download.aida64.com/aida64engineer597.zip', - 'Adobe Reader DC': 'http://ardownload.adobe.com/pub/adobe/reader/win/AcrobatDC/1801120035/AcroRdrDC1801120035_en_US.exe', + 'Adobe Reader DC': 'http://ardownload.adobe.com/pub/adobe/reader/win/AcrobatDC/1801120040/AcroRdrDC1801120040_en_US.exe', 'AdwCleaner': 'https://toolslib.net/downloads/finish/1-adwcleaner/', 'Autoruns': 'https://download.sysinternals.com/files/Autoruns.zip', 'BleachBit': 'https://download.bleachbit.org/BleachBit-2.0-portable.zip', @@ -16,7 +16,7 @@ SOURCE_URLS = { 'Everything64': 'https://www.voidtools.com/Everything-1.4.1.895.x64.zip', 'FastCopy32': 'http://ftp.vector.co.jp/69/93/2323/FastCopy341.zip', 'FastCopy64': 'http://ftp.vector.co.jp/69/93/2323/FastCopy341_x64.zip', - 'Firefox uBO': 'https://addons.cdn.mozilla.net/user-media/addons/607454/ublock_origin-1.15.10-an+fx.xpi?filehash=sha256%3A30b258803fd6cd988c5ba479f2f6ff5b4e9b40110c81e3421a6867b20ec718a6', + 'Firefox uBO': 'https://addons.mozilla.org/firefox/downloads/file/956394/ublock_origin-1.16.6-an+fx.xpi', 'HWiNFO': 'http://app.oldfoss.com:81/download/HWiNFO/hwi_582.zip', 'HitmanPro32': 'https://dl.surfright.nl/HitmanPro.exe', 'HitmanPro64': 'https://dl.surfright.nl/HitmanPro_x64.exe', @@ -25,7 +25,7 @@ SOURCE_URLS = { 'KVRT': 'http://devbuilds.kaspersky-labs.com/devbuilds/KVRT/latest/full/KVRT.exe', 'NotepadPlusPlus': 'https://notepad-plus-plus.org/repository/7.x/7.5.6/npp.7.5.6.bin.minimalist.7z', 'Office Deployment Tool 2013': 'https://download.microsoft.com/download/6/2/3/6230F7A2-D8A9-478B-AC5C-57091B632FCF/officedeploymenttool_x86_4827-1000.exe', - 'Office Deployment Tool 2016': 'https://download.microsoft.com/download/2/7/A/27AF1BE6-DD20-4CB4-B154-EBAB8A7D4A7E/officedeploymenttool_8529.3600.exe', + 'Office Deployment Tool 2016': 'https://download.microsoft.com/download/2/7/A/27AF1BE6-DD20-4CB4-B154-EBAB8A7D4A7E/officedeploymenttool_9326.3600.exe', 'ProduKey32': 'http://www.nirsoft.net/utils/produkey.zip', 'ProduKey64': 'http://www.nirsoft.net/utils/produkey-x64.zip', 'PuTTY': 'https://the.earth.li/~sgtatham/putty/latest/w32/putty.zip', @@ -196,6 +196,7 @@ RST_SOURCES = { 'SetupRST_14.8.exe': 'https://downloadmirror.intel.com/26759/eng/setuprst.exe', 'SetupRST_15.8.exe': 'https://downloadmirror.intel.com/27442/eng/SetupRST.exe', 'SetupRST_15.9.exe': 'https://downloadmirror.intel.com/27400/eng/SetupRST.exe', + 'SetupRST_16.0.exe': 'https://downloadmirror.intel.com/27681/eng/SetupRST.exe', } From 7e8f9df87786fcc9f7f4b667309388c70754a8f5 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Thu, 17 May 2018 21:40:44 -0600 Subject: [PATCH 29/46] Set Intel RST 16.0 as current release --- .bin/Scripts/settings/launchers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.bin/Scripts/settings/launchers.py b/.bin/Scripts/settings/launchers.py index fa65c06e..1875ccc7 100644 --- a/.bin/Scripts/settings/launchers.py +++ b/.bin/Scripts/settings/launchers.py @@ -294,8 +294,8 @@ LAUNCHERS = { 'Intel RST (Current Release)': { 'L_TYPE': 'Executable', 'L_PATH': '_Drivers\Intel RST', - 'L_ITEM': 'SetupRST_15.9.exe', - 'L_7ZIP': 'SetupRST_15.9.exe', + 'L_ITEM': 'SetupRST_16.0.exe', + 'L_7ZIP': 'SetupRST_16.0.exe', }, 'Intel RST (Previous Releases)': { 'L_TYPE': 'Folder', From 352bf042b0b8162324821f85c9f856463a4df0d7 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Thu, 17 May 2018 21:47:56 -0600 Subject: [PATCH 30/46] Fixed typo --- .bin/Scripts/build_pe.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.bin/Scripts/build_pe.ps1 b/.bin/Scripts/build_pe.ps1 index e2f614c4..7329aa82 100644 --- a/.bin/Scripts/build_pe.ps1 +++ b/.bin/Scripts/build_pe.ps1 @@ -177,8 +177,8 @@ if ($MyInvocation.InvocationName -ne ".") { @("testdisk32.zip", "https://www.cgsecurity.org/testdisk-7.1-WIP.win.zip"), @("testdisk64.zip", "https://www.cgsecurity.org/testdisk-7.1-WIP.win64.zip"), # wimlib-imagex - @("wimlib32.zip", "https://wimlib.net/downloads/wimlib-1.12.0-windows-i686-bin.zip") - @("wimlib64.zip", "https://wimlib.net/downloads/wimlib-1.12.0-windows-x86_64-bin.zip"), + @("wimlib32.zip", "https://wimlib.net/downloads/wimlib-1.12.0-windows-i686-bin.zip"), + @("wimlib64.zip", "https://wimlib.net/downloads/wimlib-1.12.0-windows-x86_64-bin.zip") ) foreach ($Tool in $ToolSources) { DownloadFile -Path $Temp -Name $Tool[0] -Url $Tool[1] From fb16b0e7483c65605732175c7970eb48e20a361e Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Fri, 18 May 2018 21:03:36 -0600 Subject: [PATCH 31/46] Deprecated inxi * Displays too much info * Fixes issue #37 --- .bin/Scripts/hw-drive-info | 27 +++++ .bin/Scripts/hw-info | 98 +++++++++++++++++++ .../include/airootfs/etc/skel/.aliases | 3 +- 3 files changed, 127 insertions(+), 1 deletion(-) create mode 100755 .bin/Scripts/hw-drive-info create mode 100755 .bin/Scripts/hw-info diff --git a/.bin/Scripts/hw-drive-info b/.bin/Scripts/hw-drive-info new file mode 100755 index 00000000..71a8d388 --- /dev/null +++ b/.bin/Scripts/hw-drive-info @@ -0,0 +1,27 @@ +#!/bin/bash +# + +BLUE='\033[34m' +CLEAR='\033[0m' + +# List devices +IFS=$'\n' +for line in $(lsblk -do NAME,TRAN,SIZE,VENDOR,MODEL,SERIAL); do + if [[ "${line:0:4}" == "NAME" ]]; then + echo -e "${BLUE}${line}${CLEAR}" + else + echo "${line}" + fi +done +echo "" + +# List partitions +for line in $(lsblk -o NAME,SIZE,FSTYPE,LABEL,MOUNTPOINT); do + if [[ "${line:0:4}" == "NAME" ]]; then + echo -e "${BLUE}${line}${CLEAR}" + else + echo "${line}" + fi +done +echo "" + diff --git a/.bin/Scripts/hw-info b/.bin/Scripts/hw-info new file mode 100755 index 00000000..f4508fa9 --- /dev/null +++ b/.bin/Scripts/hw-info @@ -0,0 +1,98 @@ +#!/bin/bash +# + +# COLORS +CLEAR="\e[0m" +RED="\e[31m" +GREEN="\e[32m" +YELLOW="\e[33m" +BLUE="\e[34m" + +function print_in_columns() { + string="$1" + label="$(echo "$string" | sed -r 's/^\s*(.*:).*/\1/')" + value="$(echo "$string" | sed -r 's/^\s*.*:\s*(.*)/\1/')" + printf ' %-18s%s\n' "$label" "$value" +} + +# System +echo -e "${BLUE}System Information${CLEAR}" +echo " Vendor: $(cat /sys/devices/virtual/dmi/id/sys_vendor)" +echo " Name: $(cat /sys/devices/virtual/dmi/id/product_name)" +echo " Serial: $(cat /sys/devices/virtual/dmi/id/product_serial)" +echo "" + +# Motherboard +echo -e "${BLUE}Motherboard${CLEAR}" +echo " Vendor: $(cat /sys/devices/virtual/dmi/id/board_vendor)" +echo " Name: $(cat /sys/devices/virtual/dmi/id/board_name)" +echo " Version: $(cat /sys/devices/virtual/dmi/id/board_version)" +echo " Serial: $(cat /sys/devices/virtual/dmi/id/board_serial)" +echo "" + +# BIOS +echo -e "${BLUE}BIOS${CLEAR}" +echo " Vendor: $(cat /sys/devices/virtual/dmi/id/bios_vendor)" +echo " Version: $(cat /sys/devices/virtual/dmi/id/bios_version)" +echo " Release Date: $(cat /sys/devices/virtual/dmi/id/bios_date)" +echo "" + +# Processor +echo -e "${BLUE}Processor${CLEAR}" +lscpu | grep -E '^(Arch|CPU.s.|Core|Thread|Model name|Virt)' \ + | sed -r 's/\(s\)(.*:)/s\1 /' \ + | sed -r 's/CPUs: /Threads:/' \ + | sed -r 's/^(.*:) / \1/' +echo "" + +# Memory +echo -e "${BLUE}Memory${CLEAR}" +first_device="True" +while read -r line; do + if [[ "$line" == "Memory Device" ]]; then + if [[ "$first_device" == "True" ]]; then + first_device="False" + else + # Add space between devices + echo "" + fi + else + print_in_columns "$line" + fi +done <<< $(sudo dmidecode -t memory \ + | grep -E '^(Memory Device|\s+(Type|Size|Speed|Manuf.*|Locator|Part Number):)') +echo "" + +# Graphics +echo -e "${BLUE}Graphics${CLEAR}" +lspci | grep 'VGA' | sed -r 's/^.*:/ Device: /' \ + | sed 's/Intel Corporation/Intel/' \ + | sed 's/Generation Core Processor Family/Gen/' \ + | sed 's/Integrated Graphics Controller.*/iGPU/' +glxinfo | grep 'OpenGL renderer' | sed -r 's/^.*:/ OpenGL Renderer: /' \ + | sed 's/Mesa DRI //' +echo "" + +# Audio +echo -e "${BLUE}Audio${CLEAR}" +while read -r line; do + print_in_columns "$line" +done <<< $(aplay -l | grep '^card' | sed -r 's/.*\[(.*)\].*\[(.*)\].*/\1: \2/') +echo "" + +# Network +echo -e "${BLUE}Network${CLEAR}" +lspci | grep -Ei '(ethernet|network|wireless|wifi)' \ + | sed -r 's/.*: (.*) \(.*$/ \1/' +echo "" + +# Drives +echo -e "${BLUE}Drives${CLEAR}" +hw-drive-info | sed 's/^/ /' +echo "" + +# Sensors +echo -e "${BLUE}Sensors${CLEAR}" +hw-sensors | sed 's/^/ /' +echo "" + diff --git a/.linux_items/include/airootfs/etc/skel/.aliases b/.linux_items/include/airootfs/etc/skel/.aliases index 2fc314d1..d20b59b3 100644 --- a/.linux_items/include/airootfs/etc/skel/.aliases +++ b/.linux_items/include/airootfs/etc/skel/.aliases @@ -7,7 +7,8 @@ alias 7z9='7z a -t7z -mx=9' alias diff='colordiff -ur' alias du='du -sch --apparent-size' alias fix-perms='find -type d -exec chmod 755 "{}" \; && find -type f -exec chmod 644 "{}" \;' -alias hw-info='sudo inxi -ACDdGlMmNopRsxxc 25' +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' From 70e4797b7ae3d690f3a79c755790b266de80e696 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Mon, 21 May 2018 15:43:05 -0600 Subject: [PATCH 32/46] Refactored windows_image code * Better names (e.g. 'Letter' instead of 'Source') * Added 'Local' bool to simplify network-vs-local installs * Only reassign the source letter if necessary * Bugfix: Update 'Path' when reassigning a volume letter * Fixes #33 (again) --- .bin/Scripts/functions/windows_setup.py | 6 ++++-- .bin/Scripts/functions/winpe_menus.py | 20 ++++++++++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.bin/Scripts/functions/windows_setup.py b/.bin/Scripts/functions/windows_setup.py index bf21069a..cd7f8444 100644 --- a/.bin/Scripts/functions/windows_setup.py +++ b/.bin/Scripts/functions/windows_setup.py @@ -50,7 +50,8 @@ def find_windows_image(windows_version): path = '{}images\{}.{}'.format(d.mountpoint, imagefile, ext) if os.path.isfile(path) and wim_contains_image(path, imagename): image['Path'] = path - image['Source'] = d.mountpoint[:1] + image['Letter'] = d.mountpoint[:1].upper() + image['Local'] = True if ext == 'swm': image['Glob'] = '--ref="{}*.swm"'.format(image['Path'][:-4]) break @@ -68,7 +69,8 @@ def find_windows_image(windows_version): ext) if os.path.isfile(path) and wim_contains_image(path, imagename): image['Path'] = path - image['Source'] = None + image['Letter'] = None + image['Local'] = False if ext == 'swm': image['Glob'] = '--ref="{}*.swm"'.format( image['Path'][:-4]) diff --git a/.bin/Scripts/functions/winpe_menus.py b/.bin/Scripts/functions/winpe_menus.py index 6d8d10bc..aed9839d 100644 --- a/.bin/Scripts/functions/winpe_menus.py +++ b/.bin/Scripts/functions/winpe_menus.py @@ -337,10 +337,22 @@ def menu_setup(): raise GenericAbort # Remove volume letters so S, T, & W can be used below - remove_volume_letters(keep=windows_image['Source']) - new_letter = reassign_volume_letter(letter=windows_image['Source']) - if new_letter: - windows_image['Source'] = new_letter + try_and_print( + message = 'Removing volume letters...', + function = remove_volume_letters, + other_results = other_results, + keep=windows_image['Letter']) + + # Assign new letter for local source if necessary + if windows_image['Local'] and windows_image['Letter'] in ['S', 'T', 'W']: + new_letter = try_and_print( + message = 'Reassigning source volume letter...', + function = reassign_volume_letter, + other_results = other_results, + letter=windows_image['Letter']) + windows_image['Path'] = '{}{}'.format( + new_letter, windows_image['Path'][1:]) + windows_image['Letter'] = new_letter # Format and partition disk result = try_and_print( From 25d34e5ace41ba931cc82af7f7e88d94aeab6b13 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Mon, 21 May 2018 15:57:24 -0600 Subject: [PATCH 33/46] Copy WinPE.log to new Windows installations --- .bin/Scripts/functions/winpe_menus.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.bin/Scripts/functions/winpe_menus.py b/.bin/Scripts/functions/winpe_menus.py index aed9839d..64ffb666 100644 --- a/.bin/Scripts/functions/winpe_menus.py +++ b/.bin/Scripts/functions/winpe_menus.py @@ -391,6 +391,11 @@ def menu_setup(): other_results = other_results, windows_version = windows_version) + # Copy WinPE log(s) + source = r'{}\Info'.format(global_vars['ClientDir']) + dest = r'W:\{}\Info'.format(KIT_NAME_SHORT) + shutil.copytree(source, dest) + # Print summary print_standard('\nDone.') if 'LogFile' in global_vars and ask('\nReview log?'): From e6b7cc602b73e0ab42c716c4ad8220c9e46625e9 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Mon, 21 May 2018 20:18:13 -0600 Subject: [PATCH 34/46] Report missing hw-info data * Show UNKNOWN for missing DMI variables * Suppress errors for systems w/out sound cards * Suppress errors for glxinfo * Keep revision numbers for network devices --- .bin/Scripts/hw-info | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/.bin/Scripts/hw-info b/.bin/Scripts/hw-info index f4508fa9..98514e3e 100755 --- a/.bin/Scripts/hw-info +++ b/.bin/Scripts/hw-info @@ -15,26 +15,36 @@ function print_in_columns() { printf ' %-18s%s\n' "$label" "$value" } +function print_dmi_value() { + name="$1" + file="/sys/devices/virtual/dmi/id/$2" + value="UNKNOWN" + if [[ -e "$file" ]]; then + value="$(cat "$file")" + fi + print_in_columns "$name: $value" +} + # System echo -e "${BLUE}System Information${CLEAR}" -echo " Vendor: $(cat /sys/devices/virtual/dmi/id/sys_vendor)" -echo " Name: $(cat /sys/devices/virtual/dmi/id/product_name)" -echo " Serial: $(cat /sys/devices/virtual/dmi/id/product_serial)" +print_dmi_value "Vendor" "sys_vendor" +print_dmi_value "Name" "product_name" +print_dmi_value "Serial" "product_serial" echo "" # Motherboard echo -e "${BLUE}Motherboard${CLEAR}" -echo " Vendor: $(cat /sys/devices/virtual/dmi/id/board_vendor)" -echo " Name: $(cat /sys/devices/virtual/dmi/id/board_name)" -echo " Version: $(cat /sys/devices/virtual/dmi/id/board_version)" -echo " Serial: $(cat /sys/devices/virtual/dmi/id/board_serial)" +print_dmi_value "Vendor" "board_vendor" +print_dmi_value "Name" "board_name" +print_dmi_value "Version" "board_version" +print_dmi_value "Serial" "board_serial" echo "" # BIOS echo -e "${BLUE}BIOS${CLEAR}" -echo " Vendor: $(cat /sys/devices/virtual/dmi/id/bios_vendor)" -echo " Version: $(cat /sys/devices/virtual/dmi/id/bios_version)" -echo " Release Date: $(cat /sys/devices/virtual/dmi/id/bios_date)" +print_dmi_value "Vendor" "bios_vendor" +print_dmi_value "Version" "bios_version" +print_dmi_value "Release Date" "bios_date" echo "" # Processor @@ -69,21 +79,25 @@ lspci | grep 'VGA' | sed -r 's/^.*:/ Device: /' \ | sed 's/Intel Corporation/Intel/' \ | sed 's/Generation Core Processor Family/Gen/' \ | sed 's/Integrated Graphics Controller.*/iGPU/' -glxinfo | grep 'OpenGL renderer' | sed -r 's/^.*:/ OpenGL Renderer: /' \ +glxinfo 2>/dev/null | grep 'OpenGL renderer' | sed -r 's/^.*:/ OpenGL Renderer: /' \ | sed 's/Mesa DRI //' echo "" # Audio echo -e "${BLUE}Audio${CLEAR}" while read -r line; do - print_in_columns "$line" -done <<< $(aplay -l | grep '^card' | sed -r 's/.*\[(.*)\].*\[(.*)\].*/\1: \2/') + if [[ "$line" =~ .*no.soundcards.found.* ]]; then + echo " No soundcards found" + else + print_in_columns "$line" + fi +done <<< $(aplay -l 2>&1 | grep -Ei '(^card|no soundcards found)' | sed -r 's/.*\[(.*)\].*\[(.*)\].*/\1: \2/') echo "" # Network echo -e "${BLUE}Network${CLEAR}" lspci | grep -Ei '(ethernet|network|wireless|wifi)' \ - | sed -r 's/.*: (.*) \(.*$/ \1/' + | sed -r 's/.*: (.*)$/ \1/' echo "" # Drives From 24df753a40585bd2d55a35b05407a2193b15cb8f Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Mon, 21 May 2018 20:25:12 -0600 Subject: [PATCH 35/46] Add support for LVM and RAID to mount-all-volumes * Renamed get_mounted_data to get_mounted_volumes * Report data is now a dict for better clarity * Widened report hoping that LVM names will fit (they probably wont) * This fixes #38 --- .bin/Scripts/functions/data.py | 123 ++++++++++++++++++--------------- .bin/Scripts/mount-all-volumes | 4 +- 2 files changed, 70 insertions(+), 57 deletions(-) diff --git a/.bin/Scripts/functions/data.py b/.bin/Scripts/functions/data.py index 5e06a188..ad4fe4f1 100644 --- a/.bin/Scripts/functions/data.py +++ b/.bin/Scripts/functions/data.py @@ -170,93 +170,106 @@ def is_valid_wim_file(item): print_log('WARNING: Image "{}" damaged.'.format(item.name)) return valid -def get_mounted_data(): +def get_mounted_volumes(): """Get mounted volumes, returns dict.""" cmd = [ 'findmnt', '-J', '-b', '-i', - 't', ( - 'autofs,binfmt_misc,cgroup,cgroup2,configfs,debugfs,devpts,devtmpfs,' + '-t', ( + 'autofs,binfmt_misc,bpf,cgroup,cgroup2,configfs,debugfs,devpts,devtmpfs,' 'hugetlbfs,mqueue,proc,pstore,securityfs,sysfs,tmpfs' ), '-o', 'SOURCE,TARGET,FSTYPE,LABEL,SIZE,AVAIL,USED'] result = run_program(cmd) json_data = json.loads(result.stdout.decode()) - mounted_data = [] + mounted_volumes = [] for item in json_data.get('filesystems', []): - mounted_data.append(item) - mounted_data.extend(item.get('children', [])) - return {item['source']: item for item in mounted_data} + mounted_volumes.append(item) + mounted_volumes.extend(item.get('children', [])) + return {item['source']: item for item in mounted_volumes} def mount_all_volumes(): - """Mount all attached devices with recognized filesystems.""" - report = [] + """Mount all detected filesystems.""" + report = {} # Get list of block devices - cmd = ['lsblk', '-J', '-o', 'NAME,FSTYPE,LABEL,UUID,PARTTYPE,TYPE,SIZE'] + cmd = [ + 'lsblk', '-J', '-p', + '-o', 'NAME,FSTYPE,LABEL,UUID,PARTTYPE,TYPE,SIZE'] result = run_program(cmd) json_data = json.loads(result.stdout.decode()) devs = json_data.get('blockdevices', []) - # Get list of mounted devices - mounted_data = get_mounted_data() - mounted_list = [m['source'] for m in mounted_data.values()] - - # Loop over devices + # Get list of volumes + volumes = {} for dev in devs: - dev_path = '/dev/{}'.format(dev['name']) - if re.search(r'^(loop|sr)', dev['name'], re.IGNORECASE): - # Skip loopback devices and optical media - report.append([dev_path, 'Skipped']) - continue for child in dev.get('children', []): - child_path = '/dev/{}'.format(child['name']) - if child_path in mounted_list: - report.append([child_path, 'Already Mounted']) - else: - try: - run_program(['udevil', 'mount', '-o', 'ro', child_path]) - report.append([child_path, 'CS']) - except subprocess.CalledProcessError: - report.append([child_path, 'NS']) + volumes.update({child['name']: child}) + for grandchild in child.get('children', []): + volumes.update({grandchild['name']: grandchild}) + + # Get list of mounted volumes + mounted_volumes = get_mounted_volumes() - # Update list of mounted devices - mounted_data = get_mounted_data() - mounted_list = [m['source'] for m in mounted_data.values()] - - # Update report lines for show_data() - for line in report: - _path = line[0] - _result = line[1] - info = {'message': '{}:'.format(_path)} - if _path in mounted_list: - info['data'] = 'Mounted on {}'.format( - mounted_data[_path]['target']) - info['data'] = '{:40} ({} used, {} free)'.format( - info['data'], - human_readable_size(mounted_data[_path]['used']), - human_readable_size(mounted_data[_path]['avail'])) - if _result == 'Already Mounted': - info['warning'] = True - elif _result == 'Skipped': - info['data'] = 'Skipped' - info['warning'] = True + # Loop over volumes + for vol_path, vol_data in volumes.items(): + vol_data['show_data'] = { + 'message': vol_path.replace('/dev/mapper/', ''), + 'data': None, + } + if re.search(r'^loop\d', vol_path, re.IGNORECASE): + # Skip loopback devices + vol_data['show_data']['data'] = 'Skipped' + vol_data['show_data']['warning'] = True + report[vol_path] = vol_data + elif 'children' in vol_data: + # Skip LVM/RAID partitions (the real volume is mounted separately) + vol_data['show_data']['data'] = vol_data.get('fstype', 'UNKNOWN') + if vol_data.get('label', None): + vol_data['show_data']['data'] += ' "{}"'.format(vol_data['label']) + vol_data['show_data']['info'] = True + report[vol_path] = vol_data else: - info['data'] = 'Failed to mount' - info['error'] = True - line.append(info) + if vol_path in mounted_volumes: + vol_data['show_data']['warning'] = True + else: + # Mount volume + try: + run_program(['udevil', 'mount', '-o', 'ro', vol_path]) + except subprocess.CalledProcessError: + vol_data['show_data']['data'] = 'Failed to mount' + vol_data['show_data']['error'] = True + # Update mounted_volumes data + mounted_volumes = get_mounted_volumes() + + # Format pretty result string + if vol_data['show_data']['data'] != 'Failed to mount': + size_used = human_readable_size( + mounted_volumes[vol_path]['used']) + size_avail = human_readable_size( + mounted_volumes[vol_path]['avail']) + vol_data['show_data']['data'] = 'Mounted on {}'.format( + mounted_volumes[vol_path]['target']) + vol_data['show_data']['data'] = '{:40} ({} used, {} free)'.format( + vol_data['show_data']['data'], + size_used, + size_avail) + + # Update report + report[vol_path] = vol_data + return report def mount_backup_shares(read_write=False): """Mount the backup shares unless labeled as already mounted.""" if psutil.LINUX: - mounted_data = get_mounted_data() + mounted_volumes = get_mounted_volumes() for server in BACKUP_SERVERS: if psutil.LINUX: # Update mounted status source = '//{IP}/{Share}'.format(**server) dest = '/Backups/{Name}'.format(**server) mounted_str = '(Already) Mounted {}'.format(dest) - data = mounted_data.get(source, {}) + data = mounted_volumes.get(source, {}) if dest == data.get('target', ''): server['Mounted'] = True elif psutil.WINDOWS: diff --git a/.bin/Scripts/mount-all-volumes b/.bin/Scripts/mount-all-volumes index b547e6b6..d743d656 100755 --- a/.bin/Scripts/mount-all-volumes +++ b/.bin/Scripts/mount-all-volumes @@ -22,8 +22,8 @@ if __name__ == '__main__': # Print report print_info('\nResults') - for line in report: - show_data(indent=4, width=16, **line[-1]) + for vol_name, vol_data in sorted(report.items()): + show_data(indent=4, width=20, **vol_data['show_data']) # Done print_standard('\nDone.') From 629d29ec9929dc2496f55b392199d151221765d4 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Mon, 21 May 2018 20:38:05 -0600 Subject: [PATCH 36/46] Allow LVM devices in udevil * Part of the #38 fix --- .linux_items/include/airootfs/etc/udevil/udevil.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.linux_items/include/airootfs/etc/udevil/udevil.conf b/.linux_items/include/airootfs/etc/udevil/udevil.conf index b61d2c30..83fe334d 100644 --- a/.linux_items/include/airootfs/etc/udevil/udevil.conf +++ b/.linux_items/include/airootfs/etc/udevil/udevil.conf @@ -119,7 +119,7 @@ allowed_media_dirs = /media # allowed_devices = /dev/* # WARNING: ALLOWING USERS TO MOUNT DEVICES OUTSIDE OF /dev CAN CAUSE SERIOUS # SECURITY PROBLEMS. DO NOT ALLOW DEVICES IN /dev/shm -allowed_devices = /dev/* +allowed_devices = /dev/*, /dev/mapper/* # allowed_internal_devices causes udevil to treat any listed block devices as @@ -133,7 +133,7 @@ allowed_devices = /dev/* # Some removable esata drives look like internal drives to udevil. To avoid # this problem, they can be treated as removable with this setting. # WARNING: SETTING A SYSTEM DEVICE HERE CAN CAUSE SERIOUS SECURITY PROBLEMS. -allowed_internal_devices = /dev/* +allowed_internal_devices = /dev/*, /dev/mapper/* # allowed_internal_uuids and allowed_internal_uuids_FSTYPE work similarly to From 0063de68469a4170b0a681316ec46b995cc15ca3 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Tue, 22 May 2018 12:24:33 -0600 Subject: [PATCH 37/46] Bump TeamViewer version --- .bin/Scripts/settings/sources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bin/Scripts/settings/sources.py b/.bin/Scripts/settings/sources.py index f1782ded..3560b092 100644 --- a/.bin/Scripts/settings/sources.py +++ b/.bin/Scripts/settings/sources.py @@ -176,7 +176,7 @@ NINITE_SOURCES = { 'Launchy.exe': 'launchy', 'RealVNC.exe': 'realvnc', 'Revo Uninstaller.exe': 'revo', - 'TeamViewer 12.exe': 'teamviewer12', + 'TeamViewer 13.exe': 'teamviewer13', 'TeraCopy.exe': 'teracopy', 'WinDirStat.exe': 'windirstat', }, From 5b0e7b9dfed22d6800aac843780bc2b4b24b9e3d Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Tue, 22 May 2018 12:26:43 -0600 Subject: [PATCH 38/46] cbin copied correctly again in Copy WizardKit.cmd --- .bin/Scripts/Copy WizardKit.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.bin/Scripts/Copy WizardKit.cmd b/.bin/Scripts/Copy WizardKit.cmd index 60340710..1740382d 100644 --- a/.bin/Scripts/Copy WizardKit.cmd +++ b/.bin/Scripts/Copy WizardKit.cmd @@ -67,7 +67,7 @@ start "" /wait "%fastcopy%" %fastcopy_args% %_sources% /to="%dest%\.bin\" echo Copying .cbin... mkdir "%dest%\.cbin" >nul 2>&1 attrib +h "%dest%\.cbin" -start "" /wait "%fastcopy%" %fastcopy_args% %cbin%\* /to="%dest%\.cbin\" +start "" /wait "%fastcopy%" %fastcopy_args% "%cbin%"\* /to="%dest%\.cbin\" :CopyMainData echo Copying Main Kit... @@ -149,4 +149,4 @@ goto Exit :: Cleanup and exit :: :Exit endlocal -exit /b %errorlevel% \ No newline at end of file +exit /b %errorlevel% From 0b1d7bb4f3a2e5f3ed2d8d8801f1d1e5b33f6ef5 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Tue, 22 May 2018 12:49:00 -0600 Subject: [PATCH 39/46] Adjusted system_diagnostics.py messages --- .bin/Scripts/system_diagnostics.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/.bin/Scripts/system_diagnostics.py b/.bin/Scripts/system_diagnostics.py index 518eee8c..a6b014f1 100644 --- a/.bin/Scripts/system_diagnostics.py +++ b/.bin/Scripts/system_diagnostics.py @@ -34,8 +34,6 @@ if __name__ == '__main__': if ENABLED_TICKET_NUMBERS: print_info('Starting System Diagnostics for Ticket #{}\n'.format( ticket_number)) - else: - print_info('Starting System Diagnostics\n') # Sanitize Environment print_info('Sanitizing Environment') From da61ea38564f36d81c35bd63554b1e9aa3e9f1b3 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Tue, 22 May 2018 19:33:21 -0600 Subject: [PATCH 40/46] Updated SW diag/checklist summaries to match * Also added AV check to SW diag --- .bin/Scripts/system_checklist.py | 8 +++----- .bin/Scripts/system_diagnostics.py | 24 ++++++++++++++---------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/.bin/Scripts/system_checklist.py b/.bin/Scripts/system_checklist.py index c24e9fb1..73410d92 100644 --- a/.bin/Scripts/system_checklist.py +++ b/.bin/Scripts/system_checklist.py @@ -32,8 +32,6 @@ if __name__ == '__main__': if ENABLED_TICKET_NUMBERS: print_info('Starting System Checklist for Ticket #{}\n'.format( ticket_number)) - else: - print_info('Starting System Checklist\n') # Configure print_info('Configure') @@ -78,15 +76,15 @@ if __name__ == '__main__': try_and_print(message='BIOS Activation:', function=activate_with_bios, other_results=other_results) + try_and_print(message='Installed RAM:', + function=show_installed_ram, ns='Unknown', silent_function=False) + show_free_space() try_and_print(message='Installed Antivirus:', function=get_installed_antivirus, ns='Unknown', other_results=other_results, print_return=True) try_and_print(message='Installed Office:', function=get_installed_office, ns='Unknown', other_results=other_results, print_return=True) - show_free_space() - try_and_print(message='Installed RAM:', - function=show_installed_ram, ns='Unknown', silent_function=False) # Play audio, show devices, open Windows updates, and open Activation try_and_print(message='Opening Device Manager...', diff --git a/.bin/Scripts/system_diagnostics.py b/.bin/Scripts/system_diagnostics.py index a6b014f1..9a6e1c0b 100644 --- a/.bin/Scripts/system_diagnostics.py +++ b/.bin/Scripts/system_diagnostics.py @@ -87,19 +87,23 @@ if __name__ == '__main__': # Summary print_info('Summary') - try_and_print(message='Temp Size:', - function=show_temp_files_size, silent_function=False) - show_free_space() - try_and_print(message='Installed RAM:', - function=show_installed_ram, ns='Unknown', silent_function=False) - try_and_print(message='Installed Office:', - function=get_installed_office, ns='Unknown', print_return=True) - try_and_print(message='Product Keys:', - function=get_product_keys, ns='Unknown', print_return=True) try_and_print(message='Operating System:', function=show_os_name, ns='Unknown', silent_function=False) - try_and_print(message='', + try_and_print(message='Activation:', function=show_os_activation, ns='Unknown', silent_function=False) + try_and_print(message='Installed RAM:', + function=show_installed_ram, ns='Unknown', silent_function=False) + show_free_space() + try_and_print(message='Temp Size:', + function=show_temp_files_size, silent_function=False) + try_and_print(message='Installed Antivirus:', + function=get_installed_antivirus, ns='Unknown', + other_results=other_results, print_return=True) + try_and_print(message='Installed Office:', + function=get_installed_office, ns='Unknown', + other_results=other_results, print_return=True) + try_and_print(message='Product Keys:', + function=get_product_keys, ns='Unknown', print_return=True) # User data print_info('User Data') From c7ae1b1dc7ce5bc93d07c13536db99776168f6a8 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Tue, 22 May 2018 20:05:49 -0600 Subject: [PATCH 41/46] Moved SafeMode scripts into the Misc folder --- .bin/Scripts/settings/launchers.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.bin/Scripts/settings/launchers.py b/.bin/Scripts/settings/launchers.py index 1875ccc7..6e011691 100644 --- a/.bin/Scripts/settings/launchers.py +++ b/.bin/Scripts/settings/launchers.py @@ -8,18 +8,6 @@ LAUNCHERS = { 'L_ITEM': 'activate.py', 'L_ELEV': 'True', }, - 'Enter SafeMode': { - 'L_TYPE': 'PyScript', - 'L_PATH': 'Scripts', - 'L_ITEM': 'safemode_enter.py', - 'L_ELEV': 'True', - }, - 'Exit SafeMode': { - 'L_TYPE': 'PyScript', - 'L_PATH': 'Scripts', - 'L_ITEM': 'safemode_exit.py', - 'L_ELEV': 'True', - }, 'System Checklist': { 'L_TYPE': 'PyScript', 'L_PATH': 'Scripts', @@ -458,6 +446,12 @@ LAUNCHERS = { 'L_PATH': 'ConEmu', 'L_ITEM': 'ConEmu.exe', }, + 'Enter SafeMode': { + 'L_TYPE': 'PyScript', + 'L_PATH': 'Scripts', + 'L_ITEM': 'safemode_enter.py', + 'L_ELEV': 'True', + }, 'Everything': { 'L_TYPE': 'Executable', 'L_PATH': 'Everything', @@ -465,6 +459,12 @@ LAUNCHERS = { 'L_ARGS': '-nodb', 'L_ELEV': 'True', }, + 'Exit SafeMode': { + 'L_TYPE': 'PyScript', + 'L_PATH': 'Scripts', + 'L_ITEM': 'safemode_exit.py', + 'L_ELEV': 'True', + }, 'Notepad++': { 'L_TYPE': 'Executable', 'L_PATH': 'notepadplusplus', From 69cbbbc2039348dcf7bb77c699ec6d07f4d16d9e Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Tue, 22 May 2018 20:09:43 -0600 Subject: [PATCH 42/46] Suppress SDIO warning If there's hidden folders at the root of the device it's running from then it shows a red banner with a "you may have a virus!" warning.. This check has been disabled --- .bin/_Drivers/SDIO/sdi.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bin/_Drivers/SDIO/sdi.cfg b/.bin/_Drivers/SDIO/sdi.cfg index 614df221..d1bd67fb 100644 --- a/.bin/_Drivers/SDIO/sdi.cfg +++ b/.bin/_Drivers/SDIO/sdi.cfg @@ -21,4 +21,4 @@ -uplimit:1 -connections:0 --expertmode -norestorepnt -showdrpnames2 -onlyupdates -preservecfg \ No newline at end of file +-expertmode -norestorepnt -showdrpnames2 -onlyupdates -preservecfg -novirusalerts \ No newline at end of file From 341f424eae741bead3a1c169458791f37af74547 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Tue, 22 May 2018 20:47:18 -0600 Subject: [PATCH 43/46] Use a different label for combined kits * WK_LINUX doesn't reflect what the UFDs actually contain --- .bin/Scripts/build-ufd | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.bin/Scripts/build-ufd b/.bin/Scripts/build-ufd index cabc7ba0..76c2b141 100755 --- a/.bin/Scripts/build-ufd +++ b/.bin/Scripts/build-ufd @@ -469,7 +469,8 @@ if [ -z ${KIT_NAME_FULL+x} ]; then echo -e "${RED}ERROR${CLEAR}: failed to load settings from ${MAIN_PY}" abort fi -UFD_LABEL="${KIT_NAME_SHORT}_LINUX" +ISO_LABEL="${KIT_NAME_SHORT}_LINUX" +UFD_LABEL="${KIT_NAME_SHORT}_UFD" # Check if root if [[ "$EUID" -ne 0 ]]; then @@ -555,6 +556,8 @@ mount "${WINPE_ISO}" /mnt/WinPE -r >> "${LOG_FILE}" 2>&1 # Copy files echo "Copying Linux files..." rsync ${RSYNC_ARGS} /mnt/Linux/* /mnt/Dest/ >> "${LOG_FILE}" 2>&1 +sed -i "s/${ISO_LABEL}/${UFD_LABEL}/" /mnt/Dest/EFI/boot/refind.conf +sed -i "s/${ISO_LABEL}/${UFD_LABEL}/" /mnt/Dest/arch/boot/syslinux/*cfg echo "Copying WinPE files..." rsync ${RSYNC_ARGS} /mnt/WinPE/{Boot,bootmgr{,.efi},en-us,sources} /mnt/Dest/ >> "${LOG_FILE}" 2>&1 From 2dabfd4020ab9ebe7b8acd1ed579c0922a607108 Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Tue, 22 May 2018 20:55:11 -0600 Subject: [PATCH 44/46] Hide more root items --- .bin/Scripts/build-ufd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bin/Scripts/build-ufd b/.bin/Scripts/build-ufd index 76c2b141..faae7867 100755 --- a/.bin/Scripts/build-ufd +++ b/.bin/Scripts/build-ufd @@ -595,7 +595,7 @@ sync echo "Hiding boot files..." echo "drive s: file=\"${DEST_PAR}\"" > /root/.mtoolsrc echo 'mtools_skip_check=1' >> /root/.mtoolsrc -for item in boot{,mgr,mgr.efi} efi en-us images isolinux sources "${KIT_NAME_FULL}"/{.bin,.cbin}; do +for item in arch Boot bootmgr{,.efi} EFI en-us images isolinux sources "${KIT_NAME_FULL}"/{.bin,.cbin}; do yes | mattrib +h "S:/${item}" >> "${LOG_FILE}" 2>&1 || true done sync From 9ed4c6209b465e156ffab2f91fca20384aa02b8c Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Tue, 22 May 2018 21:22:00 -0600 Subject: [PATCH 45/46] papirus-icon-theme has moved to the community repo --- .linux_items/packages/aur | 1 - 1 file changed, 1 deletion(-) diff --git a/.linux_items/packages/aur b/.linux_items/packages/aur index 09982dd6..11874fa5 100644 --- a/.linux_items/packages/aur +++ b/.linux_items/packages/aur @@ -6,7 +6,6 @@ inxi mprime nvme-cli openbox-patched -papirus-icon-theme smartmontools-svn testdisk-wip ttf-font-awesome-4 From 7559a673ef1a81a889420aefcd2eba11408424cd Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Wed, 23 May 2018 19:20:57 -0600 Subject: [PATCH 46/46] Added VirtIO drivers --- .bin/Scripts/build_pe.ps1 | 41 ++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/.bin/Scripts/build_pe.ps1 b/.bin/Scripts/build_pe.ps1 index 7329aa82..0e19050a 100644 --- a/.bin/Scripts/build_pe.ps1 +++ b/.bin/Scripts/build_pe.ps1 @@ -176,6 +176,8 @@ if ($MyInvocation.InvocationName -ne ".") { # TestDisk / PhotoRec @("testdisk32.zip", "https://www.cgsecurity.org/testdisk-7.1-WIP.win.zip"), @("testdisk64.zip", "https://www.cgsecurity.org/testdisk-7.1-WIP.win64.zip"), + # VirtIO drivers + @("virtio-win.iso", "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/virtio-win.iso"), # wimlib-imagex @("wimlib32.zip", "https://wimlib.net/downloads/wimlib-1.12.0-windows-i686-bin.zip"), @("wimlib64.zip", "https://wimlib.net/downloads/wimlib-1.12.0-windows-x86_64-bin.zip") @@ -207,8 +209,6 @@ if ($MyInvocation.InvocationName -ne ".") { "-aoa", "-bso0", "-bse0", "-bsp0", "7za.exe", "*.txt") Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait - Remove-Item "$Temp\7z*" -Recurse - $SevenZip = "$Build\bin\x86\7-Zip\7za.exe" } catch { Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red" @@ -225,7 +225,6 @@ if ($MyInvocation.InvocationName -ne ".") { "x", "$Temp\bluescreenview32.zip", "-o$Build\bin\x86\BlueScreenView", "-aoa", "-bso0", "-bse0", "-bsp0") Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait - Remove-Item "$Temp\bluescreenview*" } catch { Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red" @@ -248,7 +247,6 @@ if ($MyInvocation.InvocationName -ne ".") { Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait Remove-Item "$Build\bin\x86\ConEmu\ConEmu64.exe" Remove-Item "$Build\bin\x86\ConEmu\ConEmu64.map" - Remove-Item "$Temp\ConEmuPack*" } catch { Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red" @@ -267,7 +265,6 @@ if ($MyInvocation.InvocationName -ne ".") { "-aoa", "-bso0", "-bse0", "-bsp0", "-x!setup.exe", "-x!*.dll") Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait - Remove-Item "$Temp\fastcopy*" } catch { Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red" @@ -286,7 +283,6 @@ if ($MyInvocation.InvocationName -ne ".") { "-aoa", "-bso0", "-bse0", "-bsp0", "Production\Windows10-x86\Eth\*") Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait - Remove-Item "$Temp\killerinf*" } catch { Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red" @@ -303,7 +299,6 @@ if ($MyInvocation.InvocationName -ne ".") { "e", "$Temp\hwinfo.zip", "-o$Build\bin\x86\HWiNFO", "-aoa", "-bso0", "-bse0", "-bsp0", "HWiNFO32.exe") Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait - # Remove-Item "$Temp\hwinfo.zip" Move-Item "$Build\bin\amd64\HWiNFO\HWiNFO64.exe" "$Build\bin\amd64\HWiNFO\HWiNFO.exe" -Force Move-Item "$Build\bin\x86\HWiNFO\HWiNFO32.exe" "$Build\bin\x86\HWiNFO\HWiNFO.exe" -Force } @@ -322,7 +317,6 @@ if ($MyInvocation.InvocationName -ne ".") { "x", "$Temp\npp_x86.7z", "-o$Build\bin\x86\NotepadPlusPlus", "-aoa", "-bso0", "-bse0", "-bsp0") Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait - Remove-Item "$Temp\npp*" Move-Item "$Build\bin\amd64\NotepadPlusPlus\notepad++.exe" "$Build\bin\amd64\NotepadPlusPlus\notepadplusplus.exe" -Force Move-Item "$Build\bin\x86\NotepadPlusPlus\notepad++.exe" "$Build\bin\x86\NotepadPlusPlus\notepadplusplus.exe" -Force } @@ -344,7 +338,6 @@ if ($MyInvocation.InvocationName -ne ".") { "-aoa", "-bso0", "-bse0", "-bsp0", "ntpwedit.exe", "*.txt") Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait - Remove-Item "$Temp\ntpwed*" } catch { Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red" @@ -369,7 +362,6 @@ if ($MyInvocation.InvocationName -ne ".") { Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait Move-Item "$Build\bin\x86\TestDisk\testdisk-7.1-WIP\*" "$Build\bin\x86\TestDisk" -Force Remove-Item "$Build\bin\x86\TestDisk\testdisk-7.1-WIP" -Recurse -Force - Remove-Item "$Temp\testdisk*" } catch { Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red" @@ -386,7 +378,6 @@ if ($MyInvocation.InvocationName -ne ".") { "x", "$Temp\prime95_32.zip", "-o$Build\bin\x86\Prime95", "-aoa", "-bso0", "-bse0", "-bsp0") Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait - Remove-Item "$Temp\prime95*" } catch { Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red" @@ -402,7 +393,6 @@ if ($MyInvocation.InvocationName -ne ".") { "x", "$Temp\produkey32.zip", "-o$Build\bin\x86\ProduKey", "-aoa", "-bso0", "-bse0", "-bsp0") Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait - Remove-Item "$Temp\produkey*" } catch { Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red" @@ -441,8 +431,6 @@ if ($MyInvocation.InvocationName -ne ".") { catch { Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red" } - Remove-Item "$Temp\python*" - Remove-Item "$Temp\*.whl" # Q-Dir Write-Host "Extracting: Q-Dir" @@ -456,7 +444,24 @@ if ($MyInvocation.InvocationName -ne ".") { "x", "$Temp\qdir32.zip", "-o$Build\bin\x86", "-aoa", "-bso0", "-bse0", "-bsp0") Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait - Remove-Item "$Temp\qdir*" + } + catch { + Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red" + } + + # VirtIO Drivers + Write-Host "Extracting: VirtIO Drivers" + try { + $ArgumentList = @( + "e", "$Temp\virtio-win.iso", "-o$Build\Drivers\amd64\VirtIO", + "-aoa", "-bso0", "-bse0", "-bsp0", + "*\w10\amd64\*") + Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait + $ArgumentList = @( + "e", "$Temp\virtio-win.iso", "-o$Build\Drivers\x86\VirtIO", + "-aoa", "-bso0", "-bse0", "-bsp0", + "*\w10\x86\*") + Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait } catch { Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red" @@ -472,11 +477,15 @@ if ($MyInvocation.InvocationName -ne ".") { "x", "$Temp\wimlib32.zip", "-o$Build\bin\x86\wimlib", "-aoa", "-bso0", "-bse0", "-bsp0") Start-Process -FilePath $SevenZip -ArgumentList $ArgumentList -NoNewWindow -Wait - Remove-Item "$Temp\wimlib*" } catch { Write-Host (" ERROR: Failed to extract files." ) -ForegroundColor "Red" } + + ## Cleanup ## + if (Ask-User "Delete temp files?") { + Remove-Item "$Temp" -Recurse + } } ## Build ##