Set RemoteXPC initial root ID to 0

This commit is contained in:
Jackson Coxson
2026-02-17 07:33:51 -07:00
parent 93d2f1b28c
commit 7782df8bd9
4 changed files with 4129 additions and 7 deletions

4089
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -4,11 +4,12 @@ use std::path::Path;
use ed25519_dalek::{SigningKey, VerifyingKey}; use ed25519_dalek::{SigningKey, VerifyingKey};
use plist::Dictionary; use plist::Dictionary;
use plist_macro::plist_to_xml_bytes;
use rsa::rand_core::OsRng; use rsa::rand_core::OsRng;
use serde::de::Error; use serde::de::Error;
use tracing::{debug, warn}; use tracing::{debug, warn};
use crate::{IdeviceError, util::plist_to_xml_bytes}; use crate::IdeviceError;
#[derive(Clone)] #[derive(Clone)]
pub struct RpPairingFile { pub struct RpPairingFile {

View File

@@ -28,7 +28,7 @@ impl<R: ReadWrite> RemoteXpcClient<R> {
pub async fn new(socket: R) -> Result<Self, IdeviceError> { pub async fn new(socket: R) -> Result<Self, IdeviceError> {
Ok(Self { Ok(Self {
h2_client: http2::Http2Client::new(socket).await?, h2_client: http2::Http2Client::new(socket).await?,
root_id: 1, root_id: 0,
}) })
} }

View File

@@ -4,13 +4,12 @@
// Jackson Coxson // Jackson Coxson
use std::{any::Any, io::Write, net::IpAddr, str::FromStr, sync::Arc, time::Duration}; use std::{any::Any, sync::Arc, time::Duration};
use clap::{Arg, Command}; use clap::{Arg, Command};
use futures_util::{StreamExt, pin_mut}; use idevice::{RemoteXpcClient, rsd::RsdHandshake, xpc};
use idevice::remote_pairing::{RemotePairingClient, RpPairingFile};
use zeroconf::{ use zeroconf::{
BrowserEvent, MdnsBrowser, ServiceDiscovery, ServiceType, BrowserEvent, MdnsBrowser, ServiceType,
prelude::{TEventLoop, TMdnsBrowser}, prelude::{TEventLoop, TMdnsBrowser},
}; };
@@ -56,7 +55,40 @@ fn on_service_discovered(
) { ) {
if let Ok(BrowserEvent::Add(result)) = result { if let Ok(BrowserEvent::Add(result)) = result {
tokio::task::spawn(async move { tokio::task::spawn(async move {
println!("{result:?}"); println!("Found iOS device to pair with!! - {result:?}");
let looked_up = tokio::net::lookup_host(format!("{}:{}", result.host_name(), 58783))
.await
.unwrap();
let mut stream = None;
for l in looked_up {
if l.is_ipv4() {
continue;
}
println!("Found IP: {l:?}");
match tokio::net::TcpStream::connect(l).await {
Ok(s) => {
println!("connected with local addr {:?}", s.local_addr());
stream = Some(s);
break;
}
Err(e) => println!("failed to connect: {e:?}"),
}
}
let stream = match stream {
Some(s) => s,
None => {
println!("Couldn't open TCP port on device");
return;
}
};
let handshake = RsdHandshake::new(stream).await.expect("no rsd");
println!("handshake: {handshake:?}");
}); });
} }
} }