pymobiledevice3 4.27.0__py3-none-any.whl → 5.1.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.
Files changed (143) hide show
  1. misc/plist_sniffer.py +15 -15
  2. misc/remotexpc_sniffer.py +29 -28
  3. pymobiledevice3/__main__.py +123 -98
  4. pymobiledevice3/_version.py +2 -2
  5. pymobiledevice3/bonjour.py +351 -117
  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 +27 -20
  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 +601 -519
  18. pymobiledevice3/cli/diagnostics.py +38 -33
  19. pymobiledevice3/cli/lockdown.py +82 -72
  20. pymobiledevice3/cli/mounter.py +84 -67
  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 +188 -111
  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 +156 -78
  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 +400 -251
  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 +64 -42
  52. pymobiledevice3/remote/tunnel_service.py +383 -297
  53. pymobiledevice3/remote/utils.py +14 -13
  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 +587 -0
  65. pymobiledevice3/restore/recovery.py +125 -135
  66. pymobiledevice3/restore/restore.py +535 -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 +137 -127
  72. pymobiledevice3/services/afc.py +363 -293
  73. pymobiledevice3/services/amfi.py +21 -18
  74. pymobiledevice3/services/companion.py +23 -19
  75. pymobiledevice3/services/crash_reports.py +61 -47
  76. pymobiledevice3/services/debugserver_applist.py +3 -3
  77. pymobiledevice3/services/device_arbitration.py +8 -8
  78. pymobiledevice3/services/device_link.py +56 -48
  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 +466 -384
  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 +42 -52
  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 +331 -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 +128 -74
  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 +183 -179
  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 +3 -3
  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 +142 -116
  132. pymobiledevice3/tcp_forwarder.py +64 -50
  133. pymobiledevice3/tunneld/api.py +20 -15
  134. pymobiledevice3/tunneld/server.py +315 -193
  135. pymobiledevice3/usbmux.py +197 -148
  136. pymobiledevice3/utils.py +14 -11
  137. {pymobiledevice3-4.27.0.dist-info → pymobiledevice3-5.1.2.dist-info}/METADATA +2 -6
  138. pymobiledevice3-5.1.2.dist-info/RECORD +173 -0
  139. pymobiledevice3-4.27.0.dist-info/RECORD +0 -172
  140. {pymobiledevice3-4.27.0.dist-info → pymobiledevice3-5.1.2.dist-info}/WHEEL +0 -0
  141. {pymobiledevice3-4.27.0.dist-info → pymobiledevice3-5.1.2.dist-info}/entry_points.txt +0 -0
  142. {pymobiledevice3-4.27.0.dist-info → pymobiledevice3-5.1.2.dist-info}/licenses/LICENSE +0 -0
  143. {pymobiledevice3-4.27.0.dist-info → pymobiledevice3-5.1.2.dist-info}/top_level.txt +0 -0
@@ -4,7 +4,7 @@ from pymobiledevice3.remote.remote_service_discovery import RemoteServiceDiscove
4
4
 
5
5
 
6
6
  class RestoreService(RemoteService):
7
- SERVICE_NAME = 'com.apple.RestoreRemoteServices.restoreserviced'
7
+ SERVICE_NAME = "com.apple.RestoreRemoteServices.restoreserviced"
8
8
 
9
9
  def __init__(self, lockdown: RemoteServiceDiscoveryService):
10
10
  super().__init__(lockdown, self.SERVICE_NAME)
@@ -13,33 +13,33 @@ class RestoreService(RemoteService):
13
13
  """
14
14
  Set `delay-recovery-image` on devices of ProductType 0x1677b394. Otherwise, fail
15
15
  """
16
- await self.validate_command('delayrecoveryimage')
16
+ await self.validate_command("delayrecoveryimage")
17
17
 
18
18
  async def enter_recovery(self) -> None:
19
- """ Enter recovery """
20
- await self.validate_command('recovery')
19
+ """Enter recovery"""
20
+ await self.validate_command("recovery")
21
21
 
22
22
  async def reboot(self) -> None:
23
- """ Reboot device """
24
- await self.validate_command('reboot')
23
+ """Reboot device"""
24
+ await self.validate_command("reboot")
25
25
 
26
26
  async def get_preflightinfo(self) -> dict:
27
- """ Get preflight info """
28
- return await self.service.send_receive_request({'command': 'getpreflightinfo'})
27
+ """Get preflight info"""
28
+ return await self.service.send_receive_request({"command": "getpreflightinfo"})
29
29
 
30
30
  async def get_nonces(self) -> dict:
31
- """ Get ApNonce and SEPNonce """
32
- return await self.service.send_receive_request({'command': 'getnonces'})
31
+ """Get ApNonce and SEPNonce"""
32
+ return await self.service.send_receive_request({"command": "getnonces"})
33
33
 
34
34
  async def get_app_parameters(self) -> dict:
35
- return await self.validate_command('getappparameters')
35
+ return await self.validate_command("getappparameters")
36
36
 
37
37
  async def restore_lang(self, language: str) -> dict:
38
- return await self.service.send_receive_request({'command': 'restorelang', 'argument': language})
38
+ return await self.service.send_receive_request({"command": "restorelang", "argument": language})
39
39
 
40
40
  async def validate_command(self, command: str) -> dict:
41
- """ Execute command and validate result is `success` """
42
- response = await self.service.send_receive_request({'command': command})
43
- if response.get('result') != 'success':
44
- raise PyMobileDevice3Exception(f'request command: {command} failed with error: {response}')
41
+ """Execute command and validate result is `success`"""
42
+ response = await self.service.send_receive_request({"command": command})
43
+ if response.get("result") != "success":
44
+ raise PyMobileDevice3Exception(f"request command: {command} failed with error: {response}")
45
45
  return response
@@ -4,26 +4,29 @@ from pymobiledevice3.services.lockdown_service import LockdownService
4
4
 
5
5
 
6
6
  class ScreenshotService(LockdownService):
7
- SERVICE_NAME = 'com.apple.mobile.screenshotr'
7
+ SERVICE_NAME = "com.apple.mobile.screenshotr"
8
8
 
9
9
  def __init__(self, lockdown: LockdownClient):
10
10
  super().__init__(lockdown, self.SERVICE_NAME, is_developer_service=True)
11
11
 
12
12
  dl_message_version_exchange = self.service.recv_plist()
13
13
  version_major = dl_message_version_exchange[1]
14
- dl_message_device_ready = self.service.send_recv_plist(
15
- ['DLMessageVersionExchange', 'DLVersionsOk', version_major])
16
- if dl_message_device_ready[0] != 'DLMessageDeviceReady':
17
- raise PyMobileDevice3Exception('Screenshotr didn\'t return ready state')
14
+ dl_message_device_ready = self.service.send_recv_plist([
15
+ "DLMessageVersionExchange",
16
+ "DLVersionsOk",
17
+ version_major,
18
+ ])
19
+ if dl_message_device_ready[0] != "DLMessageDeviceReady":
20
+ raise PyMobileDevice3Exception("Screenshotr didn't return ready state")
18
21
 
19
22
  def take_screenshot(self) -> bytes:
20
- self.service.send_plist(['DLMessageProcessMessage', {'MessageType': 'ScreenShotRequest'}])
23
+ self.service.send_plist(["DLMessageProcessMessage", {"MessageType": "ScreenShotRequest"}])
21
24
  response = self.service.recv_plist()
22
25
 
23
26
  assert len(response) == 2
24
- assert response[0] == 'DLMessageProcessMessage'
27
+ assert response[0] == "DLMessageProcessMessage"
25
28
 
26
- if response[1].get('MessageType') == 'ScreenShotReply':
27
- return response[1]['ScreenShotData']
29
+ if response[1].get("MessageType") == "ScreenShotReply":
30
+ return response[1]["ScreenShotData"]
28
31
 
29
- raise PyMobileDevice3Exception(f'invalid response: {response}')
32
+ raise PyMobileDevice3Exception(f"invalid response: {response}")
@@ -6,22 +6,22 @@ from pymobiledevice3.services.lockdown_service import LockdownService
6
6
 
7
7
 
8
8
  class DtSimulateLocation(LockdownService, LocationSimulationBase):
9
- SERVICE_NAME = 'com.apple.dt.simulatelocation'
9
+ SERVICE_NAME = "com.apple.dt.simulatelocation"
10
10
 
11
11
  def __init__(self, lockdown: LockdownClient):
12
12
  LockdownService.__init__(self, lockdown, self.SERVICE_NAME)
13
13
  LocationSimulationBase.__init__(self)
14
14
 
15
15
  def clear(self) -> None:
16
- """ stop simulation """
16
+ """stop simulation"""
17
17
  service = self.lockdown.start_lockdown_developer_service(self.SERVICE_NAME)
18
- service.sendall(struct.pack('>I', 1))
18
+ service.sendall(struct.pack(">I", 1))
19
19
 
20
20
  def set(self, latitude: float, longitude: float) -> None:
21
- """ stop simulation """
21
+ """stop simulation"""
22
22
  service = self.lockdown.start_lockdown_developer_service(self.SERVICE_NAME)
23
- service.sendall(struct.pack('>I', 0))
23
+ service.sendall(struct.pack(">I", 0))
24
24
  latitude = str(latitude).encode()
25
25
  longitude = str(longitude).encode()
26
- service.sendall(struct.pack('>I', len(latitude)) + latitude)
27
- service.sendall(struct.pack('>I', len(longitude)) + longitude)
26
+ service.sendall(struct.pack(">I", len(latitude)) + latitude)
27
+ service.sendall(struct.pack(">I", len(longitude)) + longitude)
@@ -14,8 +14,8 @@ class InterfaceOrientation(IntEnum):
14
14
 
15
15
 
16
16
  class SpringBoardServicesService(LockdownService):
17
- RSD_SERVICE_NAME = 'com.apple.springboardservices.shim.remote'
18
- SERVICE_NAME = 'com.apple.springboardservices'
17
+ RSD_SERVICE_NAME = "com.apple.springboardservices.shim.remote"
18
+ SERVICE_NAME = "com.apple.springboardservices"
19
19
 
20
20
  def __init__(self, lockdown: LockdownServiceProvider) -> None:
21
21
  if isinstance(lockdown, LockdownClient):
@@ -23,38 +23,38 @@ class SpringBoardServicesService(LockdownService):
23
23
  else:
24
24
  super().__init__(lockdown, self.RSD_SERVICE_NAME)
25
25
 
26
- def get_icon_state(self, format_version: str = '2') -> list:
27
- cmd = {'command': 'getIconState'}
26
+ def get_icon_state(self, format_version: str = "2") -> list:
27
+ cmd = {"command": "getIconState"}
28
28
  if format_version:
29
- cmd['formatVersion'] = format_version
29
+ cmd["formatVersion"] = format_version
30
30
  return self.service.send_recv_plist(cmd)
31
31
 
32
32
  def set_icon_state(self, newstate: Optional[list] = None) -> None:
33
33
  if newstate is None:
34
34
  newstate = {}
35
- self.service.send_plist({'command': 'setIconState', 'iconState': newstate})
35
+ self.service.send_plist({"command": "setIconState", "iconState": newstate})
36
36
  self.service.recv_prefixed()
37
37
 
38
38
  def get_icon_pngdata(self, bundle_id: str) -> bytes:
39
- return self.service.send_recv_plist({'command': 'getIconPNGData',
40
- 'bundleId': bundle_id}).get('pngData')
39
+ return self.service.send_recv_plist({"command": "getIconPNGData", "bundleId": bundle_id}).get("pngData")
41
40
 
42
41
  def get_interface_orientation(self) -> InterfaceOrientation:
43
- res = self.service.send_recv_plist({'command': 'getInterfaceOrientation'})
44
- return InterfaceOrientation(res.get('interfaceOrientation'))
42
+ res = self.service.send_recv_plist({"command": "getInterfaceOrientation"})
43
+ return InterfaceOrientation(res.get("interfaceOrientation"))
45
44
 
46
45
  def get_wallpaper_pngdata(self) -> bytes:
47
- return self.service.send_recv_plist({'command': 'getHomeScreenWallpaperPNGData'}).get('pngData')
46
+ return self.service.send_recv_plist({"command": "getHomeScreenWallpaperPNGData"}).get("pngData")
48
47
 
49
48
  def get_homescreen_icon_metrics(self) -> dict[str, float]:
50
- return self.service.send_recv_plist({'command': 'getHomeScreenIconMetrics'})
49
+ return self.service.send_recv_plist({"command": "getHomeScreenIconMetrics"})
51
50
 
52
51
  def get_wallpaper_info(self, wallpaper_name: str) -> dict:
53
- return self.service.send_recv_plist({'command': 'getWallpaperInfo', 'wallpaperName': wallpaper_name})
52
+ return self.service.send_recv_plist({"command": "getWallpaperInfo", "wallpaperName": wallpaper_name})
54
53
 
55
54
  def reload_icon_state(self) -> None:
56
55
  self.set_icon_state(self.get_icon_state())
57
56
 
58
57
  def get_wallpaper_preview_image(self, wallpaper_name: str) -> bytes:
59
- return self.service.send_recv_plist({
60
- 'command': 'getWallpaperPreviewImage', 'wallpaperName': wallpaper_name})['pngData']
58
+ return self.service.send_recv_plist({"command": "getWallpaperPreviewImage", "wallpaperName": wallpaper_name})[
59
+ "pngData"
60
+ ]
@@ -4,8 +4,8 @@ from pymobiledevice3.services.lockdown_service import LockdownService
4
4
  from pymobiledevice3.utils import try_decode
5
5
 
6
6
  CHUNK_SIZE = 4096
7
- TIME_FORMAT = '%H:%M:%S'
8
- SYSLOG_LINE_SPLITTER = b'\n\x00'
7
+ TIME_FORMAT = "%H:%M:%S"
8
+ SYSLOG_LINE_SPLITTER = b"\n\x00"
9
9
 
10
10
 
11
11
  class SyslogService(LockdownService):
@@ -13,8 +13,8 @@ class SyslogService(LockdownService):
13
13
  View system logs
14
14
  """
15
15
 
16
- SERVICE_NAME = 'com.apple.syslog_relay'
17
- RSD_SERVICE_NAME = 'com.apple.syslog_relay.shim.remote'
16
+ SERVICE_NAME = "com.apple.syslog_relay"
17
+ RSD_SERVICE_NAME = "com.apple.syslog_relay.shim.remote"
18
18
 
19
19
  def __init__(self, service_provider: LockdownServiceProvider):
20
20
  if isinstance(service_provider, LockdownClient):
@@ -23,7 +23,7 @@ class SyslogService(LockdownService):
23
23
  super().__init__(service_provider, self.RSD_SERVICE_NAME)
24
24
 
25
25
  def watch(self):
26
- buf = b''
26
+ buf = b""
27
27
  while True:
28
28
  # read in chunks till we have at least one syslog line
29
29
  chunk = self.service.recv(CHUNK_SIZE)
@@ -6,11 +6,11 @@ class Alert:
6
6
  self.session = session
7
7
 
8
8
  def accept(self):
9
- """ Accepts the alert available. """
9
+ """Accepts the alert available."""
10
10
  self.session.accept_current_javascript_dialog()
11
11
 
12
12
  def dismiss(self):
13
- """ Dismisses the alert available. """
13
+ """Dismisses the alert available."""
14
14
  self.session.dismiss_current_javascript_dialog()
15
15
 
16
16
  def send_keys(self, text: str):
@@ -22,5 +22,5 @@ class Alert:
22
22
 
23
23
  @property
24
24
  def text(self) -> str:
25
- """ Gets the text of the Alert. """
25
+ """Gets the text of the Alert."""
26
26
  return self.session.message_of_current_javascript_dialog()