forked from 6a6179/Nugget
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_app.py
More file actions
161 lines (149 loc) · 6.96 KB
/
main_app.py
File metadata and controls
161 lines (149 loc) · 6.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
from exploit.restore import restore_file
from pathlib import Path
import plistlib
import traceback
import shutil
import os
running = True
passed_check = False
# tweaks
dynamic_island_enabled = False
current_model_name = ""
boot_chime_enabled = False
charge_limit_enabled = False
stage_manager_enabled = False
shutter_sound_enabled = False
always_on_display_enabled = False
apple_pencil_enabled = False
action_button_enabled = False
internal_storage_enabled = False
gestalt_path = Path.joinpath(Path.cwd(), "com.apple.MobileGestalt.plist")
def find_file(filename, directory='.'):
# List all files in the specified directory
files = os.listdir(directory)
if filename in files:
return os.path.join(directory, filename)
return None
def print_option(num: int, active: bool, message: str):
txt = str(num) + ". "
if active:
txt = txt + "[Y] "
txt = txt + message
print(txt)
while running:
filepath = find_file(com.apple.MobileGestalt.plist)
if find_file:
print("""\n\n\n\n
,--.
,--.'| ___
,--,: : | ,--.'|_
,`--.'`| ' : ,--, | | :,'
| : : | | ,'_ /| ,----._,. ,----._,. : : ' :
: | \\ | : .--. | | : / / ' / / / ' / ,---. .;__,' /
| : ' '; |,'_ /| : . || : || : | / \\ | | |
' ' ;. ;| ' | | . .| | .\\ .| | .\\ . / / |:__,'| :
| | | \\ || | ' | | |. ; '; |. ; '; |. ' / | ' : |__
' : | ; .': | : ; ; |' . . |' . . |' ; /| | | '.'|
| | '`--' ' : `--' \\`---`-'| | `---`-'| |' | / | ; : ;
' : | : , .-./.'__/\\_: | .'__/\\_: || : | | , /
; |.' `--`----' | : : | : : \\ \\ / ---`-'
'---' \\ \\ / \\ \\ / `----'
`--`-' `--`-'
""")
print("by LeminLimez")
print("v1.2\n\n")
print("\nPlease back up your device before using!")
print("\nSuccessfully backed up MobileGestalt")
if not passed_check and Path.exists(gestalt_path) and Path.is_file(gestalt_path):
passed_check = True
if passed_check:
print_option(1, dynamic_island_enabled, "Toggle Dynamic Island")
print_option(2, current_model_name != "", "Set Device Model Name")
print_option(3, boot_chime_enabled, "Toggle Boot Chime")
print_option(4, charge_limit_enabled, "Toggle Charge Limit")
print_option(5, stage_manager_enabled, "Toggle Stage Manager Supported")
print_option(6, shutter_sound_enabled, "Disable Region Restrictions (ie. Shutter Sound)")
print_option(7, always_on_display_enabled, "Always On Display (iOS 18+ only)")
print_option(8, apple_pencil_enabled, "Toggle Apple Pencil")
print_option(9, action_button_enabled, "Toggle Action Button")
print_option(10, internal_storage_enabled, "Toggle Internal Storage")
print("\n11. Apply")
print("0. Exit\n")
page = int(input("Enter a number: "))
if page == 1:
dynamic_island_enabled = not dynamic_island_enabled
elif page == 2:
print("\n\nSet Model Name")
print("Leave blank to turn off custom name.\n")
name = input("Enter Model Name: ")
current_model_name = name
elif page == 3:
boot_chime_enabled = not boot_chime_enabled
elif page == 4:
charge_limit_enabled = not charge_limit_enabled
elif page == 5:
stage_manager_enabled = not stage_manager_enabled
elif page == 6:
shutter_sound_enabled = not shutter_sound_enabled
elif page == 7:
always_on_display_enabled = not always_on_display_enabled
elif page == 8:
apple_pencil_enabled = not apple_pencil_enabled
elif page == 9:
action_button_enabled = not action_button_enabled
elif page == 10:
internal_storage_enabled = not internal_storage_enabled
elif page == 11:
print()
# set the tweaks and apply
# first open the file in read mode
with open(gestalt_path, 'rb') as in_fp:
plist = plistlib.load(in_fp)
# set the plist keys
if dynamic_island_enabled:
plist["CacheExtra"]["oPeik/9e8lQWMszEjbPzng"]["ArtworkDeviceSubType"] = 2556
if current_model_name != "":
plist["CacheExtra"]["oPeik/9e8lQWMszEjbPzng"]["ArtworkDeviceProductDescription"] = current_model_name
if boot_chime_enabled:
plist["CacheExtra"]["QHxt+hGLaBPbQJbXiUJX3w"] = True
if charge_limit_enabled:
plist["CacheExtra"]["37NVydb//GP/GrhuTN+exg"] = True
if stage_manager_enabled:
plist["CacheExtra"]["qeaj75wk3HF4DwQ8qbIi7g"] = 1
if shutter_sound_enabled:
plist["CacheExtra"]["h63QSdBCiT/z0WU6rdQv6Q"] = "US"
plist["CacheExtra"]["zHeENZu+wbg7PUprwNwBWg"] = "LL/A"
if always_on_display_enabled:
plist["CacheExtra"]["2OOJf1VhaM7NxfRok3HbWQ"] = True
plist["CacheExtra"]["j8/Omm6s1lsmTDFsXjsBfA"] = True
if apple_pencil_enabled:
plist["CacheExtra"]["yhHcB0iH0d1XzPO/CFd3ow"] = True
if action_button_enabled:
plist["CacheExtra"]["cT44WE1EohiwRzhsZ8xEsw"] = True
if internal_storage_enabled:
plist["CacheExtra"]["LBJfwOEzExRxzlAnSuI7eg"] = True
# write back to the file
with open(gestalt_path, 'wb') as out_fp:
plistlib.dump(plist, out_fp)
# restore to the device
try:
restore_file(fp=gestalt_path, restore_path="/var/containers/Shared/SystemGroup/systemgroup.com.apple.mobilegestaltcache/Library/Caches/", restore_name="com.apple.MobileGestalt.plist")
input("Success! Reboot your device to see the changes.")
except Exception as e:
print(traceback.format_exc())
input("Press Enter to continue...")
running = False
elif page == 0:
# exit the panel
print("Goodbye!")
running = False
if passed_check == False:
print("No MobileGestalt file found!")
print(f"Please place the file in \'{Path.cwd()}\' with the name \'com.apple.MobileGestalt.plist\'")
print("Remember to make a backup of the file!!\n")
print("1. Retry")
print("2. Enter path\n")
choice = int(input("Enter number: "))
if choice == 2:
new_path = input("Enter new path to file: ")
gestalt_path = Path(new_path)