Reorganized ClientDir

* "ClientDir\Info" renamed to "ClientDir\Logs"
  * Logs are sorted into subdirs based on the source:
  * KIT_NAME_FULL: WizardKit logs
  * d7II: d7II logs
  * Tools: Logs from tools called by WizardKit or d7II
  * (no subdir): System information
* "ClientDir\Backups"
  * Switched to "Backups\Source\{Date}" from "Backups\{Date}\Source"
This commit is contained in:
2Shirt 2018-10-07 21:04:41 -06:00
parent 8189d412eb
commit f9ab36fc7c
37 changed files with 244 additions and 238 deletions

View file

@ -39,7 +39,7 @@ if __name__ == '__main__':
selection = menu_select( selection = menu_select(
'{}: Windows Activation Menu'.format(KIT_NAME_FULL), '{}: Windows Activation Menu'.format(KIT_NAME_FULL),
main_entries=activation_methods, action_entries=actions) main_entries=activation_methods, action_entries=actions)
if (selection.isnumeric()): if (selection.isnumeric()):
result = try_and_print( result = try_and_print(
message = activation_methods[int(selection)-1]['Name'], message = activation_methods[int(selection)-1]['Name'],

View file

@ -35,7 +35,7 @@ class feature(Structure):
_fields_ = [("name", c_char_p), _fields_ = [("name", c_char_p),
("number", c_int), ("number", c_int),
("type", c_int)] ("type", c_int)]
# sensors_feature_type # sensors_feature_type
IN = 0x00 IN = 0x00
FAN = 0x01 FAN = 0x01
@ -71,10 +71,10 @@ COMPUTE_MAPPING = 4
def init(cfg_file = None): def init(cfg_file = None):
file = _libc.fopen(cfg_file.encode("utf-8"), "r") if cfg_file is not None else None file = _libc.fopen(cfg_file.encode("utf-8"), "r") if cfg_file is not None else None
if _hdl.sensors_init(file) != 0: if _hdl.sensors_init(file) != 0:
raise Exception("sensors_init failed") raise Exception("sensors_init failed")
if file is not None: if file is not None:
_libc.fclose(file) _libc.fclose(file)
@ -84,10 +84,10 @@ def cleanup():
def parse_chip_name(orig_name): def parse_chip_name(orig_name):
ret = chip_name() ret = chip_name()
err= _hdl.sensors_parse_chip_name(orig_name.encode("utf-8"), byref(ret)) err= _hdl.sensors_parse_chip_name(orig_name.encode("utf-8"), byref(ret))
if err < 0: if err < 0:
raise Exception(strerror(err)) raise Exception(strerror(err))
return ret return ret
def strerror(errnum): def strerror(errnum):
@ -101,10 +101,10 @@ def get_detected_chips(match, nr):
@return: (chip, next nr to query) @return: (chip, next nr to query)
""" """
_nr = c_int(nr) _nr = c_int(nr)
if match is not None: if match is not None:
match = byref(match) match = byref(match)
chip = _hdl.sensors_get_detected_chips(match, byref(_nr)) chip = _hdl.sensors_get_detected_chips(match, byref(_nr))
chip = chip.contents if bool(chip) else None chip = chip.contents if bool(chip) else None
return chip, _nr.value return chip, _nr.value
@ -115,10 +115,10 @@ def chip_snprintf_name(chip, buffer_size=200):
""" """
ret = create_string_buffer(buffer_size) ret = create_string_buffer(buffer_size)
err = _hdl.sensors_snprintf_chip_name(ret, buffer_size, byref(chip)) err = _hdl.sensors_snprintf_chip_name(ret, buffer_size, byref(chip))
if err < 0: if err < 0:
raise Exception(strerror(err)) raise Exception(strerror(err))
return ret.value.decode("utf-8") return ret.value.decode("utf-8")
def do_chip_sets(chip): def do_chip_sets(chip):
@ -128,7 +128,7 @@ def do_chip_sets(chip):
err = _hdl.sensors_do_chip_sets(byref(chip)) err = _hdl.sensors_do_chip_sets(byref(chip))
if err < 0: if err < 0:
raise Exception(strerror(err)) raise Exception(strerror(err))
def get_adapter_name(bus): def get_adapter_name(bus):
return _hdl.sensors_get_adapter_name(byref(bus)).decode("utf-8") return _hdl.sensors_get_adapter_name(byref(bus)).decode("utf-8")
@ -177,60 +177,60 @@ class ChipIterator:
def __init__(self, match = None): def __init__(self, match = None):
self.match = parse_chip_name(match) if match is not None else None self.match = parse_chip_name(match) if match is not None else None
self.nr = 0 self.nr = 0
def __iter__(self): def __iter__(self):
return self return self
def __next__(self): def __next__(self):
chip, self.nr = get_detected_chips(self.match, self.nr) chip, self.nr = get_detected_chips(self.match, self.nr)
if chip is None: if chip is None:
raise StopIteration raise StopIteration
return chip return chip
def __del__(self): def __del__(self):
if self.match is not None: if self.match is not None:
free_chip_name(self.match) free_chip_name(self.match)
def next(self): # python2 compability def next(self): # python2 compability
return self.__next__() return self.__next__()
class FeatureIterator: class FeatureIterator:
def __init__(self, chip): def __init__(self, chip):
self.chip = chip self.chip = chip
self.nr = 0 self.nr = 0
def __iter__(self): def __iter__(self):
return self return self
def __next__(self): def __next__(self):
feature, self.nr = get_features(self.chip, self.nr) feature, self.nr = get_features(self.chip, self.nr)
if feature is None: if feature is None:
raise StopIteration raise StopIteration
return feature return feature
def next(self): # python2 compability def next(self): # python2 compability
return self.__next__() return self.__next__()
class SubFeatureIterator: class SubFeatureIterator:
def __init__(self, chip, feature): def __init__(self, chip, feature):
self.chip = chip self.chip = chip
self.feature = feature self.feature = feature
self.nr = 0 self.nr = 0
def __iter__(self): def __iter__(self):
return self return self
def __next__(self): def __next__(self):
subfeature, self.nr = get_all_subfeatures(self.chip, self.feature, self.nr) subfeature, self.nr = get_all_subfeatures(self.chip, self.feature, self.nr)
if subfeature is None: if subfeature is None:
raise StopIteration raise StopIteration
return subfeature return subfeature
def next(self): # python2 compability def next(self): # python2 compability
return self.__next__() return self.__next__()

View file

@ -10,7 +10,8 @@ from functions.cleanup import *
from functions.data import * from functions.data import *
init_global_vars() init_global_vars()
os.system('title {}: CBS Cleanup'.format(KIT_NAME_FULL)) os.system('title {}: CBS Cleanup'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\CBS Cleanup.log'.format(**global_vars) global_vars['LogFile'] = r'{LogDir}\{kit_name}\CBS Cleanup.log'.format(
kit_name=KIT_NAME_FULL, **global_vars)
if __name__ == '__main__': if __name__ == '__main__':
try: try:
@ -20,18 +21,18 @@ if __name__ == '__main__':
folder_path = r'{}\Backups'.format(KIT_NAME_SHORT) folder_path = r'{}\Backups'.format(KIT_NAME_SHORT)
dest = select_destination(folder_path=folder_path, dest = select_destination(folder_path=folder_path,
prompt='Which disk are we using for temp data and backup?') prompt='Which disk are we using for temp data and backup?')
# Show details # Show details
print_info('{}: CBS Cleanup Tool\n'.format(KIT_NAME_FULL)) print_info('{}: CBS Cleanup Tool\n'.format(KIT_NAME_FULL))
show_data('Backup / Temp path:', dest) show_data('Backup / Temp path:', dest)
print_standard('\n') print_standard('\n')
if (not ask('Proceed with CBS cleanup?')): if (not ask('Proceed with CBS cleanup?')):
abort() abort()
# Run Cleanup # Run Cleanup
try_and_print(message='Running cleanup...', function=cleanup_cbs, try_and_print(message='Running cleanup...', function=cleanup_cbs,
cs='Done', dest_folder=dest) cs='Done', dest_folder=dest)
# Done # Done
print_standard('\nDone.') print_standard('\nDone.')
pause("Press Enter to exit...") pause("Press Enter to exit...")

View file

@ -9,7 +9,8 @@ sys.path.append(os.getcwd())
from functions.repairs import * from functions.repairs import *
init_global_vars() init_global_vars()
os.system('title {}: Check Disk Tool'.format(KIT_NAME_FULL)) os.system('title {}: Check Disk Tool'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\Check Disk.log'.format(**global_vars) global_vars['LogFile'] = r'{LogDir}\{kit_name}\Check Disk.log'.format(
kit_name=KIT_NAME_FULL, **global_vars)
if __name__ == '__main__': if __name__ == '__main__':
try: try:
@ -45,7 +46,7 @@ if __name__ == '__main__':
cs=cs, other_results=other_results, repair=repair) cs=cs, other_results=other_results, repair=repair)
else: else:
abort() abort()
# Done # Done
print_success('Done.') print_success('Done.')
pause("Press Enter to exit...") pause("Press Enter to exit...")

View file

@ -9,7 +9,8 @@ sys.path.append(os.getcwd())
from functions.repairs import * from functions.repairs import *
init_global_vars() init_global_vars()
os.system('title {}: DISM helper Tool'.format(KIT_NAME_FULL)) os.system('title {}: DISM helper Tool'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\DISM helper tool.log'.format(**global_vars) global_vars['LogFile'] = r'{LogDir}\{kit_name}\DISM Helper.log'.format(
kit_name=KIT_NAME_FULL, **global_vars)
if __name__ == '__main__': if __name__ == '__main__':
try: try:
@ -46,7 +47,7 @@ if __name__ == '__main__':
other_results=other_results, repair=repair) other_results=other_results, repair=repair)
else: else:
abort() abort()
# Done # Done
print_success('Done.') print_success('Done.')
pause("Press Enter to exit...") pause("Press Enter to exit...")

View file

@ -59,7 +59,7 @@ def windows_is_activated():
['cscript', '//nologo', SLMGR, '/xpr'], check=False, ['cscript', '//nologo', SLMGR, '/xpr'], check=False,
stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout=subprocess.PIPE, stderr=subprocess.PIPE)
activation_string = activation_string.stdout.decode() activation_string = activation_string.stdout.decode()
return bool(activation_string and 'permanent' in activation_string) return bool(activation_string and 'permanent' in activation_string)
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -16,7 +16,7 @@ def backup_partition(disk, par):
"""Create a backup image of a partition.""" """Create a backup image of a partition."""
if par.get('Image Exists', False) or par['Number'] in disk['Bad Partitions']: if par.get('Image Exists', False) or par['Number'] in disk['Bad Partitions']:
raise GenericAbort raise GenericAbort
cmd = [ cmd = [
global_vars['Tools']['wimlib-imagex'], global_vars['Tools']['wimlib-imagex'],
'capture', 'capture',
@ -48,7 +48,7 @@ def get_volume_display_name(mountpoint):
serial_number = None serial_number = None
max_component_length = None max_component_length = None
file_system_flags = None file_system_flags = None
vol_info = kernel32.GetVolumeInformationW( vol_info = kernel32.GetVolumeInformationW(
ctypes.c_wchar_p(mountpoint), ctypes.c_wchar_p(mountpoint),
vol_name_buffer, vol_name_buffer,
@ -59,16 +59,16 @@ def get_volume_display_name(mountpoint):
fs_name_buffer, fs_name_buffer,
ctypes.sizeof(fs_name_buffer) ctypes.sizeof(fs_name_buffer)
) )
name = '{} "{}"'.format(name, vol_name_buffer.value) name = '{} "{}"'.format(name, vol_name_buffer.value)
except: except:
pass pass
return name return name
def prep_disk_for_backup(destination, disk, backup_prefix): def prep_disk_for_backup(destination, disk, backup_prefix):
"""Gather details about the disk and its partitions. """Gather details about the disk and its partitions.
This includes partitions that can't be backed up, This includes partitions that can't be backed up,
whether backups already exist on the BACKUP_SERVER, whether backups already exist on the BACKUP_SERVER,
partition names/sizes/used space, etc.""" partition names/sizes/used space, etc."""
@ -83,7 +83,7 @@ def prep_disk_for_backup(destination, disk, backup_prefix):
if disk['Valid Partitions'] <= 0: if disk['Valid Partitions'] <= 0:
print_error('ERROR: No partitions can be backed up for this disk') print_error('ERROR: No partitions can be backed up for this disk')
raise GenericAbort raise GenericAbort
# Prep partitions # Prep partitions
for par in disk['Partitions']: for par in disk['Partitions']:
display = '{size} {fs}'.format( display = '{size} {fs}'.format(
@ -91,7 +91,7 @@ def prep_disk_for_backup(destination, disk, backup_prefix):
width = width, width = width,
size = par['Size'], size = par['Size'],
fs = par['FileSystem']) fs = par['FileSystem'])
if par['Number'] in disk['Bad Partitions']: if par['Number'] in disk['Bad Partitions']:
# Set display string using partition description & OS type # Set display string using partition description & OS type
display = '* {display}\t\t{q}{name}{q}\t{desc} ({os})'.format( 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) display = '+ {}'.format(display)
else: else:
display = ' {}'.format(display) display = ' {}'.format(display)
# Append rest of Display String for valid/clobber partitions # Append rest of Display String for valid/clobber partitions
display += ' (Used: {used})\t{q}{name}{q}'.format( display += ' (Used: {used})\t{q}{name}{q}'.format(
used = par['Used Space'], used = par['Used Space'],
@ -128,7 +128,7 @@ def prep_disk_for_backup(destination, disk, backup_prefix):
name = par['Name']) name = par['Name'])
# For all partitions # For all partitions
par['Display String'] = display par['Display String'] = display
# Set description for bad partitions # Set description for bad partitions
warnings = '\n' warnings = '\n'
if disk['Bad Partitions']: if disk['Bad Partitions']:
@ -148,7 +148,7 @@ def select_backup_destination(auto_select=True):
actions = [ actions = [
{'Name': 'Main Menu', 'Letter': 'M'}, {'Name': 'Main Menu', 'Letter': 'M'},
] ]
# Add local disks # Add local disks
for d in psutil.disk_partitions(): for d in psutil.disk_partitions():
if re.search(r'^{}'.format(global_vars['Env']['SYSTEMDRIVE']), d.mountpoint, re.IGNORECASE): 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)), get_volume_display_name(d.mountpoint)),
'Letter': re.sub(r'^(\w):\\.*$', r'\1', d.mountpoint), 'Letter': re.sub(r'^(\w):\\.*$', r'\1', d.mountpoint),
}) })
# Size check # Size check
for dest in destinations: for dest in destinations:
if 'IP' in dest: if 'IP' in dest:
@ -175,11 +175,11 @@ def select_backup_destination(auto_select=True):
if not destinations: if not destinations:
print_warning('No backup destinations found.') print_warning('No backup destinations found.')
raise GenericAbort raise GenericAbort
# Skip menu? # Skip menu?
if len(destinations) == 1 and auto_select: if len(destinations) == 1 and auto_select:
return destinations[0] return destinations[0]
selection = menu_select( selection = menu_select(
title = 'Where are we backing up to?', title = 'Where are we backing up to?',
main_entries = destinations, main_entries = destinations,

View file

@ -137,7 +137,7 @@ def archive_all_users():
if not os.path.exists(source_path): if not os.path.exists(source_path):
continue continue
source_items = source_path + '*' source_items = source_path + '*'
archive_path = r'{BackupDir}\Browsers ({USERNAME})'.format( archive_path = r'{BackupDir}\Browsers ({USERNAME})\{Date}'.format(
**global_vars, **fake_env) **global_vars, **fake_env)
os.makedirs(archive_path, exist_ok=True) os.makedirs(archive_path, exist_ok=True)
archive_path += r'\{}.7z'.format(b_k) archive_path += r'\{}.7z'.format(b_k)
@ -152,7 +152,7 @@ def archive_all_users():
def archive_browser(name): def archive_browser(name):
"""Create backup of Browser saved in the BackupDir.""" """Create backup of Browser saved in the BackupDir."""
source = '{}*'.format(browser_data[name]['user_data_path']) source = '{}*'.format(browser_data[name]['user_data_path'])
dest = r'{BackupDir}\Browsers ({USERNAME})'.format( dest = r'{BackupDir}\Browsers ({USERNAME})\{Date}'.format(
**global_vars, **global_vars['Env']) **global_vars, **global_vars['Env'])
archive = r'{}\{}.7z'.format(dest, name) archive = r'{}\{}.7z'.format(dest, name)
os.makedirs(dest, exist_ok=True) os.makedirs(dest, exist_ok=True)
@ -274,7 +274,7 @@ def get_browser_details(name):
profiles.extend( profiles.extend(
get_mozilla_profiles( get_mozilla_profiles(
search_path=browser['user_data_path'], dev=dev)) search_path=browser['user_data_path'], dev=dev))
elif 'Opera' in name: elif 'Opera' in name:
if os.path.exists(browser['user_data_path']): if os.path.exists(browser['user_data_path']):
profiles.append( profiles.append(
@ -413,7 +413,7 @@ def install_adblock(indent=8, width=32, just_firefox=False):
winreg.QueryValue(HKLM, UBO_EXTRA_CHROME_REG) winreg.QueryValue(HKLM, UBO_EXTRA_CHROME_REG)
except FileNotFoundError: except FileNotFoundError:
urls.append(UBO_EXTRA_CHROME) urls.append(UBO_EXTRA_CHROME)
if len(urls) == 0: if len(urls) == 0:
urls = ['chrome://extensions'] urls = ['chrome://extensions']
elif 'Opera' in browser: elif 'Opera' in browser:
@ -421,7 +421,7 @@ def install_adblock(indent=8, width=32, just_firefox=False):
else: else:
urls.append(UBO_CHROME) urls.append(UBO_CHROME)
urls.append(UBO_EXTRA_CHROME) urls.append(UBO_EXTRA_CHROME)
elif browser_data[browser]['base'] == 'mozilla': elif browser_data[browser]['base'] == 'mozilla':
# Check for system extensions # Check for system extensions
try: try:
@ -434,11 +434,11 @@ def install_adblock(indent=8, width=32, just_firefox=False):
urls = ['about:addons'] urls = ['about:addons']
else: else:
urls = [UBO_MOZILLA] urls = [UBO_MOZILLA]
elif browser_data[browser]['base'] == 'ie': elif browser_data[browser]['base'] == 'ie':
urls.append(IE_GALLERY) urls.append(IE_GALLERY)
function=popen_program function=popen_program
# By using check=False we're skipping any return codes so # By using check=False we're skipping any return codes so
# it should only fail if the program can't be run # it should only fail if the program can't be run
# (or can't be found). # (or can't be found).
@ -461,7 +461,7 @@ def list_homepages(indent=8, width=32):
end='', flush=True) end='', flush=True)
print_warning('Not implemented', timestamp=False) print_warning('Not implemented', timestamp=False)
continue continue
# All other browsers # All other browsers
print_info('{indent}{browser:<{width}}'.format( print_info('{indent}{browser:<{width}}'.format(
indent=' '*indent, width=width, browser=browser+'...')) indent=' '*indent, width=width, browser=browser+'...'))

View file

@ -46,7 +46,7 @@ def cleanup_adwcleaner():
# Main folder # Main folder
if os.path.exists(source_path): if os.path.exists(source_path):
os.makedirs(global_vars['LogDir'], exist_ok=True) os.makedirs(global_vars['LogDir'], exist_ok=True)
dest_name = r'{LogDir}\{Date}\AdwCleaner'.format( dest_name = r'{LogDir}\Tools\AdwCleaner'.format(
**global_vars) **global_vars)
dest_name = non_clobber_rename(dest_name) dest_name = non_clobber_rename(dest_name)
shutil.move(source_path, dest_name) shutil.move(source_path, dest_name)
@ -93,7 +93,7 @@ def cleanup_cbs(dest_folder):
def cleanup_d7ii(): def cleanup_d7ii():
"""Sort d7II logs and remove temp items.""" """Sort d7II logs and remove temp items."""
d7_path = r'{}\d7II'.format(global_vars['ClientDir']) d7_path = r'{}\d7II'.format(global_vars['ClientDir'])
d7_reports = r'{}_Reports'.format(d7_path) d7_reports = r'{} Reports'.format(d7_path)
d7_temp = r'{}\Temp'.format(d7_path) d7_temp = r'{}\Temp'.format(d7_path)
# Logs & Reports # Logs & Reports
@ -103,49 +103,46 @@ def cleanup_d7ii():
d7_date = '{}-{:02d}-{:02d}'.format( d7_date = '{}-{:02d}-{:02d}'.format(
r.group(1), int(r.group(2)), int(r.group(3))) r.group(1), int(r.group(2)), int(r.group(3)))
d7_mlogs = r'{}\Malware Logs'.format(entry.path) d7_mlogs = r'{}\Malware Logs'.format(entry.path)
log_dest = r'{SYSTEMDRIVE}\{prefix}\Info\{date}'.format( log_dest = r'{SYSTEMDRIVE}\{prefix}\Logs\{date}'.format(
prefix=KIT_NAME_SHORT, prefix=KIT_NAME_SHORT,
date=d7_date, date=d7_date,
**global_vars['Env']) **global_vars['Env'])
# Remove empty folders
for f in ('Malware Logs', 'Screen Shots'):
try:
os.rmdir(r'{}\{}'.format(entry.path, f))
except FileNotFoundError:
pass
except OSError:
pass
# Malware Logs # Malware Logs
if os.path.exists(d7_mlogs): if os.path.exists(d7_mlogs):
m_report = 'MalwareScan_Report.txt'
for m_entry in os.scandir(d7_mlogs): for m_entry in os.scandir(d7_mlogs):
prefix = '' dest_path = r'{}\{}\{}'.format(
if m_entry.name == 'MalwareScan_Report.txt': log_dest,
prefix = 'd7II_' 'd7II' if m_entry.name == m_report else 'Tools',
dest_path = r'{log_dest}\{prefix}{name}'.format( m_entry.name)
log_dest=log_dest,
prefix=prefix,
name=m_entry.name)
dest_path = non_clobber_rename(dest_path) dest_path = non_clobber_rename(dest_path)
shutil.move(entry.path, dest_path) shutil.move(entry.path, dest_path)
try:
os.rmdir(d7_mlogs)
except OSError:
pass
# Other items # Other items
for o_entry in os.scandir(entry.path): for o_entry in os.scandir(entry.path):
dest_path = r'{log_dest}\d7II_{name}'.format( dest_path = r'{log_dest}\d7II\{name}'.format(
log_dest=log_dest, log_dest=log_dest,
name=m_entry.name) name=m_entry.name)
dest_path = non_clobber_rename(dest_path) dest_path = non_clobber_rename(dest_path)
# Just remove empty folders
if o_entry.isdir():
try:
os.rmdir(o_entry.path)
except OSError:
pass
else:
continue
# Move item
shutil.move(entry.path, dest_path) shutil.move(entry.path, dest_path)
# Remove folder if empty # Remove folder
try: try:
os.rmdir(entry.path) os.rmdir(entry.path)
except OSError: except OSError:
# Folder should be empty but whatever
pass pass
# Registry Items # Registry Items
@ -167,7 +164,7 @@ def cleanup_d7ii():
def cleanup_desktop(): def cleanup_desktop():
"""Move known backup files and reports into the ClientDir.""" """Move known backup files and reports into the ClientDir."""
dest_folder = r'{ProgBackupDir}\{Date}\Desktop'.format(**global_vars) dest_folder = r'{LogDir}\Tools'.format(**global_vars)
os.makedirs(dest_folder, exist_ok=True) os.makedirs(dest_folder, exist_ok=True)
desktop_path = r'{USERPROFILE}\Desktop'.format(**global_vars['Env']) desktop_path = r'{USERPROFILE}\Desktop'.format(**global_vars['Env'])
@ -210,12 +207,13 @@ def cleanup_regbackups():
if not os.path.exists(source_path): if not os.path.exists(source_path):
return return
# Make dest folder
dest_dir = r'{BackupDir}\Registry\{Date}'.format(**global_vars)
os.makedirs(dest_dir, exist_ok=True)
# Move to backup folder # Move to backup folder
for entry in os.scandir(source_path): for entry in os.scandir(source_path):
os.makedirs(global_vars['ProgBackupDir'], exist_ok=True) dest_path = r'{dest}\{name}'.format(dest=dest_dir, name=entry.name)
dest_path = r'{ProgBackupDir}\{Date}\Registry\{name}'.format(
name=entry.name,
**global_vars)
dest_path = non_clobber_rename(dest_path) dest_path = non_clobber_rename(dest_path)
shutil.move(entry.path, dest_path) shutil.move(entry.path, dest_path)

View file

@ -168,8 +168,7 @@ def exit_script(return_value=0):
# Remove dirs (if empty) # Remove dirs (if empty)
for dir in ['BackupDir', 'LogDir', 'TmpDir']: for dir in ['BackupDir', 'LogDir', 'TmpDir']:
try: try:
dir = global_vars[dir] os.rmdir(global_vars[dir])
os.rmdir(dir)
except Exception: except Exception:
pass pass
@ -774,11 +773,9 @@ def set_common_vars():
**global_vars) **global_vars)
global_vars['ClientDir'] = r'{SYSTEMDRIVE}\{prefix}'.format( global_vars['ClientDir'] = r'{SYSTEMDRIVE}\{prefix}'.format(
prefix=KIT_NAME_SHORT, **global_vars['Env']) prefix=KIT_NAME_SHORT, **global_vars['Env'])
global_vars['BackupDir'] = r'{ClientDir}\Backups\{Date}'.format( global_vars['BackupDir'] = r'{ClientDir}\Backups'.format(
**global_vars) **global_vars)
global_vars['LogDir'] = r'{ClientDir}\Info\{Date}'.format( global_vars['LogDir'] = r'{ClientDir}\Logs\{Date}'.format(
**global_vars)
global_vars['ProgBackupDir'] = r'{ClientDir}\Backups'.format(
**global_vars) **global_vars)
global_vars['QuarantineDir'] = r'{ClientDir}\Quarantine'.format( global_vars['QuarantineDir'] = r'{ClientDir}\Quarantine'.format(
**global_vars) **global_vars)

View file

@ -126,11 +126,11 @@ def cleanup_transfer(dest_path):
if not os.path.exists(dest_path): if not os.path.exists(dest_path):
# Bail if dest_path was empty and removed # Bail if dest_path was empty and removed
raise Exception raise Exception
# Fix attributes # Fix attributes
cmd = ['attrib', '-a', '-h', '-r', '-s', dest_path] cmd = ['attrib', '-a', '-h', '-r', '-s', dest_path]
run_program(cmd, check=False) run_program(cmd, check=False)
for root, dirs, files in os.walk(dest_path, topdown=False): for root, dirs, files in os.walk(dest_path, topdown=False):
for name in dirs: for name in dirs:
# Remove empty directories and junction points # Remove empty directories and junction points
@ -278,7 +278,7 @@ def mount_volumes(all_devices=True, device_path=None, read_write=False):
volumes.update({child['name']: child}) volumes.update({child['name']: child})
for grandchild in child.get('children', []): for grandchild in child.get('children', []):
volumes.update({grandchild['name']: grandchild}) volumes.update({grandchild['name']: grandchild})
# Get list of mounted volumes # Get list of mounted volumes
mounted_volumes = get_mounted_volumes() mounted_volumes = get_mounted_volumes()
@ -357,7 +357,7 @@ def mount_backup_shares(read_write=False):
if server['Mounted']: if server['Mounted']:
print_warning(mounted_str) print_warning(mounted_str)
continue continue
mount_network_share(server, read_write) mount_network_share(server, read_write)
def mount_network_share(server, read_write=False): def mount_network_share(server, read_write=False):
@ -419,12 +419,12 @@ def run_fast_copy(items, dest):
"""Copy items to dest using FastCopy.""" """Copy items to dest using FastCopy."""
if not items: if not items:
raise Exception raise Exception
cmd = [global_vars['Tools']['FastCopy'], *FAST_COPY_ARGS] cmd = [global_vars['Tools']['FastCopy'], *FAST_COPY_ARGS]
cmd.append(r'/logfile={}\FastCopy.log'.format(global_vars['LogDir'])) cmd.append(r'/logfile={LogDir}\Tools\FastCopy.log'.format(**global_vars))
cmd.extend(items) cmd.extend(items)
cmd.append('/to={}\\'.format(dest)) cmd.append('/to={}\\'.format(dest))
run_program(cmd) run_program(cmd)
def run_wimextract(source, items, dest): def run_wimextract(source, items, dest):
@ -491,7 +491,7 @@ def list_source_items(source_obj, rel_path=None):
def scan_source(source_obj, dest_path, rel_path='', interactive=True): def scan_source(source_obj, dest_path, rel_path='', interactive=True):
"""Scan source for files/folders to transfer, returns list. """Scan source for files/folders to transfer, returns list.
This will scan the root and (recursively) any Windows.old folders.""" This will scan the root and (recursively) any Windows.old folders."""
selected_items = [] selected_items = []
win_olds = [] win_olds = []
@ -568,7 +568,7 @@ def scan_source(source_obj, dest_path, rel_path='', interactive=True):
'{}{}{}'.format(dest_path, os.sep, old.name), '{}{}{}'.format(dest_path, os.sep, old.name),
rel_path=old.name, rel_path=old.name,
interactive=False)) interactive=False))
# Done # Done
return selected_items return selected_items
@ -712,7 +712,7 @@ def select_source(backup_prefix):
item.name, # Image file item.name, # Image file
), ),
'Source': item}) 'Source': item})
# Check for local sources # Check for local sources
print_standard('Scanning for local sources...') print_standard('Scanning for local sources...')
set_thread_error_mode(silent=True) # Prevents "No disk" popups set_thread_error_mode(silent=True) # Prevents "No disk" popups
@ -752,7 +752,7 @@ def select_source(backup_prefix):
' Local', d.mountpoint, item.name), ' Local', d.mountpoint, item.name),
'Sort': r'{}{}'.format(d.mountpoint, item.name), 'Sort': r'{}{}'.format(d.mountpoint, item.name),
'Source': item}) 'Source': item})
set_thread_error_mode(silent=False) # Return to normal set_thread_error_mode(silent=False) # Return to normal
# Build Menu # Build Menu
@ -780,7 +780,7 @@ def select_source(backup_prefix):
umount_backup_shares() umount_backup_shares()
pause("Press Enter to exit...") pause("Press Enter to exit...")
exit_script() exit_script()
# Sanity check # Sanity check
if selected_source.is_file(): if selected_source.is_file():
# Image-Based # Image-Based
@ -788,7 +788,7 @@ def select_source(backup_prefix):
print_error('ERROR: Unsupported image: {}'.format( print_error('ERROR: Unsupported image: {}'.format(
selected_source.path)) selected_source.path))
raise GenericError raise GenericError
# Done # Done
return selected_source return selected_source
@ -796,7 +796,7 @@ def select_volume(title='Select disk', auto_select=True):
"""Select disk from attached disks. returns dict.""" """Select disk from attached disks. returns dict."""
actions = [{'Name': 'Quit', 'Letter': 'Q'}] actions = [{'Name': 'Quit', 'Letter': 'Q'}]
disks = [] disks = []
# Build list of disks # Build list of disks
set_thread_error_mode(silent=True) # Prevents "No disk" popups set_thread_error_mode(silent=True) # Prevents "No disk" popups
for d in psutil.disk_partitions(): for d in psutil.disk_partitions():
@ -817,11 +817,11 @@ def select_volume(title='Select disk', auto_select=True):
info['Display Name'] = '{} ({})'.format(info['Name'], free) info['Display Name'] = '{} ({})'.format(info['Name'], free)
disks.append(info) disks.append(info)
set_thread_error_mode(silent=False) # Return to normal set_thread_error_mode(silent=False) # Return to normal
# Skip menu? # Skip menu?
if len(disks) == 1 and auto_select: if len(disks) == 1 and auto_select:
return disks[0] return disks[0]
# Show menu # Show menu
selection = menu_select(title, main_entries=disks, action_entries=actions) selection = menu_select(title, main_entries=disks, action_entries=actions)
if selection == 'Q': if selection == 'Q':
@ -831,12 +831,12 @@ def select_volume(title='Select disk', auto_select=True):
def set_thread_error_mode(silent=True): def set_thread_error_mode(silent=True):
"""Disable or Enable Windows error message dialogs. """Disable or Enable Windows error message dialogs.
Disable when scanning for disks to avoid popups for empty cardreaders, etc Disable when scanning for disks to avoid popups for empty cardreaders, etc
""" """
# Code borrowed from: https://stackoverflow.com/a/29075319 # Code borrowed from: https://stackoverflow.com/a/29075319
kernel32 = ctypes.WinDLL('kernel32') kernel32 = ctypes.WinDLL('kernel32')
if silent: if silent:
kernel32.SetThreadErrorMode(SEM_FAIL, ctypes.byref(SEM_NORMAL)) kernel32.SetThreadErrorMode(SEM_FAIL, ctypes.byref(SEM_NORMAL))
else: else:

View file

@ -323,7 +323,7 @@ class RecoveryState():
elif not is_writable_filesystem(dest): elif not is_writable_filesystem(dest):
raise GenericError( raise GenericError(
'Destination is mounted read-only, refusing to continue.') 'Destination is mounted read-only, refusing to continue.')
# Safety checks passed # Safety checks passed
self.block_pairs.append(BlockPair(self.mode, source, dest)) self.block_pairs.append(BlockPair(self.mode, source, dest))
@ -1081,7 +1081,7 @@ def select_path(skip_device=None):
except OSError: except OSError:
raise GenericError( raise GenericError(
'Failed to create folder "{}"'.format(s_path)) 'Failed to create folder "{}"'.format(s_path))
# Create DirObj # Create DirObj
selected_path = DirObj(s_path) selected_path = DirObj(s_path)

View file

@ -147,7 +147,7 @@ def run_hitmanpro():
cmd = [ cmd = [
global_vars['Tools']['HitmanPro'], global_vars['Tools']['HitmanPro'],
'/quiet', '/noinstall', '/noupload', '/quiet', '/noinstall', '/noupload',
r'/log={LogDir}\hitman.xml'.format(**global_vars)] r'/log={LogDir}\Tools\HitmanPro.txt'.format(**global_vars)]
popen_program(cmd) popen_program(cmd)
def run_process_killer(): def run_process_killer():
@ -165,20 +165,17 @@ def run_rkill():
extract_item('RKill', silent=True) extract_item('RKill', silent=True)
cmd = [ cmd = [
global_vars['Tools']['RKill'], global_vars['Tools']['RKill'],
'-l', r'{LogDir}\RKill.log'.format(**global_vars), '-s', '-l', r'{LogDir}\Tools\RKill.log'.format(**global_vars),
'-new_console:n', '-new_console:s33V'] '-new_console:n', '-new_console:s33V']
run_program(cmd, check=False) run_program(cmd, check=False)
wait_for_process('RKill') wait_for_process('RKill')
kill_process('notepad.exe')
# RKill cleanup # RKill cleanup
desktop_path = r'{USERPROFILE}\Desktop'.format(**global_vars['Env']) desktop_path = r'{USERPROFILE}\Desktop'.format(**global_vars['Env'])
if os.path.exists(desktop_path): if os.path.exists(desktop_path):
for item in os.scandir(desktop_path): for item in os.scandir(desktop_path):
if re.search(r'^RKill', item.name, re.IGNORECASE): if re.search(r'^RKill', item.name, re.IGNORECASE):
dest = re.sub(r'^(.*)\.', '\1_{Date-Time}.'.format( dest = r'{LogDir}\Tools\{name}'.format(
**global_vars), item.name)
dest = r'{ClientDir}\Info\{name}'.format(
name=dest, **global_vars) name=dest, **global_vars)
dest = non_clobber_rename(dest) dest = non_clobber_rename(dest)
shutil.move(item.path, dest) shutil.move(item.path, dest)

View file

@ -14,13 +14,13 @@ REGEX_DISK_RAW = re.compile(r'Disk ID: 00000000', re.IGNORECASE)
def assign_volume_letters(): def assign_volume_letters():
"""Assign a volume letter to all available volumes.""" """Assign a volume letter to all available volumes."""
remove_volume_letters() remove_volume_letters()
# Write script # Write script
script = [] script = []
for vol in get_volumes(): for vol in get_volumes():
script.append('select volume {}'.format(vol['Number'])) script.append('select volume {}'.format(vol['Number']))
script.append('assign') script.append('assign')
# Run # Run
run_diskpart(script) run_diskpart(script)
@ -35,7 +35,7 @@ def get_boot_mode():
boot_mode = 'UEFI' boot_mode = 'UEFI'
except: except:
boot_mode = 'Unknown' boot_mode = 'Unknown'
return boot_mode return boot_mode
def get_disk_details(disk): def get_disk_details(disk):
@ -44,7 +44,7 @@ def get_disk_details(disk):
script = [ script = [
'select disk {}'.format(disk['Number']), 'select disk {}'.format(disk['Number']),
'detail disk'] 'detail disk']
# Run # Run
try: try:
result = run_diskpart(script) result = run_diskpart(script)
@ -60,13 +60,13 @@ def get_disk_details(disk):
tmp = [s.split(':') for s in tmp if ':' in s] tmp = [s.split(':') for s in tmp if ':' in s]
# Add key/value pairs to the details variable and return dict # Add key/value pairs to the details variable and return dict
details.update({key.strip(): value.strip() for (key, value) in tmp}) details.update({key.strip(): value.strip() for (key, value) in tmp})
return details return details
def get_disks(): def get_disks():
"""Get list of attached disks using DiskPart.""" """Get list of attached disks using DiskPart."""
disks = [] disks = []
try: try:
# Run script # Run script
result = run_diskpart(['list disk']) result = run_diskpart(['list disk'])
@ -79,7 +79,7 @@ def get_disks():
num = tmp[0] num = tmp[0]
size = human_readable_size(tmp[1]) size = human_readable_size(tmp[1])
disks.append({'Number': num, 'Size': size}) disks.append({'Number': num, 'Size': size})
return disks return disks
def get_partition_details(disk, partition): def get_partition_details(disk, partition):
@ -89,7 +89,7 @@ def get_partition_details(disk, partition):
'select disk {}'.format(disk['Number']), 'select disk {}'.format(disk['Number']),
'select partition {}'.format(partition['Number']), 'select partition {}'.format(partition['Number']),
'detail partition'] 'detail partition']
# Diskpart details # Diskpart details
try: try:
# Run script # Run script
@ -111,14 +111,14 @@ def get_partition_details(disk, partition):
tmp = [s.split(':') for s in tmp if ':' in s] tmp = [s.split(':') for s in tmp if ':' in s]
# Add key/value pairs to the details variable and return dict # Add key/value pairs to the details variable and return dict
details.update({key.strip(): value.strip() for (key, value) in tmp}) details.update({key.strip(): value.strip() for (key, value) in tmp})
# Get MBR type / GPT GUID for extra details on "Unknown" partitions # Get MBR type / GPT GUID for extra details on "Unknown" partitions
guid = partition_uids.lookup_guid(details.get('Type')) guid = partition_uids.lookup_guid(details.get('Type'))
if guid: if guid:
details.update({ details.update({
'Description': guid.get('Description', '')[:29], 'Description': guid.get('Description', '')[:29],
'OS': guid.get('OS', 'Unknown')[:27]}) 'OS': guid.get('OS', 'Unknown')[:27]})
if 'Letter' in details: if 'Letter' in details:
# Disk usage # Disk usage
try: try:
@ -128,7 +128,7 @@ def get_partition_details(disk, partition):
details['Error'] = err.strerror details['Error'] = err.strerror
else: else:
details['Used Space'] = human_readable_size(tmp.used) details['Used Space'] = human_readable_size(tmp.used)
# fsutil details # fsutil details
cmd = [ cmd = [
'fsutil', 'fsutil',
@ -151,14 +151,14 @@ def get_partition_details(disk, partition):
tmp = [s.split(':') for s in tmp if ':' in s] tmp = [s.split(':') for s in tmp if ':' in s]
# Add key/value pairs to the details variable and return dict # Add key/value pairs to the details variable and return dict
details.update({key.strip(): value.strip() for (key, value) in tmp}) details.update({key.strip(): value.strip() for (key, value) in tmp})
# Set Volume Name # Set Volume Name
details['Name'] = details.get('Volume Name', '') details['Name'] = details.get('Volume Name', '')
# Set FileSystem Type # Set FileSystem Type
if details.get('FileSystem', '') not in ['RAW', 'Unknown']: if details.get('FileSystem', '') not in ['RAW', 'Unknown']:
details['FileSystem'] = details.get('File System Name', 'Unknown') details['FileSystem'] = details.get('File System Name', 'Unknown')
return details return details
def get_partitions(disk): def get_partitions(disk):
@ -167,7 +167,7 @@ def get_partitions(disk):
script = [ script = [
'select disk {}'.format(disk['Number']), 'select disk {}'.format(disk['Number']),
'list partition'] 'list partition']
try: try:
# Run script # Run script
result = run_diskpart(script) result = run_diskpart(script)
@ -181,7 +181,7 @@ def get_partitions(disk):
num = tmp[0] num = tmp[0]
size = human_readable_size(tmp[1]) size = human_readable_size(tmp[1])
partitions.append({'Number': num, 'Size': size}) partitions.append({'Number': num, 'Size': size})
return partitions return partitions
def get_table_type(disk): def get_table_type(disk):
@ -190,7 +190,7 @@ def get_table_type(disk):
script = [ script = [
'select disk {}'.format(disk['Number']), 'select disk {}'.format(disk['Number']),
'uniqueid disk'] 'uniqueid disk']
try: try:
result = run_diskpart(script) result = run_diskpart(script)
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
@ -203,7 +203,7 @@ def get_table_type(disk):
part_type = 'MBR' part_type = 'MBR'
elif REGEX_DISK_RAW.search(output): elif REGEX_DISK_RAW.search(output):
part_type = 'RAW' part_type = 'RAW'
return part_type return part_type
def get_volumes(): def get_volumes():
@ -218,7 +218,7 @@ def get_volumes():
output = result.stdout.decode().strip() output = result.stdout.decode().strip()
for tmp in re.findall(r'Volume (\d+)\s+([A-Za-z]?)\s+', output): for tmp in re.findall(r'Volume (\d+)\s+([A-Za-z]?)\s+', output):
vols.append({'Number': tmp[0], 'Letter': tmp[1]}) vols.append({'Number': tmp[0], 'Letter': tmp[1]})
return vols return vols
def is_bad_partition(par): def is_bad_partition(par):
@ -229,7 +229,7 @@ def prep_disk_for_formatting(disk=None):
"""Gather details about the disk and its partitions.""" """Gather details about the disk and its partitions."""
disk['Format Warnings'] = '\n' disk['Format Warnings'] = '\n'
width = len(str(len(disk['Partitions']))) width = len(str(len(disk['Partitions'])))
# Bail early # Bail early
if disk is None: if disk is None:
raise Exception('Disk not provided.') raise Exception('Disk not provided.')
@ -242,7 +242,7 @@ def prep_disk_for_formatting(disk=None):
else: else:
if (ask("Setup Windows to use BIOS/Legacy booting?")): if (ask("Setup Windows to use BIOS/Legacy booting?")):
disk['Use GPT'] = False disk['Use GPT'] = False
# Set Display and Warning Strings # Set Display and Warning Strings
if len(disk['Partitions']) == 0: if len(disk['Partitions']) == 0:
disk['Format Warnings'] += 'No partitions found\n' disk['Format Warnings'] += 'No partitions found\n'
@ -252,7 +252,7 @@ def prep_disk_for_formatting(disk=None):
width = width, width = width,
size = partition['Size'], size = partition['Size'],
fs = partition['FileSystem']) fs = partition['FileSystem'])
if is_bad_partition(partition): if is_bad_partition(partition):
# Set display string using partition description & OS type # Set display string using partition description & OS type
display += '\t\t{q}{name}{q}\t{desc} ({os})'.format( 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.""" """Remove all assigned volume letters using DiskPart."""
if not keep: if not keep:
keep = '' keep = ''
script = [] script = []
for vol in get_volumes(): for vol in get_volumes():
if vol['Letter'].upper() != keep.upper(): if vol['Letter'].upper() != keep.upper():
script.append('select volume {}'.format(vol['Number'])) script.append('select volume {}'.format(vol['Number']))
script.append('remove noerr') script.append('remove noerr')
# Run script # Run script
try: try:
run_diskpart(script) run_diskpart(script)
@ -306,12 +306,12 @@ def remove_volume_letters(keep=None):
def run_diskpart(script): def run_diskpart(script):
"""Run DiskPart script.""" """Run DiskPart script."""
tempfile = r'{}\diskpart.script'.format(global_vars['Env']['TMP']) tempfile = r'{}\diskpart.script'.format(global_vars['Env']['TMP'])
# Write script # Write script
with open(tempfile, 'w') as f: with open(tempfile, 'w') as f:
for line in script: for line in script:
f.write('{}\n'.format(line)) f.write('{}\n'.format(line))
# Run script # Run script
cmd = [ cmd = [
r'{}\Windows\System32\diskpart.exe'.format( r'{}\Windows\System32\diskpart.exe'.format(
@ -335,7 +335,7 @@ def scan_disks():
# Get partition info for disk # Get partition info for disk
disk['Partitions'] = get_partitions(disk) disk['Partitions'] = get_partitions(disk)
for partition in disk['Partitions']: for partition in disk['Partitions']:
# Get partition details # Get partition details
partition.update(get_partition_details(disk, partition)) partition.update(get_partition_details(disk, partition))
@ -364,12 +364,12 @@ def select_disk(title='Which disk?', disks=[]):
fs = partition['FileSystem']) fs = partition['FileSystem'])
if partition['Name']: if partition['Name']:
p_name += '\t"{}"'.format(partition['Name']) p_name += '\t"{}"'.format(partition['Name'])
# Show unsupported partition(s) # Show unsupported partition(s)
if is_bad_partition(partition): if is_bad_partition(partition):
p_name = '{YELLOW}{p_name}{CLEAR}'.format( p_name = '{YELLOW}{p_name}{CLEAR}'.format(
p_name=p_name, **COLORS) p_name=p_name, **COLORS)
display_name += '\n\t\t\t{}'.format(p_name) display_name += '\n\t\t\t{}'.format(p_name)
if not disk['Partitions']: if not disk['Partitions']:
display_name += '\n\t\t\t{}No partitions found.{}'.format( display_name += '\n\t\t\t{}No partitions found.{}'.format(

View file

@ -68,7 +68,8 @@ def backup_file_list():
def backup_power_plans(): def backup_power_plans():
"""Export current power plans.""" """Export current power plans."""
os.makedirs(r'{BackupDir}\Power Plans'.format(**global_vars), exist_ok=True) os.makedirs(r'{BackupDir}\Power Plans\{Date}'.format(
**global_vars), exist_ok=True)
plans = run_program(['powercfg', '/L']) plans = run_program(['powercfg', '/L'])
plans = plans.stdout.decode().splitlines() plans = plans.stdout.decode().splitlines()
plans = [p for p in plans if re.search(r'^Power Scheme', p)] plans = [p for p in plans if re.search(r'^Power Scheme', p)]
@ -76,7 +77,7 @@ def backup_power_plans():
guid = re.sub(r'Power Scheme GUID:\s+([0-9a-f\-]+).*', r'\1', p) guid = re.sub(r'Power Scheme GUID:\s+([0-9a-f\-]+).*', r'\1', p)
name = re.sub( name = re.sub(
r'Power Scheme GUID:\s+[0-9a-f\-]+\s+\(([^\)]+)\).*', r'\1', p) r'Power Scheme GUID:\s+[0-9a-f\-]+\s+\(([^\)]+)\).*', r'\1', p)
out = r'{BackupDir}\Power Plans\{name}.pow'.format( out = r'{BackupDir}\Power Plans\{Date}\{name}.pow'.format(
name=name, **global_vars) name=name, **global_vars)
if not os.path.exists(out): if not os.path.exists(out):
cmd = ['powercfg', '-export', out, guid] cmd = ['powercfg', '-export', out, guid]
@ -87,7 +88,7 @@ def backup_registry(overwrite=False):
extract_item('erunt', silent=True) extract_item('erunt', silent=True)
cmd = [ cmd = [
global_vars['Tools']['ERUNT'], global_vars['Tools']['ERUNT'],
r'{BackupDir}\Registry'.format(**global_vars), r'{BackupDir}\Registry\{Date}'.format(**global_vars),
'sysreg', 'sysreg',
'curuser', 'curuser',
'otherusers', 'otherusers',
@ -374,7 +375,7 @@ def run_bleachbit(cleaners=None, preview=True):
"""Run BleachBit preview and save log. """Run BleachBit preview and save log.
If preview is True then no files should be deleted.""" If preview is True then no files should be deleted."""
error_path = r'{}\BleachBit.err'.format(global_vars['LogDir']) error_path = r'{}\Tools\BleachBit.err'.format(global_vars['LogDir'])
log_path = error_path.replace('err', 'log') log_path = error_path.replace('err', 'log')
extract_item('BleachBit', silent=True) extract_item('BleachBit', silent=True)
@ -473,7 +474,7 @@ def show_os_name():
def show_temp_files_size(): def show_temp_files_size():
"""Show total size of temp files identified by BleachBit.""" """Show total size of temp files identified by BleachBit."""
size = None size = None
with open(r'{LogDir}\BleachBit.log'.format(**global_vars), 'r') as f: with open(r'{LogDir}\Tools\BleachBit.log'.format(**global_vars), 'r') as f:
for line in f.readlines(): for line in f.readlines():
if re.search(r'^disk space to be recovered:', line, re.IGNORECASE): if re.search(r'^disk space to be recovered:', line, re.IGNORECASE):
size = re.sub(r'.*: ', '', line.strip()) size = re.sub(r'.*: ', '', line.strip())

View file

@ -26,7 +26,7 @@ def connect_to_network():
# Bail if currently connected # Bail if currently connected
if is_connected(): if is_connected():
return return
# WiFi # WiFi
if 'wl' in net_ifs: if 'wl' in net_ifs:
cmd = [ cmd = [
@ -37,7 +37,7 @@ def connect_to_network():
message = 'Connecting to {}...'.format(WIFI_SSID), message = 'Connecting to {}...'.format(WIFI_SSID),
function = run_program, function = run_program,
cmd = cmd) cmd = cmd)
def is_connected(): def is_connected():
"""Check for a valid private IP.""" """Check for a valid private IP."""
devs = psutil.net_if_addrs() devs = psutil.net_if_addrs()

View file

@ -39,7 +39,7 @@ def extract_keys():
keys[product] = [] keys[product] = []
if key not in keys[product]: if key not in keys[product]:
keys[product].append(key) keys[product].append(key)
# Done # Done
return keys return keys

View file

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

View file

@ -17,7 +17,7 @@ WINDOWS_VERSIONS = [
{'Name': 'Windows 7 Ultimate', {'Name': 'Windows 7 Ultimate',
'Image File': 'Win7', 'Image File': 'Win7',
'Image Name': 'Windows 7 ULTIMATE'}, 'Image Name': 'Windows 7 ULTIMATE'},
{'Name': 'Windows 8.1', {'Name': 'Windows 8.1',
'Image File': 'Win8', 'Image File': 'Win8',
'Image Name': 'Windows 8.1', 'Image Name': 'Windows 8.1',
@ -25,7 +25,7 @@ WINDOWS_VERSIONS = [
{'Name': 'Windows 8.1 Pro', {'Name': 'Windows 8.1 Pro',
'Image File': 'Win8', 'Image File': 'Win8',
'Image Name': 'Windows 8.1 Pro'}, 'Image Name': 'Windows 8.1 Pro'},
{'Name': 'Windows 10 Home', {'Name': 'Windows 10 Home',
'Image File': 'Win10', 'Image File': 'Win10',
'Image Name': 'Windows 10 Home', 'Image Name': 'Windows 10 Home',
@ -75,7 +75,7 @@ def find_windows_image(windows_version):
image['Glob'] = '--ref="{}*.swm"'.format( image['Glob'] = '--ref="{}*.swm"'.format(
image['Path'][:-4]) image['Path'][:-4])
break break
# Display image to be used (if any) and return # Display image to be used (if any) and return
if image: if image:
print_info('Using image: {}'.format(image['Path'])) print_info('Using image: {}'.format(image['Path']))
@ -122,7 +122,7 @@ def format_gpt(disk):
'set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"', 'set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"',
'gpt attributes=0x8000000000000001', 'gpt attributes=0x8000000000000001',
] ]
# Run # Run
run_diskpart(script) run_diskpart(script)
@ -151,7 +151,7 @@ def format_mbr(disk):
'assign letter="T"', 'assign letter="T"',
'set id=27', 'set id=27',
] ]
# Run # Run
run_diskpart(script) 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) win = r'{}:\Windows'.format(windows_letter)
winre = r'{}\System32\Recovery\WinRE.wim'.format(win) winre = r'{}\System32\Recovery\WinRE.wim'.format(win)
dest = r'{}:\Recovery\WindowsRE'.format(tools_letter) dest = r'{}:\Recovery\WindowsRE'.format(tools_letter)
# Copy WinRE.wim # Copy WinRE.wim
os.makedirs(dest, exist_ok=True) os.makedirs(dest, exist_ok=True)
shutil.copy(winre, r'{}\WinRE.wim'.format(dest)) shutil.copy(winre, r'{}\WinRE.wim'.format(dest))
# Set location # Set location
cmd = [ cmd = [
r'{}\System32\ReAgentc.exe'.format(win), r'{}\System32\ReAgentc.exe'.format(win),
@ -231,7 +231,7 @@ def wim_contains_image(filename, imagename):
run_program(cmd) run_program(cmd)
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
return False return False
return True return True
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -90,7 +90,7 @@ def menu_backup():
message = 'Assigning letters...', message = 'Assigning letters...',
function = assign_volume_letters, function = assign_volume_letters,
other_results = other_results) other_results = other_results)
# Mount backup shares # Mount backup shares
mount_backup_shares(read_write=True) mount_backup_shares(read_write=True)
@ -107,12 +107,12 @@ def menu_backup():
else: else:
print_error('ERROR: No disks found.') print_error('ERROR: No disks found.')
raise GenericAbort raise GenericAbort
# Select disk to backup # Select disk to backup
disk = select_disk('For which disk are we creating backups?', disks) disk = select_disk('For which disk are we creating backups?', disks)
if not disk: if not disk:
raise GenericAbort raise GenericAbort
# "Prep" disk # "Prep" disk
prep_disk_for_backup(destination, disk, backup_prefix) prep_disk_for_backup(destination, disk, backup_prefix)
@ -150,7 +150,7 @@ def menu_backup():
# Ask to proceed # Ask to proceed
if (not ask('Proceed with backup?')): if (not ask('Proceed with backup?')):
raise GenericAbort raise GenericAbort
# Backup partition(s) # Backup partition(s)
print_info('\n\nStarting task.\n') print_info('\n\nStarting task.\n')
for par in disk['Partitions']: for par in disk['Partitions']:
@ -163,7 +163,7 @@ def menu_backup():
if not result['CS'] and not isinstance(result['Error'], GenericAbort): if not result['CS'] and not isinstance(result['Error'], GenericAbort):
errors = True errors = True
par['Error'] = result['Error'] par['Error'] = result['Error']
# Verify backup(s) # Verify backup(s)
if disk['Valid Partitions']: if disk['Valid Partitions']:
print_info('\n\nVerifying backup images(s)\n') print_info('\n\nVerifying backup images(s)\n')
@ -270,7 +270,7 @@ def menu_setup():
# Select the version of Windows to apply # Select the version of Windows to apply
windows_version = select_windows_version() windows_version = select_windows_version()
# Find Windows image # Find Windows image
# NOTE: Reassign volume letters to ensure all devices are scanned # NOTE: Reassign volume letters to ensure all devices are scanned
try_and_print( try_and_print(
@ -289,12 +289,12 @@ def menu_setup():
else: else:
print_error('ERROR: No disks found.') print_error('ERROR: No disks found.')
raise GenericAbort raise GenericAbort
# Select disk to use as the OS disk # Select disk to use as the OS disk
dest_disk = select_disk('To which disk are we installing Windows?', disks) dest_disk = select_disk('To which disk are we installing Windows?', disks)
if not dest_disk: if not dest_disk:
raise GenericAbort raise GenericAbort
# "Prep" disk # "Prep" disk
prep_disk_for_formatting(dest_disk) prep_disk_for_formatting(dest_disk)
@ -323,10 +323,10 @@ def menu_setup():
data = par['Display String'], data = par['Display String'],
warning = True) warning = True)
print_warning(dest_disk['Format Warnings']) print_warning(dest_disk['Format Warnings'])
if (not ask('Is this correct?')): if (not ask('Is this correct?')):
raise GenericAbort raise GenericAbort
# Safety check # Safety check
print_standard('\nSAFETY CHECK') print_standard('\nSAFETY CHECK')
print_warning('All data will be DELETED from the ' print_warning('All data will be DELETED from the '
@ -342,7 +342,7 @@ def menu_setup():
function = remove_volume_letters, function = remove_volume_letters,
other_results = other_results, other_results = other_results,
keep=windows_image['Letter']) keep=windows_image['Letter'])
# Assign new letter for local source if necessary # Assign new letter for local source if necessary
if windows_image['Local'] and windows_image['Letter'] in ['S', 'T', 'W']: if windows_image['Local'] and windows_image['Letter'] in ['S', 'T', 'W']:
new_letter = try_and_print( new_letter = try_and_print(
@ -377,13 +377,13 @@ def menu_setup():
# We need to crash as the disk is in an unknown state # We need to crash as the disk is in an unknown state
print_error('ERROR: Failed to apply image.') print_error('ERROR: Failed to apply image.')
raise GenericAbort raise GenericAbort
# Create Boot files # Create Boot files
try_and_print( try_and_print(
message = 'Updating boot files...', message = 'Updating boot files...',
function = update_boot_partition, function = update_boot_partition,
other_results = other_results) other_results = other_results)
# Setup WinRE # Setup WinRE
try_and_print( try_and_print(
message = 'Updating recovery tools...', message = 'Updating recovery tools...',
@ -392,8 +392,8 @@ def menu_setup():
windows_version = windows_version) windows_version = windows_version)
# Copy WinPE log(s) # Copy WinPE log(s)
source = r'{}\Info'.format(global_vars['ClientDir']) source = r'{}\Logs'.format(global_vars['ClientDir'])
dest = r'W:\{}\Info'.format(KIT_NAME_SHORT) dest = r'W:\{}\Logs\WinPE'.format(KIT_NAME_SHORT)
shutil.copytree(source, dest) shutil.copytree(source, dest)
# Print summary # Print summary

View file

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

View file

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

View file

@ -9,7 +9,8 @@ sys.path.append(os.getcwd())
from functions.setup import * from functions.setup import *
init_global_vars() init_global_vars()
os.system('title {}: SW Bundle Tool'.format(KIT_NAME_FULL)) os.system('title {}: SW Bundle Tool'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\Install SW Bundle.log'.format(**global_vars) global_vars['LogFile'] = r'{LogDir}\{kit_name}\Install SW Bundle.log'.format(
kit_name=KIT_NAME_FULL, **global_vars)
D7_MODE = 'd7mode' in sys.argv D7_MODE = 'd7mode' in sys.argv
if __name__ == '__main__': if __name__ == '__main__':
@ -35,7 +36,7 @@ if __name__ == '__main__':
answer_mse = ask('Install MSE?') answer_mse = ask('Install MSE?')
else: else:
answer_mse = False answer_mse = False
print_info('Installing Programs') print_info('Installing Programs')
if answer_vcr: if answer_vcr:
install_vcredists() install_vcredists()

View file

@ -9,7 +9,8 @@ sys.path.append(os.getcwd())
from functions.setup import * from functions.setup import *
init_global_vars() init_global_vars()
os.system('title {}: Install Visual C++ Runtimes'.format(KIT_NAME_FULL)) os.system('title {}: Install Visual C++ Runtimes'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\Install Visual C++ Runtimes.log'.format(**global_vars) global_vars['LogFile'] = r'{LogDir}\{kit_name}\Install Visual C++ Runtimes.log'.format(
kit_name=KIT_NAME_FULL, **global_vars)
if __name__ == '__main__': if __name__ == '__main__':
try: try:
@ -20,12 +21,12 @@ if __name__ == '__main__':
'Error': { 'Error': {
'CalledProcessError': 'Unknown Error', 'CalledProcessError': 'Unknown Error',
}} }}
if ask('Install Visual C++ Runtimes?'): if ask('Install Visual C++ Runtimes?'):
install_vcredists() install_vcredists()
else: else:
abort() abort()
print_standard('\nDone.') print_standard('\nDone.')
exit_script() exit_script()
except SystemExit: except SystemExit:

View file

@ -11,8 +11,8 @@ from functions.cleanup import *
from functions.setup import * from functions.setup import *
init_global_vars() init_global_vars()
os.system('title {}: Post-d7II Work'.format(KIT_NAME_FULL)) os.system('title {}: Post-d7II Work'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\Post-d7II Work.log'.format( global_vars['LogFile'] = r'{LogDir}\{kit_name}\Post-d7II Work.log'.format(
**global_vars, **global_vars['Env']) kit_name=KIT_NAME_FULL, **global_vars)
if __name__ == '__main__': if __name__ == '__main__':
try: try:

View file

@ -11,8 +11,8 @@ from functions.cleanup import *
from functions.setup import * from functions.setup import *
init_global_vars() init_global_vars()
os.system('title {}: Browser Reset Tool'.format(KIT_NAME_FULL)) os.system('title {}: Browser Reset Tool'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\Browser Reset ({USERNAME}).log'.format( global_vars['LogFile'] = r'{LogDir}\{kit_name}\Browser Reset ({USERNAME}).log'.format(
**global_vars, **global_vars['Env']) kit_name=KIT_NAME_FULL, **global_vars, **global_vars['Env'])
D7_MODE = 'd7mode' in sys.argv D7_MODE = 'd7mode' in sys.argv
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -17,16 +17,16 @@ if __name__ == '__main__':
other_results = { other_results = {
'Error': {'CalledProcessError': 'Unknown Error'}, 'Error': {'CalledProcessError': 'Unknown Error'},
'Warning': {}} 'Warning': {}}
if not ask('Enable booting to SafeMode (with Networking)?'): if not ask('Enable booting to SafeMode (with Networking)?'):
abort() abort()
# Configure SafeMode # Configure SafeMode
try_and_print(message='Set BCD option...', try_and_print(message='Set BCD option...',
function=enable_safemode, other_results=other_results) function=enable_safemode, other_results=other_results)
try_and_print(message='Enable MSI in SafeMode...', try_and_print(message='Enable MSI in SafeMode...',
function=enable_safemode_msi, other_results=other_results) function=enable_safemode_msi, other_results=other_results)
# Done # Done
print_standard('\nDone.') print_standard('\nDone.')
pause('Press Enter to reboot...') pause('Press Enter to reboot...')

View file

@ -17,16 +17,16 @@ if __name__ == '__main__':
other_results = { other_results = {
'Error': {'CalledProcessError': 'Unknown Error'}, 'Error': {'CalledProcessError': 'Unknown Error'},
'Warning': {}} 'Warning': {}}
if not ask('Disable booting to SafeMode?'): if not ask('Disable booting to SafeMode?'):
abort() abort()
# Configure SafeMode # Configure SafeMode
try_and_print(message='Remove BCD option...', try_and_print(message='Remove BCD option...',
function=disable_safemode, other_results=other_results) function=disable_safemode, other_results=other_results)
try_and_print(message='Disable MSI in SafeMode...', try_and_print(message='Disable MSI in SafeMode...',
function=disable_safemode_msi, other_results=other_results) function=disable_safemode_msi, other_results=other_results)
# Done # Done
print_standard('\nDone.') print_standard('\nDone.')
pause('Press Enter to reboot...') pause('Press Enter to reboot...')

View file

@ -105,7 +105,7 @@ LAUNCHERS = {
'L_PATH': 'FastCopy', 'L_PATH': 'FastCopy',
'L_ITEM': 'FastCopy.exe', 'L_ITEM': 'FastCopy.exe',
'L_ARGS': ( 'L_ARGS': (
r' /logfile=%log_dir%\FastCopy.log' r' /logfile=%log_dir%\Tools\FastCopy.log'
r' /cmd=noexist_only' r' /cmd=noexist_only'
r' /utf8' r' /utf8'
r' /skip_empty_dir' r' /skip_empty_dir'
@ -145,7 +145,7 @@ LAUNCHERS = {
), ),
'L_ELEV': 'True', 'L_ELEV': 'True',
'Extra Code': [ 'Extra Code': [
r'call "%bin%\Scripts\init_client_dir.cmd" /Info /Transfer', r'call "%bin%\Scripts\init_client_dir.cmd" /Logs /Transfer',
], ],
}, },
'FastCopy': { 'FastCopy': {
@ -153,7 +153,7 @@ LAUNCHERS = {
'L_PATH': 'FastCopy', 'L_PATH': 'FastCopy',
'L_ITEM': 'FastCopy.exe', 'L_ITEM': 'FastCopy.exe',
'L_ARGS': ( 'L_ARGS': (
r' /logfile=%log_dir%\FastCopy.log' r' /logfile=%log_dir%\Tools\FastCopy.log'
r' /cmd=noexist_only' r' /cmd=noexist_only'
r' /utf8' r' /utf8'
r' /skip_empty_dir' r' /skip_empty_dir'
@ -192,7 +192,7 @@ LAUNCHERS = {
r' /to=%client_dir%\Transfer_%iso_date%\ ' r' /to=%client_dir%\Transfer_%iso_date%\ '
), ),
'Extra Code': [ 'Extra Code': [
r'call "%bin%\Scripts\init_client_dir.cmd" /Info /Transfer', r'call "%bin%\Scripts\init_client_dir.cmd" /Logs /Transfer',
], ],
}, },
'KVRT': { 'KVRT': {
@ -302,10 +302,10 @@ LAUNCHERS = {
'L_TYPE': 'Executable', 'L_TYPE': 'Executable',
'L_PATH': 'erunt', 'L_PATH': 'erunt',
'L_ITEM': 'ERUNT.EXE', 'L_ITEM': 'ERUNT.EXE',
'L_ARGS': '%client_dir%\Backups\%iso_date%\Registry sysreg curuser otherusers', 'L_ARGS': '%client_dir%\Backups\Registry\%iso_date% sysreg curuser otherusers',
'L_ELEV': 'True', 'L_ELEV': 'True',
'Extra Code': [ 'Extra Code': [
r'call "%bin%\Scripts\init_client_dir.cmd" /Info', r'call "%bin%\Scripts\init_client_dir.cmd" /Logs',
], ],
}, },
'FurMark': { 'FurMark': {
@ -323,7 +323,7 @@ LAUNCHERS = {
'L_PATH': 'HitmanPro', 'L_PATH': 'HitmanPro',
'L_ITEM': 'HitmanPro.exe', 'L_ITEM': 'HitmanPro.exe',
'Extra Code': [ 'Extra Code': [
r'call "%bin%\Scripts\init_client_dir.cmd" /Info', r'call "%bin%\Scripts\init_client_dir.cmd" /Logs',
], ],
}, },
'HWiNFO': { 'HWiNFO': {
@ -624,8 +624,10 @@ LAUNCHERS = {
'L_TYPE': 'Executable', 'L_TYPE': 'Executable',
'L_PATH': 'RKill', 'L_PATH': 'RKill',
'L_ITEM': 'RKill.exe', 'L_ITEM': 'RKill.exe',
'L_ARGS': '-s -l %log_dir%\Tools\RKill.log',
'L_ELEV': 'True',
'Extra Code': [ 'Extra Code': [
r'call "%bin%\Scripts\init_client_dir.cmd" /Info', r'call "%bin%\Scripts\init_client_dir.cmd" /Logs',
], ],
}, },
'SFC Scan': { 'SFC Scan': {
@ -639,7 +641,7 @@ LAUNCHERS = {
'L_PATH': 'TDSSKiller', 'L_PATH': 'TDSSKiller',
'L_ITEM': 'TDSSKiller.exe', 'L_ITEM': 'TDSSKiller.exe',
'L_ARGS': ( 'L_ARGS': (
r' -l %log_dir%\TDSSKiller.log' r' -l %log_dir%\Tools\TDSSKiller.log'
r' -qpath %q_dir%' r' -qpath %q_dir%'
r' -accepteula' r' -accepteula'
r' -accepteulaksn' r' -accepteulaksn'

View file

@ -6,16 +6,16 @@ WINDOWS_BUILDS = {
'6000': ( 'Vista', 'RTM', 'Longhorn', None, 'unsupported'), '6000': ( 'Vista', 'RTM', 'Longhorn', None, 'unsupported'),
'6001': ( 'Vista', 'SP1', 'Longhorn', None, 'unsupported'), '6001': ( 'Vista', 'SP1', 'Longhorn', None, 'unsupported'),
'6002': ( 'Vista', 'SP2', 'Longhorn', None, 'unsupported'), '6002': ( 'Vista', 'SP2', 'Longhorn', None, 'unsupported'),
'7600': ( '7', 'RTM', 'Vienna', None, 'unsupported'), '7600': ( '7', 'RTM', 'Vienna', None, 'unsupported'),
'7601': ( '7', 'SP1', 'Vienna', None, 'outdated'), '7601': ( '7', 'SP1', 'Vienna', None, 'outdated'),
#9199 is a fake build since Win 8 is 6.2.9200 but that collides with Win 8.1 (6.3.9200) #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'), '9199': ( '8', 'RTM', None, None, 'unsupported'),
'9200': ( '8.1', None, 'Blue', None, 'outdated'), '9200': ( '8.1', None, 'Blue', None, 'outdated'),
'9600': ( '8.1', None, 'Update', None, None), '9600': ( '8.1', None, 'Update', None, None),
'9841': ( '10', None, 'Threshold 1', None, 'preview build'), '9841': ( '10', None, 'Threshold 1', None, 'preview build'),
'9860': ( '10', None, 'Threshold 1', None, 'preview build'), '9860': ( '10', None, 'Threshold 1', None, 'preview build'),
'9879': ( '10', None, 'Threshold 1', None, 'preview build'), '9879': ( '10', None, 'Threshold 1', None, 'preview build'),

View file

@ -9,7 +9,8 @@ sys.path.append(os.getcwd())
from functions.repairs import * from functions.repairs import *
init_global_vars() init_global_vars()
os.system('title {}: SFC Tool'.format(KIT_NAME_FULL)) os.system('title {}: SFC Tool'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\SFC Tool.log'.format(**global_vars) global_vars['LogFile'] = r'{LogDir}\{kit_name}\SFC Tool.log'.format(
kit_name=KIT_NAME_FULL, **global_vars)
if __name__ == '__main__': if __name__ == '__main__':
try: try:
@ -28,7 +29,7 @@ if __name__ == '__main__':
function=run_sfc_scan, other_results=other_results) function=run_sfc_scan, other_results=other_results)
else: else:
abort() abort()
# Done # Done
print_standard('\nDone.') print_standard('\nDone.')
pause('Press Enter to exit...') pause('Press Enter to exit...')

View file

@ -14,7 +14,8 @@ from functions.product_keys import *
from functions.setup import * from functions.setup import *
init_global_vars() init_global_vars()
os.system('title {}: System Checklist Tool'.format(KIT_NAME_FULL)) os.system('title {}: System Checklist Tool'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\System Checklist.log'.format(**global_vars) global_vars['LogFile'] = r'{LogDir}\{kit_name}\System Checklist.log'.format(
kit_name=KIT_NAME_FULL, **global_vars)
D7_MODE = 'd7mode' in sys.argv D7_MODE = 'd7mode' in sys.argv
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -14,7 +14,8 @@ from functions.product_keys import *
from functions.setup import * from functions.setup import *
init_global_vars() init_global_vars()
os.system('title {}: System HW Checklist Tool'.format(KIT_NAME_FULL)) os.system('title {}: System HW Checklist Tool'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\System HW Checklist.log'.format(**global_vars) global_vars['LogFile'] = r'{LogDir}\{kit_name}\System HW Checklist.log'.format(
kit_name=KIT_NAME_FULL, **global_vars)
if __name__ == '__main__': if __name__ == '__main__':
try: try:

View file

@ -13,8 +13,8 @@ from functions.product_keys import *
from functions.repairs import * from functions.repairs import *
init_global_vars() init_global_vars()
os.system('title {}: System Diagnostics Tool'.format(KIT_NAME_FULL)) os.system('title {}: System Diagnostics Tool'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\System Diagnostics.log'.format( global_vars['LogFile'] = r'{LogDir}\{kit_name}\System Diagnostics.log'.format(
**global_vars) kit_name=KIT_NAME_FULL, **global_vars)
D7_MODE = 'd7mode' in sys.argv D7_MODE = 'd7mode' in sys.argv
# Static Variables # Static Variables

View file

@ -9,7 +9,8 @@ sys.path.append(os.getcwd())
from functions.product_keys import * from functions.product_keys import *
init_global_vars() init_global_vars()
os.system('title {}: Transferred Key Finder'.format(KIT_NAME_FULL)) os.system('title {}: Transferred Key Finder'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\Transferred Keys.log'.format(**global_vars) global_vars['LogFile'] = r'{LogDir}\{kit_name}\Transferred Keys.log'.format(
kit_name=KIT_NAME_FULL, **global_vars)
if __name__ == '__main__': if __name__ == '__main__':
try: try:
@ -18,7 +19,7 @@ if __name__ == '__main__':
print_info('{}: Transferred Key Finder\n'.format(KIT_NAME_FULL)) print_info('{}: Transferred Key Finder\n'.format(KIT_NAME_FULL))
try_and_print(message='Searching for keys...', try_and_print(message='Searching for keys...',
function=list_clientdir_keys, print_return=True) function=list_clientdir_keys, print_return=True)
# Done # Done
print_standard('\nDone.') print_standard('\nDone.')
exit_script() exit_script()

View file

@ -11,8 +11,8 @@ from functions.cleanup import *
from functions.setup import * from functions.setup import *
init_global_vars() init_global_vars()
os.system('title {}: User Checklist Tool'.format(KIT_NAME_FULL)) os.system('title {}: User Checklist Tool'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\User Checklist ({USERNAME}).log'.format( global_vars['LogFile'] = r'{LogDir}\{kit_name}\User Checklist ({USERNAME}).log'.format(
**global_vars, **global_vars['Env']) kit_name=KIT_NAME_FULL, **global_vars, **global_vars['Env'])
D7_MODE = 'd7mode' in sys.argv D7_MODE = 'd7mode' in sys.argv
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -10,7 +10,8 @@ from functions.data import *
from functions.repairs import * from functions.repairs import *
init_global_vars() init_global_vars()
os.system('title {}: User Data Transfer Tool'.format(KIT_NAME_FULL)) os.system('title {}: User Data Transfer Tool'.format(KIT_NAME_FULL))
global_vars['LogFile'] = r'{LogDir}\User Data Transfer.log'.format(**global_vars) global_vars['LogFile'] = r'{LogDir}\{kit_name}\User Data Transfer.log'.format(
kit_name=KIT_NAME_FULL, **global_vars)
if __name__ == '__main__': if __name__ == '__main__':
try: try:
@ -18,7 +19,7 @@ if __name__ == '__main__':
stay_awake() stay_awake()
clear_screen() clear_screen()
print_info('{}: User Data Transfer Tool\n'.format(KIT_NAME_FULL)) print_info('{}: User Data Transfer Tool\n'.format(KIT_NAME_FULL))
# Get backup name prefix # Get backup name prefix
ticket_number = get_ticket_number() ticket_number = get_ticket_number()
if ENABLED_TICKET_NUMBERS: if ENABLED_TICKET_NUMBERS:
@ -26,16 +27,16 @@ if __name__ == '__main__':
else: else:
backup_prefix = get_simple_string(prompt='Enter backup name prefix') backup_prefix = get_simple_string(prompt='Enter backup name prefix')
backup_prefix = backup_prefix.replace(' ', '_') backup_prefix = backup_prefix.replace(' ', '_')
# Set destination # Set destination
folder_path = r'{}\Transfer'.format(KIT_NAME_SHORT) folder_path = r'{}\Transfer'.format(KIT_NAME_SHORT)
dest = select_destination(folder_path=folder_path, dest = select_destination(folder_path=folder_path,
prompt='Which disk are we transferring to?') prompt='Which disk are we transferring to?')
# Set source items # Set source items
source = select_source(backup_prefix) source = select_source(backup_prefix)
items = scan_source(source, dest) items = scan_source(source, dest)
# Transfer # Transfer
clear_screen() clear_screen()
print_info('Transfer Details:\n') print_info('Transfer Details:\n')
@ -43,17 +44,17 @@ if __name__ == '__main__':
show_data('Ticket:', ticket_number) show_data('Ticket:', ticket_number)
show_data('Source:', source.path) show_data('Source:', source.path)
show_data('Destination:', dest) show_data('Destination:', dest)
if (not ask('Proceed with transfer?')): if (not ask('Proceed with transfer?')):
umount_backup_shares() umount_backup_shares()
abort() abort()
print_info('Transferring Data') print_info('Transferring Data')
transfer_source(source, dest, items) transfer_source(source, dest, items)
try_and_print(message='Removing extra files...', try_and_print(message='Removing extra files...',
function=cleanup_transfer, cs='Done', dest_path=dest) function=cleanup_transfer, cs='Done', dest_path=dest)
umount_backup_shares() umount_backup_shares()
# Done # Done
try_and_print(message='Running KVRT...', try_and_print(message='Running KVRT...',
function=run_kvrt, cs='Started') function=run_kvrt, cs='Started')