mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 14:36:16 +01:00
Use device MAC, not host
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -1236,7 +1236,6 @@ dependencies = [
|
|||||||
"env_logger 0.11.8",
|
"env_logger 0.11.8",
|
||||||
"idevice",
|
"idevice",
|
||||||
"log",
|
"log",
|
||||||
"mac_address",
|
|
||||||
"ns-keyed-archive",
|
"ns-keyed-archive",
|
||||||
"plist",
|
"plist",
|
||||||
"sha2",
|
"sha2",
|
||||||
|
|||||||
@@ -258,7 +258,6 @@ impl LockdownClient {
|
|||||||
///
|
///
|
||||||
/// # Arguments
|
/// # Arguments
|
||||||
/// * `host_id` - The host ID, in the form of a UUID. Typically generated from the host name
|
/// * `host_id` - The host ID, in the form of a UUID. Typically generated from the host name
|
||||||
/// * `wifi_mac` - The MAC address of the WiFi interface. Does not affect anything.
|
|
||||||
/// * `system_buid` - UUID fetched from usbmuxd. Doesn't appear to affect function.
|
/// * `system_buid` - UUID fetched from usbmuxd. Doesn't appear to affect function.
|
||||||
///
|
///
|
||||||
/// # Returns
|
/// # Returns
|
||||||
@@ -270,11 +269,9 @@ impl LockdownClient {
|
|||||||
pub async fn pair(
|
pub async fn pair(
|
||||||
&mut self,
|
&mut self,
|
||||||
host_id: impl Into<String>,
|
host_id: impl Into<String>,
|
||||||
wifi_mac: impl Into<String>,
|
|
||||||
system_buid: impl Into<String>,
|
system_buid: impl Into<String>,
|
||||||
) -> Result<crate::pairing_file::PairingFile, IdeviceError> {
|
) -> Result<crate::pairing_file::PairingFile, IdeviceError> {
|
||||||
let host_id = host_id.into();
|
let host_id = host_id.into();
|
||||||
let wifi_mac = wifi_mac.into();
|
|
||||||
let system_buid = system_buid.into();
|
let system_buid = system_buid.into();
|
||||||
|
|
||||||
let pub_key = self.get_value("DevicePublicKey", None).await?;
|
let pub_key = self.get_value("DevicePublicKey", None).await?;
|
||||||
@@ -286,6 +283,15 @@ impl LockdownClient {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let wifi_mac = self.get_value("WiFiAddress", None).await?;
|
||||||
|
let wifi_mac = match wifi_mac.as_string() {
|
||||||
|
Some(w) => w,
|
||||||
|
None => {
|
||||||
|
log::warn!("Did not get WiFiAddress string");
|
||||||
|
return Err(IdeviceError::UnexpectedResponse);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let ca = crate::ca::generate_certificates(&pub_key, None).unwrap();
|
let ca = crate::ca::generate_certificates(&pub_key, None).unwrap();
|
||||||
let mut pair_record = plist::Dictionary::new();
|
let mut pair_record = plist::Dictionary::new();
|
||||||
pair_record.insert("DevicePublicKey".into(), plist::Value::Data(pub_key));
|
pair_record.insert("DevicePublicKey".into(), plist::Value::Data(pub_key));
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ clap = { version = "4.5" }
|
|||||||
plist = { version = "1.7" }
|
plist = { version = "1.7" }
|
||||||
ns-keyed-archive = "0.1.2"
|
ns-keyed-archive = "0.1.2"
|
||||||
uuid = "1.16"
|
uuid = "1.16"
|
||||||
mac_address = "1.1"
|
|
||||||
|
|
||||||
# When testing the pair binary, creating certificates takes forever
|
# When testing the pair binary, creating certificates takes forever
|
||||||
[profile.dev.package.idevice]
|
[profile.dev.package.idevice]
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ use idevice::{
|
|||||||
usbmuxd::{Connection, UsbmuxdAddr, UsbmuxdConnection},
|
usbmuxd::{Connection, UsbmuxdAddr, UsbmuxdConnection},
|
||||||
IdeviceService,
|
IdeviceService,
|
||||||
};
|
};
|
||||||
use mac_address::get_mac_address;
|
|
||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
@@ -63,14 +62,10 @@ async fn main() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let mac_address = get_mac_address()
|
|
||||||
.expect("Failed to get MAC")
|
|
||||||
.expect("No MAC??")
|
|
||||||
.to_string();
|
|
||||||
let id = uuid::Uuid::new_v4().to_string().to_uppercase();
|
let id = uuid::Uuid::new_v4().to_string().to_uppercase();
|
||||||
|
|
||||||
let mut pairing_file = lockdown_client
|
let mut pairing_file = lockdown_client
|
||||||
.pair(id, mac_address, u.get_buid().await.unwrap())
|
.pair(id, u.get_buid().await.unwrap())
|
||||||
.await
|
.await
|
||||||
.expect("Failed to pair");
|
.expect("Failed to pair");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user