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.connect_info()) # connection summary dict
tunnel.close()
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.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.8
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.8.tar.gz | 351.5 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| rust_ios_device_tunnel-0.1.8-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| rust_ios_device_tunnel-0.1.8-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.8-cp39-abi3-manylinux_2_38_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.38+ ARM64 | Details |
| rust_ios_device_tunnel-0.1.8-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 12.4 MB
Release files / rust_ios_device_tunnel-0.1.8.tar.gz
| Download URL | rust_ios_device_tunnel-0.1.8.tar.gz |
|---|---|
| Size | 351.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
be0da6685b970e52df48cf787f8c25732fdaa9045a3c7ba65e685030c3c6f8f7
|
|
BLAKE2b-256 checksum How to use checksums |
5d0ad3c509ad2281bc7fe85e5ab81b2863f4fe5e4ca7c9b05c475b2d3022ee59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Release files / rust_ios_device_tunnel-0.1.8-cp39-abi3-win_amd64.whl
| Download URL | rust_ios_device_tunnel-0.1.8-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 4.3 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
aff4f5ded0ad47174b9d7854e1206c5973d0f19ea5383eb8fe5333d1a2abdb5a
|
|
BLAKE2b-256 checksum How to use checksums |
c5655d7df1613d3cfa3ca0919e5b107b19d61c9c20ac9c53d9e997223b93cf6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Release files / rust_ios_device_tunnel-0.1.8-cp39-abi3-manylinux_2_38_x86_64.whl
| Download URL | rust_ios_device_tunnel-0.1.8-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 |
6df0f577ff930e91103039826fe86735d04743ee967aea3b8c35508ecf75e82c
|
|
BLAKE2b-256 checksum How to use checksums |
b9c6aca470afd58a90d0ef7d6ae2da14261571cf57855a4b65578fb8c02e8500
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Release files / rust_ios_device_tunnel-0.1.8-cp39-abi3-manylinux_2_38_aarch64.whl
| Download URL | rust_ios_device_tunnel-0.1.8-cp39-abi3-manylinux_2_38_aarch64.whl |
|---|---|
| Size | 3.9 MB |
| Tags | CPython 3.9 Linux glibc 2.38+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
6eeb7364791ad07590b9d02189d1c0b5a757b3764cf9739cf26513268ddf29f4
|
|
BLAKE2b-256 checksum How to use checksums |
018f2ce8aa9305e4385af55d6101726b6eeac270cb2858e4decba5b72303a21d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Release files / rust_ios_device_tunnel-0.1.8-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | rust_ios_device_tunnel-0.1.8-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 |
61c3e196fb6d1956e22e44cea06fe3ef694dd8166efcf6ea6c0b8e527e4424d3
|
|
BLAKE2b-256 checksum How to use checksums |
a342124b1b78cc7fe2cc95b3592c8ca3d578a30cd1a0f172bb377cf39ab1a9ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|