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.5.tar.gz (295.1 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.5-cp39-abi3-win_amd64.whl (4.3 MB view details)

Uploaded CPython 3.9+Windows x86-64

rust_ios_device_tunnel-0.1.5-cp39-abi3-manylinux_2_38_x86_64.whl (1.9 MB view details)

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

rust_ios_device_tunnel-0.1.5-cp39-abi3-manylinux_2_38_aarch64.whl (3.9 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.38+ ARM64

rust_ios_device_tunnel-0.1.5-cp39-abi3-macosx_11_0_arm64.whl (2.0 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: rust_ios_device_tunnel-0.1.5.tar.gz
  • Upload date:
  • Size: 295.1 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.5.tar.gz
Algorithm Hash digest
SHA256 29d728d5a59f64b3fead8588f59c2f77b63eafd2dcd08bd37cde99b40884ddd3
MD5 fe433389727c574073d396c54e0816f5
BLAKE2b-256 19cd80eefabebb88094ba452867a747f3bb36e28039769ab1451783aa5d464e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rust_ios_device_tunnel-0.1.5-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0fa6795e251fe0da5cf728d474c572b0c73c21251557da3ef71df5ba6a904aaa
MD5 d501e73979bf546339f69413c0efe32b
BLAKE2b-256 bc8a56addc1e36e525afd6f6bc2bca962f22d017372c219ff8b0d12fda2017e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rust_ios_device_tunnel-0.1.5-cp39-abi3-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 06d1de94f73f35a2e6f8277b8dc23d7ee19a01c353295f4042dbddd532d46360
MD5 2c765027bc3aeeefcc7b4e40d55c7e0d
BLAKE2b-256 358bfdf826910066930fa918ae9ab8909577120bb5594e23eb60cf15ac7f9730

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rust_ios_device_tunnel-0.1.5-cp39-abi3-manylinux_2_38_aarch64.whl
Algorithm Hash digest
SHA256 94ac602f77f68dc9a53999c7e3b98dfaecfeda2c30ac32ffbbcb9b64cdab054d
MD5 0d227fbd14b402f53b290929b203c077
BLAKE2b-256 21641a9ace4ce815f0477eae50a0812d0735b373d93332ab29912540f8f4453e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rust_ios_device_tunnel-0.1.5-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0e596ebfaaeeceda8f0c53ecaf29c1462f3329ed1b011478cf2972a9ebce62ae
MD5 c5e0cf8cc34b2b655e89127886f87e85
BLAKE2b-256 980efa9346df55656e5b37f809bca7d6c18f724becfd09396837f8ce0477fcbf

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