save the device model fix reverting spoofing

This commit is contained in:
leminlimez
2024-10-22 13:35:11 -04:00
parent 97fb5106b1
commit ac5a9077af
8 changed files with 30 additions and 19 deletions

View File

@@ -3,6 +3,7 @@ import plistlib
from pathlib import Path from pathlib import Path
from PySide6.QtWidgets import QMessageBox from PySide6.QtWidgets import QMessageBox
from PySide6.QtCore import QSettings
from pymobiledevice3 import usbmux from pymobiledevice3 import usbmux
from pymobiledevice3.lockdown import create_using_usbmux from pymobiledevice3.lockdown import create_using_usbmux
@@ -32,7 +33,7 @@ class DeviceManager:
self.apply_over_wifi = True self.apply_over_wifi = True
self.skip_setup = True self.skip_setup = True
def get_devices(self): def get_devices(self, settings: QSettings):
self.devices.clear() self.devices.clear()
connected_devices = usbmux.list_devices() connected_devices = usbmux.list_devices()
# Connect via usbmuxd # Connect via usbmuxd
@@ -41,16 +42,26 @@ class DeviceManager:
try: try:
ld = create_using_usbmux(serial=device.serial) ld = create_using_usbmux(serial=device.serial)
vals = ld.all_values vals = ld.all_values
model = vals['ProductType']
try:
product_type = settings.value(device.serial + "_model", "", type=str)
if product_type == "":
# save the new product type
settings.setValue(device.serial + "_model", model)
else:
model = product_type
except:
pass
dev = Device( dev = Device(
uuid=device.serial, uuid=device.serial,
name=vals['DeviceName'], name=vals['DeviceName'],
version=vals['ProductVersion'], version=vals['ProductVersion'],
build=vals['BuildVersion'], build=vals['BuildVersion'],
model=vals['ProductType'], model=model,
locale=ld.locale, locale=ld.locale,
ld=ld ld=ld
) )
tweaks["RdarFix"].get_rdar_mode(vals['ProductType']) tweaks["RdarFix"].get_rdar_mode(model)
self.devices.append(dev) self.devices.append(dev)
except Exception as e: except Exception as e:
print(f"ERROR with lockdown device with UUID {device.serial}") print(f"ERROR with lockdown device with UUID {device.serial}")
@@ -68,6 +79,7 @@ class DeviceManager:
self.data_singleton.device_available = False self.data_singleton.device_available = False
self.data_singleton.gestalt_path = None self.data_singleton.gestalt_path = None
self.current_device_index = 0 self.current_device_index = 0
tweaks["SpoofModel"].value[0] = "Placeholder"
else: else:
self.data_singleton.current_device = self.devices[index] self.data_singleton.current_device = self.devices[index]
if Version(self.devices[index].version) < Version("17.0"): if Version(self.devices[index].version) < Version("17.0"):
@@ -75,6 +87,7 @@ class DeviceManager:
self.data_singleton.gestalt_path = None self.data_singleton.gestalt_path = None
else: else:
self.data_singleton.device_available = True self.data_singleton.device_available = True
tweaks["SpoofModel"].value[0] = self.data_singleton.current_device.model
self.current_device_index = index self.current_device_index = index
def get_current_device_name(self) -> str: def get_current_device_name(self) -> str:
@@ -285,10 +298,12 @@ class DeviceManager:
show_error_msg(type(e).__name__) show_error_msg(type(e).__name__)
## RESETTING MOBILE GESTALT ## RESETTING MOBILE GESTALT
def reset_mobilegestalt(self, update_label=lambda x: None): def reset_mobilegestalt(self, settings: QSettings, update_label=lambda x: None):
# restore to the device # restore to the device
update_label("Restoring to device...") update_label("Restoring to device...")
try: try:
# remove the saved device model
settings.setValue(self.data_singleton.current_device.uuid + "_model", "")
domain, file_path = self.get_domain_for_path("/var/containers/Shared/SystemGroup/systemgroup.com.apple.mobilegestaltcache/Library/Caches/com.apple.MobileGestalt.plist") domain, file_path = self.get_domain_for_path("/var/containers/Shared/SystemGroup/systemgroup.com.apple.mobilegestaltcache/Library/Caches/com.apple.MobileGestalt.plist")
restore_files(files=[FileToRestore( restore_files(files=[FileToRestore(
contents=b"", contents=b"",

View File

@@ -159,7 +159,7 @@ class MainWindow(QtWidgets.QMainWindow):
@QtCore.Slot() @QtCore.Slot()
def refresh_devices(self): def refresh_devices(self):
# get the devices # get the devices
self.device_manager.get_devices() self.device_manager.get_devices(self.settings)
# clear the picker # clear the picker
self.ui.devicePicker.clear() self.ui.devicePicker.clear()
self.ui.restoreProgressBar.hide() self.ui.restoreProgressBar.hide()
@@ -510,10 +510,7 @@ class MainWindow(QtWidgets.QMainWindow):
def on_languageTxt_textEdited(self, text: str): def on_languageTxt_textEdited(self, text: str):
tweaks["AIEligibility"].set_language_code(text) tweaks["AIEligibility"].set_language_code(text)
def on_spoofedModelDrp_activated(self, index: int): def on_spoofedModelDrp_activated(self, index: int):
if index == 0: tweaks["SpoofModel"].set_selected_option(index)
tweaks["SpoofModel"].set_enabled(False)
else:
tweaks["SpoofModel"].set_selected_option(index - 1)
## SPRINGBOARD OPTIONS PAGE ## SPRINGBOARD OPTIONS PAGE
@@ -622,7 +619,7 @@ class MainWindow(QtWidgets.QMainWindow):
# TODO: Add safety here # TODO: Add safety here
self.device_manager.apply_changes(resetting=True, update_label=self.update_label) self.device_manager.apply_changes(resetting=True, update_label=self.update_label)
def on_resetGestaltBtn_clicked(self): def on_resetGestaltBtn_clicked(self):
self.device_manager.reset_mobilegestalt(update_label=self.update_label) self.device_manager.reset_mobilegestalt(self.settings, update_label=self.update_label)
@QtCore.Slot() @QtCore.Slot()
def on_applyTweaksBtn_clicked(self): def on_applyTweaksBtn_clicked(self):

View File

@@ -7,7 +7,6 @@ from devicemanagement.device_manager import DeviceManager
if __name__ == "__main__": if __name__ == "__main__":
app = QtWidgets.QApplication([]) app = QtWidgets.QApplication([])
dm = DeviceManager() dm = DeviceManager()
dm.get_devices()
widget = MainWindow(device_manager=dm) widget = MainWindow(device_manager=dm)
widget.resize(800, 600) widget.resize(800, 600)

View File

@@ -1566,7 +1566,7 @@ QToolButton:pressed {
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Nugget GUI - Version 3.1 (beta 2)</string> <string>Nugget GUI - Version 3.1 (beta 3)</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -1726,7 +1726,7 @@ QToolButton:pressed {
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>-292</y> <y>0</y>
<width>650</width> <width>650</width>
<height>1200</height> <height>1200</height>
</rect> </rect>

View File

@@ -945,7 +945,7 @@ class Ui_Nugget(object):
self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.scrollAreaWidgetContents = QWidget() self.scrollAreaWidgetContents = QWidget()
self.scrollAreaWidgetContents.setObjectName(u"scrollAreaWidgetContents") self.scrollAreaWidgetContents.setObjectName(u"scrollAreaWidgetContents")
self.scrollAreaWidgetContents.setGeometry(QRect(0, -292, 650, 1200)) self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 650, 1200))
self.scrollAreaWidgetContents.setMinimumSize(QSize(650, 1200)) self.scrollAreaWidgetContents.setMinimumSize(QSize(650, 1200))
self.scrollAreaWidgetContents.setMaximumSize(QSize(650, 1200)) self.scrollAreaWidgetContents.setMaximumSize(QSize(650, 1200))
self.verticalLayout_9 = QVBoxLayout(self.scrollAreaWidgetContents) self.verticalLayout_9 = QVBoxLayout(self.scrollAreaWidgetContents)
@@ -2694,7 +2694,7 @@ class Ui_Nugget(object):
self.toolButton_15.setText(QCoreApplication.translate("Nugget", u"Additional Thanks", None)) self.toolButton_15.setText(QCoreApplication.translate("Nugget", u"Additional Thanks", None))
self.libiBtn.setText(QCoreApplication.translate("Nugget", u"pymobiledevice3", None)) self.libiBtn.setText(QCoreApplication.translate("Nugget", u"pymobiledevice3", None))
self.qtBtn.setText(QCoreApplication.translate("Nugget", u"Qt Creator", None)) self.qtBtn.setText(QCoreApplication.translate("Nugget", u"Qt Creator", None))
self.label.setText(QCoreApplication.translate("Nugget", u"Nugget GUI - Version 3.1 (beta 2)", None)) self.label.setText(QCoreApplication.translate("Nugget", u"Nugget GUI - Version 3.1 (beta 3)", None))
self.statusBarLbl.setText(QCoreApplication.translate("Nugget", u"Mobile Gestalt", None)) self.statusBarLbl.setText(QCoreApplication.translate("Nugget", u"Mobile Gestalt", None))
self.label_9.setText(QCoreApplication.translate("Nugget", u"Device Subtype Preset", None)) self.label_9.setText(QCoreApplication.translate("Nugget", u"Device Subtype Preset", None))
self.dynamicIslandDrp.setItemText(0, QCoreApplication.translate("Nugget", u"None", None)) self.dynamicIslandDrp.setItemText(0, QCoreApplication.translate("Nugget", u"None", None))

View File

@@ -945,7 +945,7 @@ class Ui_Nugget(object):
self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.scrollAreaWidgetContents = QWidget() self.scrollAreaWidgetContents = QWidget()
self.scrollAreaWidgetContents.setObjectName(u"scrollAreaWidgetContents") self.scrollAreaWidgetContents.setObjectName(u"scrollAreaWidgetContents")
self.scrollAreaWidgetContents.setGeometry(QRect(0, -292, 650, 1200)) self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 650, 1200))
self.scrollAreaWidgetContents.setMinimumSize(QSize(650, 1200)) self.scrollAreaWidgetContents.setMinimumSize(QSize(650, 1200))
self.scrollAreaWidgetContents.setMaximumSize(QSize(650, 1200)) self.scrollAreaWidgetContents.setMaximumSize(QSize(650, 1200))
self.verticalLayout_9 = QVBoxLayout(self.scrollAreaWidgetContents) self.verticalLayout_9 = QVBoxLayout(self.scrollAreaWidgetContents)
@@ -2694,7 +2694,7 @@ class Ui_Nugget(object):
self.toolButton_15.setText(QCoreApplication.translate("Nugget", u"Additional Thanks", None)) self.toolButton_15.setText(QCoreApplication.translate("Nugget", u"Additional Thanks", None))
self.libiBtn.setText(QCoreApplication.translate("Nugget", u"pymobiledevice3", None)) self.libiBtn.setText(QCoreApplication.translate("Nugget", u"pymobiledevice3", None))
self.qtBtn.setText(QCoreApplication.translate("Nugget", u"Qt Creator", None)) self.qtBtn.setText(QCoreApplication.translate("Nugget", u"Qt Creator", None))
self.label.setText(QCoreApplication.translate("Nugget", u"Nugget GUI - Version 3.1 (beta 2)", None)) self.label.setText(QCoreApplication.translate("Nugget", u"Nugget GUI - Version 3.1 (beta 3)", None))
self.statusBarLbl.setText(QCoreApplication.translate("Nugget", u"Mobile Gestalt", None)) self.statusBarLbl.setText(QCoreApplication.translate("Nugget", u"Mobile Gestalt", None))
self.label_9.setText(QCoreApplication.translate("Nugget", u"Device Subtype Preset", None)) self.label_9.setText(QCoreApplication.translate("Nugget", u"Device Subtype Preset", None))
self.dynamicIslandDrp.setItemText(0, QCoreApplication.translate("Nugget", u"None", None)) self.dynamicIslandDrp.setItemText(0, QCoreApplication.translate("Nugget", u"None", None))

View File

@@ -147,7 +147,7 @@ class MobileGestaltPickerTweak(Tweak):
self.selected_option = 0 # index of the selected option self.selected_option = 0 # index of the selected option
def apply_tweak(self, plist: dict): def apply_tweak(self, plist: dict):
if not self.enabled: if not self.enabled or self.value[self.selected_option] == "Placeholder":
return plist return plist
new_value = self.value[self.selected_option] new_value = self.value[self.selected_option]
if self.subkey == None: if self.subkey == None:

View File

@@ -42,7 +42,7 @@ tweaks = {
## AI Enabler ## AI Enabler
"AIEligibility": AITweak(), "AIEligibility": AITweak(),
"AIGestalt": MobileGestaltTweak("Enable Apple Intelligence (for Unsupported Devices) (Gestalt)", "A62OafQ85EJAiiqKn4agtg", min_version=Version("18.1")), "AIGestalt": MobileGestaltTweak("Enable Apple Intelligence (for Unsupported Devices) (Gestalt)", "A62OafQ85EJAiiqKn4agtg", min_version=Version("18.1")),
"SpoofModel": MobileGestaltPickerTweak("Spoofed Device Model", "h9jDsbgj7xIVeIQ8S3/X3Q", values=["iPhone16,2", "iPhone17,3", "iPhone17,4", "iPad16,3"], min_version=Version("18.1"), divider_below=True), "SpoofModel": MobileGestaltPickerTweak("Spoofed Device Model", "h9jDsbgj7xIVeIQ8S3/X3Q", values=["Placeholder", "iPhone16,2", "iPhone17,3", "iPhone17,4", "iPad16,3"], min_version=Version("18.1"), divider_below=True),
## Springboard Tweaks ## Springboard Tweaks
"LockScreenFootnote": BasicPlistTweak( "LockScreenFootnote": BasicPlistTweak(