rust-ios-device-tunnel
Python bindings for device discovery, CoreDevice tunnel management, and asyncio transport bridging.
Built on top of rust-ios-device. This package exposes device discovery plus CoreDevice tunnel metadata and a local userspace bridge; it does not expose the Rust lockdown or service clients as direct Python APIs.
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.15
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.15.tar.gz | 636.5 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| rust_ios_device_tunnel-0.1.15-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| rust_ios_device_tunnel-0.1.15-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.15-cp39-abi3-manylinux_2_38_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.38+ ARM64 | Details |
| rust_ios_device_tunnel-0.1.15-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 13.6 MB
Release files / rust_ios_device_tunnel-0.1.15.tar.gz
| Download URL | rust_ios_device_tunnel-0.1.15.tar.gz |
|---|---|
| Size | 636.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c40dbc1267d9c6bd1f9aa8ef506af529f80a570cd09830d28642bb482ee0369
|
|
BLAKE2b-256 checksum How to use checksums |
e636dd2223dd7b56425297465561de8ebb6ff3948566a01fcb492ca2f833ea49
|
| 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.15-cp39-abi3-win_amd64.whl
| Download URL | rust_ios_device_tunnel-0.1.15-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 4.6 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
752458a31a6cf4a775b927e56e131b2b3f89f458a97c553ec8a03d839a5c561c
|
|
BLAKE2b-256 checksum How to use checksums |
c6197ebbb18e18196db2ee2758ddf3448c1fe52110095633ae05aa3451db2772
|
| 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.15-cp39-abi3-manylinux_2_38_x86_64.whl
| Download URL | rust_ios_device_tunnel-0.1.15-cp39-abi3-manylinux_2_38_x86_64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.9 Linux glibc 2.38+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
e7aae479bc7be09445916bbc0cce7d12ea380490199b0c58c7b102b9abbde18a
|
|
BLAKE2b-256 checksum How to use checksums |
2bcca481b98d567dfe7b1cde993a518adc9b701297097ff8ac685b44b4b91db9
|
| 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.15-cp39-abi3-manylinux_2_38_aarch64.whl
| Download URL | rust_ios_device_tunnel-0.1.15-cp39-abi3-manylinux_2_38_aarch64.whl |
|---|---|
| Size | 4.1 MB |
| Tags | CPython 3.9 Linux glibc 2.38+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
871215adff68db919b1b24a792c514a20e1a14f09e8c3f9d146e5aa4b755e4d2
|
|
BLAKE2b-256 checksum How to use checksums |
bd18a85b03daf05d9e29516b443dc6b9170c6f9fe4e3fc5a39ad0f895bd94e4a
|
| 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.15-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | rust_ios_device_tunnel-0.1.15-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
59f886c8af7ea9081cc4263e4853f16d45f7e7028e0dd1de1cc2fdd78573be47
|
|
BLAKE2b-256 checksum How to use checksums |
946191ea42194a8e74df4a71a122d43b8866034c87be5e4d81741d1db56bfb4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|