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.13

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.13
File Size Uploaded
rust_ios_device_tunnel-0.1.13.tar.gz 605.2 kB Details

Built distributions (wheels)

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

Total release size: 13.0 MB

Release files / rust_ios_device_tunnel-0.1.13.tar.gz

Download URL rust_ios_device_tunnel-0.1.13.tar.gz
Size 605.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3cab27a9f82971ac3f622408c297318fdadac345f14ba950c9167b7bd81054f8
BLAKE2b-256 checksum
How to use checksums
aaf514e6d56c1f6134eeb20d42002a0ac563b103350614f416c25b8339e06af7
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.13-cp39-abi3-win_amd64.whl

Download URL rust_ios_device_tunnel-0.1.13-cp39-abi3-win_amd64.whl
Size 4.3 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
7767ad0a7078d06aa813aa3f7d58c028a5b4e361b54cde98c79a44b5e233fd07
BLAKE2b-256 checksum
How to use checksums
8dd74ed0122d1dfdedb851db0e6346523f558befe4371ef75871269239aff67a
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.13-cp39-abi3-manylinux_2_38_x86_64.whl

Download URL rust_ios_device_tunnel-0.1.13-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
10eefbd8bfa0177ec6a864c7a2920bef34d7cbeee27129b4dadbdd02331afd1d
BLAKE2b-256 checksum
How to use checksums
37979f8b226c009dfd83e44d533471b3af3082cad2001e3ad7406232d061ccae
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.13-cp39-abi3-manylinux_2_38_aarch64.whl

Download URL rust_ios_device_tunnel-0.1.13-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
7c07ca01f19f5e37643a5e93173057a1e24be9d488e85a4dc19578a54eb18f9f
BLAKE2b-256 checksum
How to use checksums
6e737e0a204314767fe8a50e41a94bb371f3d223f8053d024670c32f911224e1
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.13-cp39-abi3-macosx_11_0_arm64.whl

Download URL rust_ios_device_tunnel-0.1.13-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
8348f8146d950d7e74da410381882a7c94b3c22f06213f1fa401548247e3edd9
BLAKE2b-256 checksum
How to use checksums
b95c9b473854f746ca2344b9d0542b8c9339438cbd037a76f65a1c23e480096d
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.13 This release

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