mirror of
https://github.com/leminlimez/Nugget.git
synced 2025-04-07 20:23:05 +00:00
save the device model fix reverting spoofing
This commit is contained in:
parent
97fb5106b1
commit
ac5a9077af
@ -3,6 +3,7 @@ import plistlib
|
||||
from pathlib import Path
|
||||
|
||||
from PySide6.QtWidgets import QMessageBox
|
||||
from PySide6.QtCore import QSettings
|
||||
|
||||
from pymobiledevice3 import usbmux
|
||||
from pymobiledevice3.lockdown import create_using_usbmux
|
||||
@ -32,7 +33,7 @@ class DeviceManager:
|
||||
self.apply_over_wifi = True
|
||||
self.skip_setup = True
|
||||
|
||||
def get_devices(self):
|
||||
def get_devices(self, settings: QSettings):
|
||||
self.devices.clear()
|
||||
connected_devices = usbmux.list_devices()
|
||||
# Connect via usbmuxd
|
||||
@ -41,16 +42,26 @@ class DeviceManager:
|
||||
try:
|
||||
ld = create_using_usbmux(serial=device.serial)
|
||||
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(
|
||||
uuid=device.serial,
|
||||
name=vals['DeviceName'],
|
||||
version=vals['ProductVersion'],
|
||||
build=vals['BuildVersion'],
|
||||
model=vals['ProductType'],
|
||||
model=model,
|
||||
locale=ld.locale,
|
||||
ld=ld
|
||||
)
|
||||
tweaks["RdarFix"].get_rdar_mode(vals['ProductType'])
|
||||
tweaks["RdarFix"].get_rdar_mode(model)
|
||||
self.devices.append(dev)
|
||||
except Exception as e:
|
||||
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.gestalt_path = None
|
||||
self.current_device_index = 0
|
||||
tweaks["SpoofModel"].value[0] = "Placeholder"
|
||||
else:
|
||||
self.data_singleton.current_device = self.devices[index]
|
||||
if Version(self.devices[index].version) < Version("17.0"):
|
||||
@ -75,6 +87,7 @@ class DeviceManager:
|
||||
self.data_singleton.gestalt_path = None
|
||||
else:
|
||||
self.data_singleton.device_available = True
|
||||
tweaks["SpoofModel"].value[0] = self.data_singleton.current_device.model
|
||||
self.current_device_index = index
|
||||
|
||||
def get_current_device_name(self) -> str:
|
||||
@ -285,10 +298,12 @@ class DeviceManager:
|
||||
show_error_msg(type(e).__name__)
|
||||
|
||||
## 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
|
||||
update_label("Restoring to device...")
|
||||
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")
|
||||
restore_files(files=[FileToRestore(
|
||||
contents=b"",
|
||||
|
||||
@ -159,7 +159,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
@QtCore.Slot()
|
||||
def refresh_devices(self):
|
||||
# get the devices
|
||||
self.device_manager.get_devices()
|
||||
self.device_manager.get_devices(self.settings)
|
||||
# clear the picker
|
||||
self.ui.devicePicker.clear()
|
||||
self.ui.restoreProgressBar.hide()
|
||||
@ -510,10 +510,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
def on_languageTxt_textEdited(self, text: str):
|
||||
tweaks["AIEligibility"].set_language_code(text)
|
||||
def on_spoofedModelDrp_activated(self, index: int):
|
||||
if index == 0:
|
||||
tweaks["SpoofModel"].set_enabled(False)
|
||||
else:
|
||||
tweaks["SpoofModel"].set_selected_option(index - 1)
|
||||
tweaks["SpoofModel"].set_selected_option(index)
|
||||
|
||||
|
||||
## SPRINGBOARD OPTIONS PAGE
|
||||
@ -622,7 +619,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
# TODO: Add safety here
|
||||
self.device_manager.apply_changes(resetting=True, update_label=self.update_label)
|
||||
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()
|
||||
def on_applyTweaksBtn_clicked(self):
|
||||
|
||||
@ -7,7 +7,6 @@ from devicemanagement.device_manager import DeviceManager
|
||||
if __name__ == "__main__":
|
||||
app = QtWidgets.QApplication([])
|
||||
dm = DeviceManager()
|
||||
dm.get_devices()
|
||||
|
||||
widget = MainWindow(device_manager=dm)
|
||||
widget.resize(800, 600)
|
||||
|
||||
@ -1566,7 +1566,7 @@ QToolButton:pressed {
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Nugget GUI - Version 3.1 (beta 2)</string>
|
||||
<string>Nugget GUI - Version 3.1 (beta 3)</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
@ -1726,7 +1726,7 @@ QToolButton:pressed {
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-292</y>
|
||||
<y>0</y>
|
||||
<width>650</width>
|
||||
<height>1200</height>
|
||||
</rect>
|
||||
|
||||
@ -945,7 +945,7 @@ class Ui_Nugget(object):
|
||||
self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
self.scrollAreaWidgetContents = QWidget()
|
||||
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.setMaximumSize(QSize(650, 1200))
|
||||
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.libiBtn.setText(QCoreApplication.translate("Nugget", u"pymobiledevice3", 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.label_9.setText(QCoreApplication.translate("Nugget", u"Device Subtype Preset", None))
|
||||
self.dynamicIslandDrp.setItemText(0, QCoreApplication.translate("Nugget", u"None", None))
|
||||
|
||||
@ -945,7 +945,7 @@ class Ui_Nugget(object):
|
||||
self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
self.scrollAreaWidgetContents = QWidget()
|
||||
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.setMaximumSize(QSize(650, 1200))
|
||||
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.libiBtn.setText(QCoreApplication.translate("Nugget", u"pymobiledevice3", 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.label_9.setText(QCoreApplication.translate("Nugget", u"Device Subtype Preset", None))
|
||||
self.dynamicIslandDrp.setItemText(0, QCoreApplication.translate("Nugget", u"None", None))
|
||||
|
||||
@ -147,7 +147,7 @@ class MobileGestaltPickerTweak(Tweak):
|
||||
self.selected_option = 0 # index of the selected option
|
||||
|
||||
def apply_tweak(self, plist: dict):
|
||||
if not self.enabled:
|
||||
if not self.enabled or self.value[self.selected_option] == "Placeholder":
|
||||
return plist
|
||||
new_value = self.value[self.selected_option]
|
||||
if self.subkey == None:
|
||||
|
||||
@ -42,7 +42,7 @@ tweaks = {
|
||||
## AI Enabler
|
||||
"AIEligibility": AITweak(),
|
||||
"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
|
||||
"LockScreenFootnote": BasicPlistTweak(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user