mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 06:26:15 +01:00
89 lines
2.4 KiB
Rust
89 lines
2.4 KiB
Rust
// Jackson Coxson
|
|
// idevice Rust implementation of libimobiledevice's ideviceinfo
|
|
|
|
use clap::{Arg, Command};
|
|
use idevice::{lockdown::LockdownClient, IdeviceService};
|
|
|
|
mod common;
|
|
|
|
#[tokio::main]
|
|
async fn main() {
|
|
env_logger::init();
|
|
|
|
let matches = Command::new("core_device_proxy_tun")
|
|
.about("Start a tunnel")
|
|
.arg(
|
|
Arg::new("host")
|
|
.long("host")
|
|
.value_name("HOST")
|
|
.help("IP address of the device"),
|
|
)
|
|
.arg(
|
|
Arg::new("pairing_file")
|
|
.long("pairing-file")
|
|
.value_name("PATH")
|
|
.help("Path to the pairing file"),
|
|
)
|
|
.arg(
|
|
Arg::new("udid")
|
|
.value_name("UDID")
|
|
.help("UDID of the device (overrides host/pairing file)")
|
|
.index(1),
|
|
)
|
|
.arg(
|
|
Arg::new("about")
|
|
.long("about")
|
|
.help("Show about information")
|
|
.action(clap::ArgAction::SetTrue),
|
|
)
|
|
.get_matches();
|
|
|
|
if matches.get_flag("about") {
|
|
println!("ideviceinfo - get information from the idevice. Reimplementation of libimobiledevice's binary.");
|
|
println!("Copyright (c) 2025 Jackson Coxson");
|
|
return;
|
|
}
|
|
|
|
let udid = matches.get_one::<String>("udid");
|
|
let host = matches.get_one::<String>("host");
|
|
let pairing_file = matches.get_one::<String>("pairing_file");
|
|
|
|
let provider =
|
|
match common::get_provider(udid, host, pairing_file, "ideviceinfo-jkcoxson").await {
|
|
Ok(p) => p,
|
|
Err(e) => {
|
|
eprintln!("{e}");
|
|
return;
|
|
}
|
|
};
|
|
|
|
let mut lockdown_client = match LockdownClient::connect(&*provider).await {
|
|
Ok(l) => l,
|
|
Err(e) => {
|
|
eprintln!("Unable to connect to lockdown: {e:?}");
|
|
return;
|
|
}
|
|
};
|
|
|
|
println!(
|
|
"{:?}",
|
|
lockdown_client
|
|
.get_value(Some("ProductVersion"), None)
|
|
.await
|
|
);
|
|
|
|
println!(
|
|
"{:?}",
|
|
lockdown_client
|
|
.start_session(
|
|
&provider
|
|
.get_pairing_file()
|
|
.await
|
|
.expect("failed to get pairing file")
|
|
)
|
|
.await
|
|
);
|
|
println!("{:?}", lockdown_client.idevice.get_type().await.unwrap());
|
|
println!("{:#?}", lockdown_client.get_value(None, None).await);
|
|
}
|