rust-ios-device-tunnel
Python bindings for communicating with iOS devices — device discovery, CoreDevice tunnel management, and asyncio integration.
Built on top of rust-ios-device, a Rust library for iOS device interaction through usbmuxd, lockdown, and CoreDevice/RemoteXPC protocols.
Install
pip install rust-ios-device-tunnel
Requires Python 3.9+. Pre-built abi3 wheels are published for:
- Linux x86_64 (
x86_64-unknown-linux-gnu) - Linux aarch64 (
aarch64-unknown-linux-gnu) - macOS Apple Silicon (
aarch64-apple-darwin) - Windows x86_64 (
x86_64-pc-windows-msvc)
A source distribution is also available for other targets via pip install --no-binary rust-ios-device-tunnel rust-ios-device-tunnel.
Quick start
import ios_rs
# List connected devices
devices = ios_rs.list_devices()
for d in devices:
print(f"{d['udid']} {d['connection_type']}")
Tunnel usage
Start a CoreDevice tunnel to a trusted iOS device:
import ios_rs
devices = ios_rs.list_devices()
tunnel = ios_rs.start_tunnel(devices[0]["udid"], mode="userspace")
print(tunnel.server_address) # device tunnel IPv6 address
print(tunnel.rsd_port) # Remote Service Discovery port
print(tunnel.userspace_port) # local TCP proxy port
print(tunnel.services) # discovered RSD service names
print(tunnel.service_ports) # service name -> device TCP port
print(tunnel.service_features) # service name -> advertised identifiers (possibly [])
print(tunnel.connect_info()) # connection summary dict
tunnel.close()
The services list and both mapping attributes use stable service-name order.
service_ports and service_features contain every discovered service;
service_features uses an empty list when the device did not advertise
capability metadata. Missing metadata is not an explicit deny-all result.
Tunnel setup and initial RSD/XPC connection setup are limited to 15 seconds.
Kernel TUN mode (mode="kernel") requires root/administrator privileges. Userspace mode works without elevated permissions and is the default.
asyncio integration
The userspace tunnel includes a context manager that patches asyncio.open_connection so asyncio-based libraries can connect to the device tunnel transparently:
import asyncio
import ios_rs
devices = ios_rs.list_devices()
tunnel = ios_rs.start_tunnel(devices[0]["udid"])
with tunnel.asyncio_proxy():
# Connections to the tunnel IPv6 address are routed
# through the local userspace proxy automatically.
reader, writer = asyncio.get_event_loop().run_until_complete(
asyncio.open_connection(tunnel.server_address, tunnel.rsd_port)
)
tunnel.close()
pymobiledevice3 interoperability
Tunnel.asyncio_proxy() can also be used as a transport bridge for
asyncio-based RemoteXPC clients. For example, pymobiledevice3's
RemoteServiceDiscoveryService calls asyncio.open_connection() internally, so
it can run over an ios_rs userspace tunnel without requiring pymobiledevice3's
own privileged tunnel startup path:
cd crates/ios-py
uvx maturin develop
uv pip install pymobiledevice3
uv run python examples/pymobiledevice3_coredevice_bridge.py --udid <UDID>
The example is read-only by default and reports RSD service presence. Add
--probe-coredevice to try opening selected pymobiledevice3 CoreDevice service
classes through the same tunnel; the diagnostics probe is connect-only and does
not capture a full sysdiagnose.
API reference
| Function / Class | Description |
|---|---|
ios_rs.list_devices() |
Returns a list of dicts with udid, device_id, and connection_type for each connected device. |
ios_rs.start_tunnel(udid, mode="userspace") |
Opens a CoreDevice tunnel. Returns a Tunnel object. |
Tunnel.server_address |
Device tunnel IPv6 address. |
Tunnel.rsd_port |
Remote Service Discovery port. |
Tunnel.userspace_port |
Local TCP proxy port (userspace mode only). |
Tunnel.services |
List of discovered RSD service names. |
Tunnel.service_ports |
Dict mapping RSD service names to device TCP ports. |
Tunnel.service_features |
Dict mapping every RSD service to advertised capability identifiers; an empty list means metadata was not advertised. |
Tunnel.connect_info() |
Dict summarizing connection parameters. |
Tunnel.asyncio_proxy() |
Context manager that patches asyncio.open_connection. |
Tunnel.close() |
Tears down the tunnel. |
Requirements
- A trusted iOS device connected via USB.
- usbmuxd (Linux), Apple Mobile Device Support (Windows), or macOS device support components.
- For CoreDevice tunnels: a compatible iOS version (17+) with pairing material on the host.
Links
- Source: https://github.com/oslo254804746/rust-ios-device
- Rust crate: https://crates.io/crates/ios-core
- Issues: https://github.com/oslo254804746/rust-ios-device/issues
License
Licensed under either of Apache-2.0 or MIT at your option.
Metadata
Release files for rust-ios-device-tunnel 0.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rust_ios_device_tunnel-0.1.9.tar.gz | 362.0 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| rust_ios_device_tunnel-0.1.9-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| rust_ios_device_tunnel-0.1.9-cp39-abi3-manylinux_2_38_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.38+ x86-64 | Details |
| rust_ios_device_tunnel-0.1.9-cp39-abi3-manylinux_2_38_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.38+ ARM64 | Details |
| rust_ios_device_tunnel-0.1.9-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 12.6 MB
Release files / rust_ios_device_tunnel-0.1.9.tar.gz
| Download URL | rust_ios_device_tunnel-0.1.9.tar.gz |
|---|---|
| Size | 362.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
061c944b59e97dbdcaa9801acc33c8782c0a0bfe3d24dd43bb5b0f45229ea856
|
|
BLAKE2b-256 checksum How to use checksums |
e0810f68434b0bc0e5f7c5e6cd88cac25dec925663562a22b3eddc20bdba5074
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / rust_ios_device_tunnel-0.1.9-cp39-abi3-win_amd64.whl
| Download URL | rust_ios_device_tunnel-0.1.9-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 4.3 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
3131569237b51b55a9213224c64a349a59270df9c1318b0c75a344627ed27d88
|
|
BLAKE2b-256 checksum How to use checksums |
d0a42962433d2209eb1dc819cd9d633d30af81e8b1db62dbaa41684cd75bf6ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / rust_ios_device_tunnel-0.1.9-cp39-abi3-manylinux_2_38_x86_64.whl
| Download URL | rust_ios_device_tunnel-0.1.9-cp39-abi3-manylinux_2_38_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.9 Linux glibc 2.38+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
4fcf88cf19c36a754042c598a57a994839149e239ced7847b8b6530d5cf2f87b
|
|
BLAKE2b-256 checksum How to use checksums |
120ed843b70e34544d3a7b535fe9392ac1fcf6594388dab022ee03de71600889
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / rust_ios_device_tunnel-0.1.9-cp39-abi3-manylinux_2_38_aarch64.whl
| Download URL | rust_ios_device_tunnel-0.1.9-cp39-abi3-manylinux_2_38_aarch64.whl |
|---|---|
| Size | 4.0 MB |
| Tags | CPython 3.9 Linux glibc 2.38+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
99cc08c9f3a7915d59baca7070903db5e9765ce2eab5bdde0e517bf4521c6588
|
|
BLAKE2b-256 checksum How to use checksums |
51d5778219bad2a31fb3192728b9de8160a8c0b739c84ab6d441a4876d514de7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / rust_ios_device_tunnel-0.1.9-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | rust_ios_device_tunnel-0.1.9-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1c903ee1d8ad17d12abb599871ac8b6ac9b14b5d9de7eaab9b7616ba19b6df04
|
|
BLAKE2b-256 checksum How to use checksums |
3eac2dd31694cf6dc5ee8233c377a54fc2fa0cd5a2642681a5ec07bda895b430
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|