Add AMFI detection on build

This commit is contained in:
Mykola Grymalyuk
2021-07-25 23:15:23 -06:00
parent eca98c65d3
commit bb09b0432f
2 changed files with 13 additions and 4 deletions

View File

@@ -70,6 +70,9 @@ class OpenCoreLegacyPatcher:
if "-v" in (Utilities.get_nvram("boot-args") or ""): if "-v" in (Utilities.get_nvram("boot-args") or ""):
self.constants.verbose_debug = True self.constants.verbose_debug = True
if Utilities.amfi_status() is False:
self.constants.disable_amfi = True
self.constants.latebloom_delay, self.constants.latebloom_range, self.constants.latebloom_debug = Utilities.latebloom_detection(model) self.constants.latebloom_delay, self.constants.latebloom_range, self.constants.latebloom_debug = Utilities.latebloom_detection(model)
# Check if running in RecoveryOS # Check if running in RecoveryOS

View File

@@ -108,6 +108,14 @@ def friendly_hex(integer: int):
return "{:02X}".format(integer) return "{:02X}".format(integer)
def amfi_status():
amfi_1 = "amfi_get_out_of_my_way=0x1"
amfi_2 = "amfi_get_out_of_my_way=1"
if get_nvram("boot-args", decode=False) and (amfi_1 in get_nvram("boot-args", decode=False) or amfi_2 in get_nvram("boot-args", decode=False)):
return False
return True
def patching_status(os_sip): def patching_status(os_sip):
# Detection for Root Patching # Detection for Root Patching
sip_enabled = True # System Integrity Protection sip_enabled = True # System Integrity Protection
@@ -116,13 +124,11 @@ def patching_status(os_sip):
fv_enabled = True # FileVault fv_enabled = True # FileVault
dosdude_patched = True dosdude_patched = True
amfi_1 = "amfi_get_out_of_my_way=0x1"
amfi_2 = "amfi_get_out_of_my_way=1"
gen6_kext = "/System/Library/Extension/AppleIntelHDGraphics.kext" gen6_kext = "/System/Library/Extension/AppleIntelHDGraphics.kext"
gen7_kext = "/System/Library/Extension/AppleIntelHD3000Graphics.kext" gen7_kext = "/System/Library/Extension/AppleIntelHD3000Graphics.kext"
if get_nvram("boot-args", decode=False) and (amfi_1 in get_nvram("boot-args", decode=False) or amfi_2 in get_nvram("boot-args", decode=False)): amfi_enabled = amfi_status()
amfi_enabled = False
if get_nvram("HardwareModel", "94B73556-2197-4702-82A8-3E1337DAFBFB", decode=False) not in Constants.Constants.sbm_values: if get_nvram("HardwareModel", "94B73556-2197-4702-82A8-3E1337DAFBFB", decode=False) not in Constants.Constants.sbm_values:
sbm_enabled = False sbm_enabled = False