WinPE files moved into place.

This commit is contained in:
Alan Mason 2017-12-01 19:43:42 -08:00
parent ef9775273c
commit 750112cfb2
27 changed files with 32 additions and 1807 deletions

View file

@ -1,4 +1,4 @@
# Wizard Kit PE: Functions - Backup # Wizard Kit: Functions - Backup
from functions.disk import * from functions.disk import *

View file

@ -1,4 +1,4 @@
# Wizard Kit PE: Functions - Disk # Wizard Kit: Functions - Disk
from functions.common import * from functions.common import *
from functions import partition_uids from functions import partition_uids

View file

@ -1,4 +1,4 @@
# Wizard Kit PE: Functions - Windows Setup # Wizard Kit: Functions - Windows Setup
from functions.data import * from functions.data import *
from functions.disk import * from functions.disk import *

View file

@ -1,4 +1,4 @@
# Wizard Kit PE: Menus # Wizard Kit: WinPE Menus
from functions.backup import * from functions.backup import *
from functions.disk import * from functions.disk import *

View file

@ -1,4 +1,4 @@
# Wizard Kit PE: Root Menu # Wizard Kit: WinPE Root Menu
import os import os
import sys import sys

1
.gitignore vendored
View file

@ -36,4 +36,5 @@
.cbin/_Office/ .cbin/_Office/
.cbin/_vcredists/ .cbin/_vcredists/
.cbin/wimlib/ .cbin/wimlib/
BUILD*/
OUT*/ OUT*/

View file

@ -1,713 +0,0 @@
# Wizard Kit PE: Functions - Common
import os
import psutil
import re
import shutil
import subprocess
import sys
import time
import traceback
import winreg
from subprocess import CalledProcessError
from settings.main import *
from settings.tools import *
# Global variables
global_vars = {}
# STATIC VARIABLES
COLORS = {
'CLEAR': '\033[0m',
'RED': '\033[31m',
'GREEN': '\033[32m',
'YELLOW': '\033[33m',
'BLUE': '\033[34m'
}
HKU = winreg.HKEY_USERS
HKCU = winreg.HKEY_CURRENT_USER
HKLM = winreg.HKEY_LOCAL_MACHINE
# Error Classes
class BIOSKeyNotFoundError(Exception):
pass
class BinNotFoundError(Exception):
pass
class GenericAbort(Exception):
pass
class GenericError(Exception):
pass
class GenericRepair(Exception):
pass
class MultipleInstallationsError(Exception):
pass
class NotInstalledError(Exception):
pass
class NoProfilesError(Exception):
pass
class PathNotFoundError(Exception):
pass
class UnsupportedOSError(Exception):
pass
# General functions
def abort():
"""Abort script."""
print_warning('Aborted.')
sleep(5)
exit_script()
def ask(prompt='Kotaero!'):
"""Prompt the user with a Y/N question, log answer, and return a bool."""
answer = None
prompt = '{} [Y/N]: '.format(prompt)
while answer is None:
tmp = input(prompt)
if re.search(r'^y(es|)$', tmp, re.IGNORECASE):
answer = True
elif re.search(r'^n(o|ope|)$', tmp, re.IGNORECASE):
answer = False
message = '{prompt}{answer_text}'.format(
prompt = prompt,
answer_text = 'Yes' if answer else 'No')
print_log(message=message)
return answer
def clear_screen():
"""Simple wrapper for cls."""
os.system('cls')
def convert_to_bytes(size):
"""Convert human-readable size str to bytes and return an int."""
size = str(size)
tmp = re.search(r'(\d+)\s+([KMGT]B)', size.upper())
if tmp:
size = int(tmp.group(1))
units = tmp.group(2)
if units == 'TB':
size *= 1099511627776
elif units == 'GB':
size *= 1073741824
elif units == 'MB':
size *= 1048576
elif units == 'KB':
size *= 1024
else:
return -1
return size
def exit_script(return_value=0):
"""Exits the script after some cleanup and opens the log (if set)."""
# Remove dirs (if empty)
for dir in ['BackupDir', 'LogDir', 'TmpDir']:
try:
dir = global_vars[dir]
os.rmdir(dir)
except Exception:
pass
# Open Log (if it exists)
log = global_vars.get('LogFile', '')
if log and os.path.exists(log):
try:
extract_item('NotepadPlusPlus', silent=True)
popen_program(
[global_vars['Tools']['NotepadPlusPlus'],
global_vars['LogFile']])
except Exception:
print_error('ERROR: Failed to extract Notepad++ and open log.')
pause('Press Enter to exit...')
# Kill Caffeine if still running
kill_process('caffeine.exe')
# Exit
sys.exit(return_value)
def extract_item(item, filter='', silent=False):
"""Extract item from .cbin into .bin."""
cmd = [
global_vars['Tools']['SevenZip'], 'x', '-aos', '-bso0', '-bse0',
'-p{ArchivePassword}'.format(**global_vars),
r'-o{BinDir}\{item}'.format(item=item, **global_vars),
r'{CBinDir}\{item}.7z'.format(item=item, **global_vars),
filter]
if not silent:
print_standard('Extracting "{item}"...'.format(item=item))
try:
run_program(cmd)
except subprocess.CalledProcessError:
if not silent:
print_warning('WARNING: Errors encountered while exctracting data')
def get_ticket_number():
"""Get TicketNumber from user, save in LogDir, and return as str."""
ticket_number = None
while ticket_number is None:
_input = input('Enter ticket number: ')
if re.match(r'^([0-9]+([-_]?\w+|))$', _input):
ticket_number = _input
with open(r'{LogDir}\TicketNumber'.format(**global_vars), 'w') as f:
f.write(ticket_number)
return ticket_number
def human_readable_size(size, decimals=0):
"""Convert size in bytes to a human-readable format and return a str."""
# Prep string formatting
width = 3+decimals
if decimals > 0:
width += 1
# Convert size to int
try:
size = int(size)
except ValueError:
size = convert_to_bytes(size)
# Verify we have a valid size
if size < 0:
return '{size:>{width}} b'.format(size='???', width=width)
# Convert to sensible units
if size >= 1099511627776:
size /= 1099511627776
units = 'Tb'
elif size >= 1073741824:
size /= 1073741824
units = 'Gb'
elif size >= 1048576:
size /= 1048576
units = 'Mb'
elif size >= 1024:
size /= 1024
units = 'Kb'
else:
units = ' b'
# Return
return '{size:>{width}.{decimals}f} {units}'.format(
size=size, width=width, decimals=decimals, units=units)
def kill_process(name):
"""Kill any running caffeine.exe processes."""
for proc in psutil.process_iter():
if proc.name() == name:
proc.kill()
def major_exception():
"""Display traceback and exit"""
print_error('Major exception')
print_warning(SUPPORT_MESSAGE)
print(traceback.format_exc())
print_log(traceback.format_exc())
sleep(30)
pause('Press Enter to exit...')
exit_script(1)
def menu_select(title='~ Untitled Menu ~',
prompt='Please make a selection', secret_exit=False,
main_entries=[], action_entries=[], disabled_label='DISABLED'):
"""Display options in a menu and return selected option as a str."""
# Bail early
if not main_entries and not action_entries:
raise Exception("MenuError: No items given")
# Set title
if 'Title' in global_vars:
title = '{}\n\n{}'.format(global_vars['Title'], title)
# Build menu
menu_splash = '{}\n\n'.format(title)
width = len(str(len(main_entries)))
valid_answers = []
if (secret_exit):
valid_answers.append('Q')
# Add main entries
for i in range(len(main_entries)):
entry = main_entries[i]
# Add Spacer
if ('CRLF' in entry):
menu_splash += '\n'
entry_str = '{number:>{width}}: {name}'.format(
number = i+1,
width = width,
name = entry.get('Display Name', entry['Name']))
if entry.get('Disabled', False):
entry_str = '{YELLOW}{entry_str} ({disabled}){CLEAR}'.format(
entry_str = entry_str,
disabled = disabled_label,
**COLORS)
else:
valid_answers.append(str(i+1))
menu_splash += '{}\n'.format(entry_str)
menu_splash += '\n'
# Add action entries
for entry in action_entries:
# Add Spacer
if ('CRLF' in entry):
menu_splash += '\n'
valid_answers.append(entry['Letter'])
menu_splash += '{letter:>{width}}: {name}\n'.format(
letter = entry['Letter'].upper(),
width = len(str(len(action_entries))),
name = entry['Name'])
menu_splash += '\n'
answer = ''
while (answer.upper() not in valid_answers):
os.system('cls')
print(menu_splash)
answer = input('{}: '.format(prompt))
return answer.upper()
def non_clobber_rename(full_path):
"""Append suffix to path, if necessary, to avoid clobbering path"""
new_path = full_path
_i = 1;
while os.path.exists(new_path):
new_path = '{path}_{i}'.format(i=_i, path=full_path)
_i += 1
return new_path
def pause(prompt='Press Enter to continue... '):
"""Simple pause implementation."""
input(prompt)
def ping(addr='google.com'):
"""Attempt to ping addr."""
cmd = ['ping', '-n', '2', addr]
run_program(cmd)
def popen_program(cmd, pipe=False, minimized=False, shell=False, **kwargs):
"""Run program and return a subprocess.Popen object."""
startupinfo=None
if minimized:
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags = subprocess.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = 6
if pipe:
popen_obj = subprocess.Popen(cmd, shell=shell, startupinfo=startupinfo,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
else:
popen_obj = subprocess.Popen(cmd, shell=shell, startupinfo=startupinfo)
return popen_obj
def print_error(*args, **kwargs):
"""Prints message to screen in RED."""
print_standard(*args, color=COLORS['RED'], **kwargs)
def print_info(*args, **kwargs):
"""Prints message to screen in BLUE."""
print_standard(*args, color=COLORS['BLUE'], **kwargs)
def print_standard(message='Generic info',
color=None, end='\n', timestamp=True, **kwargs):
"""Prints message to screen and log (if set)."""
display_message = message
if color:
display_message = color + message + COLORS['CLEAR']
# **COLORS is used below to support non-"standard" color printing
print(display_message.format(**COLORS), end=end, **kwargs)
print_log(message, end, timestamp)
def print_success(*args, **kwargs):
"""Prints message to screen in GREEN."""
print_standard(*args, color=COLORS['GREEN'], **kwargs)
def print_warning(*args, **kwargs):
"""Prints message to screen in YELLOW."""
print_standard(*args, color=COLORS['YELLOW'], **kwargs)
def print_log(message='', end='\n', timestamp=True):
time_str = time.strftime("%Y-%m-%d %H%M%z: ") if timestamp else ''
if 'LogFile' in global_vars and global_vars['LogFile'] is not None:
with open(global_vars['LogFile'], 'a') as f:
for line in message.splitlines():
f.write('{timestamp}{line}{end}'.format(
timestamp = time_str,
line = line,
end = end))
def run_program(cmd, args=[], check=True, pipe=True, shell=False):
"""Run program and return a subprocess.CompletedProcess object."""
if args:
# Deprecated so let's raise an exception to find & fix all occurances
print_error('ERROR: Using args is no longer supported.')
raise Exception
cmd = [c for c in cmd if c]
if shell:
cmd = ' '.join(cmd)
if pipe:
process_return = subprocess.run(cmd, check=check, shell=shell,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
else:
process_return = subprocess.run(cmd, check=check, shell=shell)
return process_return
def set_title(title='~Some Title~'):
"""Set title.
Used for window title and menu titles."""
global_vars['Title'] = title
os.system('title {}'.format(title))
def show_data(message='~Some message~', data='~Some data~', indent=8, width=32,
info=False, warning=False, error=False):
"""Display info with formatting."""
message = '{indent}{message:<{width}}{data}'.format(
indent=' '*indent, width=width, message=message, data=data)
if error:
print_error(message)
elif warning:
print_warning(message)
elif info:
print_info(message)
else:
print_standard(message)
def show_info(message='~Some message~', info='~Some info~', indent=8, width=32):
show_data(message=message, data=info, indent=indent, width=width)
def sleep(seconds=2):
"""Wait for a while."""
time.sleep(seconds)
def stay_awake():
"""Prevent the system from sleeping or hibernating."""
# Bail if caffeine is already running
for proc in psutil.process_iter():
if proc.name() == 'caffeine.exe':
return
# Extract and run
extract_item('Caffeine', silent=True)
try:
popen_program(global_vars['Tools']['Caffeine'])
except Exception:
print_error('ERROR: No caffeine available.')
print_warning('Please set the power setting to High Performance.')
def get_exception(s):
"""Get exception by name, returns Exception object."""
return getattr(sys.modules[__name__], s)
def try_and_print(message='Trying...',
function=None, cs='CS', ns='NS', other_results={},
catch_all=True, print_return=False, silent_function=True,
indent=8, width=32, *args, **kwargs):
"""Run function, print if successful or not, and return dict.
other_results is in the form of
{
'Warning': {'ExceptionClassName': 'Result Message'},
'Error': {'ExceptionClassName': 'Result Message'}
}
The the ExceptionClassNames will be excepted conditions
and the result string will be printed in the correct color.
catch_all=False will result in unspecified exceptions being re-raised."""
err = None
out = None
w_exceptions = other_results.get('Warning', {}).keys()
w_exceptions = tuple(get_exception(e) for e in w_exceptions)
e_exceptions = other_results.get('Error', {}).keys()
e_exceptions = tuple(get_exception(e) for e in e_exceptions)
w_results = other_results.get('Warning', {})
e_results = other_results.get('Error', {})
# Run function and catch errors
print_standard('{indent}{message:<{width}}'.format(
indent=' '*indent, message=message, width=width), end='', flush=True)
try:
out = function(*args, **kwargs)
if print_return:
print_standard(out[0], timestamp=False)
for item in out[1:]:
print_standard('{indent}{item}'.format(
indent=' '*(indent+width), item=item))
elif silent_function:
print_success(cs, timestamp=False)
except w_exceptions as e:
_result = w_results.get(e.__class__.__name__, 'Warning')
print_warning(_result, timestamp=False)
err = e
except e_exceptions as e:
_result = e_results.get(e.__class__.__name__, 'Error')
print_error(_result, timestamp=False)
err = e
except Exception:
print_error(ns, timestamp=False)
err = traceback.format_exc()
# Return or raise?
if err and not catch_all:
raise
else:
return {'CS': not bool(err), 'Error': err, 'Out': out}
def upload_data(path, file):
"""Add CLIENT_INFO_SERVER to authorized connections and upload file."""
if not ENABLED_UPLOAD_DATA:
raise GenericError('Feature disabled.')
extract_item('PuTTY', filter='wizkit.ppk psftp.exe', silent=True)
# Authorize connection to the server
winreg.CreateKey(HKCU, r'Software\SimonTatham\PuTTY\SshHostKeys')
with winreg.OpenKey(HKCU, r'Software\SimonTatham\PuTTY\SshHostKeys',
access=winreg.KEY_WRITE) as key:
winreg.SetValueEx(key,
'rsa2@22:{IP}'.format(**CLIENT_INFO_SERVER), 0,
winreg.REG_SZ, CLIENT_INFO_SERVER['RegEntry'])
# Write batch file
with open(r'{TmpDir}\psftp.batch'.format(**global_vars),
'w', encoding='ascii') as f:
f.write('lcd "{path}"\n'.format(path=path))
f.write('cd "{Share}"\n'.format(**CLIENT_INFO_SERVER))
f.write('mkdir {TicketNumber}\n'.format(**global_vars))
f.write('cd {TicketNumber}\n'.format(**global_vars))
f.write('put "{file}"\n'.format(file=file))
# Upload Info
cmd = [
global_vars['Tools']['PuTTY-PSFTP'],
'-noagent',
'-i', r'{BinDir}\PuTTY\wizkit.ppk'.format(**global_vars),
'{User}@{IP}'.format(**CLIENT_INFO_SERVER),
'-b', r'{TmpDir}\psftp.batch'.format(**global_vars)]
run_program(cmd)
def upload_info():
"""Upload compressed Info file to the NAS as set in settings.main.py."""
if not ENABLED_UPLOAD_DATA:
raise GenericError('Feature disabled.')
path = '{ClientDir}'.format(**global_vars)
file = 'Info_{Date-Time}.7z'.format(**global_vars)
upload_data(path, file)
def compress_info():
"""Compress ClientDir info folders with 7-Zip for upload_info()."""
path = '{ClientDir}'.format(**global_vars)
file = 'Info_{Date-Time}.7z'.format(**global_vars)
_cmd = [
global_vars['Tools']['SevenZip'],
'a', '-t7z', '-mx=9', '-bso0', '-bse0',
r'{}\{}'.format(path, file),
r'{ClientDir}\Info'.format(**global_vars)]
run_program(_cmd)
def wait_for_process(name, poll_rate=3):
"""Wait for process by name."""
running = True
while running:
sleep(poll_rate)
running = False
for proc in psutil.process_iter():
if re.search(r'^{}'.format(name), proc.name(), re.IGNORECASE):
running = True
sleep(1)
# global_vars functions
def init_global_vars():
"""Sets global variables based on system info."""
print_info('Initializing')
os.system('title Wizard Kit')
init_functions = [
['Checking .bin...', find_bin],
['Checking environment...', set_common_vars],
['Checking OS...', check_os],
['Checking tools...', check_tools],
['Creating folders...', make_tmp_dirs],
['Clearing collisions...', clean_env_vars],
]
try:
for f in init_functions:
try_and_print(
message=f[0], function=f[1],
cs='Done', ns='Error', catch_all=False)
except:
major_exception()
def check_os():
"""Set OS specific variables."""
tmp = {}
# Query registry
_reg_path = winreg.OpenKey(
HKLM, r'SOFTWARE\Microsoft\Windows NT\CurrentVersion')
for key in ['CSDVersion', 'CurrentBuild', 'CurrentBuildNumber',
'CurrentVersion', 'ProductName']:
try:
tmp[key] = winreg.QueryValueEx(_reg_path, key)[0]
if key in ['CurrentBuild', 'CurrentBuildNumber']:
tmp[key] = int(tmp[key])
except ValueError:
# Couldn't convert Build to int so this should be interesting...
tmp[key] = 0
except Exception:
tmp[key] = 'Unknown'
# Determine OS bit depth
tmp['Arch'] = 32
if 'PROGRAMFILES(X86)' in global_vars['Env']:
tmp['Arch'] = 64
# Determine OS Name
tmp['Name'] = '{ProductName} {CSDVersion}'.format(**tmp)
if tmp['CurrentBuild'] == 9600:
tmp['Name'] += ' Update' # Win 8.1u
if tmp['CurrentBuild'] == 10240:
tmp['Name'] += ' Release 1507 "Threshold 1"'
if tmp['CurrentBuild'] == 10586:
tmp['Name'] += ' Release 1511 "Threshold 2"'
if tmp['CurrentBuild'] == 14393:
tmp['Name'] += ' Release 1607 "Redstone 1" / "Anniversary Update"'
if tmp['CurrentBuild'] == 15063:
tmp['Name'] += ' Release 1703 "Redstone 2" / "Creators Update"'
if tmp['CurrentBuild'] == 16299:
tmp['Name'] += ' Release 1709 "Redstone 3" / "Fall Creators Update"'
tmp['Name'] = tmp['Name'].replace('Service Pack ', 'SP')
tmp['Name'] = tmp['Name'].replace('Unknown Release', 'Release')
tmp['Name'] = re.sub(r'\s+', ' ', tmp['Name'])
# Determine OS version
name = '{Name} x{Arch}'.format(**tmp)
if tmp['CurrentVersion'] == '6.0':
tmp['Version'] = 'Vista'
name += ' (very outdated)'
elif tmp['CurrentVersion'] == '6.1':
tmp['Version'] = '7'
if tmp['CSDVersion'] == 'Service Pack 1':
name += ' (outdated)'
else:
name += ' (very outdated)'
elif tmp['CurrentVersion'] in ['6.2', '6.3']:
if int(tmp['CurrentBuildNumber']) <= 9600:
tmp['Version'] = '8'
elif int(tmp['CurrentBuildNumber']) >= 10240:
tmp['Version'] = '10'
if tmp['CurrentBuild'] in [9200, 10240, 10586]:
name += ' (very outdated)'
elif tmp['CurrentBuild'] in [9600, 14393, 15063]:
name += ' (outdated)'
elif tmp['CurrentBuild'] == 16299:
pass # Current Win10
else:
name += ' (unrecognized)'
tmp['DisplayName'] = name
# == vista ==
# 6.0.6000
# 6.0.6001
# 6.0.6002
# ==== 7 ====
# 6.1.7600
# 6.1.7601
# 6.1.7602
# ==== 8 ====
# 6.2.9200
# === 8.1 ===
# 6.3.9200
# === 8.1u ==
# 6.3.9600
# === 10 v1507 "Threshold 1" ==
# 6.3.10240
# === 10 v1511 "Threshold 2" ==
# 6.3.10586
# === 10 v1607 "Redstone 1" "Anniversary Update" ==
# 6.3.14393
# === 10 v1703 "Redstone 2" "Creators Update" ==
# 6.3.15063
# === 10 v1709 "Redstone 3" "Fall Creators Update" ==
# 6.3.16299
global_vars['OS'] = tmp
def check_tools():
"""Set tool variables based on OS bit-depth and tool availability."""
if global_vars['OS'].get('Arch', 32) == 64:
global_vars['Tools'] = {
k: v.get('64', v.get('32')) for (k, v) in TOOLS.items()}
else:
global_vars['Tools'] = {k: v.get('32') for (k, v) in TOOLS.items()}
# Fix paths
global_vars['Tools'] = {k: os.path.join(global_vars['BinDir'], v)
for (k, v) in global_vars['Tools'].items()}
def clean_env_vars():
"""Remove conflicting global_vars and env variables.
This fixes an issue where both global_vars and
global_vars['Env'] are expanded at the same time."""
for key in global_vars.keys():
global_vars['Env'].pop(key, None)
def find_bin():
"""Find .bin folder in the cwd or it's parents."""
wd = os.getcwd()
base = None
while base is None:
if os.path.exists('.bin'):
base = os.getcwd()
break
if re.fullmatch(r'\w:\\', os.getcwd()):
break
os.chdir('..')
os.chdir(wd)
if base is None:
raise BinNotFoundError
global_vars['BaseDir'] = base
def make_tmp_dirs():
"""Make temp directories."""
os.makedirs(global_vars['BackupDir'], exist_ok=True)
os.makedirs(global_vars['LogDir'], exist_ok=True)
os.makedirs(global_vars['TmpDir'], exist_ok=True)
def set_common_vars():
"""Set common variables."""
global_vars['Date'] = time.strftime("%Y-%m-%d")
global_vars['Date-Time'] = time.strftime("%Y-%m-%d_%H%M_%z")
global_vars['Env'] = os.environ.copy()
global_vars['ArchivePassword'] = ARCHIVE_PASSWORD
global_vars['BinDir'] = r'{BaseDir}\.bin'.format(
**global_vars)
global_vars['CBinDir'] = r'{BaseDir}\.cbin'.format(
**global_vars)
global_vars['ClientDir'] = r'{SYSTEMDRIVE}\{prefix}'.format(
prefix=KIT_NAME_SHORT, **global_vars['Env'])
global_vars['BackupDir'] = r'{ClientDir}\Backups\{Date}'.format(
**global_vars)
global_vars['LogDir'] = r'{ClientDir}\Info\{Date}'.format(
**global_vars)
global_vars['ProgBackupDir'] = r'{ClientDir}\Backups'.format(
**global_vars)
global_vars['QuarantineDir'] = r'{ClientDir}\Quarantine'.format(
**global_vars)
global_vars['TmpDir'] = r'{BinDir}\tmp'.format(
**global_vars)
if __name__ == '__main__':
print("This file is not meant to be called directly.")

View file

@ -1,607 +0,0 @@
# Wizard Kit PE: Functions - Data
import ctypes
from operator import itemgetter
from functions.common import *
# Classes
class LocalDisk():
def __init__(self, disk):
self.disk = disk
self.name = disk.mountpoint.upper()
self.path = self.name
def is_dir(self):
# Should always be true
return True
# Regex
REGEX_EXCL_ITEMS = re.compile(
r'^(\.(AppleDB|AppleDesktop|AppleDouble'
r'|com\.apple\.timemachine\.supported|dbfseventsd'
r'|DocumentRevisions-V100.*|DS_Store|fseventsd|PKInstallSandboxManager'
r'|Spotlight.*|SymAV.*|symSchedScanLockxz|TemporaryItems|Trash.*'
r'|vol|VolumeIcon\.icns)|desktop\.(ini|.*DB|.*DF)'
r'|(hiberfil|pagefile)\.sys|lost\+found|Network\.*Trash\.*Folder'
r'|Recycle[dr]|System\.*Volume\.*Information|Temporary\.*Items'
r'|Thumbs\.db)$',
re.IGNORECASE)
REGEX_EXCL_ROOT_ITEMS = re.compile(
r'^\\?(boot(mgr|nxt)$|Config.msi'
r'|(eula|globdata|install|vc_?red)'
r'|.*.sys$|System Volume Information|RECYCLER?|\$Recycle\.bin'
r'|\$?Win(dows(.old.*|\.~BT|)$|RE_)|\$GetCurrent|Windows10Upgrade'
r'|PerfLogs|Program Files|SYSTEM.SAV'
r'|.*\.(esd|swm|wim|dd|map|dmg|image)$)',
re.IGNORECASE)
REGEX_INCL_ROOT_ITEMS = re.compile(
r'^\\?(AdwCleaner|(My\s*|)(Doc(uments?( and Settings|)|s?)|Downloads'
r'|Media|Music|Pic(ture|)s?|Vid(eo|)s?)'
r'|{prefix}(-?Info|-?Transfer|)'
r'|(ProgramData|Recovery|Temp.*|Users)$'
r'|.*\.(log|txt|rtf|qb\w*|avi|m4a|m4v|mp4|mkv|jpg|png|tiff?)$)'
r''.format(prefix=KIT_NAME_SHORT),
re.IGNORECASE)
REGEX_WIM_FILE = re.compile(
r'\.wim$',
re.IGNORECASE)
REGEX_WINDOWS_OLD = re.compile(
r'^\\Win(dows|)\.old',
re.IGNORECASE)
# STATIC VARIABLES
FAST_COPY_EXCLUDES = [
r'\*.esd',
r'\*.swm',
r'\*.wim',
r'\*.dd',
r'\*.dd.tgz',
r'\*.dd.txz',
r'\*.map',
r'\*.dmg',
r'\*.image',
r'$RECYCLE.BIN',
r'$Recycle.Bin',
r'.AppleDB',
r'.AppleDesktop',
r'.AppleDouble',
r'.com.apple.timemachine.supported',
r'.dbfseventsd',
r'.DocumentRevisions-V100*',
r'.DS_Store',
r'.fseventsd',
r'.PKInstallSandboxManager',
r'.Spotlight*',
r'.SymAV*',
r'.symSchedScanLockxz',
r'.TemporaryItems',
r'.Trash*',
r'.vol',
r'.VolumeIcon.icns',
r'desktop.ini',
r'Desktop?DB',
r'Desktop?DF',
r'hiberfil.sys',
r'lost+found',
r'Network?Trash?Folder',
r'pagefile.sys',
r'Recycled',
r'RECYCLER',
r'System?Volume?Information',
r'Temporary?Items',
r'Thumbs.db',
]
FAST_COPY_ARGS = [
'/cmd=noexist_only',
'/utf8',
'/skip_empty_dir',
'/linkdest',
'/no_ui',
'/auto_close',
'/exclude={}'.format(';'.join(FAST_COPY_EXCLUDES)),
]
# Code borrowed from: https://stackoverflow.com/a/29075319
SEM_NORMAL = ctypes.c_uint()
SEM_FAILCRITICALERRORS = 1
SEM_NOOPENFILEERRORBOX = 0x8000
SEM_FAIL = SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS
def cleanup_transfer(dest_path):
"""Fix attributes and move extraneous items outside the Transfer folder."""
try:
# Remove dest_path if empty
os.rmdir(dest_path)
except OSError:
pass
if not os.path.exists(dest_path):
# Bail if dest_path was empty and removed
raise Exception
# Fix attributes
cmd = ['attrib', '-a', '-h', '-r', '-s', dest_path]
run_program(cmd, check=False)
for root, dirs, files in os.walk(dest_path, topdown=False):
for name in dirs:
# Remove empty directories and junction points
try:
os.rmdir(os.path.join(root, name))
except OSError:
pass
for name in files:
# "Remove" files based on exclusion regex
if REGEX_EXCL_ITEMS.search(name):
# Make dest folder
dest_name = root.replace(dest_path, dest_path+'.Removed')
os.makedirs(dest_name, exist_ok=True)
# Set dest filename
dest_name = os.path.join(dest_name, name)
dest_name = non_clobber_rename(dest_name)
source_name = os.path.join(root, name)
try:
shutil.move(source_name, dest_name)
except Exception:
pass
def is_valid_wim_file(item):
"""Checks if the provided os.DirEntry is a valid WIM file, returns bool."""
valid = bool(item.is_file() and REGEX_WIM_FILE.search(item.name))
if valid:
extract_item('wimlib', silent=True)
cmd = [global_vars['Tools']['wimlib-imagex'], 'info', item.path]
try:
run_program(cmd)
except subprocess.CalledProcessError:
valid = False
print_log('WARNING: Image "{}" damaged.'.format(item.name))
return valid
def mount_backup_shares():
"""Mount the backup shares unless labeled as already mounted."""
for server in BACKUP_SERVERS:
# Blindly skip if we mounted earlier
if server['Mounted']:
continue
mount_network_share(server)
def mount_network_share(server):
"""Mount a network share defined by server."""
# Test connection
try:
ping(server['IP'])
except subprocess.CalledProcessError:
print_error(
r'Failed to mount \\{Name}\{Share}, {IP} unreachable.'.format(
**server))
sleep(1)
return False
# Mount
cmd = r'net use \\{IP}\{Share} /user:{User} {Pass}'.format(**server)
cmd = cmd.split(' ')
try:
run_program(cmd)
except Exception:
print_warning(r'Failed to mount \\{Name}\{Share} ({IP})'.format(
**server))
sleep(1)
else:
print_info('Mounted {Name}'.format(**server))
server['Mounted'] = True
def run_fast_copy(items, dest):
"""Copy items to dest using FastCopy."""
if not items:
raise Exception
cmd = [global_vars['Tools']['FastCopy'], *FAST_COPY_ARGS]
if 'LogFile' in global_vars:
cmd.append('/logfile={LogFile}'.format(**global_vars))
cmd.extend(items)
cmd.append('/to={}\\'.format(dest))
run_program(cmd)
def run_wimextract(source, items, dest):
"""Extract items from source WIM to dest folder."""
if not items:
raise Exception
extract_item('wimlib', silent=True)
# Write files.txt
with open(r'{TmpDir}\wim_files.txt'.format(**global_vars), 'w') as f:
# Defaults
for item in items:
f.write('{item}\n'.format(item=item))
sleep(1) # For safety?
# Extract files
cmd = [
global_vars['Tools']['wimlib-imagex'],
'extract',
source, '1',
r'@{TmpDir}\wim_files.txt'.format(**global_vars),
'--dest-dir={}\\'.format(dest),
'--no-acls',
'--nullglob']
run_program(cmd)
def scan_source(source_obj, dest_path):
"""Scan source for files/folders to transfer."""
selected_items = []
if source_obj.is_dir():
# File-Based
print_standard('Scanning source (folder): {}'.format(source_obj.path))
selected_items = scan_source_path(source_obj.path, dest_path)
else:
# Image-Based
if REGEX_WIM_FILE.search(source_obj.name):
print_standard('Scanning source (image): {}'.format(
source_obj.path))
selected_items = scan_source_wim(source_obj.path, dest_path)
else:
print_error('ERROR: Unsupported image: {}'.format(
source_obj.path))
raise GenericError
return selected_items
def scan_source_path(source_path, dest_path, rel_path=None, interactive=True):
"""Scan source folder for files/folders to transfer, returns list.
This will scan the root and (recursively) any Windows.old folders."""
rel_path = '\\' + rel_path if rel_path else ''
if rel_path:
dest_path = dest_path + rel_path
selected_items = []
win_olds = []
# Root items
root_items = []
for item in os.scandir(source_path):
if REGEX_INCL_ROOT_ITEMS.search(item.name):
root_items.append(item.path)
elif not REGEX_EXCL_ROOT_ITEMS.search(item.name):
if (not interactive
or ask('Copy: "{}{}" ?'.format(rel_path, item.name))):
root_items.append(item.path)
if REGEX_WINDOWS_OLD.search(item.name):
win_olds.append(item)
if root_items:
selected_items.append({
'Message': '{}Root Items...'.format(rel_path),
'Items': root_items.copy(),
'Destination': dest_path})
# Fonts
if os.path.exists(r'{}\Windows\Fonts'.format(source_path)):
selected_items.append({
'Message': '{}Fonts...'.format(rel_path),
'Items': [r'{}\Windows\Fonts'.format(rel_path)],
'Destination': r'{}\Windows'.format(dest_path)})
# Registry
registry_items = []
for folder in ['config', 'OEM']:
folder = r'Windows\System32\{}'.format(folder)
folder = os.path.join(source_path, folder)
if os.path.exists(folder):
registry_items.append(folder)
if registry_items:
selected_items.append({
'Message': '{}Registry...'.format(rel_path),
'Items': registry_items.copy(),
'Destination': r'{}\Windows\System32'.format(dest_path)})
# Windows.old(s)
for old in win_olds:
selected_items.append(
scan_source_path(
old.path, dest_path, rel_path=old.name, interactive=False))
# Done
return selected_items
def scan_source_wim(source_wim, dest_path, rel_path=None, interactive=True):
"""Scan source WIM file for files/folders to transfer, returns list.
This will scan the root and (recursively) any Windows.old folders."""
rel_path = '\\' + rel_path if rel_path else ''
selected_items = []
win_olds = []
# Scan source
extract_item('wimlib', silent=True)
cmd = [
global_vars['Tools']['wimlib-imagex'], 'dir',
source_wim, '1']
try:
file_list = run_program(cmd)
except subprocess.CalledProcessError:
print_error('ERROR: Failed to get file list.')
raise
# Root Items
file_list = [i.strip()
for i in file_list.stdout.decode('utf-8', 'ignore').splitlines()
if i.count('\\') == 1 and i.strip() != '\\']
root_items = []
if rel_path:
file_list = [i.replace(rel_path, '') for i in file_list]
for item in file_list:
if REGEX_INCL_ROOT_ITEMS.search(item):
root_items.append(item)
elif not REGEX_EXCL_ROOT_ITEMS.search(item):
if (not interactive
or ask('Extract: "{}{}" ?'.format(rel_path, item))):
root_items.append('{}{}'.format(rel_path, item))
if REGEX_WINDOWS_OLD.search(item):
win_olds.append(item)
if root_items:
selected_items.append({
'Message': '{}Root Items...'.format(rel_path),
'Items': root_items.copy(),
'Destination': dest_path})
# Fonts
if wim_contains(source_wim, r'{}Windows\Fonts'.format(rel_path)):
selected_items.append({
'Message': '{}Fonts...'.format(rel_path),
'Items': [r'{}\Windows\Fonts'.format(rel_path)],
'Destination': dest_path})
# Registry
registry_items = []
for folder in ['config', 'OEM']:
folder = r'{}Windows\System32\{}'.format(rel_path, folder)
if wim_contains(source_wim, folder):
registry_items.append(folder)
if registry_items:
selected_items.append({
'Message': '{}Registry...'.format(rel_path),
'Items': registry_items.copy(),
'Destination': dest_path})
# Windows.old(s)
for old in win_olds:
scan_source_wim(source_wim, dest_path, rel_path=old, interactive=False)
# Done
return selected_items
def select_destination(folder_path, prompt='Select destination'):
"""Select destination drive, returns path as string."""
disk = select_volume(prompt)
if 'fixed' not in disk['Disk'].opts:
folder_path = folder_path.replace('\\', '-')
path = '{disk}{folder_path}_{Date}'.format(
disk = disk['Disk'].mountpoint,
folder_path = folder_path,
**global_vars)
# Avoid merging with existing folder
path = non_clobber_rename(path)
os.makedirs(path, exist_ok=True)
return path
def select_source(ticket_number):
"""Select backup from those found on the BACKUP_SERVERS for the ticket."""
selected_source = None
sources = []
mount_backup_shares()
# Check for ticket folders on servers
for server in BACKUP_SERVERS:
if server['Mounted']:
print_standard('Scanning {}...'.format(server['Name']))
for d in os.scandir(r'\\{IP}\{Share}'.format(**server)):
if (d.is_dir()
and d.name.lower().startswith(ticket_number.lower())):
# Add folder to sources
sources.append({
'Name': '{:9}| File-Based: [DIR] {}'.format(
server['Name'], d.name),
'Server': server,
'Source': d})
# Check for images and subfolders
for ticket_path in sources.copy():
for item in os.scandir(ticket_path['Source'].path):
if item.is_dir():
# Add folder to sources
sources.append({
'Name': r'{:9}| File-Based: [DIR] {}\{}'.format(
ticket_path['Server']['Name'], # Server
ticket_path['Source'].name, # Ticket folder
item.name, # Sub-folder
),
'Server': ticket_path['Server'],
'Source': item})
# Check for images in folder
for subitem in os.scandir(item.path):
if REGEX_WIM_FILE.search(item.name):
# Add image to sources
try:
size = human_readable_size(item.stat().st_size)
except Exception:
size = ' ? ?' # unknown
sources.append({
'Disabled': bool(not is_valid_wim_file(subitem)),
'Name': r'{:9}| Image-Based: {:>7} {}\{}\{}'.format(
ticket_path['Server']['Name'], # Server
size, # Size (duh)
ticket_path['Source'].name, # Ticket folder
item.name, # Sub-folder
subitem.name, # Image file
),
'Server': ticket_path['Server'],
'Source': subitem})
elif REGEX_WIM_FILE.search(item.name):
# Add image to sources
try:
size = human_readable_size(item.stat().st_size)
except Exception:
size = ' ? ?' # unknown
sources.append({
'Disabled': bool(not is_valid_wim_file(item)),
'Name': r'{:9}| Image-Based: {:>7} {}\{}'.format(
ticket_path['Server']['Name'], # Server
size, # Size (duh)
ticket_path['Source'].name, # Ticket folder
item.name, # Image file
),
'Server': ticket_path['Server'],
'Source': item})
# Check for local sources
print_standard('Scanning for local sources...')
set_thread_error_mode(silent=True) # Prevents "No disk" popups
sys_drive = global_vars['Env']['SYSTEMDRIVE']
for d in psutil.disk_partitions():
if re.search(r'^{}'.format(sys_drive), d.mountpoint, re.IGNORECASE):
# Skip current OS drive
continue
if 'fixed' in d.opts:
# Skip DVD, etc
sources.append({
'Name': '{:9}| File-Based: [DISK] {}'.format(
' Local', d.mountpoint),
'Source': LocalDisk(d)})
set_thread_error_mode(silent=False) # Return to normal
# Build Menu
sources.sort(key=itemgetter('Name'))
actions = [{'Name': 'Quit', 'Letter': 'Q'}]
# Select backup from sources
if len(sources) > 0:
selection = menu_select(
'Which backup are we using?',
main_entries=sources,
action_entries=actions,
disabled_label='DAMAGED')
if selection == 'Q':
umount_backup_shares()
exit_script()
else:
selected_source = sources[int(selection)-1]['Source']
else:
print_error('ERROR: No backups found for ticket: {}.'.format(
ticket_number))
umount_backup_shares()
pause("Press Enter to exit...")
exit_script()
# Done
return selected_source
def select_volume(title='Select disk', auto_select=True):
"""Select disk from attached disks. returns dict."""
actions = [{'Name': 'Quit', 'Letter': 'Q'}]
disks = []
# Build list of disks
set_thread_error_mode(silent=True) # Prevents "No disk" popups
for d in psutil.disk_partitions():
info = {
'Disk': d,
'Name': d.mountpoint}
try:
usage = psutil.disk_usage(d.device)
free = '{free} / {total} available'.format(
free = human_readable_size(usage.free, 2),
total = human_readable_size(usage.total, 2))
except Exception:
# Meh, leaving unsupported destinations out
pass
# free = 'Unknown'
# info['Disabled'] = True
else:
info['Display Name'] = '{} ({})'.format(info['Name'], free)
disks.append(info)
set_thread_error_mode(silent=False) # Return to normal
# Skip menu?
if len(disks) == 1 and auto_select:
return disks[0]
# Show menu
selection = menu_select(title, main_entries=disks, action_entries=actions)
if selection == 'Q':
exit_script()
else:
return disks[int(selection)-1]
def set_thread_error_mode(silent=True):
"""Disable or Enable Windows error message dialogs.
Disable when scanning for disks to avoid popups for empty cardreaders, etc
"""
# Code borrowed from: https://stackoverflow.com/a/29075319
kernel32 = ctypes.WinDLL('kernel32')
if silent:
kernel32.SetThreadErrorMode(SEM_FAIL, ctypes.byref(SEM_NORMAL))
else:
kernel32.SetThreadErrorMode(SEM_NORMAL, ctypes.byref(SEM_NORMAL))
def transfer_source(source_obj, dest_path, selected_items):
"""Transfer, or extract, files/folders from source to destination."""
if source_obj.is_dir():
# Run FastCopy for each selection "group"
for group in selected_items:
try_and_print(message=group['Message'],
function=run_fast_copy, cs='Done',
items=group['Items'],
dest=group['Destination'])
else:
if REGEX_WIM_FILE.search(source_obj.name):
# Extract files from WIM
for group in selected_items:
try_and_print(message=group['Message'],
function=run_wimextract, cs='Done',
source=source_obj.path,
items=group['Items'],
dest=group['Destination'])
else:
print_error('ERROR: Unsupported image: {}'.format(source_obj.path))
raise GenericError
def umount_backup_shares():
"""Unnount the backup shares regardless of current status."""
for server in BACKUP_SERVERS:
umount_network_share(server)
def umount_network_share(server):
"""Unnount a network share defined by server."""
cmd = r'net use \\{IP}\{Share} /delete'.format(**server)
cmd = cmd.split(' ')
try:
run_program(cmd)
except Exception:
print_error(r'Failed to umount \\{Name}\{Share}.'.format(**server))
sleep(1)
else:
print_info('Umounted {Name}'.format(**server))
server['Mounted'] = False
def wim_contains(source_path, file_path):
"""Check if the WIM contains a file or folder."""
_cmd = [
global_vars['Tools']['wimlib-imagex'], 'dir',
source_path, '1',
'--path={}'.format(file_path),
'--one-file-only']
try:
run_program(_cmd)
except subprocess.CalledProcessError:
return False
else:
return True
if __name__ == '__main__':
print("This file is not meant to be called directly.")

View file

@ -1,325 +0,0 @@
# Wizard Kit PE: Functions - PARTITION UIDs
# sources: https://en.wikipedia.org/wiki/GUID_Partition_Table
# https://en.wikipedia.org/wiki/Partition_type
PARTITION_UIDS = {
'00': {'OS': 'All', 'Description': 'Empty partition entry'},
'01': {'OS': 'DOS 2.0+', 'Description': 'FAT12 as primary partition in first physical 32 MB of disk or as logical drive anywhere on disk (else use 06hinstead)'},
'02': {'OS': 'XENIX', 'Description': 'XENIX root'},
'03': {'OS': 'XENIX', 'Description': 'XENIX usr'},
'04': {'OS': 'DOS 3.0+', 'Description': 'FAT16 with less than 65536 sectors (32 MB). As primary partition it must reside in first physical 32 MB of disk, or as logical drive anywhere on disk (else use 06h instead).'},
'05': {'OS': 'DOS (3.2) 3.3+ / SpeedStor', 'Description': 'Extended partition with CHS addressing. It must reside in first physical 8 GB of disk, else use 0Fh instead / can occur in SpeedStor MBRs'},
'06': {'OS': 'DOS 3.31+', 'Description': 'FAT16B with 65536 or more sectors. It must reside in first physical 8 GB of disk, unless used for logical drives in an 0Fh extended partition (else use 0Eh instead). Also used for FAT12 and FAT16 volumes in primary partitions if they are not residing in first physical 32 MB of disk.'},
'07': {'OS': 'OS/2 1.2+ / OS/2 1.2+, Windows NT / Windows NT / Windows Embedded CE / QNX 2', 'Description': 'IFS / HPFS / NTFS / exFAT / QNX "qnx" (7) (pre-1988 only)'},
'08': {'OS': 'Commodore MS-DOS 3.x / OS/2 1.0-1.3 / AIX / QNX 1.x/2.x', 'Description': 'Logical sectored FAT12 or FAT16 / OS/2 (FAT?) / AIX boot/split / SplitDrive / QNX "qny" (8) / partition spanning multiple drives'},
'09': {'OS': 'AIX / QNX 1.x/2.x / Coherent / OS-9', 'Description': 'AIX data/boot / QNX "qnz" (9) / Coherent file system / OS-9 RBF'},
'0A': {'OS': 'OS/2 / Coherent', 'Description': 'OS/2 Boot Manager / Coherent swap partition'},
'0B': {'OS': 'DOS 7.1+', 'Description': 'FAT32 with CHS addressing'},
'0C': {'OS': 'DOS 7.1+', 'Description': 'FAT32 with LBA'},
'0D': {'OS': 'Silicon Safe', 'Description': 'Reserved'},
'0E': {'OS': 'DOS 7.0+', 'Description': 'FAT16B with LBA'},
'0F': {'OS': 'DOS 7.0+', 'Description': 'Extended partition with LBA'},
'10': {'OS': 'OPUS', 'Description': 'Unknown'},
'11': {'OS': 'Leading Edge MS-DOS 3.x / OS/2 Boot Manager', 'Description': 'Logical sectored FAT12 or FAT16 / Hidden FAT12 '},
'12': {'OS': 'Compaq Contura', 'Description': 'configuration partition (bootable FAT) / configuration partition / hibernation partition / diagnostics and firmware partition (bootable FAT) / service partition (bootable FAT) / Rescue and Recovery partition'},
'14': {'OS': 'AST MS-DOS 3.x / OS/2 Boot Manager / Maverick OS', 'Description': 'Logical sectored FAT12 or FAT16 / Hidden FAT16 / Omega file system'},
'15': {'OS': 'OS/2 Boot Manager / Maverick OS', 'Description': 'Hidden extended partition with CHS addressing / swap'},
'16': {'OS': 'OS/2 Boot Manager', 'Description': 'Hidden FAT16B '},
'17': {'OS': 'OS/2 Boot Manager', 'Description': 'Hidden IFS / Hidden HPFS / Hidden NTFS / Hidden exFAT '},
'18': {'OS': 'AST Windows', 'Description': 'AST Zero Volt Suspend or SmartSleep partition'},
'19': {'OS': 'Willowtech Photon coS', 'Description': 'Willowtech Photon coS'},
'1B': {'OS': 'OS/2 Boot Manager', 'Description': 'Hidden FAT32 '},
'1C': {'OS': 'OS/2 Boot Manager', 'Description': 'Hidden FAT32 with LBA '},
'1E': {'OS': 'OS/2 Boot Manager', 'Description': 'Hidden FAT16 with LBA '},
'1F': {'OS': 'OS/2 Boot Manager', 'Description': 'Hidden extended partition with LBA addressing '},
'20': {'OS': 'Windows Mobile', 'Description': 'Windows Mobile update XIP / Willowsoft Overture File System (OFS1)'},
'21': {'OS': 'Oxygen', 'Description': 'HP Volume Expansion (SpeedStor) / FSo2 (Oxygen File System)'},
'22': {'OS': 'Oxygen', 'Description': 'Oxygen Extended Partition Table'},
'23': {'OS': 'Windows Mobile', 'Description': 'Reserved / Windows Mobile boot XIP'},
'24': {'OS': 'NEC MS-DOS 3.30', 'Description': 'Logical sectored FAT12 or FAT16 '},
'25': {'OS': 'Windows Mobile', 'Description': 'Windows Mobile IMGFS[citation needed]'},
'26': {'OS': 'Microsoft, IBM', 'Description': 'Reserved'},
'27': {'OS': 'Windows / PQservice / MirOS BSD / RooterBOOT', 'Description': 'Windows Recovery Environment (RE) partition (hidden NTFS partition type 07h) / FAT32 or NTFS rescue partition / MirOS partition / RooterBOOT kernel partition (contains a raw ELF Linux kernel, no file system)'},
'2A': {'OS': 'AtheOS', 'Description': 'AtheOS file system (AthFS, AFS) (an extension of BFS, see 2Bh and EBh) / Reserved'},
'2B': {'OS': 'SyllableOS', 'Description': 'SyllableSecure (SylStor), a variant of AthFS (an extension of BFS, see 2Ah and EBh)'},
'31': {'OS': 'Microsoft, IBM', 'Description': 'Reserved'},
'32': {'OS': 'NOS', 'Description': 'Unknown'},
'33': {'OS': 'Microsoft, IBM', 'Description': 'Reserved'},
'34': {'OS': 'Microsoft, IBM', 'Description': 'Reserved'},
'35': {'OS': 'OS/2 Warp Server /eComStation', 'Description': 'JFS (OS/2 implementation of AIX Journaling File system)'},
'36': {'OS': 'Microsoft, IBM', 'Description': 'Reserved'},
'38': {'OS': 'THEOS', 'Description': 'THEOS version 3.2, 2 GB partition'},
'39': {'OS': 'Plan 9 / THEOS', 'Description': 'Plan 9 edition 3 partition (sub-partitions described in second sector of partition) / THEOS version 4 spanned partition'},
'3A': {'OS': 'THEOS', 'Description': 'THEOS version 4, 4 GB partition'},
'3B': {'OS': 'THEOS', 'Description': 'THEOS version 4 extended partition'},
'3C': {'OS': 'PartitionMagic', 'Description': 'PqRP (PartitionMagic or DriveImage in progress)'},
'3D': {'OS': 'PartitionMagic', 'Description': 'Hidden NetWare'},
'3F': {'OS': 'OS/32', 'Description': 'Unknown'},
'40': {'OS': 'PICK / Venix', 'Description': 'PICK R83 / Venix 80286'},
'41': {'OS': 'Personal RISC / Linux / PowerPC', 'Description': 'Personal RISC Boot / Old Linux/Minix (disk shared with DR DOS 6.0) / PPC PReP (Power PC Reference Platform) Boot'},
'42': {'OS': 'SFS / Linux / Windows 2000, XP, etc.', 'Description': 'Secure File system (SFS) / Old Linux swap (disk shared with DR DOS 6.0) / Dynamic extended partition marker'},
'43': {'OS': 'Linux', 'Description': 'Old Linux native (disk shared with DR DOS 6.0) '},
'44': {'OS': 'GoBack', 'Description': 'Norton GoBack, WildFile GoBack, Adaptec GoBack, Roxio GoBack'},
'45': {'OS': 'Boot-US / EUMEL/ELAN', 'Description': 'Priam / Boot-US boot manager (1 cylinder) / EUMEL/ELAN (L2)'},
'46': {'OS': 'EUMEL/ELAN', 'Description': 'EUMEL/ELAN (L2)'},
'47': {'OS': 'EUMEL/ELAN', 'Description': 'EUMEL/ELAN (L2)'},
'48': {'OS': 'EUMEL/ELAN', 'Description': 'EUMEL/ELAN (L2), ERGOS L3'},
'4A': {'OS': 'AdaOS / ALFS/THIN', 'Description': 'Aquila / ALFS/THIN advanced lightweight file system for DOS'},
'4C': {'OS': 'ETH Oberon', 'Description': 'Aos (A2) file system (76)'},
'4D': {'OS': 'QNX 4.x, Neutrino', 'Description': 'Primary QNX POSIX volume on disk (77)'},
'4E': {'OS': 'QNX 4.x, Neutrino', 'Description': 'Secondary QNX POSIX volume on disk (78)'},
'4F': {'OS': 'QNX 4.x, Neutrino / ETH Oberon', 'Description': 'Tertiary QNX POSIX volume on disk (79) / boot / native file system (79)'},
'50': {'OS': 'ETH Oberon / Disk Manager 4 / LynxOS / Novell', 'Description': 'Alternative native file system (80) / Read-only partition (old) / Lynx RTOS'},
'51': {'OS': 'Disk Manager 4-6', 'Description': 'Read-write partition (Aux 1)'},
'52': {'OS': 'CP/M-80 / System V/AT, V/386', 'Description': 'CP/M-80'},
'53': {'OS': 'Disk Manager 6', 'Description': 'Auxiliary 3 (WO)'},
'54': {'OS': 'Disk Manager 6', 'Description': 'Dynamic Drive Overlay (DDO)'},
'55': {'OS': 'EZ-Drive', 'Description': 'EZ-Drive, Maxtor, MaxBlast, or DriveGuide INT 13h redirector volume'},
'56': {'OS': 'AT&T MS-DOS 3.x / EZ-Drive / VFeature', 'Description': 'Logical sectored FAT12 or FAT16 / Disk Manager partition converted to EZ-BIOS / VFeature partitionned volume'},
'57': {'OS': 'DrivePro', 'Description': 'VNDI partition'},
'5C': {'OS': 'EDISK', 'Description': 'Priam EDisk Partitioned Volume '},
'61': {'OS': 'SpeedStor', 'Description': 'Unknown'},
'63': {'OS': 'Unix', 'Description': 'SCO Unix, ISC, UnixWare, AT&T System V/386, ix, MtXinu BSD 4.3 on Mach, GNU HURD'},
'64': {'OS': 'SpeedStor / NetWare', 'Description': 'NetWare File System 286/2 / PC-ARMOUR'},
'65': {'OS': 'NetWare', 'Description': 'NetWare File System 386'},
'66': {'OS': 'NetWare / NetWare', 'Description': 'NetWare File System 386 / Storage Management Services (SMS)'},
'67': {'OS': 'NetWare', 'Description': 'Wolf Mountain'},
'68': {'OS': 'NetWare', 'Description': 'Unknown'},
'69': {'OS': 'NetWare 5 / NetWare', 'Description': 'Novell Storage Services (NSS)'},
'6E': {'Description': 'Unknown'},
'70': {'OS': 'DiskSecure', 'Description': 'DiskSecure multiboot'},
'71': {'OS': 'Microsoft, IBM', 'Description': 'Reserved'},
'72': {'OS': 'APTI conformant systems / Unix V7/x86', 'Description': 'APTI alternative FAT12 (CHS, SFN) / V7/x86'},
'73': {'OS': 'Microsoft, IBM', 'Description': 'Reserved'},
'74': {'OS': 'Microsoft, IBM', 'Description': 'Reserved / Scramdisk'},
'75': {'OS': 'PC/IX', 'Description': 'Unknown'},
'76': {'OS': 'Microsoft, IBM', 'Description': 'Reserved'},
'77': {'OS': 'Novell', 'Description': 'VNDI, M2FS, M2CS'},
'78': {'OS': 'Geurt Vos', 'Description': 'XOSL bootloader file system'},
'79': {'OS': 'APTI conformant systems', 'Description': 'APTI alternative FAT16 (CHS, SFN) '},
'7A': {'OS': 'APTI conformant systems', 'Description': 'APTI alternative FAT16 (LBA, SFN) '},
'7B': {'OS': 'APTI conformant systems', 'Description': 'APTI alternative FAT16B (CHS, SFN) '},
'7C': {'OS': 'APTI conformant systems', 'Description': 'APTI alternative FAT32 (LBA, SFN) '},
'7D': {'OS': 'APTI conformant systems', 'Description': 'APTI alternative FAT32 (CHS, SFN) '},
'7E': {'OS': 'F.I.X. (claim) / PrimoCache', 'Description': 'Level 2 cache'},
'7F': {'OS': 'Varies', 'Description': 'Alternative OS Development Partition Standard - reserved for individual or local use and temporary or experimental projects'},
'80': {'OS': 'Minix 1.1-1.4a', 'Description': 'Minix file system (old)'},
'81': {'OS': 'Minix 1.4b+ / Linux', 'Description': 'MINIX file system / Mitac Advanced Disk Manager'},
'82': {'OS': 'Linux / Sun Microsystems', 'Description': 'Linux swap space / Solaris x86 (for Sun disklabels up to 2005) / Prime'},
'83': {'OS': 'GNU/Linux', 'Description': 'Any native Linux file system '},
'84': {'OS': 'OS/2 / Windows 7', 'Description': 'APM hibernation (suspend to disk, S2D) / Hidden C: (FAT16) / Rapid Start technology'},
'85': {'OS': 'GNU/Linux', 'Description': 'Linux extended '},
'86': {'OS': 'Windows NT 4 Server / Linux', 'Description': 'Fault-tolerant FAT16B mirrored volume set / Linux RAID superblock with auto-detect (old)'},
'87': {'OS': 'Windows NT 4 Server', 'Description': 'Fault-tolerant HPFS/NTFS mirrored volume set '},
'88': {'OS': 'GNU/Linux', 'Description': 'Linux plaintext partition table'},
'8A': {'OS': 'AiR-BOOT', 'Description': 'Linux kernel image'},
'8B': {'OS': 'Windows NT 4 Server', 'Description': 'Legacy fault-tolerant FAT32 mirrored volume set '},
'8C': {'OS': 'Windows NT 4 Server', 'Description': 'Legacy fault-tolerant FAT32 mirrored volume set '},
'8D': {'OS': 'Free FDISK', 'Description': 'Hidden FAT12 '},
'8E': {'OS': 'Linux', 'Description': 'Linux LVM'},
'90': {'OS': 'Free FDISK', 'Description': 'Hidden FAT16 '},
'91': {'OS': 'Free FDISK', 'Description': 'Hidden extended partition with CHS addressing '},
'92': {'OS': 'Free FDISK', 'Description': 'Hidden FAT16B '},
'93': {'OS': 'Amoeba / Linux', 'Description': 'Amoeba native file system / Hidden Linux file system'},
'94': {'OS': 'Amoeba', 'Description': 'Amoeba bad block table'},
'95': {'OS': 'EXOPC', 'Description': 'EXOPC native'},
'96': {'OS': 'CHRP', 'Description': 'ISO-9660 file system'},
'97': {'OS': 'Free FDISK', 'Description': 'Hidden FAT32 '},
'98': {'OS': 'Free FDISK / ROM-DOS', 'Description': 'Hidden FAT32 / service partition (bootable FAT) ROM-DOS SuperBoot / service partition (bootable FAT)'},
'99': {'OS': 'early Unix', 'Description': 'Unknown'},
'9A': {'OS': 'Free FDISK', 'Description': 'Hidden FAT16 '},
'9B': {'OS': 'Free FDISK', 'Description': 'Hidden extended partition with LBA '},
'9E': {'OS': 'VSTA / ForthOS', 'Description': 'ForthOS (eForth port)'},
'9F': {'OS': 'BSD/OS 3.0+, BSDI', 'Description': 'Unknown'},
'A0': {'OS': 'Hewlett Packard / Phoenix, IBM, Toshiba, Sony', 'Description': 'Diagnostic partition for HP laptops / Hibernate partition'},
'A1': {'OS': 'Hewlett Packard / Phoenix, NEC', 'Description': 'HP Volume Expansion (SpeedStor) / Hibernate partition'},
'A2': {'OS': 'Cyclone V', 'Description': 'Hard Processor System (HPS) ARM preloader'},
'A3': {'OS': 'Hewlett Packard', 'Description': 'HP Volume Expansion (SpeedStor)'},
'A4': {'OS': 'Hewlett Packard', 'Description': 'HP Volume Expansion (SpeedStor)'},
'A5': {'OS': 'BSD', 'Description': 'BSD slice (BSD/386, 386BSD, NetBSD (old), FreeBSD)'},
'A6': {'OS': 'OpenBSD', 'Description': 'HP Volume Expansion (SpeedStor) / OpenBSD slice'},
'A7': {'OS': 'NeXT', 'Description': 'NeXTSTEP'},
'A8': {'OS': 'Darwin, Mac OS X', 'Description': 'Apple Darwin, Mac OS X UFS'},
'A9': {'OS': 'NetBSD', 'Description': 'NetBSD slice'},
'AA': {'OS': 'MS-DOS', 'Description': 'Olivetti MS-DOS FAT12 (1.44 MB) '},
'AB': {'OS': 'Darwin, Mac OS X / GO! OS', 'Description': 'Apple Darwin, Mac OS X boot / GO!'},
'AD': {'OS': 'RISC OS', 'Description': 'ADFS / FileCore format'},
'AE': {'OS': 'ShagOS', 'Description': 'ShagOS file system'},
'AF': {'OS': 'ShagOS', 'Description': 'Apple Mac OS X HFS and HFS+ / ShagOS swap'},
'B0': {'OS': 'Boot-Star', 'Description': 'Boot-Star dummy partition'},
'B1': {'OS': 'QNX 6.x', 'Description': 'HP Volume Expansion (SpeedStor) / QNX Neutrino power-safe file system'},
'B2': {'OS': 'QNX 6.x', 'Description': 'QNX Neutrino power-safe file system'},
'B3': {'OS': 'QNX 6.x', 'Description': 'HP Volume Expansion (SpeedStor) / QNX Neutrino power-safe file system'},
'B4': {'OS': 'Hewlett Packard', 'Description': 'HP Volume Expansion (SpeedStor)'},
'B6': {'OS': 'Windows NT 4 Server', 'Description': 'HP Volume Expansion (SpeedStor) / Corrupted fault-tolerant FAT16B mirrored master volume '},
'B7': {'OS': 'BSDI (before 3.0) / Windows NT 4 Server', 'Description': 'BSDI native file system / swap / Corrupted fault-tolerant HPFS/NTFS mirrored master volume '},
'B8': {'OS': 'BSDI (before 3.0)', 'Description': 'BSDI swap / native file system'},
'BB': {'OS': 'BootWizard, OS Selector / Acronis True Image / Windows NT 4 Server', 'Description': 'PTS BootWizard 4 / OS Selector 5 for hidden partitions other than 01h, 04h, 06h, 07h, 0Bh, 0Ch, 0Eh and unformatted partitions / OEM Secure Zone (corresponds to BCh) / Corrupted fault-tolerant FAT32 mirrored master volume '},
'BC': {'OS': 'Windows NT 4 Server / Acronis True Image / Backup Capsule', 'Description': 'Corrupted fault-tolerant FAT32 mirrored master volume / Acronis Secure Zone / Backup Capsule'},
'BD': {'OS': 'BonnyDOS/286', 'Description': 'Unknown'},
'BE': {'OS': 'Solaris 8', 'Description': 'Solaris 8 boot'},
'BF': {'OS': 'Solaris', 'Description': 'Solaris x86 (for Sun disklabels, since 2005)'},
'C0': {'OS': 'DR-DOS, Multiuser DOS,REAL/32', 'Description': 'Secured FAT partition (smaller than 32 MB)'},
'C1': {'OS': 'DR DOS 6.0+', 'Description': 'Secured FAT12 '},
'C2': {'OS': 'Power Boot', 'Description': 'Hidden Linux native file system'},
'C3': {'OS': 'Power Boot', 'Description': 'Hidden Linux swap'},
'C4': {'OS': 'DR DOS 6.0+', 'Description': 'Secured FAT16 '},
'C5': {'OS': 'DR DOS 6.0+', 'Description': 'Secured extended partition with CHS addressing '},
'C6': {'OS': 'DR DOS 6.0+ / Windows NT 4 Server', 'Description': 'Secured FAT16B / Corrupted fault-tolerant FAT16B mirrored slave volume '},
'C7': {'OS': 'Syrinx / Windows NT 4 Server', 'Description': 'Syrinx boot / Corrupted fault-tolerant HPFS/NTFS mirrored slave volume '},
'C8': {'Description': 'Reserved for DR-DOS since 1997'},
'C9': {'Description': 'Reserved for DR-DOS since 1997'},
'CA': {'Description': 'Reserved for DR-DOS since 1997'},
'CB': {'OS': 'DR-DOS 7.0x / Windows NT 4 Server', 'Description': 'Secured FAT32 / Corrupted fault-tolerant FAT32 mirrored slave volume '},
'CC': {'OS': 'DR-DOS 7.0x / Windows NT 4 Server', 'Description': 'Secured FAT32 / Corrupted fault-tolerant FAT32 mirrored slave volume '},
'CD': {'OS': 'CTOS', 'Description': 'Memory dump'},
'CE': {'OS': 'DR-DOS 7.0x', 'Description': 'Secured FAT16B '},
'CF': {'OS': 'DR-DOS 7.0x', 'Description': 'Secured extended partition with LBA '},
'D0': {'OS': 'Multiuser DOS, REAL/32', 'Description': 'Secured FAT partition (larger than 32 MB)'},
'D1': {'OS': 'Multiuser DOS', 'Description': 'Secured FAT12 '},
'D4': {'OS': 'Multiuser DOS', 'Description': 'Secured FAT16 '},
'D5': {'OS': 'Multiuser DOS', 'Description': 'Secured extended partition with CHS addressing '},
'D6': {'OS': 'Multiuser DOS', 'Description': 'Secured FAT16B '},
'D8': {'OS': 'Digital Research', 'Description': 'CP/M-86 [citation needed]'},
'DA': {'OS': 'Powercopy Backup', 'Description': 'Non-file system data / Shielded disk'},
'DB': {'OS': 'CP/M-86,Concurrent CP/M-86,Concurrent DOS / CTOS / D800 / DRMK', 'Description': 'CP/M-86, Concurrent CP/M-86, Concurrent DOS / boot image for x86 supervisor CPU (SCPU) module / FAT32 system restore partition (DSR)'},
'DD': {'OS': 'CTOS', 'Description': 'Hidden memory dump'},
'DE': {'OS': 'Dell', 'Description': 'FAT16 utility/diagnostic partition'},
'DF': {'OS': 'DG/UX / BootIt / Aviion', 'Description': 'DG/UX virtual disk manager / EMBRM'},
'E0': {'OS': 'STMicroelectronics', 'Description': 'ST AVFS'},
'E1': {'OS': 'SpeedStor', 'Description': 'Extended FAT12 (> 1023 cylinder)'},
'E2': {'Description': 'DOS read-only (XFDISK)'},
'E3': {'OS': 'SpeedStor', 'Description': 'DOS read-only'},
'E4': {'OS': 'SpeedStor', 'Description': 'Extended FAT16 (< 1024 cylinder)'},
'E5': {'OS': 'Tandy MS-DOS', 'Description': 'Logical sectored FAT12 or FAT16'},
'E6': {'OS': 'SpeedStor', 'Description': 'Unknown'},
'E8': {'OS': 'LUKS', 'Description': 'Linux Unified Key Setup'},
'EB': {'OS': 'BeOS, Haiku', 'Description': 'BFS'},
'EC': {'OS': 'SkyOS', 'Description': 'SkyFS'},
'ED': {'OS': 'Sprytix / EDD 4', 'Description': 'EDC loader / GPT hybrid MBR'},
'EE': {'OS': 'EFI', 'Description': 'GPT protective MBR'},
'EF': {'OS': 'EFI', 'Description': 'EFI system partition can be a FAT12, FAT16, FAT32 (or other) file system'},
'F0': {'OS': 'Linux / OS/32', 'Description': 'PA-RISC Linux boot loader. It must reside in first physical 2 GB. / floppy'},
'F1': {'OS': 'SpeedStor', 'Description': 'Unknown'},
'F2': {'OS': 'Sperry IT MS-DOS 3.x, Unisys MS-DOS 3.3, Digital ResearchDOS Plus 2.1', 'Description': 'Logical sectored FAT12 or FAT16 secondary partition'},
'F3': {'OS': 'SpeedStor', 'Description': 'Unknown'},
'F4': {'OS': 'SpeedStor / Prologue', 'Description': '"large" DOS partition / single volume partition for NGF or TwinFS'},
'F5': {'OS': 'Prologue', 'Description': 'MD0-MD9 multi volume partition for NGF or TwinFS'},
'F6': {'OS': 'SpeedStor', 'Description': 'Unknown'},
'F7': {'OS': 'O.S.G. / X1', 'Description': 'EFAT / Solid State file system'},
'F9': {'OS': 'Linux', 'Description': 'pCache ext2/ext3 persistent cache'},
'FA': {'OS': 'Bochs', 'Description': 'x86 emulator'},
'FB': {'OS': 'VMware', 'Description': 'VMware VMFS file system partition'},
'FC': {'OS': 'VMware', 'Description': 'VMware swap / VMKCORE kernel dump partition'},
'FD': {'OS': 'Linux / FreeDOS', 'Description': 'Linux RAID superblock with auto-detect / Reserved for FreeDOS'},
'FE': {'OS': 'SpeedStor / LANstep / Windows NT / Linux', 'Description': 'partition > 1024 cylinder / PS/2 IML partition / PS/2 recovery partition (FAT12 reference disk floppy image), / Disk Administration hidden partition / old Linux LVM'},
'FF': {'OS': 'XENIX', 'Description': 'XENIX bad block table'},
'00000000-0000-0000-0000-000000000000': {'Description': 'Unused entry'},
'024DEE41-33E7-11D3-9D69-0008C781F39F': {'Description': 'MBR partition scheme'},
'C12A7328-F81F-11D2-BA4B-00A0C93EC93B': {'Description': 'EFI System partition'},
'21686148-6449-6E6F-744E-656564454649': {'Description': 'BIOS Boot partition'},
'D3BFE2DE-3DAF-11DF-BA40-E3A556D89593': {'Description': 'Intel Fast Flash (iFFS) partition (for Intel Rapid Start technology)'},
'F4019732-066E-4E12-8273-346C5641494F': {'Description': 'Sony boot partition'},
'BFBFAFE7-A34F-448A-9A5B-6213EB736C22': {'Description': 'Lenovo boot partition'},
'E3C9E316-0B5C-4DB8-817D-F92DF00215AE': {'OS': 'Windows', 'Description': 'Microsoft Reserved Partition (MSR)'},
'EBD0A0A2-B9E5-4433-87C0-68B6B72699C7': {'OS': 'Windows', 'Description': 'Basic data partition'},
'5808C8AA-7E8F-42E0-85D2-E1E90434CFB3': {'OS': 'Windows', 'Description': 'Logical Disk Manager (LDM) metadata partition'},
'AF9B60A0-1431-4F62-BC68-3311714A69AD': {'OS': 'Windows', 'Description': 'Logical Disk Manager data partition'},
'DE94BBA4-06D1-4D40-A16A-BFD50179D6AC': {'OS': 'Windows', 'Description': 'Windows Recovery Environment'},
'37AFFC90-EF7D-4E96-91C3-2D7AE055B174': {'OS': 'Windows', 'Description': 'IBM General Parallel File System (GPFS) partition'},
'E75CAF8F-F680-4CEE-AFA3-B001E56EFC2D': {'OS': 'Windows', 'Description': 'Storage Spaces partition'},
'75894C1E-3AEB-11D3-B7C1-7B03A0000000': {'OS': 'HP-UX', 'Description': 'Data partition'},
'E2A1E728-32E3-11D6-A682-7B03A0000000': {'OS': 'HP-UX', 'Description': 'Service Partition'},
'0FC63DAF-8483-4772-8E79-3D69D8477DE4': {'OS': 'Linux', 'Description': 'Linux filesystem data'},
'A19D880F-05FC-4D3B-A006-743F0F84911E': {'OS': 'Linux', 'Description': 'RAID partition'},
'44479540-F297-41B2-9AF7-D131D5F0458A': {'OS': 'Linux', 'Description': 'Root partition (x86)'},
'4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709': {'OS': 'Linux', 'Description': 'Root partition (x86-64)'},
'69DAD710-2CE4-4E3C-B16C-21A1D49ABED3': {'OS': 'Linux', 'Description': 'Root partition (32-bit ARM)'},
'B921B045-1DF0-41C3-AF44-4C6F280D3FAE': {'OS': 'Linux', 'Description': 'Root partition (64-bit ARM/AArch64)'},
'0657FD6D-A4AB-43C4-84E5-0933C84B4F4F': {'OS': 'Linux', 'Description': 'Swap partition'},
'E6D6D379-F507-44C2-A23C-238F2A3DF928': {'OS': 'Linux', 'Description': 'Logical Volume Manager (LVM) partition'},
'933AC7E1-2EB4-4F13-B844-0E14E2AEF915': {'OS': 'Linux', 'Description': '/home partition'},
'3B8F8425-20E0-4F3B-907F-1A25A76F98E8': {'OS': 'Linux', 'Description': '/srv (server data) partition'},
'7FFEC5C9-2D00-49B7-8941-3EA10A5586B7': {'OS': 'Linux', 'Description': 'Plain dm-crypt partition'},
'CA7D7CCB-63ED-4C53-861C-1742536059CC': {'OS': 'Linux', 'Description': 'LUKS partition'},
'8DA63339-0007-60C0-C436-083AC8230908': {'OS': 'Linux', 'Description': 'Reserved'},
'83BD6B9D-7F41-11DC-BE0B-001560B84F0F': {'OS': 'FreeBSD', 'Description': 'Boot partition'},
'516E7CB4-6ECF-11D6-8FF8-00022D09712B': {'OS': 'FreeBSD', 'Description': 'Data partition'},
'516E7CB5-6ECF-11D6-8FF8-00022D09712B': {'OS': 'FreeBSD', 'Description': 'Swap partition'},
'516E7CB6-6ECF-11D6-8FF8-00022D09712B': {'OS': 'FreeBSD', 'Description': 'Unix File System (UFS) partition'},
'516E7CB8-6ECF-11D6-8FF8-00022D09712B': {'OS': 'FreeBSD', 'Description': 'Vinum volume manager partition'},
'516E7CBA-6ECF-11D6-8FF8-00022D09712B': {'OS': 'FreeBSD', 'Description': 'ZFS partition'},
'48465300-0000-11AA-AA11-00306543ECAC': {'OS': 'OS X Darwin', 'Description': 'Hierarchical File System Plus (HFS+) partition'},
'55465300-0000-11AA-AA11-00306543ECAC': {'OS': 'OS X Darwin', 'Description': 'Apple UFS'},
'6A898CC3-1DD2-11B2-99A6-080020736631': {'OS': 'OS X Darwin', 'Description': 'ZFS'},
'52414944-0000-11AA-AA11-00306543ECAC': {'OS': 'OS X Darwin', 'Description': 'Apple RAID partition'},
'52414944-5F4F-11AA-AA11-00306543ECAC': {'OS': 'OS X Darwin', 'Description': 'Apple RAID partition, offline'},
'426F6F74-0000-11AA-AA11-00306543ECAC': {'OS': 'OS X Darwin', 'Description': 'Apple Boot partition (Recovery HD)'},
'4C616265-6C00-11AA-AA11-00306543ECAC': {'OS': 'OS X Darwin', 'Description': 'Apple Label'},
'5265636F-7665-11AA-AA11-00306543ECAC': {'OS': 'OS X Darwin', 'Description': 'Apple TV Recovery partition'},
'53746F72-6167-11AA-AA11-00306543ECAC': {'OS': 'OS X Darwin', 'Description': 'Apple Core Storage (i.e. Lion FileVault) partition'},
'6A82CB45-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos', 'Description': 'Boot partition'},
'6A85CF4D-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos', 'Description': 'Root partition'},
'6A87C46F-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos', 'Description': 'Swap partition'},
'6A8B642B-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos', 'Description': 'Backup partition'},
'6A898CC3-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos', 'Description': '/usr partition'},
'6A8EF2E9-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos', 'Description': '/var partition'},
'6A90BA39-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos', 'Description': '/home partition'},
'6A9283A5-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos', 'Description': 'Alternate sector'},
'6A945A3B-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos', 'Description': 'Reserved partition'},
'6A9630D1-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos'},
'6A980767-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos'},
'6A96237F-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos'},
'6A8D2AC7-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos'},
'49F48D32-B10E-11DC-B99B-0019D1879648': {'OS': 'NetBSD', 'Description': 'Swap partition'},
'49F48D5A-B10E-11DC-B99B-0019D1879648': {'OS': 'NetBSD', 'Description': 'FFS partition'},
'49F48D82-B10E-11DC-B99B-0019D1879648': {'OS': 'NetBSD', 'Description': 'LFS partition'},
'49F48DAA-B10E-11DC-B99B-0019D1879648': {'OS': 'NetBSD', 'Description': 'RAID partition'},
'2DB519C4-B10F-11DC-B99B-0019D1879648': {'OS': 'NetBSD', 'Description': 'Concatenated partition'},
'2DB519EC-B10F-11DC-B99B-0019D1879648': {'OS': 'NetBSD', 'Description': 'Encrypted partition'},
'FE3A2A5D-4F32-41A7-B725-ACCC3285A309': {'OS': 'ChromeOS', 'Description': 'ChromeOS kernel'},
'3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC': {'OS': 'ChromeOS', 'Description': 'ChromeOS rootfs'},
'2E0A753D-9E48-43B0-8337-B15192CB1B5E': {'OS': 'ChromeOS', 'Description': 'ChromeOS future use'},
'42465331-3BA3-10F1-802A-4861696B7521': {'OS': 'Haiku', 'Description': 'Haiku BFS'},
'85D5E45E-237C-11E1-B4B3-E89A8F7FC3A7': {'OS': 'MidnightBSD', 'Description': 'Boot partition'},
'85D5E45A-237C-11E1-B4B3-E89A8F7FC3A7': {'OS': 'MidnightBSD', 'Description': 'Data partition'},
'85D5E45B-237C-11E1-B4B3-E89A8F7FC3A7': {'OS': 'MidnightBSD', 'Description': 'Swap partition'},
'0394EF8B-237E-11E1-B4B3-E89A8F7FC3A7': {'OS': 'MidnightBSD', 'Description': 'Unix File System (UFS) partition'},
'85D5E45C-237C-11E1-B4B3-E89A8F7FC3A7': {'OS': 'MidnightBSD', 'Description': 'Vinum volume manager partition'},
'85D5E45D-237C-11E1-B4B3-E89A8F7FC3A7': {'OS': 'MidnightBSD', 'Description': 'ZFS partition'},
'45B0969E-9B03-4F30-B4C6-B4B80CEFF106': {'OS': 'Ceph', 'Description': 'Ceph Journal'},
'45B0969E-9B03-4F30-B4C6-5EC00CEFF106': {'OS': 'Ceph', 'Description': 'Ceph dm-crypt Encrypted Journal'},
'4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D': {'OS': 'Ceph', 'Description': 'Ceph OSD'},
'4FBD7E29-9D25-41B8-AFD0-5EC00CEFF05D': {'OS': 'Ceph', 'Description': 'Ceph dm-crypt OSD'},
'89C57F98-2FE5-4DC0-89C1-F3AD0CEFF2BE': {'OS': 'Ceph', 'Description': 'Ceph disk in creation'},
'89C57F98-2FE5-4DC0-89C1-5EC00CEFF2BE': {'OS': 'Ceph', 'Description': 'Ceph dm-crypt disk in creation'},
'824CC7A0-36A8-11E3-890A-952519AD3F61': {'OS': 'OpenBSD', 'Description': 'Data partition'},
'CEF5A9AD-73BC-4601-89F3-CDEEEEE321A1': {'OS': 'QNX', 'Description': 'Power-safe (QNX6) file system'},
'C91818F9-8025-47AF-89D2-F030D7000C2C': {'OS': 'Plan 9', 'Description': 'Plan 9 partition'},
'9D275380-40AD-11DB-BF97-000C2911D1B8': {'OS': 'VMware ESX', 'Description': 'vmkcore (coredump partition)'},
'AA31E02A-400F-11DB-9590-000C2911D1B8': {'OS': 'VMware ESX', 'Description': 'VMFS filesystem partition'},
'9198EFFC-31C0-11DB-8F78-000C2911D1B8': {'OS': 'VMware ESX', 'Description': 'VMware Reserved'},
'2568845D-2332-4675-BC39-8FA5A4748D15': {'OS': 'Android-IA', 'Description': 'Bootloader'},
'114EAFFE-1552-4022-B26E-9B053604CF84': {'OS': 'Android-IA', 'Description': 'Bootloader2'},
'49A4D17F-93A3-45C1-A0DE-F50B2EBE2599': {'OS': 'Android-IA', 'Description': 'Boot'},
'4177C722-9E92-4AAB-8644-43502BFD5506': {'OS': 'Android-IA', 'Description': 'Recovery'},
'EF32A33B-A409-486C-9141-9FFB711F6266': {'OS': 'Android-IA', 'Description': 'Misc'},
'20AC26BE-20B7-11E3-84C5-6CFDB94711E9': {'OS': 'Android-IA', 'Description': 'Metadata'},
'38F428E6-D326-425D-9140-6E0EA133647C': {'OS': 'Android-IA', 'Description': 'System'},
'A893EF21-E428-470A-9E55-0668FD91A2D9': {'OS': 'Android-IA', 'Description': 'Cache'},
'DC76DDA9-5AC1-491C-AF42-A82591580C0D': {'OS': 'Android-IA', 'Description': 'Data'},
'EBC597D0-2053-4B15-8B64-E0AAC75F4DB1': {'OS': 'Android-IA', 'Description': 'Persistent'},
'8F68CC74-C5E5-48DA-BE91-A0C8C15E9C80': {'OS': 'Android-IA', 'Description': 'Factory'},
'767941D0-2085-11E3-AD3B-6CFDB94711E9': {'OS': 'Android-IA', 'Description': 'Fastboot / Tertiary'},
'AC6D7924-EB71-4DF8-B48D-E267B27148FF': {'OS': 'Android-IA', 'Description': 'OEM'},
'7412F7D5-A156-4B13-81DC-867174929325': {'OS': 'ONIE', 'Description': 'Boot'},
'D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149': {'OS': 'ONIE', 'Description': 'Config'},
'9E1A2D38-C612-4316-AA26-8B49521E5A8B': {'OS': 'PowerPC', 'Description': 'PReP boot'},
'BC13C2FF-59E6-4262-A352-B275FD6F7172': {'OS': 'Freedesktop', 'Description': 'Extended Boot Partition ($BOOT)'},
}
def lookup_guid(guid):
return PARTITION_UIDS.get(guid.upper(), None)
if __name__ == '__main__':
print("This file is not meant to be called directly.")

View file

@ -1,68 +0,0 @@
# Wizard Kit PE: Settings - Main / Branding
# Features
ENABLED_UPLOAD_DATA = False
# STATIC VARIABLES (also used by .cmd files)
## Not using spaces aroung '=' for easier .cmd substrings
ARCHIVE_PASSWORD='Abracadabra'
KIT_NAME_FULL='Wizard Kit PE'
KIT_NAME_SHORT='WKPE'
OFFICE_SERVER_IP='10.0.0.10'
QUICKBOOKS_SERVER_IP='10.0.0.10'
SUPPORT_MESSAGE='Please let 2Shirt know by opening an issue on GitHub'
TIME_ZONE='Pacific Standard Time' # Always use "Standard Time" (DST is applied correctly)
# SERVER VARIABLES
## NOTE: Windows can only use one user per server. This means that if
## one server serves multiple shares then you have to use the same
## user/password for all of those shares.
BACKUP_SERVERS = [
{ 'IP': '10.0.0.10',
'Name': 'ServerOne',
'Mounted': False,
'Share': 'Backups',
'User': 'restore',
'Pass': 'Abracadabra',
},
{ 'IP': '10.0.0.11',
'Name': 'ServerTwo',
'Mounted': False,
'Share': 'Backups',
'User': 'restore',
'Pass': 'Abracadabra',
},
]
CLIENT_INFO_SERVER = {
'IP': '10.0.0.10',
'RegEntry': r'0x10001,0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
'Share': '/srv/ClientInfo',
'User': 'upload',
}
OFFICE_SERVER = {
'IP': OFFICE_SERVER_IP,
'Name': 'ServerOne',
'Mounted': False,
'Share': 'Office',
'User': 'restore',
'Pass': 'Abracadabra',
}
QUICKBOOKS_SERVER = {
'IP': QUICKBOOKS_SERVER_IP,
'Name': 'ServerOne',
'Mounted': False,
'Share': 'QuickBooks',
'User': 'restore',
'Pass': 'Abracadabra',
}
WINDOWS_SERVER = {
'IP': '10.0.0.10',
'Name': 'ServerOne',
'Mounted': False,
'Share': 'Windows',
'User': 'restore',
'Pass': 'Abracadabra',
}
if __name__ == '__main__':
print("This file is not meant to be called directly.")

View file

@ -1,55 +0,0 @@
# Wizard Kit PE: Settings - Tools
TOOLS = {
# NOTE: BinDir will be prepended to these paths at runtime
'AIDA64': {
'32': r'AIDA64\aida64.exe'},
'AutoRuns': {
'32': r'Autoruns\autoruns.exe',
'64': r'Autoruns\autoruns64.exe'},
'BleachBit': {
'32': r'BleachBit\bleachbit_console.exe'},
'Caffeine': {
'32': r'Caffeine\caffeine.exe'},
'Du': {
'32': r'Du\du.exe',
'64': r'Du\du64.exe'},
'ERUNT': {
'32': r'ERUNT\ERUNT.EXE'},
'Everything': {
'32': r'Everything\Everything.exe',
'64': r'Everything\Everything64.exe'},
'FastCopy': {
'32': r'FastCopy\FastCopy.exe',
'64': r'FastCopy\FastCopy64.exe'},
'HitmanPro': {
'32': r'HitmanPro\HitmanPro.exe',
'64': r'HitmanPro\HitmanPro64.exe'},
'HWiNFO': {
'32': r'HWiNFO\HWiNFO.exe',
'64': r'HWiNFO\HWiNFO64.exe'},
'KVRT': {
'32': r'KVRT\KVRT.exe'},
'NotepadPlusPlus': {
'32': r'NotepadPlusPlus\notepadplusplus.exe'},
'ProduKey': {
'32': r'ProduKey\ProduKey.exe',
'64': r'ProduKey\ProduKey64.exe'},
'PuTTY-PSFTP': {
'32': r'PuTTY\PSFTP.EXE'},
'RKill': {
'32': r'RKill\RKill.exe'},
'SevenZip': {
'32': r'7-Zip\7za.exe',
'64': r'7-Zip\7za64.exe'},
'TDSSKiller': {
'32': r'TDSSKiller\TDSSKiller.exe'},
'wimlib-imagex': {
'32': r'wimlib\x32\wimlib-imagex.exe',
'64': r'wimlib\x64\wimlib-imagex.exe'},
'XMPlay': {
'32': r'XMPlay\xmplay.exe'},
}
if __name__ == '__main__':
print("This file is not meant to be called directly.")

View file

@ -1,3 +0,0 @@
**/__pycache__/*
BUILD
OUT_PE

View file

@ -1,7 +0,0 @@
Copyright (c) 2017 Alan Mason
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -1,18 +0,0 @@
# Wizard Kit PE #
A collection of scripts to help technicians service Windows systems.
# NOTICE: Currently under maintenance #
*These scripts are being reviewed and updated at the moment.*
Things may or may not work until this is completed. This warning will be removed once the maintenance is finished.
## Requirements ##
* Windows Assessment and Deployment Kit for Windows 10
## Initial Setup ##
* Install Windows ADK for Windows 10
* Run "Deployment and Imaging Tools Environment" as admin
* Run `make.cmd` to build a new Windows 10 PE image

View file

Before

Width:  |  Height:  |  Size: 168 KiB

After

Width:  |  Height:  |  Size: 168 KiB

View file

@ -2,20 +2,22 @@
A collection of scripts to help technicians service Windows systems. A collection of scripts to help technicians service Windows systems.
## Requirements ## ## Main Kit ##
### Build Requirements ###
* PowerShell 3.0 or newer<sup>1</sup> * PowerShell 3.0 or newer<sup>1</sup>
* 6 Gb disk space * 6 Gb disk space
## Initial Setup ## ### Initial Setup ###
* Replace ConEmu.png if desired * Replace artwork as desired
* Run `Build Kit.cmd` which will do the following: * Run `Build Kit.cmd` which will do the following:
* Download 7-Zip, ConEmu, Notepad++, and Python (including wheel packages) * Download 7-Zip, ConEmu, Notepad++, and Python (including wheel packages)
* Open `.bin\Scripts\settings\main.py` in Notepad++ for configuration * Open `.bin\Scripts\settings\main.py` in Notepad++ for configuration
* Update the rest of the tools with the `.bin\Scripts\update_kit.py` script * Update the rest of the tools with the `.bin\Scripts\update_kit.py` script
## Layout ## ### Layout ###
* Root * Root
* Main script launchers: * Main script launchers:
@ -37,5 +39,23 @@ A collection of scripts to help technicians service Windows systems.
* `Repairs` * `Repairs`
* `Uninstallers` * `Uninstallers`
### Notes ### ## Windows PE ##
1. PowerShell 6.0 on Windows 7 is not supported by the build script.
### Build Requirements ###
* Windows Assessment and Deployment Kit for Windows 10
* PowerShell 3.0 or newer<sup>1</sup>
* 2 Gb disk space
### Initial Setup ###
* (If not done above)
* Replace artwork as desired
* Edit `.bin\Scripts\settings\main.py`
* Run `Build PE.cmd` which will do the following:
* Load the WADK environment
* Download all tools
* Build both 32-bit & 64-bit PE images (exported as ISO files)
#### Notes ####
1. PowerShell 6.0 on Windows 7 is not supported by the build script.