idevice
Logs & Capture

PCAPD

Capture device network packets and write PCAP files.

PCAPD exposes com.apple.pcapd through PcapdClient. The crate also includes PcapFileWriter for writing packets to a PCAP stream.

Use It For

  • Capture packets from the device.
  • Write packet captures to a .pcap file.
  • Normalize packet data before writing.

Feature Flag

Cargo.toml
[dependencies]
idevice = { version = "0.1.64", features = ["usbmuxd", "pcapd"] }

Service Names

PathValue
Lockdowncom.apple.pcapd
RSDcom.apple.pcapd.shim.remote

Rust Example

src/main.rs
use idevice::{
    IdeviceService,
    pcapd::{PcapFileWriter, PcapdClient},
};

let provider = first_provider().await?;
let mut client = PcapdClient::connect(&provider).await?;
let packet = client.next_packet().await?;
println!("{} bytes", packet.data.len());

CLI Equivalent

Terminal
idevice-tools pcapd capture.pcap
idevice-tools pcapd -

Common Errors

ErrorWhat to check
Service not foundThe device/iOS version does not advertise this service on the selected transport.
Connection failedCheck pairing, trust state, and whether the selected provider can reach the device.
Permission errorThe service requires a device state, entitlement, or developer setting that is not active.

Source

On this page