Skip to main content

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

License

Licensed under either of Apache-2.0 or MIT at your option.

Metadata

Release files for rust-ios-device-tunnel 0.1.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rust-ios-device-tunnel 0.1.14
File Size Uploaded
rust_ios_device_tunnel-0.1.14.tar.gz 616.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for rust-ios-device-tunnel 0.1.14
File
rust_ios_device_tunnel-0.1.14-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
rust_ios_device_tunnel-0.1.14-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.14-cp39-abi3-manylinux_2_38_aarch64.whl CPython 3.9 abi3 Linux glibc 2.38+ ARM64 Details
rust_ios_device_tunnel-0.1.14-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details

Total release size: 13.1 MB

Release files / rust_ios_device_tunnel-0.1.14.tar.gz

Download URL rust_ios_device_tunnel-0.1.14.tar.gz
Size 616.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f1d7738abfe270459386a24b975b3955f4d6038adf04c72b807d719dee0be503
BLAKE2b-256 checksum
How to use checksums
6b960c501976753b80f80cb169e7f7833b621759c28a72fb504954382582d697
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.14-cp39-abi3-win_amd64.whl

Download URL rust_ios_device_tunnel-0.1.14-cp39-abi3-win_amd64.whl
Size 4.4 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
6c516afca5cc41181e70c00643e6f564a863c33ec97acae3a88dca865abed1b6
BLAKE2b-256 checksum
How to use checksums
814a54b3a704a5820a3c3ea976202bb34e9d24cd4a46ed02fbf38da7a7e06ba6
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.14-cp39-abi3-manylinux_2_38_x86_64.whl

Download URL rust_ios_device_tunnel-0.1.14-cp39-abi3-manylinux_2_38_x86_64.whl
Size 2.0 MB
Tags CPython 3.9 Linux glibc 2.38+ x86-64 abi3
SHA-256 checksum
How to use checksums
4f28d1d9d0020a62fde02a2c276c68e0e59e2e2b2921d69f30fe2e73e6ee04f5
BLAKE2b-256 checksum
How to use checksums
b1a57b9b28d498d3f7993c692cbde5cc5f829303a247c28aaa2a70d4c80e7de8
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.14-cp39-abi3-manylinux_2_38_aarch64.whl

Download URL rust_ios_device_tunnel-0.1.14-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
6c2ff6e10745ade27b93f5d2e3660091094cca39d7bcd4c0300057b48416da99
BLAKE2b-256 checksum
How to use checksums
e2b05d14d780acbf7d0a783afa22359de581a9d94647e54e814ff0917f0414f8
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.14-cp39-abi3-macosx_11_0_arm64.whl

Download URL rust_ios_device_tunnel-0.1.14-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
7b44e6fc7036647ded62f264ef1a2441166c52f9f9fe7d9feb5f50854832d284
BLAKE2b-256 checksum
How to use checksums
de88323270d16fb64f59857197d3045a3dd83a0c8b3c366a7e9d452b22976bb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.1.14 This release

5 release files

0.1.13

5 release files

0.1.9

5 release files

0.1.8

5 release files

0.1.7

5 release files

0.1.6

5 release files

0.1.5

5 release files

0.1.4

5 release files

0.1.1

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page