Updated BIOS activation sections
This commit is contained in:
parent
dcd5fa1b7a
commit
b02a62a917
3 changed files with 15 additions and 16 deletions
|
|
@ -7,15 +7,9 @@ import sys
|
|||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||
sys.path.append(os.getcwd())
|
||||
from functions.activation import *
|
||||
from functions.common import *
|
||||
init_global_vars()
|
||||
os.system('title {}: Windows Activation Tool'.format(KIT_NAME_FULL))
|
||||
|
||||
def activate_with_bios():
|
||||
"""Attempt to activate Windows with a key stored in the BIOS."""
|
||||
try_and_print(message='BIOS Activation:',
|
||||
function=activate_windows_with_bios, other_results=other_results)
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
stay_awake()
|
||||
|
|
@ -26,6 +20,10 @@ if __name__ == '__main__':
|
|||
print_info('This system is already activated')
|
||||
sleep(5)
|
||||
exit_script()
|
||||
other_results = {
|
||||
'Error': {
|
||||
'BIOSKeyNotFoundError': 'BIOS key not found.',
|
||||
}}
|
||||
|
||||
# Determine activation method
|
||||
activation_methods = [
|
||||
|
|
@ -41,15 +39,18 @@ if __name__ == '__main__':
|
|||
selection = menu_select(
|
||||
'{}: Windows Activation Menu'.format(KIT_NAME_FULL),
|
||||
main_entries=activation_methods, action_entries=actions)
|
||||
|
||||
|
||||
if (selection.isnumeric()):
|
||||
activation_methods[int(selection)-1]['Function']()
|
||||
try_and_print(
|
||||
message = activation_methods[int(selection)-1]['Name'],
|
||||
function = activation_methods[int(selection)-1]['Function'],
|
||||
other_results=other_results)
|
||||
break
|
||||
elif selection == 'Q':
|
||||
exit_script()
|
||||
|
||||
# Done
|
||||
print_success('Done.')
|
||||
print_success('\nDone.')
|
||||
pause("Press Enter to exit...")
|
||||
exit_script()
|
||||
except SystemExit:
|
||||
|
|
|
|||
|
|
@ -3,16 +3,13 @@
|
|||
import subprocess
|
||||
|
||||
from borrowed import acpi
|
||||
from functions.common import *
|
||||
from os import environ
|
||||
|
||||
# Variables
|
||||
SLMGR = r'{}\System32\slmgr.vbs'.format(environ.get('SYSTEMROOT'))
|
||||
|
||||
# Error Classes
|
||||
class BIOSKeyNotFoundError(Exception):
|
||||
pass
|
||||
|
||||
def activate_windows_with_bios():
|
||||
def activate_with_bios():
|
||||
"""Attempt to activate Windows with a key stored in the BIOS."""
|
||||
# Code borrowed from https://github.com/aeruder/get_win8key
|
||||
#####################################################
|
||||
|
|
@ -29,8 +26,6 @@ def activate_windows_with_bios():
|
|||
# = Microsoft 'software licensing data structure' \
|
||||
# / 36 + 20 bytes offset from beginning = Win Key
|
||||
bios_key = rawtable[56:len(rawtable)].decode("utf-8")
|
||||
else:
|
||||
raise Exception('ACPI table {} not found.'.format(str(table)))
|
||||
if bios_key is None:
|
||||
raise BIOSKeyNotFoundError
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ HKCU = winreg.HKEY_CURRENT_USER
|
|||
HKLM = winreg.HKEY_LOCAL_MACHINE
|
||||
|
||||
# Error Classes
|
||||
class BIOSKeyNotFoundError(Exception):
|
||||
pass
|
||||
|
||||
class BinNotFoundError(Exception):
|
||||
pass
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue