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.

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