From 8064fc4a1721d2fcd27edcc15efabf42769871cc Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Fri, 23 Nov 2018 18:01:03 -0700 Subject: [PATCH] Removed whitespace from empty lines --- .bin/Scripts/activate.py | 2 +- .bin/Scripts/borrowed/sensors.py | 54 +++++++++++----------- .bin/Scripts/cbs_fix.py | 8 ++-- .bin/Scripts/check_disk.py | 4 +- .bin/Scripts/dism.py | 4 +- .bin/Scripts/functions/activation.py | 2 +- .bin/Scripts/functions/backup.py | 26 +++++------ .bin/Scripts/functions/disk.py | 60 ++++++++++++------------- .bin/Scripts/functions/network.py | 4 +- .bin/Scripts/functions/product_keys.py | 2 +- .bin/Scripts/functions/windows_setup.py | 16 +++---- .bin/Scripts/functions/winpe_menus.py | 30 ++++++------- .bin/Scripts/safemode_enter.py | 6 +-- .bin/Scripts/safemode_exit.py | 6 +-- .bin/Scripts/sfc_scan.py | 4 +- .bin/Scripts/transferred_keys.py | 4 +- .bin/Scripts/user_data_transfer.py | 16 +++---- .bin/Scripts/winpe_root_menu.py | 2 +- 18 files changed, 125 insertions(+), 125 deletions(-) diff --git a/.bin/Scripts/activate.py b/.bin/Scripts/activate.py index 3555c46a..642e5edd 100644 --- a/.bin/Scripts/activate.py +++ b/.bin/Scripts/activate.py @@ -39,7 +39,7 @@ if __name__ == '__main__': selection = menu_select( '{}: Windows Activation Menu'.format(KIT_NAME_FULL), main_entries=activation_methods, action_entries=actions) - + if (selection.isnumeric()): result = try_and_print( message = activation_methods[int(selection)-1]['Name'], diff --git a/.bin/Scripts/borrowed/sensors.py b/.bin/Scripts/borrowed/sensors.py index 847f2619..39b00a4f 100644 --- a/.bin/Scripts/borrowed/sensors.py +++ b/.bin/Scripts/borrowed/sensors.py @@ -35,7 +35,7 @@ class feature(Structure): _fields_ = [("name", c_char_p), ("number", c_int), ("type", c_int)] - + # sensors_feature_type IN = 0x00 FAN = 0x01 @@ -71,10 +71,10 @@ COMPUTE_MAPPING = 4 def init(cfg_file = None): file = _libc.fopen(cfg_file.encode("utf-8"), "r") if cfg_file is not None else None - + if _hdl.sensors_init(file) != 0: raise Exception("sensors_init failed") - + if file is not None: _libc.fclose(file) @@ -84,10 +84,10 @@ def cleanup(): def parse_chip_name(orig_name): ret = chip_name() err= _hdl.sensors_parse_chip_name(orig_name.encode("utf-8"), byref(ret)) - + if err < 0: raise Exception(strerror(err)) - + return ret def strerror(errnum): @@ -101,10 +101,10 @@ def get_detected_chips(match, nr): @return: (chip, next nr to query) """ _nr = c_int(nr) - + if match is not None: match = byref(match) - + chip = _hdl.sensors_get_detected_chips(match, byref(_nr)) chip = chip.contents if bool(chip) else None return chip, _nr.value @@ -115,10 +115,10 @@ def chip_snprintf_name(chip, buffer_size=200): """ ret = create_string_buffer(buffer_size) err = _hdl.sensors_snprintf_chip_name(ret, buffer_size, byref(chip)) - + if err < 0: raise Exception(strerror(err)) - + return ret.value.decode("utf-8") def do_chip_sets(chip): @@ -128,7 +128,7 @@ def do_chip_sets(chip): err = _hdl.sensors_do_chip_sets(byref(chip)) if err < 0: raise Exception(strerror(err)) - + def get_adapter_name(bus): return _hdl.sensors_get_adapter_name(byref(bus)).decode("utf-8") @@ -177,60 +177,60 @@ class ChipIterator: def __init__(self, match = None): self.match = parse_chip_name(match) if match is not None else None self.nr = 0 - + def __iter__(self): return self - + def __next__(self): chip, self.nr = get_detected_chips(self.match, self.nr) - + if chip is None: raise StopIteration - + return chip - + def __del__(self): if self.match is not None: free_chip_name(self.match) - + def next(self): # python2 compability return self.__next__() - + class FeatureIterator: def __init__(self, chip): self.chip = chip self.nr = 0 - + def __iter__(self): return self - + def __next__(self): feature, self.nr = get_features(self.chip, self.nr) - + if feature is None: raise StopIteration - + return feature def next(self): # python2 compability return self.__next__() - + class SubFeatureIterator: def __init__(self, chip, feature): self.chip = chip self.feature = feature self.nr = 0 - + def __iter__(self): return self - + def __next__(self): subfeature, self.nr = get_all_subfeatures(self.chip, self.feature, self.nr) - + if subfeature is None: raise StopIteration - + return subfeature - + def next(self): # python2 compability return self.__next__() diff --git a/.bin/Scripts/cbs_fix.py b/.bin/Scripts/cbs_fix.py index a3b40a8d..9a8ff10c 100644 --- a/.bin/Scripts/cbs_fix.py +++ b/.bin/Scripts/cbs_fix.py @@ -10,7 +10,7 @@ from functions.cleanup import * from functions.data import * init_global_vars() os.system('title {}: CBS Cleanup'.format(KIT_NAME_FULL)) -global_vars['LogFile'] = r'{LogDir}\CBS Cleanup.log'.format(**global_vars) +set_log_file('CBS Cleanup.log') if __name__ == '__main__': try: @@ -20,18 +20,18 @@ if __name__ == '__main__': folder_path = r'{}\Backups'.format(KIT_NAME_SHORT) dest = select_destination(folder_path=folder_path, prompt='Which disk are we using for temp data and backup?') - + # Show details print_info('{}: CBS Cleanup Tool\n'.format(KIT_NAME_FULL)) show_data('Backup / Temp path:', dest) print_standard('\n') if (not ask('Proceed with CBS cleanup?')): abort() - + # Run Cleanup try_and_print(message='Running cleanup...', function=cleanup_cbs, cs='Done', dest_folder=dest) - + # Done print_standard('\nDone.') pause("Press Enter to exit...") diff --git a/.bin/Scripts/check_disk.py b/.bin/Scripts/check_disk.py index 734319f0..7e59fb2b 100644 --- a/.bin/Scripts/check_disk.py +++ b/.bin/Scripts/check_disk.py @@ -9,7 +9,7 @@ sys.path.append(os.getcwd()) from functions.repairs import * init_global_vars() os.system('title {}: Check Disk Tool'.format(KIT_NAME_FULL)) -global_vars['LogFile'] = r'{LogDir}\Check Disk.log'.format(**global_vars) +set_log_file('Check Disk.log') if __name__ == '__main__': try: @@ -45,7 +45,7 @@ if __name__ == '__main__': cs=cs, other_results=other_results, repair=repair) else: abort() - + # Done print_success('Done.') pause("Press Enter to exit...") diff --git a/.bin/Scripts/dism.py b/.bin/Scripts/dism.py index 1c88e51b..e49a9512 100644 --- a/.bin/Scripts/dism.py +++ b/.bin/Scripts/dism.py @@ -9,7 +9,7 @@ sys.path.append(os.getcwd()) from functions.repairs import * init_global_vars() os.system('title {}: DISM helper Tool'.format(KIT_NAME_FULL)) -global_vars['LogFile'] = r'{LogDir}\DISM helper tool.log'.format(**global_vars) +set_log_file('DISM Helper.log') if __name__ == '__main__': try: @@ -46,7 +46,7 @@ if __name__ == '__main__': other_results=other_results, repair=repair) else: abort() - + # Done print_success('Done.') pause("Press Enter to exit...") diff --git a/.bin/Scripts/functions/activation.py b/.bin/Scripts/functions/activation.py index f54d1dca..24436418 100644 --- a/.bin/Scripts/functions/activation.py +++ b/.bin/Scripts/functions/activation.py @@ -59,7 +59,7 @@ def windows_is_activated(): ['cscript', '//nologo', SLMGR, '/xpr'], check=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE) activation_string = activation_string.stdout.decode() - + return bool(activation_string and 'permanent' in activation_string) if __name__ == '__main__': diff --git a/.bin/Scripts/functions/backup.py b/.bin/Scripts/functions/backup.py index e33cea2c..d872c4d0 100644 --- a/.bin/Scripts/functions/backup.py +++ b/.bin/Scripts/functions/backup.py @@ -16,7 +16,7 @@ def backup_partition(disk, par): """Create a backup image of a partition.""" if par.get('Image Exists', False) or par['Number'] in disk['Bad Partitions']: raise GenericAbort - + cmd = [ global_vars['Tools']['wimlib-imagex'], 'capture', @@ -48,7 +48,7 @@ def get_volume_display_name(mountpoint): serial_number = None max_component_length = None file_system_flags = None - + vol_info = kernel32.GetVolumeInformationW( ctypes.c_wchar_p(mountpoint), vol_name_buffer, @@ -59,16 +59,16 @@ def get_volume_display_name(mountpoint): 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. - + This includes partitions that can't be backed up, whether backups already exist on the BACKUP_SERVER, partition names/sizes/used space, etc.""" @@ -83,7 +83,7 @@ def prep_disk_for_backup(destination, disk, backup_prefix): if disk['Valid Partitions'] <= 0: print_error('ERROR: No partitions can be backed up for this disk') raise GenericAbort - + # Prep partitions for par in disk['Partitions']: display = '{size} {fs}'.format( @@ -91,7 +91,7 @@ def prep_disk_for_backup(destination, disk, backup_prefix): width = width, size = par['Size'], fs = par['FileSystem']) - + if par['Number'] in disk['Bad Partitions']: # Set display string using partition description & OS type display = '* {display}\t\t{q}{name}{q}\t{desc} ({os})'.format( @@ -120,7 +120,7 @@ def prep_disk_for_backup(destination, disk, backup_prefix): display = '+ {}'.format(display) else: display = ' {}'.format(display) - + # Append rest of Display String for valid/clobber partitions display += ' (Used: {used})\t{q}{name}{q}'.format( used = par['Used Space'], @@ -128,7 +128,7 @@ def prep_disk_for_backup(destination, disk, backup_prefix): name = par['Name']) # For all partitions par['Display String'] = display - + # Set description for bad partitions warnings = '\n' if disk['Bad Partitions']: @@ -148,7 +148,7 @@ 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): @@ -161,7 +161,7 @@ def select_backup_destination(auto_select=True): 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: @@ -175,11 +175,11 @@ def select_backup_destination(auto_select=True): if not destinations: print_warning('No backup destinations found.') raise GenericAbort - + # Skip menu? if len(destinations) == 1 and auto_select: return destinations[0] - + selection = menu_select( title = 'Where are we backing up to?', main_entries = destinations, diff --git a/.bin/Scripts/functions/disk.py b/.bin/Scripts/functions/disk.py index 2d7cf0bb..75879ff8 100644 --- a/.bin/Scripts/functions/disk.py +++ b/.bin/Scripts/functions/disk.py @@ -14,13 +14,13 @@ REGEX_DISK_RAW = re.compile(r'Disk ID: 00000000', re.IGNORECASE) def assign_volume_letters(): """Assign a volume letter to all available volumes.""" remove_volume_letters() - + # Write script script = [] for vol in get_volumes(): script.append('select volume {}'.format(vol['Number'])) script.append('assign') - + # Run run_diskpart(script) @@ -35,7 +35,7 @@ def get_boot_mode(): boot_mode = 'UEFI' except: boot_mode = 'Unknown' - + return boot_mode def get_disk_details(disk): @@ -44,7 +44,7 @@ def get_disk_details(disk): script = [ 'select disk {}'.format(disk['Number']), 'detail disk'] - + # Run try: result = run_diskpart(script) @@ -60,13 +60,13 @@ def get_disk_details(disk): tmp = [s.split(':') for s in tmp if ':' in s] # Add key/value pairs to the details variable and return dict details.update({key.strip(): value.strip() for (key, value) in tmp}) - + return details - + def get_disks(): """Get list of attached disks using DiskPart.""" disks = [] - + try: # Run script result = run_diskpart(['list disk']) @@ -79,7 +79,7 @@ def get_disks(): num = tmp[0] size = human_readable_size(tmp[1]) disks.append({'Number': num, 'Size': size}) - + return disks def get_partition_details(disk, partition): @@ -89,7 +89,7 @@ def get_partition_details(disk, partition): 'select disk {}'.format(disk['Number']), 'select partition {}'.format(partition['Number']), 'detail partition'] - + # Diskpart details try: # Run script @@ -111,14 +111,14 @@ def get_partition_details(disk, partition): tmp = [s.split(':') for s in tmp if ':' in s] # Add key/value pairs to the details variable and return dict details.update({key.strip(): value.strip() for (key, value) in tmp}) - + # Get MBR type / GPT GUID for extra details on "Unknown" partitions guid = partition_uids.lookup_guid(details.get('Type')) if guid: details.update({ 'Description': guid.get('Description', '')[:29], 'OS': guid.get('OS', 'Unknown')[:27]}) - + if 'Letter' in details: # Disk usage try: @@ -128,7 +128,7 @@ def get_partition_details(disk, partition): details['Error'] = err.strerror else: details['Used Space'] = human_readable_size(tmp.used) - + # fsutil details cmd = [ 'fsutil', @@ -151,14 +151,14 @@ def get_partition_details(disk, partition): tmp = [s.split(':') for s in tmp if ':' in s] # Add key/value pairs to the details variable and return dict details.update({key.strip(): value.strip() for (key, value) in tmp}) - + # Set Volume Name details['Name'] = details.get('Volume Name', '') - + # Set FileSystem Type if details.get('FileSystem', '') not in ['RAW', 'Unknown']: details['FileSystem'] = details.get('File System Name', 'Unknown') - + return details def get_partitions(disk): @@ -167,7 +167,7 @@ def get_partitions(disk): script = [ 'select disk {}'.format(disk['Number']), 'list partition'] - + try: # Run script result = run_diskpart(script) @@ -181,7 +181,7 @@ def get_partitions(disk): num = tmp[0] size = human_readable_size(tmp[1]) partitions.append({'Number': num, 'Size': size}) - + return partitions def get_table_type(disk): @@ -190,7 +190,7 @@ def get_table_type(disk): script = [ 'select disk {}'.format(disk['Number']), 'uniqueid disk'] - + try: result = run_diskpart(script) except subprocess.CalledProcessError: @@ -203,7 +203,7 @@ def get_table_type(disk): part_type = 'MBR' elif REGEX_DISK_RAW.search(output): part_type = 'RAW' - + return part_type def get_volumes(): @@ -218,7 +218,7 @@ def get_volumes(): output = result.stdout.decode().strip() for tmp in re.findall(r'Volume (\d+)\s+([A-Za-z]?)\s+', output): vols.append({'Number': tmp[0], 'Letter': tmp[1]}) - + return vols def is_bad_partition(par): @@ -229,7 +229,7 @@ def prep_disk_for_formatting(disk=None): """Gather details about the disk and its partitions.""" disk['Format Warnings'] = '\n' width = len(str(len(disk['Partitions']))) - + # Bail early if disk is None: raise Exception('Disk not provided.') @@ -242,7 +242,7 @@ def prep_disk_for_formatting(disk=None): else: if (ask("Setup Windows to use BIOS/Legacy booting?")): disk['Use GPT'] = False - + # Set Display and Warning Strings if len(disk['Partitions']) == 0: disk['Format Warnings'] += 'No partitions found\n' @@ -252,7 +252,7 @@ def prep_disk_for_formatting(disk=None): width = width, size = partition['Size'], fs = partition['FileSystem']) - + if is_bad_partition(partition): # Set display string using partition description & OS type display += '\t\t{q}{name}{q}\t{desc} ({os})'.format( @@ -290,13 +290,13 @@ def remove_volume_letters(keep=None): """Remove all assigned volume letters using DiskPart.""" if not keep: keep = '' - + script = [] for vol in get_volumes(): if vol['Letter'].upper() != keep.upper(): script.append('select volume {}'.format(vol['Number'])) script.append('remove noerr') - + # Run script try: run_diskpart(script) @@ -306,12 +306,12 @@ def remove_volume_letters(keep=None): def run_diskpart(script): """Run DiskPart script.""" tempfile = r'{}\diskpart.script'.format(global_vars['Env']['TMP']) - + # Write script with open(tempfile, 'w') as f: for line in script: f.write('{}\n'.format(line)) - + # Run script cmd = [ r'{}\Windows\System32\diskpart.exe'.format( @@ -335,7 +335,7 @@ def scan_disks(): # Get partition info for disk disk['Partitions'] = get_partitions(disk) - + for partition in disk['Partitions']: # Get partition details partition.update(get_partition_details(disk, partition)) @@ -364,12 +364,12 @@ def select_disk(title='Which disk?', disks=[]): fs = partition['FileSystem']) if partition['Name']: p_name += '\t"{}"'.format(partition['Name']) - + # Show unsupported partition(s) if is_bad_partition(partition): p_name = '{YELLOW}{p_name}{CLEAR}'.format( p_name=p_name, **COLORS) - + display_name += '\n\t\t\t{}'.format(p_name) if not disk['Partitions']: display_name += '\n\t\t\t{}No partitions found.{}'.format( diff --git a/.bin/Scripts/functions/network.py b/.bin/Scripts/functions/network.py index d040e343..5735c486 100644 --- a/.bin/Scripts/functions/network.py +++ b/.bin/Scripts/functions/network.py @@ -26,7 +26,7 @@ def connect_to_network(): # Bail if currently connected if is_connected(): return - + # WiFi if 'wl' in net_ifs: cmd = [ @@ -37,7 +37,7 @@ def connect_to_network(): message = 'Connecting to {}...'.format(WIFI_SSID), function = run_program, cmd = cmd) - + def is_connected(): """Check for a valid private IP.""" devs = psutil.net_if_addrs() diff --git a/.bin/Scripts/functions/product_keys.py b/.bin/Scripts/functions/product_keys.py index 705f46e9..988d36fd 100644 --- a/.bin/Scripts/functions/product_keys.py +++ b/.bin/Scripts/functions/product_keys.py @@ -39,7 +39,7 @@ def extract_keys(): keys[product] = [] if key not in keys[product]: keys[product].append(key) - + # Done return keys diff --git a/.bin/Scripts/functions/windows_setup.py b/.bin/Scripts/functions/windows_setup.py index cd7f8444..0952e64d 100644 --- a/.bin/Scripts/functions/windows_setup.py +++ b/.bin/Scripts/functions/windows_setup.py @@ -17,7 +17,7 @@ WINDOWS_VERSIONS = [ {'Name': 'Windows 7 Ultimate', 'Image File': 'Win7', 'Image Name': 'Windows 7 ULTIMATE'}, - + {'Name': 'Windows 8.1', 'Image File': 'Win8', 'Image Name': 'Windows 8.1', @@ -25,7 +25,7 @@ WINDOWS_VERSIONS = [ {'Name': 'Windows 8.1 Pro', 'Image File': 'Win8', 'Image Name': 'Windows 8.1 Pro'}, - + {'Name': 'Windows 10 Home', 'Image File': 'Win10', 'Image Name': 'Windows 10 Home', @@ -75,7 +75,7 @@ def find_windows_image(windows_version): image['Glob'] = '--ref="{}*.swm"'.format( image['Path'][:-4]) break - + # Display image to be used (if any) and return if image: print_info('Using image: {}'.format(image['Path'])) @@ -122,7 +122,7 @@ def format_gpt(disk): 'set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"', 'gpt attributes=0x8000000000000001', ] - + # Run run_diskpart(script) @@ -151,7 +151,7 @@ def format_mbr(disk): 'assign letter="T"', 'set id=27', ] - + # Run run_diskpart(script) @@ -197,11 +197,11 @@ def setup_windows_re(windows_version, windows_letter='W', tools_letter='T'): win = r'{}:\Windows'.format(windows_letter) winre = r'{}\System32\Recovery\WinRE.wim'.format(win) dest = r'{}:\Recovery\WindowsRE'.format(tools_letter) - + # Copy WinRE.wim os.makedirs(dest, exist_ok=True) shutil.copy(winre, r'{}\WinRE.wim'.format(dest)) - + # Set location cmd = [ r'{}\System32\ReAgentc.exe'.format(win), @@ -231,7 +231,7 @@ def wim_contains_image(filename, imagename): run_program(cmd) except subprocess.CalledProcessError: return False - + return True if __name__ == '__main__': diff --git a/.bin/Scripts/functions/winpe_menus.py b/.bin/Scripts/functions/winpe_menus.py index 64ffb666..1c732eca 100644 --- a/.bin/Scripts/functions/winpe_menus.py +++ b/.bin/Scripts/functions/winpe_menus.py @@ -90,7 +90,7 @@ def menu_backup(): message = 'Assigning letters...', function = assign_volume_letters, other_results = other_results) - + # Mount backup shares mount_backup_shares(read_write=True) @@ -107,12 +107,12 @@ def menu_backup(): else: print_error('ERROR: No disks found.') raise GenericAbort - + # Select disk to backup disk = select_disk('For which disk are we creating backups?', disks) if not disk: raise GenericAbort - + # "Prep" disk prep_disk_for_backup(destination, disk, backup_prefix) @@ -150,7 +150,7 @@ def menu_backup(): # Ask to proceed if (not ask('Proceed with backup?')): raise GenericAbort - + # Backup partition(s) print_info('\n\nStarting task.\n') for par in disk['Partitions']: @@ -163,7 +163,7 @@ def menu_backup(): if not result['CS'] and not isinstance(result['Error'], GenericAbort): errors = True par['Error'] = result['Error'] - + # Verify backup(s) if disk['Valid Partitions']: print_info('\n\nVerifying backup images(s)\n') @@ -270,7 +270,7 @@ def menu_setup(): # Select the version of Windows to apply windows_version = select_windows_version() - + # Find Windows image # NOTE: Reassign volume letters to ensure all devices are scanned try_and_print( @@ -289,12 +289,12 @@ def menu_setup(): else: print_error('ERROR: No disks found.') raise GenericAbort - + # Select disk to use as the OS disk dest_disk = select_disk('To which disk are we installing Windows?', disks) if not dest_disk: raise GenericAbort - + # "Prep" disk prep_disk_for_formatting(dest_disk) @@ -323,10 +323,10 @@ def menu_setup(): data = par['Display String'], warning = True) print_warning(dest_disk['Format Warnings']) - + if (not ask('Is this correct?')): raise GenericAbort - + # Safety check print_standard('\nSAFETY CHECK') print_warning('All data will be DELETED from the ' @@ -342,7 +342,7 @@ def menu_setup(): 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( @@ -377,13 +377,13 @@ def menu_setup(): # We need to crash as the disk is in an unknown state print_error('ERROR: Failed to apply image.') raise GenericAbort - + # Create Boot files try_and_print( message = 'Updating boot files...', function = update_boot_partition, other_results = other_results) - + # Setup WinRE try_and_print( message = 'Updating recovery tools...', @@ -392,8 +392,8 @@ def menu_setup(): windows_version = windows_version) # Copy WinPE log(s) - source = r'{}\Info'.format(global_vars['ClientDir']) - dest = r'W:\{}\Info'.format(KIT_NAME_SHORT) + source = r'{}\Logs'.format(global_vars['ClientDir']) + dest = r'W:\{}\Logs\WinPE'.format(KIT_NAME_SHORT) shutil.copytree(source, dest) # Print summary diff --git a/.bin/Scripts/safemode_enter.py b/.bin/Scripts/safemode_enter.py index c3213cb9..cce7e28a 100644 --- a/.bin/Scripts/safemode_enter.py +++ b/.bin/Scripts/safemode_enter.py @@ -17,16 +17,16 @@ if __name__ == '__main__': other_results = { 'Error': {'CalledProcessError': 'Unknown Error'}, 'Warning': {}} - + if not ask('Enable booting to SafeMode (with Networking)?'): abort() - + # 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...') diff --git a/.bin/Scripts/safemode_exit.py b/.bin/Scripts/safemode_exit.py index 1449cff5..af66222e 100644 --- a/.bin/Scripts/safemode_exit.py +++ b/.bin/Scripts/safemode_exit.py @@ -17,16 +17,16 @@ if __name__ == '__main__': other_results = { 'Error': {'CalledProcessError': 'Unknown Error'}, 'Warning': {}} - + if not ask('Disable booting to SafeMode?'): abort() - + # 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...') diff --git a/.bin/Scripts/sfc_scan.py b/.bin/Scripts/sfc_scan.py index 81211747..d7a3d3fc 100644 --- a/.bin/Scripts/sfc_scan.py +++ b/.bin/Scripts/sfc_scan.py @@ -9,7 +9,7 @@ sys.path.append(os.getcwd()) from functions.repairs import * init_global_vars() os.system('title {}: SFC Tool'.format(KIT_NAME_FULL)) -global_vars['LogFile'] = r'{LogDir}\SFC Tool.log'.format(**global_vars) +set_log_file('SFC Tool.log') if __name__ == '__main__': try: @@ -28,7 +28,7 @@ if __name__ == '__main__': function=run_sfc_scan, other_results=other_results) else: abort() - + # Done print_standard('\nDone.') pause('Press Enter to exit...') diff --git a/.bin/Scripts/transferred_keys.py b/.bin/Scripts/transferred_keys.py index 9829207e..b95ff3c9 100644 --- a/.bin/Scripts/transferred_keys.py +++ b/.bin/Scripts/transferred_keys.py @@ -9,7 +9,7 @@ sys.path.append(os.getcwd()) from functions.product_keys import * init_global_vars() os.system('title {}: Transferred Key Finder'.format(KIT_NAME_FULL)) -global_vars['LogFile'] = r'{LogDir}\Transferred Keys.log'.format(**global_vars) +set_log_file('Transferred Keys.log') if __name__ == '__main__': try: @@ -18,7 +18,7 @@ if __name__ == '__main__': print_info('{}: Transferred Key Finder\n'.format(KIT_NAME_FULL)) try_and_print(message='Searching for keys...', function=list_clientdir_keys, print_return=True) - + # Done print_standard('\nDone.') exit_script() diff --git a/.bin/Scripts/user_data_transfer.py b/.bin/Scripts/user_data_transfer.py index ce572f69..981e235a 100644 --- a/.bin/Scripts/user_data_transfer.py +++ b/.bin/Scripts/user_data_transfer.py @@ -10,7 +10,7 @@ from functions.data import * from functions.repairs import * init_global_vars() os.system('title {}: User Data Transfer Tool'.format(KIT_NAME_FULL)) -global_vars['LogFile'] = r'{LogDir}\User Data Transfer.log'.format(**global_vars) +set_log_file('User Data Transfer.log') if __name__ == '__main__': try: @@ -18,7 +18,7 @@ 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: @@ -26,16 +26,16 @@ if __name__ == '__main__': else: backup_prefix = get_simple_string(prompt='Enter backup name prefix') backup_prefix = backup_prefix.replace(' ', '_') - + # Set destination folder_path = r'{}\Transfer'.format(KIT_NAME_SHORT) dest = select_destination(folder_path=folder_path, prompt='Which disk are we transferring to?') - + # Set source items source = select_source(backup_prefix) items = scan_source(source, dest) - + # Transfer clear_screen() print_info('Transfer Details:\n') @@ -43,17 +43,17 @@ if __name__ == '__main__': show_data('Ticket:', ticket_number) show_data('Source:', source.path) show_data('Destination:', dest) - + if (not ask('Proceed with transfer?')): umount_backup_shares() abort() - + print_info('Transferring Data') transfer_source(source, dest, items) try_and_print(message='Removing extra files...', function=cleanup_transfer, cs='Done', dest_path=dest) umount_backup_shares() - + # Done try_and_print(message='Running KVRT...', function=run_kvrt, cs='Started') diff --git a/.bin/Scripts/winpe_root_menu.py b/.bin/Scripts/winpe_root_menu.py index 03c763af..743d987b 100644 --- a/.bin/Scripts/winpe_root_menu.py +++ b/.bin/Scripts/winpe_root_menu.py @@ -11,7 +11,7 @@ from functions.winpe_menus import * TOOLS['SevenZip'].pop('64') init_global_vars() set_title('{}: Root Menu'.format(KIT_NAME_FULL)) -global_vars['LogFile'] = r'{LogDir}\WinPE.log'.format(**global_vars) +set_log_file('WinPE.log') if __name__ == '__main__': try: