mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 06:26:15 +01:00
Create basic misagent client tool
This commit is contained in:
@@ -41,6 +41,10 @@ path = "src/remotexpc.rs"
|
||||
name = "debug_proxy"
|
||||
path = "src/debug_proxy.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "misagent"
|
||||
path = "src/misagent.rs"
|
||||
|
||||
[dependencies]
|
||||
idevice = { path = "../idevice", features = ["full"] }
|
||||
tokio = { version = "1.43", features = ["io-util", "macros", "time", "full"] }
|
||||
|
||||
78
tools/src/misagent.rs
Normal file
78
tools/src/misagent.rs
Normal file
@@ -0,0 +1,78 @@
|
||||
// Jackson Coxson
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use clap::{arg, value_parser, Arg, Command};
|
||||
use idevice::{
|
||||
lockdownd::LockdowndClient, misagent::MisagentClient, mounter::ImageMounter,
|
||||
pretty_print_plist, 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),
|
||||
)
|
||||
.subcommand(Command::new("list").about("Lists the images mounted on the device"))
|
||||
.get_matches();
|
||||
|
||||
if matches.get_flag("about") {
|
||||
println!("mounter - query and manage images mounted on a device. 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, "misagent-jkcoxson").await {
|
||||
Ok(p) => p,
|
||||
Err(e) => {
|
||||
eprintln!("{e}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
let mut misagent_client = MisagentClient::connect(&*provider)
|
||||
.await
|
||||
.expect("Unable to connect to misagent");
|
||||
|
||||
if matches.subcommand_matches("list").is_some() {
|
||||
let images = misagent_client
|
||||
.copy_all()
|
||||
.await
|
||||
.expect("Unable to get images");
|
||||
for i in images {
|
||||
println!("{}", pretty_print_plist(&i));
|
||||
}
|
||||
} else {
|
||||
eprintln!("Invalid usage, pass -h for help");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user