Skip to main content

Python bindings for iOS device management — tunnel, lockdown, and service access

Project description

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 wheels are available for Linux (x86_64, aarch64), macOS (Apple Silicon), and Windows (x86_64).

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()

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

License

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rust_ios_device_tunnel-0.1.4.tar.gz (291.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rust_ios_device_tunnel-0.1.4-cp39-abi3-win_amd64.whl (4.6 MB view details)

Uploaded CPython 3.9+Windows x86-64

rust_ios_device_tunnel-0.1.4-cp39-abi3-manylinux_2_38_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.38+ x86-64

rust_ios_device_tunnel-0.1.4-cp39-abi3-manylinux_2_38_aarch64.whl (4.1 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.38+ ARM64

rust_ios_device_tunnel-0.1.4-cp39-abi3-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file rust_ios_device_tunnel-0.1.4.tar.gz.

File metadata

  • Download URL: rust_ios_device_tunnel-0.1.4.tar.gz
  • Upload date:
  • Size: 291.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rust_ios_device_tunnel-0.1.4.tar.gz
Algorithm Hash digest
SHA256 55e326bf8b1f65ade1c9ab05756406ad046f062510420c8ae5d9f2af8686f50a
MD5 f75f1a779f25252bf289bb5734d13b62
BLAKE2b-256 2b6bc8128be95c6c0e7a6e11e710f6e9f7c093a26dd6eaed45c30287e5a0d09c

See more details on using hashes here.

File details

Details for the file rust_ios_device_tunnel-0.1.4-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for rust_ios_device_tunnel-0.1.4-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 11f6eacad57e5b0ed4fe1ac84c6cd6de61732d7377d3b68d49aa1046196d9a94
MD5 8004cd923b9424f29244db38349afd9c
BLAKE2b-256 fbb511e4fb24d328d57c538d2ffd424e7d17a24ad449a3c9feb74f8065639d5b

See more details on using hashes here.

File details

Details for the file rust_ios_device_tunnel-0.1.4-cp39-abi3-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for rust_ios_device_tunnel-0.1.4-cp39-abi3-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 531c3fd36458b8135a1df3ee3ffea2b3132a87b3316485b684746a70192f3c1e
MD5 7d0e032b59edea0499023e300b152864
BLAKE2b-256 966a26c6f32dd834823780fa4c8749814b391e47647f8c5068c79ee0d79f00e3

See more details on using hashes here.

File details

Details for the file rust_ios_device_tunnel-0.1.4-cp39-abi3-manylinux_2_38_aarch64.whl.

File metadata

File hashes

Hashes for rust_ios_device_tunnel-0.1.4-cp39-abi3-manylinux_2_38_aarch64.whl
Algorithm Hash digest
SHA256 18d9849a0b2201475c7aafc067d5e42916c26c0c8931c3ac1cc822519cc9edbd
MD5 ac9894b4a4f953e0f901e7584bbd56cc
BLAKE2b-256 3c4736de14931a7b78bba6f504a7e942fa124fbbe9599496848286e9ea1f2168

See more details on using hashes here.

File details

Details for the file rust_ios_device_tunnel-0.1.4-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rust_ios_device_tunnel-0.1.4-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b59a8daf3306130f65d5c82e8e74ffdba37ef996358b25984e138e1da175ffa9
MD5 d1dea61d3d82c135e1474f91b21afb78
BLAKE2b-256 baf4cc03c9a032a7b4c59ddf2829bfb4e71825019d2bd234e5cd10e82e416051

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page