mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 14:36:16 +01:00
Add house arrest to AFC cli
This commit is contained in:
@@ -88,6 +88,7 @@ full = [
|
|||||||
"debug_proxy",
|
"debug_proxy",
|
||||||
"dvt",
|
"dvt",
|
||||||
"heartbeat",
|
"heartbeat",
|
||||||
|
"house_arrest",
|
||||||
"installation_proxy",
|
"installation_proxy",
|
||||||
"misagent",
|
"misagent",
|
||||||
"mobile_image_mounter",
|
"mobile_image_mounter",
|
||||||
|
|||||||
@@ -90,7 +90,9 @@ impl HouseArrestClient {
|
|||||||
self.vend(bundle_id, "VendContainer".into()).await
|
self.vend(bundle_id, "VendContainer".into()).await
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Requests access to the app's Documents directory over AFC
|
/// Requests access to the app's Documents directory over AFC.
|
||||||
|
/// Note that you can only access the /Documents directory. Permission will be denied
|
||||||
|
/// otherwise.
|
||||||
///
|
///
|
||||||
/// # Arguments
|
/// # Arguments
|
||||||
/// * `bundle_id` - The bundle identifier of the target app (e.g., "com.example.MyApp")
|
/// * `bundle_id` - The bundle identifier of the target app (e.g., "com.example.MyApp")
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use std::path::PathBuf;
|
|||||||
use clap::{value_parser, Arg, Command};
|
use clap::{value_parser, Arg, Command};
|
||||||
use idevice::{
|
use idevice::{
|
||||||
afc::{opcode::AfcFopenMode, AfcClient},
|
afc::{opcode::AfcFopenMode, AfcClient},
|
||||||
|
house_arrest::HouseArrestClient,
|
||||||
IdeviceService,
|
IdeviceService,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -15,7 +16,7 @@ async fn main() {
|
|||||||
env_logger::init();
|
env_logger::init();
|
||||||
|
|
||||||
let matches = Command::new("afc")
|
let matches = Command::new("afc")
|
||||||
.about("Start a tunnel")
|
.about("Manage files on the device")
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("host")
|
Arg::new("host")
|
||||||
.long("host")
|
.long("host")
|
||||||
@@ -33,6 +34,20 @@ async fn main() {
|
|||||||
.value_name("UDID")
|
.value_name("UDID")
|
||||||
.help("UDID of the device (overrides host/pairing file)"),
|
.help("UDID of the device (overrides host/pairing file)"),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("documents")
|
||||||
|
.long("documents")
|
||||||
|
.value_name("BUNDLE_ID")
|
||||||
|
.help("Read the documents from a bundle. Note that when vending documents, you can only access files in /Documents")
|
||||||
|
.global(true),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("container")
|
||||||
|
.long("container")
|
||||||
|
.value_name("BUNDLE_ID")
|
||||||
|
.help("Read the container contents of a bundle")
|
||||||
|
.global(true),
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("about")
|
Arg::new("about")
|
||||||
.long("about")
|
.long("about")
|
||||||
@@ -101,9 +116,26 @@ async fn main() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let mut afc_client = AfcClient::connect(&*provider)
|
|
||||||
|
let mut afc_client = if let Some(bundle_id) = matches.get_one::<String>("container") {
|
||||||
|
let h = HouseArrestClient::connect(&*provider)
|
||||||
.await
|
.await
|
||||||
.expect("Unable to connect to misagent");
|
.expect("Failed to connect to house arrest");
|
||||||
|
h.vend_container(bundle_id)
|
||||||
|
.await
|
||||||
|
.expect("Failed to vend container")
|
||||||
|
} else if let Some(bundle_id) = matches.get_one::<String>("documents") {
|
||||||
|
let h = HouseArrestClient::connect(&*provider)
|
||||||
|
.await
|
||||||
|
.expect("Failed to connect to house arrest");
|
||||||
|
h.vend_documents(bundle_id)
|
||||||
|
.await
|
||||||
|
.expect("Failed to vend documents")
|
||||||
|
} else {
|
||||||
|
AfcClient::connect(&*provider)
|
||||||
|
.await
|
||||||
|
.expect("Unable to connect to misagent")
|
||||||
|
};
|
||||||
|
|
||||||
if let Some(matches) = matches.subcommand_matches("list") {
|
if let Some(matches) = matches.subcommand_matches("list") {
|
||||||
let path = matches.get_one::<String>("path").expect("No path passed");
|
let path = matches.get_one::<String>("path").expect("No path passed");
|
||||||
|
|||||||
Reference in New Issue
Block a user