pymobiledevice3 5.0.1__py3-none-any.whl → 5.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pymobiledevice3 might be problematic. Click here for more details.
- misc/plist_sniffer.py +15 -15
- misc/remotexpc_sniffer.py +29 -28
- pymobiledevice3/__main__.py +128 -102
- pymobiledevice3/_version.py +2 -2
- pymobiledevice3/bonjour.py +26 -49
- pymobiledevice3/ca.py +32 -24
- pymobiledevice3/cli/activation.py +7 -7
- pymobiledevice3/cli/afc.py +19 -19
- pymobiledevice3/cli/amfi.py +4 -4
- pymobiledevice3/cli/apps.py +51 -39
- pymobiledevice3/cli/backup.py +58 -32
- pymobiledevice3/cli/bonjour.py +25 -18
- pymobiledevice3/cli/cli_common.py +112 -81
- pymobiledevice3/cli/companion_proxy.py +4 -4
- pymobiledevice3/cli/completions.py +10 -10
- pymobiledevice3/cli/crash.py +37 -31
- pymobiledevice3/cli/developer.py +602 -520
- pymobiledevice3/cli/diagnostics.py +38 -33
- pymobiledevice3/cli/lockdown.py +79 -74
- pymobiledevice3/cli/mounter.py +85 -68
- pymobiledevice3/cli/notification.py +10 -10
- pymobiledevice3/cli/pcap.py +19 -14
- pymobiledevice3/cli/power_assertion.py +12 -10
- pymobiledevice3/cli/processes.py +10 -10
- pymobiledevice3/cli/profile.py +88 -77
- pymobiledevice3/cli/provision.py +17 -17
- pymobiledevice3/cli/remote.py +186 -110
- pymobiledevice3/cli/restore.py +43 -40
- pymobiledevice3/cli/springboard.py +30 -28
- pymobiledevice3/cli/syslog.py +85 -58
- pymobiledevice3/cli/usbmux.py +21 -20
- pymobiledevice3/cli/version.py +3 -2
- pymobiledevice3/cli/webinspector.py +157 -79
- pymobiledevice3/common.py +1 -1
- pymobiledevice3/exceptions.py +154 -60
- pymobiledevice3/irecv.py +49 -53
- pymobiledevice3/irecv_devices.py +1489 -492
- pymobiledevice3/lockdown.py +394 -241
- pymobiledevice3/lockdown_service_provider.py +5 -7
- pymobiledevice3/osu/os_utils.py +18 -9
- pymobiledevice3/osu/posix_util.py +28 -15
- pymobiledevice3/osu/win_util.py +14 -8
- pymobiledevice3/pair_records.py +19 -19
- pymobiledevice3/remote/common.py +4 -4
- pymobiledevice3/remote/core_device/app_service.py +94 -67
- pymobiledevice3/remote/core_device/core_device_service.py +17 -14
- pymobiledevice3/remote/core_device/device_info.py +5 -5
- pymobiledevice3/remote/core_device/diagnostics_service.py +10 -8
- pymobiledevice3/remote/core_device/file_service.py +47 -33
- pymobiledevice3/remote/remote_service_discovery.py +53 -35
- pymobiledevice3/remote/remotexpc.py +62 -41
- pymobiledevice3/remote/tunnel_service.py +371 -293
- pymobiledevice3/remote/utils.py +12 -11
- pymobiledevice3/remote/xpc_message.py +145 -125
- pymobiledevice3/resources/dsc_uuid_map.py +19 -19
- pymobiledevice3/resources/firmware_notifications.py +16 -16
- pymobiledevice3/restore/asr.py +27 -27
- pymobiledevice3/restore/base_restore.py +90 -47
- pymobiledevice3/restore/consts.py +87 -66
- pymobiledevice3/restore/device.py +11 -11
- pymobiledevice3/restore/fdr.py +46 -46
- pymobiledevice3/restore/ftab.py +19 -19
- pymobiledevice3/restore/img4.py +130 -133
- pymobiledevice3/restore/mbn.py +35 -54
- pymobiledevice3/restore/recovery.py +125 -135
- pymobiledevice3/restore/restore.py +524 -523
- pymobiledevice3/restore/restore_options.py +122 -115
- pymobiledevice3/restore/restored_client.py +25 -22
- pymobiledevice3/restore/tss.py +378 -270
- pymobiledevice3/service_connection.py +50 -46
- pymobiledevice3/services/accessibilityaudit.py +136 -126
- pymobiledevice3/services/afc.py +350 -291
- pymobiledevice3/services/amfi.py +21 -18
- pymobiledevice3/services/companion.py +23 -19
- pymobiledevice3/services/crash_reports.py +60 -46
- pymobiledevice3/services/debugserver_applist.py +3 -3
- pymobiledevice3/services/device_arbitration.py +8 -8
- pymobiledevice3/services/device_link.py +55 -47
- pymobiledevice3/services/diagnostics.py +971 -968
- pymobiledevice3/services/dtfetchsymbols.py +8 -8
- pymobiledevice3/services/dvt/dvt_secure_socket_proxy.py +4 -4
- pymobiledevice3/services/dvt/dvt_testmanaged_proxy.py +4 -4
- pymobiledevice3/services/dvt/instruments/activity_trace_tap.py +85 -74
- pymobiledevice3/services/dvt/instruments/application_listing.py +2 -3
- pymobiledevice3/services/dvt/instruments/condition_inducer.py +7 -6
- pymobiledevice3/services/dvt/instruments/core_profile_session_tap.py +442 -421
- pymobiledevice3/services/dvt/instruments/device_info.py +11 -11
- pymobiledevice3/services/dvt/instruments/energy_monitor.py +1 -1
- pymobiledevice3/services/dvt/instruments/graphics.py +1 -1
- pymobiledevice3/services/dvt/instruments/location_simulation.py +1 -1
- pymobiledevice3/services/dvt/instruments/location_simulation_base.py +10 -10
- pymobiledevice3/services/dvt/instruments/network_monitor.py +17 -17
- pymobiledevice3/services/dvt/instruments/notifications.py +1 -1
- pymobiledevice3/services/dvt/instruments/process_control.py +25 -10
- pymobiledevice3/services/dvt/instruments/screenshot.py +2 -2
- pymobiledevice3/services/dvt/instruments/sysmontap.py +15 -15
- pymobiledevice3/services/dvt/testmanaged/xcuitest.py +40 -50
- pymobiledevice3/services/file_relay.py +10 -10
- pymobiledevice3/services/heartbeat.py +8 -7
- pymobiledevice3/services/house_arrest.py +12 -15
- pymobiledevice3/services/installation_proxy.py +119 -100
- pymobiledevice3/services/lockdown_service.py +12 -5
- pymobiledevice3/services/misagent.py +22 -19
- pymobiledevice3/services/mobile_activation.py +84 -72
- pymobiledevice3/services/mobile_config.py +330 -301
- pymobiledevice3/services/mobile_image_mounter.py +137 -116
- pymobiledevice3/services/mobilebackup2.py +188 -150
- pymobiledevice3/services/notification_proxy.py +11 -11
- pymobiledevice3/services/os_trace.py +69 -51
- pymobiledevice3/services/pcapd.py +306 -306
- pymobiledevice3/services/power_assertion.py +10 -9
- pymobiledevice3/services/preboard.py +4 -4
- pymobiledevice3/services/remote_fetch_symbols.py +16 -14
- pymobiledevice3/services/remote_server.py +176 -146
- pymobiledevice3/services/restore_service.py +16 -16
- pymobiledevice3/services/screenshot.py +13 -10
- pymobiledevice3/services/simulate_location.py +7 -7
- pymobiledevice3/services/springboard.py +15 -15
- pymobiledevice3/services/syslog.py +5 -5
- pymobiledevice3/services/web_protocol/alert.py +3 -3
- pymobiledevice3/services/web_protocol/automation_session.py +180 -176
- pymobiledevice3/services/web_protocol/cdp_screencast.py +44 -36
- pymobiledevice3/services/web_protocol/cdp_server.py +19 -19
- pymobiledevice3/services/web_protocol/cdp_target.py +411 -373
- pymobiledevice3/services/web_protocol/driver.py +47 -45
- pymobiledevice3/services/web_protocol/element.py +74 -63
- pymobiledevice3/services/web_protocol/inspector_session.py +106 -102
- pymobiledevice3/services/web_protocol/selenium_api.py +2 -2
- pymobiledevice3/services/web_protocol/session_protocol.py +15 -10
- pymobiledevice3/services/web_protocol/switch_to.py +11 -12
- pymobiledevice3/services/webinspector.py +127 -116
- pymobiledevice3/tcp_forwarder.py +35 -22
- pymobiledevice3/tunneld/api.py +20 -15
- pymobiledevice3/tunneld/server.py +212 -133
- pymobiledevice3/usbmux.py +183 -138
- pymobiledevice3/utils.py +14 -11
- {pymobiledevice3-5.0.1.dist-info → pymobiledevice3-5.0.2.dist-info}/METADATA +1 -1
- pymobiledevice3-5.0.2.dist-info/RECORD +173 -0
- pymobiledevice3-5.0.1.dist-info/RECORD +0 -173
- {pymobiledevice3-5.0.1.dist-info → pymobiledevice3-5.0.2.dist-info}/WHEEL +0 -0
- {pymobiledevice3-5.0.1.dist-info → pymobiledevice3-5.0.2.dist-info}/entry_points.txt +0 -0
- {pymobiledevice3-5.0.1.dist-info → pymobiledevice3-5.0.2.dist-info}/licenses/LICENSE +0 -0
- {pymobiledevice3-5.0.1.dist-info → pymobiledevice3-5.0.2.dist-info}/top_level.txt +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import contextlib
|
|
1
2
|
import plistlib
|
|
2
3
|
from enum import Enum
|
|
3
4
|
from pathlib import Path
|
|
@@ -15,17 +16,17 @@ from pymobiledevice3.lockdown_service_provider import LockdownServiceProvider
|
|
|
15
16
|
from pymobiledevice3.services.lockdown_service import LockdownService
|
|
16
17
|
|
|
17
18
|
ERROR_CLOUD_CONFIGURATION_ALREADY_PRESENT = 14002
|
|
18
|
-
GLOBAL_HTTP_PROXY_UUID =
|
|
19
|
-
GLOBAL_RESTRICTIONS_UUID =
|
|
19
|
+
GLOBAL_HTTP_PROXY_UUID = "86a52338-52f7-4c09-b005-52baf3dc4882"
|
|
20
|
+
GLOBAL_RESTRICTIONS_UUID = "e22a0a66-08a8-43f5-9bbc-5279af35bb2b"
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
class Purpose(Enum):
|
|
23
|
-
PostSetupInstallation =
|
|
24
|
+
PostSetupInstallation = "PostSetupInstallation"
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
class MobileConfigService(LockdownService):
|
|
27
|
-
SERVICE_NAME =
|
|
28
|
-
RSD_SERVICE_NAME =
|
|
28
|
+
SERVICE_NAME = "com.apple.mobile.MCInstall"
|
|
29
|
+
RSD_SERVICE_NAME = "com.apple.mobile.MCInstall.shim.remote"
|
|
29
30
|
|
|
30
31
|
def __init__(self, lockdown: LockdownServiceProvider) -> None:
|
|
31
32
|
if isinstance(lockdown, LockdownClient):
|
|
@@ -34,10 +35,10 @@ class MobileConfigService(LockdownService):
|
|
|
34
35
|
super().__init__(lockdown, self.RSD_SERVICE_NAME)
|
|
35
36
|
|
|
36
37
|
def hello(self) -> None:
|
|
37
|
-
self._send_recv({
|
|
38
|
+
self._send_recv({"RequestType": "HelloHostIdentifier"})
|
|
38
39
|
|
|
39
40
|
def flush(self) -> None:
|
|
40
|
-
self._send_recv({
|
|
41
|
+
self._send_recv({"RequestType": "Flush"})
|
|
41
42
|
|
|
42
43
|
def escalate(self, keybag_file: Path) -> None:
|
|
43
44
|
"""
|
|
@@ -46,118 +47,138 @@ class MobileConfigService(LockdownService):
|
|
|
46
47
|
:param keybag_file: Certificate file in PEM format, containing certificate and private key.
|
|
47
48
|
:return: None
|
|
48
49
|
"""
|
|
49
|
-
with open(keybag_file,
|
|
50
|
+
with open(keybag_file, "rb") as keybag_file:
|
|
50
51
|
keybag_file = keybag_file.read()
|
|
51
52
|
private_key = serialization.load_pem_private_key(keybag_file, password=None)
|
|
52
53
|
cer = x509.load_pem_x509_certificate(keybag_file)
|
|
53
54
|
public_key = cer.public_bytes(Encoding.DER)
|
|
54
|
-
escalate_response = self._send_recv({
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
self._send_recv({
|
|
55
|
+
escalate_response = self._send_recv({"RequestType": "Escalate", "SupervisorCertificate": public_key})
|
|
56
|
+
signed_challenge = (
|
|
57
|
+
PKCS7SignatureBuilder()
|
|
58
|
+
.set_data(escalate_response["Challenge"])
|
|
59
|
+
.add_signer(cer, private_key, hashes.SHA256())
|
|
60
|
+
.sign(Encoding.DER, [])
|
|
61
|
+
)
|
|
62
|
+
self._send_recv({"RequestType": "EscalateResponse", "SignedRequest": signed_challenge})
|
|
63
|
+
self._send_recv({"RequestType": "ProceedWithKeybagMigration"})
|
|
62
64
|
|
|
63
65
|
def get_stored_profile(self, purpose: Purpose = Purpose.PostSetupInstallation) -> dict:
|
|
64
|
-
return self._send_recv({
|
|
66
|
+
return self._send_recv({"RequestType": "GetStoredProfile", "Purpose": purpose.value})
|
|
65
67
|
|
|
66
68
|
def store_profile(self, profile_data: bytes, purpose: Purpose = Purpose.PostSetupInstallation) -> None:
|
|
67
|
-
self._send_recv({
|
|
69
|
+
self._send_recv({"RequestType": "StoreProfile", "ProfileData": profile_data, "Purpose": purpose.value})
|
|
68
70
|
|
|
69
71
|
def get_cloud_configuration(self) -> dict:
|
|
70
|
-
return self._send_recv({
|
|
72
|
+
return self._send_recv({"RequestType": "GetCloudConfiguration"}).get("CloudConfiguration")
|
|
71
73
|
|
|
72
74
|
def set_cloud_configuration(self, cloud_configuration: dict) -> None:
|
|
73
|
-
self._send_recv({
|
|
75
|
+
self._send_recv({"RequestType": "SetCloudConfiguration", "CloudConfiguration": cloud_configuration})
|
|
74
76
|
|
|
75
77
|
def establish_provisional_enrollment(self, nonce: bytes) -> None:
|
|
76
|
-
self._send_recv({
|
|
78
|
+
self._send_recv({"RequestType": "EstablishProvisionalEnrollment", "Nonce": nonce})
|
|
77
79
|
|
|
78
80
|
def set_wifi_power_state(self, state: bool) -> None:
|
|
79
|
-
self._send_recv({
|
|
81
|
+
self._send_recv({"RequestType": "SetWiFiPowerState", "PowerState": state})
|
|
80
82
|
|
|
81
83
|
def erase_device(self, preserve_data_plan: bool, disallow_proximity_setup: bool) -> None:
|
|
82
|
-
|
|
83
|
-
self._send_recv({
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
with contextlib.suppress(ConnectionAbortedError):
|
|
85
|
+
self._send_recv({
|
|
86
|
+
"RequestType": "EraseDevice",
|
|
87
|
+
"PreserveDataPlan": preserve_data_plan,
|
|
88
|
+
"DisallowProximitySetup": disallow_proximity_setup,
|
|
89
|
+
})
|
|
87
90
|
|
|
88
91
|
def get_profile_list(self) -> dict:
|
|
89
|
-
return self._send_recv({
|
|
92
|
+
return self._send_recv({"RequestType": "GetProfileList"})
|
|
90
93
|
|
|
91
94
|
def install_profile(self, payload: bytes) -> None:
|
|
92
|
-
self._send_recv({
|
|
95
|
+
self._send_recv({"RequestType": "InstallProfile", "Payload": payload})
|
|
93
96
|
|
|
94
97
|
def install_profile_silent(self, keybag_file: Path, profile: bytes) -> None:
|
|
95
98
|
self.escalate(keybag_file)
|
|
96
|
-
self._send_recv({
|
|
99
|
+
self._send_recv({"RequestType": "InstallProfileSilent", "Payload": profile})
|
|
97
100
|
|
|
98
101
|
def remove_profile(self, identifier: str) -> None:
|
|
99
102
|
profiles = self.get_profile_list()
|
|
100
103
|
if not profiles:
|
|
101
104
|
return
|
|
102
|
-
if identifier not in profiles[
|
|
103
|
-
self.logger.info(f
|
|
105
|
+
if identifier not in profiles["ProfileMetadata"]:
|
|
106
|
+
self.logger.info(f"Trying to remove not installed profile: {identifier}")
|
|
104
107
|
return
|
|
105
|
-
meta = profiles[
|
|
106
|
-
data = plistlib.dumps({
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
meta = profiles["ProfileMetadata"][identifier]
|
|
109
|
+
data = plistlib.dumps({
|
|
110
|
+
"PayloadType": "Configuration",
|
|
111
|
+
"PayloadIdentifier": identifier,
|
|
112
|
+
"PayloadUUID": meta["PayloadUUID"],
|
|
113
|
+
"PayloadVersion": meta["PayloadVersion"],
|
|
114
|
+
})
|
|
115
|
+
self._send_recv({"RequestType": "RemoveProfile", "ProfileIdentifier": data})
|
|
112
116
|
|
|
113
117
|
def _send_recv(self, request: dict) -> dict:
|
|
114
118
|
response = self.service.send_recv_plist(request)
|
|
115
|
-
if response.get(
|
|
116
|
-
error_chain = response.get(
|
|
119
|
+
if response.get("Status", None) != "Acknowledged":
|
|
120
|
+
error_chain = response.get("ErrorChain")
|
|
117
121
|
if error_chain is not None:
|
|
118
|
-
error_code = error_chain[0][
|
|
122
|
+
error_code = error_chain[0]["ErrorCode"]
|
|
119
123
|
if error_code == ERROR_CLOUD_CONFIGURATION_ALREADY_PRESENT:
|
|
120
124
|
raise CloudConfigurationAlreadyPresentError()
|
|
121
|
-
raise ProfileError(f
|
|
125
|
+
raise ProfileError(f"invalid response {response}")
|
|
122
126
|
return response
|
|
123
127
|
|
|
124
|
-
def install_wifi_profile(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
+
def install_wifi_profile(
|
|
129
|
+
self,
|
|
130
|
+
encryption_type: str,
|
|
131
|
+
ssid: str,
|
|
132
|
+
password: str,
|
|
133
|
+
auto_join: bool = True,
|
|
134
|
+
captive_bypass: bool = False,
|
|
135
|
+
disable_association_mac_randomization: bool = False,
|
|
136
|
+
hidden_network: bool = False,
|
|
137
|
+
is_hotspot: bool = False,
|
|
138
|
+
keybag_file: Optional[Path] = None,
|
|
139
|
+
) -> None:
|
|
128
140
|
payload_uuid = str(uuid4())
|
|
129
|
-
self.install_managed_profile(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
141
|
+
self.install_managed_profile(
|
|
142
|
+
f"WiFi Profile For {ssid}",
|
|
143
|
+
{
|
|
144
|
+
"AutoJoin": auto_join,
|
|
145
|
+
"CaptiveBypass": captive_bypass,
|
|
146
|
+
"DisableAssociationMACRandomization": disable_association_mac_randomization,
|
|
147
|
+
"EncryptionType": encryption_type,
|
|
148
|
+
"HIDDEN_NETWORK": hidden_network,
|
|
149
|
+
"IsHotspot": is_hotspot,
|
|
150
|
+
"Password": password,
|
|
151
|
+
"PayloadDescription": "Configures Wi-Fi settings",
|
|
152
|
+
"PayloadDisplayName": "Wi-Fi",
|
|
153
|
+
"PayloadIdentifier": f"com.apple.wifi.managed.{payload_uuid}",
|
|
154
|
+
"PayloadType": "com.apple.wifi.managed",
|
|
155
|
+
"PayloadUUID": payload_uuid,
|
|
156
|
+
"PayloadVersion": 1,
|
|
157
|
+
"ProxyType": "None",
|
|
158
|
+
"SSID_STR": ssid,
|
|
159
|
+
},
|
|
160
|
+
keybag_file=keybag_file,
|
|
161
|
+
)
|
|
146
162
|
|
|
147
163
|
def install_http_proxy(self, server: str, server_port: int, keybag_file: Optional[Path] = None) -> None:
|
|
148
164
|
payload_uuid = str(uuid4())
|
|
149
|
-
self.install_managed_profile(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
165
|
+
self.install_managed_profile(
|
|
166
|
+
f"HTTP Proxy for {server}:{server_port}",
|
|
167
|
+
{
|
|
168
|
+
"PayloadDescription": "Global HTTP Proxy",
|
|
169
|
+
"PayloadDisplayName": "Global HTTP Proxy",
|
|
170
|
+
"PayloadIdentifier": f"com.apple.proxy.http.global.{payload_uuid}",
|
|
171
|
+
"PayloadType": "com.apple.proxy.http.global",
|
|
172
|
+
"PayloadUUID": payload_uuid,
|
|
173
|
+
"PayloadVersion": 1,
|
|
174
|
+
"ProxyCaptiveLoginAllowed": False,
|
|
175
|
+
"ProxyServer": server,
|
|
176
|
+
"ProxyServerPort": server_port,
|
|
177
|
+
"ProxyType": "Manual",
|
|
178
|
+
},
|
|
179
|
+
payload_uuid=GLOBAL_HTTP_PROXY_UUID,
|
|
180
|
+
keybag_file=keybag_file,
|
|
181
|
+
)
|
|
161
182
|
|
|
162
183
|
def remove_http_proxy(self) -> None:
|
|
163
184
|
self.remove_profile(GLOBAL_HTTP_PROXY_UUID)
|
|
@@ -166,117 +187,117 @@ class MobileConfigService(LockdownService):
|
|
|
166
187
|
cer = x509.load_pem_x509_certificate(keybag_file.read_bytes())
|
|
167
188
|
public_key = cer.public_bytes(Encoding.DER)
|
|
168
189
|
self.set_cloud_configuration({
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
190
|
+
"AllowPairing": True,
|
|
191
|
+
"CloudConfigurationUIComplete": True,
|
|
192
|
+
"ConfigurationSource": 2,
|
|
193
|
+
"ConfigurationWasApplied": True,
|
|
194
|
+
"IsMDMUnremovable": False,
|
|
195
|
+
"IsMandatory": True,
|
|
196
|
+
"IsMultiUser": False,
|
|
197
|
+
"IsSupervised": True,
|
|
198
|
+
"OrganizationMagic": str(uuid4()),
|
|
199
|
+
"OrganizationName": organization,
|
|
200
|
+
"PostSetupProfileWasInstalled": True,
|
|
201
|
+
"SkipSetup": [
|
|
202
|
+
"Location",
|
|
203
|
+
"Restore",
|
|
204
|
+
"SIMSetup",
|
|
205
|
+
"Android",
|
|
206
|
+
"AppleID",
|
|
207
|
+
"IntendedUser",
|
|
208
|
+
"TOS",
|
|
209
|
+
"Siri",
|
|
210
|
+
"ScreenTime",
|
|
211
|
+
"Diagnostics",
|
|
212
|
+
"SoftwareUpdate",
|
|
213
|
+
"Passcode",
|
|
214
|
+
"Biometric",
|
|
215
|
+
"Payment",
|
|
216
|
+
"Zoom",
|
|
217
|
+
"DisplayTone",
|
|
218
|
+
"MessagingActivationUsingPhoneNumber",
|
|
219
|
+
"HomeButtonSensitivity",
|
|
220
|
+
"CloudStorage",
|
|
221
|
+
"ScreenSaver",
|
|
222
|
+
"TapToSetup",
|
|
223
|
+
"Keyboard",
|
|
224
|
+
"PreferredLanguage",
|
|
225
|
+
"SpokenLanguage",
|
|
226
|
+
"WatchMigration",
|
|
227
|
+
"OnBoarding",
|
|
228
|
+
"TVProviderSignIn",
|
|
229
|
+
"TVHomeScreenSync",
|
|
230
|
+
"Privacy",
|
|
231
|
+
"TVRoom",
|
|
232
|
+
"iMessageAndFaceTime",
|
|
233
|
+
"AppStore",
|
|
234
|
+
"Safety",
|
|
235
|
+
"Multitasking",
|
|
236
|
+
"ActionButton",
|
|
237
|
+
"TermsOfAddress",
|
|
238
|
+
"AccessibilityAppearance",
|
|
239
|
+
"Welcome",
|
|
240
|
+
"Appearance",
|
|
241
|
+
"RestoreCompleted",
|
|
242
|
+
"UpdateCompleted",
|
|
243
|
+
"WiFi",
|
|
244
|
+
"Display",
|
|
245
|
+
"Tone",
|
|
246
|
+
"LanguageAndLocale",
|
|
247
|
+
"TouchID",
|
|
248
|
+
"TrueToneDisplay",
|
|
249
|
+
"FileVault",
|
|
250
|
+
"iCloudStorage",
|
|
251
|
+
"iCloudDiagnostics",
|
|
252
|
+
"Registration",
|
|
253
|
+
"DeviceToDeviceMigration",
|
|
254
|
+
"UnlockWithWatch",
|
|
255
|
+
"Accessibility",
|
|
256
|
+
"All",
|
|
257
|
+
"ExpressLanguage",
|
|
258
|
+
"Language",
|
|
259
|
+
"N/A",
|
|
260
|
+
"Region",
|
|
261
|
+
"Avatar",
|
|
262
|
+
"DeviceProtection",
|
|
263
|
+
"Key",
|
|
264
|
+
"LockdownMode",
|
|
265
|
+
"Wallpaper",
|
|
266
|
+
"PrivacySubtitle",
|
|
267
|
+
"SecuritySubtitle",
|
|
268
|
+
"DataSubtitle",
|
|
269
|
+
"AppleIDSubtitle",
|
|
270
|
+
"AppearanceSubtitle",
|
|
271
|
+
"PreferredLang",
|
|
272
|
+
"OnboardingSubtitle",
|
|
273
|
+
"AppleTVSubtitle",
|
|
274
|
+
"Intelligence",
|
|
275
|
+
"WebContentFiltering",
|
|
276
|
+
"CameraButton",
|
|
277
|
+
"AdditionalPrivacySettings",
|
|
278
|
+
"EnableLockdownMode",
|
|
279
|
+
"OSShowcase",
|
|
280
|
+
"SafetyAndHandling",
|
|
281
|
+
"Tips",
|
|
261
282
|
],
|
|
262
|
-
|
|
263
|
-
public_key
|
|
264
|
-
]
|
|
283
|
+
"SupervisorHostCertificates": [public_key],
|
|
265
284
|
})
|
|
266
285
|
|
|
267
286
|
def install_managed_profile(
|
|
268
|
-
|
|
269
|
-
|
|
287
|
+
self,
|
|
288
|
+
display_name: str,
|
|
289
|
+
payload_content: dict[str, Any],
|
|
290
|
+
payload_uuid: str = str(uuid4()),
|
|
291
|
+
keybag_file: Optional[Path] = None,
|
|
292
|
+
) -> None:
|
|
270
293
|
profile_data = plistlib.dumps({
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
'PayloadUUID': payload_uuid,
|
|
279
|
-
'PayloadVersion': 1
|
|
294
|
+
"PayloadContent": [payload_content],
|
|
295
|
+
"PayloadDisplayName": display_name,
|
|
296
|
+
"PayloadIdentifier": payload_uuid,
|
|
297
|
+
"PayloadRemovalDisallowed": False,
|
|
298
|
+
"PayloadType": "Configuration",
|
|
299
|
+
"PayloadUUID": payload_uuid,
|
|
300
|
+
"PayloadVersion": 1,
|
|
280
301
|
})
|
|
281
302
|
if keybag_file is not None:
|
|
282
303
|
self.install_profile_silent(keybag_file, profile_data)
|
|
@@ -284,122 +305,130 @@ class MobileConfigService(LockdownService):
|
|
|
284
305
|
self.install_profile(profile_data)
|
|
285
306
|
|
|
286
307
|
def install_restrictions_profile(
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
308
|
+
self,
|
|
309
|
+
enforced_software_update_delay: int = 0,
|
|
310
|
+
payload_uuid: str = GLOBAL_RESTRICTIONS_UUID,
|
|
311
|
+
keybag_file: Optional[Path] = None,
|
|
312
|
+
) -> None:
|
|
313
|
+
self.install_managed_profile(
|
|
314
|
+
"Restrictions",
|
|
315
|
+
{
|
|
316
|
+
"PayloadDescription": "Configures restrictions",
|
|
317
|
+
"PayloadDisplayName": "Restrictions",
|
|
318
|
+
"PayloadIdentifier": f"com.apple.applicationaccess.{payload_uuid}",
|
|
319
|
+
"PayloadType": "com.apple.applicationaccess",
|
|
320
|
+
"PayloadUUID": payload_uuid,
|
|
321
|
+
"PayloadVersion": 1,
|
|
322
|
+
"allowActivityContinuation": True,
|
|
323
|
+
"allowAddingGameCenterFriends": True,
|
|
324
|
+
"allowAirPlayIncomingRequests": True,
|
|
325
|
+
"allowAirPrint": True,
|
|
326
|
+
"allowAirPrintCredentialsStorage": True,
|
|
327
|
+
"allowAirPrintiBeaconDiscovery": True,
|
|
328
|
+
"allowAppCellularDataModification": True,
|
|
329
|
+
"allowAppClips": True,
|
|
330
|
+
"allowAppInstallation": True,
|
|
331
|
+
"allowAppRemoval": True,
|
|
332
|
+
"allowApplePersonalizedAdvertising": True,
|
|
333
|
+
"allowAssistant": True,
|
|
334
|
+
"allowAssistantWhileLocked": True,
|
|
335
|
+
"allowAutoCorrection": True,
|
|
336
|
+
"allowAutoUnlock": True,
|
|
337
|
+
"allowAutomaticAppDownloads": True,
|
|
338
|
+
"allowBluetoothModification": True,
|
|
339
|
+
"allowBookstore": True,
|
|
340
|
+
"allowBookstoreErotica": True,
|
|
341
|
+
"allowCamera": True,
|
|
342
|
+
"allowCellularPlanModification": True,
|
|
343
|
+
"allowChat": True,
|
|
344
|
+
"allowCloudBackup": True,
|
|
345
|
+
"allowCloudDocumentSync": True,
|
|
346
|
+
"allowCloudPhotoLibrary": True,
|
|
347
|
+
"allowContinuousPathKeyboard": True,
|
|
348
|
+
"allowDefinitionLookup": True,
|
|
349
|
+
"allowDeviceNameModification": True,
|
|
350
|
+
"allowDeviceSleep": True,
|
|
351
|
+
"allowDictation": True,
|
|
352
|
+
"allowESIMModification": True,
|
|
353
|
+
"allowEnablingRestrictions": True,
|
|
354
|
+
"allowEnterpriseAppTrust": True,
|
|
355
|
+
"allowEnterpriseBookBackup": True,
|
|
356
|
+
"allowEnterpriseBookMetadataSync": True,
|
|
357
|
+
"allowEraseContentAndSettings": True,
|
|
358
|
+
"allowExplicitContent": True,
|
|
359
|
+
"allowFilesNetworkDriveAccess": True,
|
|
360
|
+
"allowFilesUSBDriveAccess": True,
|
|
361
|
+
"allowFindMyDevice": True,
|
|
362
|
+
"allowFindMyFriends": True,
|
|
363
|
+
"allowFingerprintForUnlock": True,
|
|
364
|
+
"allowFingerprintModification": True,
|
|
365
|
+
"allowGameCenter": True,
|
|
366
|
+
"allowGlobalBackgroundFetchWhenRoaming": True,
|
|
367
|
+
"allowInAppPurchases": True,
|
|
368
|
+
"allowKeyboardShortcuts": True,
|
|
369
|
+
"allowManagedAppsCloudSync": True,
|
|
370
|
+
"allowMultiplayerGaming": True,
|
|
371
|
+
"allowMusicService": True,
|
|
372
|
+
"allowNews": True,
|
|
373
|
+
"allowNotificationsModification": True,
|
|
374
|
+
"allowOpenFromManagedToUnmanaged": True,
|
|
375
|
+
"allowOpenFromUnmanagedToManaged": True,
|
|
376
|
+
"allowPairedWatch": True,
|
|
377
|
+
"allowPassbookWhileLocked": True,
|
|
378
|
+
"allowPasscodeModification": True,
|
|
379
|
+
"allowPasswordAutoFill": True,
|
|
380
|
+
"allowPasswordProximityRequests": True,
|
|
381
|
+
"allowPasswordSharing": True,
|
|
382
|
+
"allowPersonalHotspotModification": True,
|
|
383
|
+
"allowPhotoStream": True,
|
|
384
|
+
"allowPredictiveKeyboard": True,
|
|
385
|
+
"allowProximitySetupToNewDevice": True,
|
|
386
|
+
"allowRadioService": True,
|
|
387
|
+
"allowRemoteAppPairing": True,
|
|
388
|
+
"allowRemoteScreenObservation": True,
|
|
389
|
+
"allowSafari": True,
|
|
390
|
+
"allowScreenShot": True,
|
|
391
|
+
"allowSharedStream": True,
|
|
392
|
+
"allowSpellCheck": True,
|
|
393
|
+
"allowSpotlightInternetResults": True,
|
|
394
|
+
"allowSystemAppRemoval": True,
|
|
395
|
+
"allowUIAppInstallation": True,
|
|
396
|
+
"allowUIConfigurationProfileInstallation": True,
|
|
397
|
+
"allowUSBRestrictedMode": True,
|
|
398
|
+
"allowUnpairedExternalBootToRecovery": False,
|
|
399
|
+
"allowUntrustedTLSPrompt": True,
|
|
400
|
+
"allowVPNCreation": True,
|
|
401
|
+
"allowVideoConferencing": True,
|
|
402
|
+
"allowVoiceDialing": True,
|
|
403
|
+
"allowWallpaperModification": True,
|
|
404
|
+
"allowiTunes": True,
|
|
405
|
+
"enforcedSoftwareUpdateDelay": enforced_software_update_delay,
|
|
406
|
+
"forceAirDropUnmanaged": False,
|
|
407
|
+
"forceAirPrintTrustedTLSRequirement": False,
|
|
408
|
+
"forceAssistantProfanityFilter": False,
|
|
409
|
+
"forceAuthenticationBeforeAutoFill": False,
|
|
410
|
+
"forceAutomaticDateAndTime": False,
|
|
411
|
+
"forceClassroomAutomaticallyJoinClasses": False,
|
|
412
|
+
"forceClassroomRequestPermissionToLeaveClasses": False,
|
|
413
|
+
"forceClassroomUnpromptedAppAndDeviceLock": False,
|
|
414
|
+
"forceClassroomUnpromptedScreenObservation": False,
|
|
415
|
+
"forceDelayedSoftwareUpdates": True,
|
|
416
|
+
"forceEncryptedBackup": False,
|
|
417
|
+
"forceITunesStorePasswordEntry": False,
|
|
418
|
+
"forceLimitAdTracking": False,
|
|
419
|
+
"forceWatchWristDetection": False,
|
|
420
|
+
"forceWiFiPowerOn": False,
|
|
421
|
+
"forceWiFiWhitelisting": False,
|
|
422
|
+
"ratingApps": 1000,
|
|
423
|
+
"ratingMovies": 1000,
|
|
424
|
+
"ratingRegion": "us",
|
|
425
|
+
"ratingTVShows": 1000,
|
|
426
|
+
"safariAcceptCookies": 2.0,
|
|
427
|
+
"safariAllowAutoFill": True,
|
|
428
|
+
"safariAllowJavaScript": True,
|
|
429
|
+
"safariAllowPopups": True,
|
|
430
|
+
"safariForceFraudWarning": False,
|
|
431
|
+
},
|
|
432
|
+
payload_uuid=payload_uuid,
|
|
433
|
+
keybag_file=keybag_file,
|
|
434
|
+
)
|