Refactor idevice tools into single binary

This commit is contained in:
Jackson Coxson
2026-01-03 16:58:33 -07:00
parent 2eebbff172
commit 189dd5caf2
34 changed files with 1983 additions and 2777 deletions

View File

@@ -1,55 +1,20 @@
// Jackson Coxson
use clap::{Arg, Command};
use idevice::{
IdeviceService,
pcapd::{PcapFileWriter, PcapdClient},
provider::IdeviceProvider,
};
use jkcli::{CollectedArguments, JkArgument, JkCommand};
mod common;
pub fn register() -> JkCommand {
JkCommand::new()
.help("Writes pcap network data")
.with_argument(JkArgument::new().with_help("Write PCAP to this file (use '-' for stdout)"))
}
#[tokio::main]
async fn main() {
tracing_subscriber::fmt::init();
let matches = Command::new("pcapd")
.about("Capture IP packets")
.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),
)
.arg(
Arg::new("out")
.long("out")
.value_name("PCAP")
.help("Write PCAP to this file (use '-' for stdout)"),
)
.get_matches();
if matches.get_flag("about") {
println!("bt_packet_logger - capture bluetooth packets");
println!("Copyright (c) 2025 Jackson Coxson");
return;
}
let udid = matches.get_one::<String>("udid");
let out = matches.get_one::<String>("out").map(String::to_owned);
let provider = match common::get_provider(udid, None, None, "pcapd-jkcoxson").await {
Ok(p) => p,
Err(e) => {
eprintln!("{e}");
return;
}
};
pub async fn main(arguments: &CollectedArguments, provider: Box<dyn IdeviceProvider>) {
let out = arguments.clone().next_argument::<String>();
let mut logger_client = PcapdClient::connect(&*provider)
.await