pymobiledevice3 4.21.4__py3-none-any.whl → 4.21.6__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.

@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '4.21.4'
21
- __version_tuple__ = version_tuple = (4, 21, 4)
20
+ __version__ = version = '4.21.6'
21
+ __version_tuple__ = version_tuple = (4, 21, 6)
@@ -21,7 +21,6 @@ from socket import create_connection
21
21
  from ssl import VerifyMode
22
22
  from typing import Optional, TextIO, cast
23
23
 
24
- import aiofiles
25
24
  from construct import Const, Container
26
25
  from construct import Enum as ConstructEnum
27
26
  from construct import GreedyBytes, GreedyRange, Int8ul, Int16ub, Int64ul, Prefixed, Struct
@@ -68,6 +67,7 @@ from pymobiledevice3.remote.xpc_message import XpcInt64Type, XpcUInt64Type
68
67
  from pymobiledevice3.service_connection import ServiceConnection
69
68
  from pymobiledevice3.utils import asyncio_print_traceback
70
69
 
70
+ DEFAULT_INTERFACE_NAME = 'pymobiledevice3-tunnel'
71
71
  TIMEOUT = 1
72
72
 
73
73
  OSUTIL = get_os_utils()
@@ -160,24 +160,30 @@ class RemotePairingTunnel(ABC):
160
160
  read_size = self.tun.mtu + len(LOOPBACK_HEADER)
161
161
  try:
162
162
  if sys.platform != 'win32':
163
- async with aiofiles.open(self.tun.fileno(), 'rb', opener=lambda path, flags: path, buffering=0) as f:
164
- while True:
165
- packet = await f.read(read_size)
166
- assert packet.startswith(LOOPBACK_HEADER)
167
- packet = packet[len(LOOPBACK_HEADER):]
168
- await self.send_packet_to_device(packet)
163
+ while True:
164
+ packet = await asyncio.to_thread(self.tun.read, read_size)
165
+ assert packet.startswith(LOOPBACK_HEADER)
166
+ packet = packet[len(LOOPBACK_HEADER):]
167
+ await self.send_packet_to_device(packet)
169
168
  else:
170
169
  while True:
171
- packet = await asyncio.get_running_loop().run_in_executor(None, self.tun.read)
170
+ packet = await self.tun.async_read()
172
171
  if packet:
172
+ if (packet[0] >> 4) != 6:
173
+ # Make sure to output only IPv6 packets
174
+ continue
173
175
  await self.send_packet_to_device(packet)
174
176
  except ConnectionResetError:
175
177
  self._logger.warning(f'got connection reset in {asyncio.current_task().get_name()}')
176
178
  except OSError:
177
179
  self._logger.warning(f'got oserror in {asyncio.current_task().get_name()}')
178
180
 
179
- def start_tunnel(self, address: str, mtu: int) -> None:
180
- self.tun = TunTapDevice()
181
+ def start_tunnel(self, address: str, mtu: int, interface_name=DEFAULT_INTERFACE_NAME) -> None:
182
+ if 'win32' == sys.platform:
183
+ # Only win32 tunnel implementation supports interface name
184
+ self.tun = TunTapDevice(interface_name)
185
+ else:
186
+ self.tun = TunTapDevice()
181
187
  self.tun.addr = address
182
188
  self.tun.mtu = mtu
183
189
  self.tun.up()
@@ -232,8 +238,8 @@ class RemotePairingQuicTunnel(RemotePairingTunnel, QuicConnectionProtocol):
232
238
  await self.ping()
233
239
  await asyncio.sleep(self._quic.configuration.idle_timeout / 2)
234
240
 
235
- def start_tunnel(self, address: str, mtu: int) -> None:
236
- super().start_tunnel(address, mtu)
241
+ def start_tunnel(self, address: str, mtu: int, interface_name=DEFAULT_INTERFACE_NAME) -> None:
242
+ super().start_tunnel(address, mtu, interface_name=interface_name)
237
243
  self._keep_alive_task = asyncio.create_task(self.keep_alive_task())
238
244
 
239
245
  async def stop_tunnel(self) -> None:
@@ -295,21 +301,21 @@ class RemotePairingTcpTunnel(RemotePairingTunnel):
295
301
  await self._writer.drain()
296
302
  return json.loads(CDTunnelPacket.parse(await self._reader.read(self.REQUESTED_MTU)).body)
297
303
 
298
- def start_tunnel(self, address: str, mtu: int) -> None:
299
- super().start_tunnel(address, mtu)
304
+ def start_tunnel(self, address: str, mtu: int, interface_name=DEFAULT_INTERFACE_NAME) -> None:
305
+ super().start_tunnel(address, mtu, interface_name=interface_name)
300
306
  self._sock_read_task = asyncio.create_task(self.sock_read_task(), name=f'sock-read-task-{address}')
301
307
 
302
308
  async def stop_tunnel(self) -> None:
303
309
  self._sock_read_task.cancel()
304
310
  with suppress(CancelledError):
305
311
  await self._sock_read_task
312
+ await super().stop_tunnel()
306
313
  if not self._writer.is_closing():
307
314
  self._writer.close()
308
315
  try:
309
316
  await self._writer.wait_closed()
310
317
  except OSError:
311
318
  pass
312
- await super().stop_tunnel()
313
319
 
314
320
 
315
321
  @dataclasses.dataclass
@@ -437,7 +443,8 @@ class RemotePairingProtocol(StartTcpTunnel):
437
443
  await client.wait_connected()
438
444
  handshake_response = await client.request_tunnel_establish()
439
445
  client.start_tunnel(handshake_response['clientParameters']['address'],
440
- handshake_response['clientParameters']['mtu'])
446
+ handshake_response['clientParameters']['mtu'],
447
+ interface_name=f'{DEFAULT_INTERFACE_NAME}-{self.remote_identifier}')
441
448
  try:
442
449
  yield TunnelResult(
443
450
  client.tun.name, handshake_response['serverAddress'], handshake_response['serverRSDPort'],
@@ -471,7 +478,8 @@ class RemotePairingProtocol(StartTcpTunnel):
471
478
  handshake_response = await tunnel.request_tunnel_establish()
472
479
 
473
480
  tunnel.start_tunnel(handshake_response['clientParameters']['address'],
474
- handshake_response['clientParameters']['mtu'])
481
+ handshake_response['clientParameters']['mtu'],
482
+ interface_name=f'{DEFAULT_INTERFACE_NAME}-{self.remote_identifier}')
475
483
 
476
484
  try:
477
485
  yield TunnelResult(
@@ -945,7 +953,8 @@ class CoreDeviceTunnelProxy(StartTcpTunnel):
945
953
  tunnel = RemotePairingTcpTunnel(self._service.reader, self._service.writer)
946
954
  handshake_response = await tunnel.request_tunnel_establish()
947
955
  tunnel.start_tunnel(handshake_response['clientParameters']['address'],
948
- handshake_response['clientParameters']['mtu'])
956
+ handshake_response['clientParameters']['mtu'],
957
+ interface_name=f'{DEFAULT_INTERFACE_NAME}-{self.remote_identifier}')
949
958
  try:
950
959
  yield TunnelResult(
951
960
  tunnel.tun.name, handshake_response['serverAddress'], handshake_response['serverRSDPort'],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pymobiledevice3
3
- Version: 4.21.4
3
+ Version: 4.21.6
4
4
  Summary: Pure python3 implementation for working with iDevices (iPhone, etc...)
5
5
  Author-email: doronz88 <doron88@gmail.com>, matan <matan1008@gmail.com>
6
6
  Maintainer-email: doronz88 <doron88@gmail.com>, matan <matan1008@gmail.com>
@@ -58,8 +58,7 @@ Requires-Dist: qh3<2,>=1.0.0
58
58
  Requires-Dist: developer_disk_image>=0.0.2
59
59
  Requires-Dist: opack2
60
60
  Requires-Dist: psutil
61
- Requires-Dist: pytun-pmd3>=2.0.9
62
- Requires-Dist: aiofiles
61
+ Requires-Dist: pytun-pmd3>=2.1.0
63
62
  Requires-Dist: prompt_toolkit
64
63
  Requires-Dist: sslpsk-pmd3>=1.0.3; python_version < "3.13"
65
64
  Requires-Dist: python-pcapng>=2.1.1
@@ -8,7 +8,7 @@ misc/understanding_idevice_protocol_layers.md,sha256=8tEqRXWOUPoxOJLZVh7C7H9JGCh
8
8
  misc/usbmux_sniff.sh,sha256=iWtbucOEQ9_UEFXk9x-2VNt48Jg5zrPsnUbZ_LfZxwA,212
9
9
  pymobiledevice3/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  pymobiledevice3/__main__.py,sha256=nwUgfXBMii2MSXLUls2uMTG88uC13s4haPBM4LuGcaU,11530
11
- pymobiledevice3/_version.py,sha256=L0S9xHZAqvyvcVNRszketqOwbVGHMmww4Q5KcJSZP7E,513
11
+ pymobiledevice3/_version.py,sha256=WjwQTI6LRzwsShpVvMPvi_IUxnnCUPhIGoX94CHWQTY,513
12
12
  pymobiledevice3/bonjour.py,sha256=FXa_x0Zdo6ims7N7F61hnnZEyn1tc2it3mQpHRMY0Kk,5560
13
13
  pymobiledevice3/ca.py,sha256=Ho0NaOtATe5hdruUSlVDRpfR9ltEYXjL3MoKwEvEJjw,2296
14
14
  pymobiledevice3/common.py,sha256=-PG6oaUkNFlB3jb7E0finMrX8wqhkS-cuTAfmLvZUmc,329
@@ -60,7 +60,7 @@ pymobiledevice3/remote/module_imports.py,sha256=DwExSL1r4kkFIWmXiQpqPo-cGl4duYd3
60
60
  pymobiledevice3/remote/remote_service.py,sha256=fCyzm4oT_WEorAXVHVLYnIOyTOuMGhX69Co3HkUdRYY,867
61
61
  pymobiledevice3/remote/remote_service_discovery.py,sha256=iqPE1PiDDB2ISK-ThuUPEiSU9ETZ-FGTcANhb6MrWmo,7156
62
62
  pymobiledevice3/remote/remotexpc.py,sha256=KbFHaH4D3RnaATve6kaIpJMHNF8H-kdhbRbEbxFmO6w,8082
63
- pymobiledevice3/remote/tunnel_service.py,sha256=a9s2pDnPfGCP166eb2CAeQEORwxNoUTn5OftjiODN7g,45761
63
+ pymobiledevice3/remote/tunnel_service.py,sha256=zVg9t7Z_zzK4Rav8Xn_UEanIXTzBvcjEsd_-bBYs1CE,46451
64
64
  pymobiledevice3/remote/utils.py,sha256=BgUODRwkET5lyloZxJ-PrVZqTvyOlBuJ-MM7OCSqZ9g,2506
65
65
  pymobiledevice3/remote/xpc_message.py,sha256=-nVbf88ZN4ZNxLg6cOq4FfeKXYAoVRKnwGdfe7s-sZE,9336
66
66
  pymobiledevice3/remote/core_device/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -164,9 +164,9 @@ pymobiledevice3/services/web_protocol/switch_to.py,sha256=hDddJUEePbRN-8xlllOeGh
164
164
  pymobiledevice3/tunneld/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
165
165
  pymobiledevice3/tunneld/api.py,sha256=EfGKXEWhsMSB__menPmRmL9R6dpazVJDUy7B3pn05MM,2357
166
166
  pymobiledevice3/tunneld/server.py,sha256=SvC57AV_R8YQhA0fCwGNUdhfy8TKMFWwL_fp_FmXrBI,22715
167
- pymobiledevice3-4.21.4.dist-info/licenses/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
168
- pymobiledevice3-4.21.4.dist-info/METADATA,sha256=snPi-jeUNDZeBWNFCmjmxcQOFlesyeiqx-MEcumR7Tg,17500
169
- pymobiledevice3-4.21.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
170
- pymobiledevice3-4.21.4.dist-info/entry_points.txt,sha256=jJMlOanHlVwUxcY__JwvKeWPrvBJr_wJyEq4oHIZNKE,66
171
- pymobiledevice3-4.21.4.dist-info/top_level.txt,sha256=MjZoRqcWPOh5banG-BbDOnKEfsS3kCxqV9cv-nzyg2Q,21
172
- pymobiledevice3-4.21.4.dist-info/RECORD,,
167
+ pymobiledevice3-4.21.6.dist-info/licenses/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
168
+ pymobiledevice3-4.21.6.dist-info/METADATA,sha256=lTExHG3NlhqzhJvwJ-C0w30OI2gNGI3dxWtohrWRRUE,17476
169
+ pymobiledevice3-4.21.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
170
+ pymobiledevice3-4.21.6.dist-info/entry_points.txt,sha256=jJMlOanHlVwUxcY__JwvKeWPrvBJr_wJyEq4oHIZNKE,66
171
+ pymobiledevice3-4.21.6.dist-info/top_level.txt,sha256=MjZoRqcWPOh5banG-BbDOnKEfsS3kCxqV9cv-nzyg2Q,21
172
+ pymobiledevice3-4.21.6.dist-info/RECORD,,