mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-18 13:20:00 +10:00
Add Serial Number Spoofing
This commit is contained in:
+50
-5
@@ -1023,9 +1023,34 @@ class BuildOpenCore:
|
||||
self.config["PlatformInfo"]["UpdateSMBIOS"] = True
|
||||
self.config["PlatformInfo"]["UpdateDataHub"] = True
|
||||
|
||||
if self.constants.custom_serial_number != "" and self.constants.custom_board_serial_number != "":
|
||||
print("- Adding custom serial numbers")
|
||||
sn = self.constants.custom_serial_number
|
||||
mlb = self.constants.custom_board_serial_number
|
||||
|
||||
# Serial Number
|
||||
self.config["PlatformInfo"]["SMBIOS"]["ChassisSerialNumber"] = sn
|
||||
self.config["PlatformInfo"]["SMBIOS"]["SystemSerialNumber"] = sn
|
||||
self.config["PlatformInfo"]["DataHub"]["SystemSerialNumber"] = sn
|
||||
self.config["PlatformInfo"]["PlatformNVRAM"]["SystemSerialNumber"] = sn
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["OCLP-Spoofed-SN"] = sn
|
||||
|
||||
# Board Serial Number
|
||||
self.config["PlatformInfo"]["SMBIOS"]["BoardSerialNumber"] = mlb
|
||||
self.config["PlatformInfo"]["PlatformNVRAM"]["BoardSerialNumber"] = mlb
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["OCLP-Spoofed-MLB"] = mlb
|
||||
|
||||
|
||||
|
||||
def moderate_serial_patch(self):
|
||||
if self.constants.custom_cpu_model == 0 or self.constants.custom_cpu_model == 1:
|
||||
self.config["PlatformInfo"]["Generic"]["ProcessorType"] = 1537
|
||||
if self.constants.custom_serial_number != "" and self.constants.custom_board_serial_number != "":
|
||||
print("- Adding custom serial numbers")
|
||||
self.config["PlatformInfo"]["Generic"]["SystemSerialNumber"] = self.constants.custom_serial_number
|
||||
self.config["PlatformInfo"]["Generic"]["MLB"] = self.constants.custom_board_serial_number
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["OCLP-Spoofed-SN"] = self.constants.custom_serial_number
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["OCLP-Spoofed-MLB"] = self.constants.custom_board_serial_number
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["run-efi-updater"] = "No"
|
||||
self.config["PlatformInfo"]["Automatic"] = True
|
||||
self.config["PlatformInfo"]["UpdateDataHub"] = True
|
||||
@@ -1037,8 +1062,14 @@ class BuildOpenCore:
|
||||
def advanced_serial_patch(self):
|
||||
if self.constants.custom_cpu_model == 0 or self.constants.custom_cpu_model == 1:
|
||||
self.config["PlatformInfo"]["Generic"]["ProcessorType"] = 1537
|
||||
macserial_output = subprocess.run([self.constants.macserial_path] + f"-g -m {self.spoofed_model} -n 1".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
macserial_output = macserial_output.stdout.decode().strip().split(" | ")
|
||||
if self.constants.custom_serial_number == "" or self.constants.custom_board_serial_number == "":
|
||||
macserial_output = subprocess.run([self.constants.macserial_path] + f"-g -m {self.spoofed_model} -n 1".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
macserial_output = macserial_output.stdout.decode().strip().split(" | ")
|
||||
sn = macserial_output[0]
|
||||
mlb = macserial_output[1]
|
||||
else:
|
||||
sn = self.constants.custom_serial_number
|
||||
mlb = self.constants.custom_board_serial_number
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["run-efi-updater"] = "No"
|
||||
self.config["PlatformInfo"]["Automatic"] = True
|
||||
self.config["PlatformInfo"]["UpdateDataHub"] = True
|
||||
@@ -1047,9 +1078,11 @@ class BuildOpenCore:
|
||||
self.config["UEFI"]["ProtocolOverrides"]["DataHub"] = True
|
||||
self.config["PlatformInfo"]["Generic"]["ROM"] = binascii.unhexlify("0016CB445566")
|
||||
self.config["PlatformInfo"]["Generic"]["SystemProductName"] = self.spoofed_model
|
||||
self.config["PlatformInfo"]["Generic"]["SystemSerialNumber"] = macserial_output[0]
|
||||
self.config["PlatformInfo"]["Generic"]["MLB"] = macserial_output[1]
|
||||
self.config["PlatformInfo"]["Generic"]["SystemSerialNumber"] = sn
|
||||
self.config["PlatformInfo"]["Generic"]["MLB"] = mlb
|
||||
self.config["PlatformInfo"]["Generic"]["SystemUUID"] = str(uuid.uuid4()).upper()
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["OCLP-Spoofed-SN"] = sn
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["OCLP-Spoofed-MLB"] = mlb
|
||||
|
||||
|
||||
if self.constants.serial_settings == "Moderate":
|
||||
@@ -1074,6 +1107,18 @@ class BuildOpenCore:
|
||||
print("- Detected UEFI 1.2 or older Mac, updating BoardProduct")
|
||||
self.config["PlatformInfo"]["DataHub"]["BoardProduct"] = self.spoofed_board
|
||||
self.config["PlatformInfo"]["UpdateDataHub"] = True
|
||||
|
||||
if self.constants.custom_serial_number != "" and self.constants.custom_board_serial_number != "":
|
||||
print("- Adding custom serial numbers")
|
||||
self.config["PlatformInfo"]["Automatic"] = True
|
||||
self.config["PlatformInfo"]["UpdateDataHub"] = True
|
||||
self.config["PlatformInfo"]["UpdateNVRAM"] = True
|
||||
self.config["PlatformInfo"]["UpdateSMBIOS"] = True
|
||||
self.config["UEFI"]["ProtocolOverrides"]["DataHub"] = True
|
||||
self.config["PlatformInfo"]["Generic"]["SystemSerialNumber"] = self.constants.custom_serial_number
|
||||
self.config["PlatformInfo"]["Generic"]["MLB"] = self.constants.custom_board_serial_number
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["OCLP-Spoofed-SN"] = self.constants.custom_serial_number
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["OCLP-Spoofed-MLB"] = self.constants.custom_board_serial_number
|
||||
|
||||
# USB Map and CPUFriend Patching
|
||||
if (
|
||||
@@ -1239,7 +1284,7 @@ class BuildOpenCore:
|
||||
|
||||
def build_opencore(self):
|
||||
self.build_efi()
|
||||
if self.constants.allow_oc_everywhere is False or self.constants.allow_native_spoofs is True:
|
||||
if self.constants.allow_oc_everywhere is False or self.constants.allow_native_spoofs is True or (self.constants.custom_serial_number != "" and self.constants.custom_board_serial_number != ""):
|
||||
self.set_smbios()
|
||||
self.cleanup()
|
||||
self.sign_files()
|
||||
|
||||
@@ -129,11 +129,13 @@ class Constants:
|
||||
self.verbose_debug = False # -v
|
||||
|
||||
## SMBIOS Settings
|
||||
self.custom_cpu_model = 2 # Patch type value
|
||||
self.custom_cpu_model_value = "" # New CPU name within About This Mac
|
||||
self.serial_settings = "None" # Set SMBIOS level used
|
||||
self.override_smbios = "Default" # Set SMBIOS model used
|
||||
self.allow_native_spoofs = False # Allow native models to recieve spoofs
|
||||
self.custom_cpu_model = 2 # Patch type value
|
||||
self.custom_cpu_model_value = "" # New CPU name within About This Mac
|
||||
self.serial_settings = "None" # Set SMBIOS level used
|
||||
self.override_smbios = "Default" # Set SMBIOS model used
|
||||
self.allow_native_spoofs = False # Allow native models to recieve spoofs
|
||||
self.custom_serial_number = "" # Set SMBIOS serial number
|
||||
self.custom_board_serial_number = "" # Set SMBIOS board serial number
|
||||
|
||||
## FeatureUnlock Settings
|
||||
self.fu_status = True # Enable FeatureUnlock
|
||||
|
||||
@@ -11,8 +11,17 @@ class generate_defaults:
|
||||
settings.sip_status = True
|
||||
settings.secure_status = False # Default false for Monterey
|
||||
settings.amfi_status = True
|
||||
settings.custom_serial_number = ""
|
||||
settings.custom_board_serial_number = ""
|
||||
|
||||
if host_is_target:
|
||||
settings.custom_serial_number = utilities.get_nvram("OCLP-Spoofed-SN", "7C436110-AB2A-4BBB-A880-FE41995C9F82", decode=True)
|
||||
settings.custom_board_serial_number = utilities.get_nvram("OCLP-Spoofed-MLB", "7C436110-AB2A-4BBB-A880-FE41995C9F82", decode=True)
|
||||
if settings.custom_serial_number is None or settings.custom_board_serial_number is None:
|
||||
# If either variables are missing, we assume something is wrong with the spoofed variables and reset
|
||||
settings.custom_serial_number = ""
|
||||
settings.custom_board_serial_number = ""
|
||||
|
||||
if settings.computer.usb_controllers:
|
||||
try:
|
||||
if smbios_data.smbios_dictionary[model]["CPU Generation"] < cpu_data.cpu_data.ivy_bridge.value:
|
||||
|
||||
Reference in New Issue
Block a user