Replace log crate with tracing

This commit is contained in:
Jackson Coxson
2025-10-23 09:49:38 -06:00
parent 18b8b7295c
commit a297eed156
91 changed files with 323 additions and 342 deletions

199
Cargo.lock generated
View File

@@ -580,29 +580,6 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "env_filter"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2"
dependencies = [
"log",
"regex",
]
[[package]]
name = "env_logger"
version = "0.11.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f"
dependencies = [
"anstream",
"anstyle",
"env_filter",
"jiff",
"log",
]
[[package]] [[package]]
name = "equivalent" name = "equivalent"
version = "1.0.2" version = "1.0.2"
@@ -1073,11 +1050,9 @@ dependencies = [
"bytes", "bytes",
"chrono", "chrono",
"crossfire", "crossfire",
"env_logger",
"futures", "futures",
"indexmap", "indexmap",
"json", "json",
"log",
"ns-keyed-archive", "ns-keyed-archive",
"obfstr", "obfstr",
"plist", "plist",
@@ -1091,6 +1066,7 @@ dependencies = [
"thiserror 2.0.17", "thiserror 2.0.17",
"tokio", "tokio",
"tokio-rustls", "tokio-rustls",
"tracing",
"tun-rs", "tun-rs",
"uuid", "uuid",
"x509-cert", "x509-cert",
@@ -1104,15 +1080,15 @@ dependencies = [
"futures", "futures",
"idevice", "idevice",
"libc", "libc",
"log",
"once_cell", "once_cell",
"plist", "plist",
"plist_ffi", "plist_ffi",
"simplelog",
"tokio", "tokio",
"tracing",
"tracing-subscriber",
"ureq", "ureq",
"uuid", "uuid",
"windows-sys 0.60.2", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@@ -1120,14 +1096,14 @@ name = "idevice-tools"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"clap", "clap",
"env_logger",
"futures-util", "futures-util",
"idevice", "idevice",
"log",
"ns-keyed-archive", "ns-keyed-archive",
"plist", "plist",
"sha2", "sha2",
"tokio", "tokio",
"tracing",
"tracing-subscriber",
"ureq", "ureq",
"uuid", "uuid",
] ]
@@ -1202,30 +1178,6 @@ version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
[[package]]
name = "jiff"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49"
dependencies = [
"jiff-static",
"log",
"portable-atomic",
"portable-atomic-util",
"serde",
]
[[package]]
name = "jiff-static"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
]
[[package]] [[package]]
name = "jobserver" name = "jobserver"
version = "0.1.34" version = "0.1.34"
@@ -1320,6 +1272,15 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "matchers"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9"
dependencies = [
"regex-automata",
]
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.7.6" version = "2.7.6"
@@ -1497,6 +1458,15 @@ dependencies = [
"thiserror 2.0.17", "thiserror 2.0.17",
] ]
[[package]]
name = "nu-ansi-term"
version = "0.50.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
dependencies = [
"windows-sys 0.61.2",
]
[[package]] [[package]]
name = "num-bigint-dig" name = "num-bigint-dig"
version = "0.8.4" version = "0.8.4"
@@ -1550,15 +1520,6 @@ dependencies = [
"libm", "libm",
] ]
[[package]]
name = "num_threads"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "obfstr" name = "obfstr"
version = "0.4.4" version = "0.4.4"
@@ -1717,21 +1678,6 @@ dependencies = [
"serde_json", "serde_json",
] ]
[[package]]
name = "portable-atomic"
version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
[[package]]
name = "portable-atomic-util"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507"
dependencies = [
"portable-atomic",
]
[[package]] [[package]]
name = "potential_utf" name = "potential_utf"
version = "0.1.3" version = "0.1.3"
@@ -2145,6 +2091,15 @@ dependencies = [
"digest", "digest",
] ]
[[package]]
name = "sharded-slab"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
dependencies = [
"lazy_static",
]
[[package]] [[package]]
name = "shlex" name = "shlex"
version = "1.3.0" version = "1.3.0"
@@ -2176,17 +2131,6 @@ version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
[[package]]
name = "simplelog"
version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16257adbfaef1ee58b1363bdc0664c9b8e1e30aed86049635fb5f147d065a9c0"
dependencies = [
"log",
"termcolor",
"time",
]
[[package]] [[package]]
name = "slab" name = "slab"
version = "0.4.11" version = "0.4.11"
@@ -2311,15 +2255,6 @@ dependencies = [
"windows-sys 0.61.2", "windows-sys 0.61.2",
] ]
[[package]]
name = "termcolor"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
dependencies = [
"winapi-util",
]
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.69" version = "1.0.69"
@@ -2360,6 +2295,15 @@ dependencies = [
"syn 2.0.106", "syn 2.0.106",
] ]
[[package]]
name = "thread_local"
version = "1.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185"
dependencies = [
"cfg-if",
]
[[package]] [[package]]
name = "time" name = "time"
version = "0.3.44" version = "0.3.44"
@@ -2368,9 +2312,7 @@ checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d"
dependencies = [ dependencies = [
"deranged", "deranged",
"itoa", "itoa",
"libc",
"num-conv", "num-conv",
"num_threads",
"powerfmt", "powerfmt",
"serde", "serde",
"time-core", "time-core",
@@ -2569,9 +2511,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
dependencies = [ dependencies = [
"pin-project-lite", "pin-project-lite",
"tracing-attributes",
"tracing-core", "tracing-core",
] ]
[[package]]
name = "tracing-attributes"
version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.106",
]
[[package]] [[package]]
name = "tracing-core" name = "tracing-core"
version = "0.1.34" version = "0.1.34"
@@ -2579,6 +2533,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678"
dependencies = [ dependencies = [
"once_cell", "once_cell",
"valuable",
]
[[package]]
name = "tracing-log"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
dependencies = [
"log",
"once_cell",
"tracing-core",
]
[[package]]
name = "tracing-subscriber"
version = "0.3.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5"
dependencies = [
"matchers",
"nu-ansi-term",
"once_cell",
"regex-automata",
"sharded-slab",
"smallvec",
"thread_local",
"tracing",
"tracing-core",
"tracing-log",
] ]
[[package]] [[package]]
@@ -2704,6 +2688,12 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "valuable"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
[[package]] [[package]]
name = "version_check" name = "version_check"
version = "0.9.5" version = "0.9.5"
@@ -2847,15 +2837,6 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
"windows-sys 0.61.2",
]
[[package]] [[package]]
name = "winapi-x86_64-pc-windows-gnu" name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0" version = "0.4.0"

View File

@@ -7,8 +7,8 @@ edition = "2024"
[dependencies] [dependencies]
idevice = { path = "../idevice", default-features = false } idevice = { path = "../idevice", default-features = false }
futures = { version = "0.3", optional = true } futures = { version = "0.3", optional = true }
log = "0.4.26" tracing = { version = "0.1.41" }
simplelog = "0.12.2" tracing-subscriber = { version = "0.3.20", features = ["env-filter"] }
once_cell = "1.21.1" once_cell = "1.21.1"
tokio = { version = "1.44.1", features = ["full"] } tokio = { version = "1.44.1", features = ["full"] }
libc = "0.2.171" libc = "0.2.171"
@@ -17,7 +17,7 @@ plist_ffi = { version = "0.1.6" }
uuid = { version = "1.12", features = ["v4"], optional = true } uuid = { version = "1.12", features = ["v4"], optional = true }
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.60", features = ["Win32_Networking_WinSock"] } windows-sys = { version = "0.61", features = ["Win32_Networking_WinSock"] }
[features] [features]
aws-lc = ["idevice/aws-lc"] aws-lc = ["idevice/aws-lc"]

View File

@@ -47,7 +47,7 @@ pub unsafe extern "C" fn adapter_connect(
null_mut() null_mut()
} }
Err(e) => { Err(e) => {
log::error!("Adapter connect failed: {e}"); tracing::error!("Adapter connect failed: {e}");
ffi_err!(e) ffi_err!(e)
} }
} }
@@ -86,7 +86,7 @@ pub unsafe extern "C" fn adapter_pcap(
match res { match res {
Ok(_) => null_mut(), Ok(_) => null_mut(),
Err(e) => { Err(e) => {
log::error!("Adapter pcap failed: {e}"); tracing::error!("Adapter pcap failed: {e}");
ffi_err!(e) ffi_err!(e)
} }
} }
@@ -169,7 +169,7 @@ pub unsafe extern "C" fn adapter_send(
match res { match res {
Ok(_) => null_mut(), Ok(_) => null_mut(),
Err(e) => { Err(e) => {
log::error!("Adapter send failed: {e}"); tracing::error!("Adapter send failed: {e}");
ffi_err!(e) ffi_err!(e)
} }
} }
@@ -223,7 +223,7 @@ pub unsafe extern "C" fn adapter_recv(
null_mut() null_mut()
} }
Err(e) => { Err(e) => {
log::error!("Adapter recv failed: {e}"); tracing::error!("Adapter recv failed: {e}");
ffi_err!(e) ffi_err!(e)
} }
} }

View File

@@ -30,7 +30,7 @@ pub unsafe extern "C" fn afc_client_connect(
client: *mut *mut AfcClientHandle, client: *mut *mut AfcClientHandle,
) -> *mut IdeviceFfiError { ) -> *mut IdeviceFfiError {
if provider.is_null() || client.is_null() { if provider.is_null() || client.is_null() {
log::error!("Null pointer provided"); tracing::error!("Null pointer provided");
return ffi_err!(IdeviceError::FfiInvalidArg); return ffi_err!(IdeviceError::FfiInvalidArg);
} }
@@ -88,7 +88,7 @@ pub unsafe extern "C" fn afc_client_new(
#[unsafe(no_mangle)] #[unsafe(no_mangle)]
pub unsafe extern "C" fn afc_client_free(handle: *mut AfcClientHandle) { pub unsafe extern "C" fn afc_client_free(handle: *mut AfcClientHandle) {
if !handle.is_null() { if !handle.is_null() {
log::debug!("Freeing afc_client"); tracing::debug!("Freeing afc_client");
let _ = unsafe { Box::from_raw(handle) }; let _ = unsafe { Box::from_raw(handle) };
} }
} }

View File

@@ -26,7 +26,7 @@ pub unsafe extern "C" fn amfi_connect(
client: *mut *mut AmfiClientHandle, client: *mut *mut AmfiClientHandle,
) -> *mut IdeviceFfiError { ) -> *mut IdeviceFfiError {
if provider.is_null() || client.is_null() { if provider.is_null() || client.is_null() {
log::error!("Null pointer provided"); tracing::error!("Null pointer provided");
return ffi_err!(IdeviceError::FfiInvalidArg); return ffi_err!(IdeviceError::FfiInvalidArg);
} }
@@ -171,7 +171,7 @@ pub unsafe extern "C" fn amfi_accept_developer_mode(
#[unsafe(no_mangle)] #[unsafe(no_mangle)]
pub unsafe extern "C" fn amfi_client_free(handle: *mut AmfiClientHandle) { pub unsafe extern "C" fn amfi_client_free(handle: *mut AmfiClientHandle) {
if !handle.is_null() { if !handle.is_null() {
log::debug!("Freeing AmfiClient handle"); tracing::debug!("Freeing AmfiClient handle");
let _ = unsafe { Box::from_raw(handle) }; let _ = unsafe { Box::from_raw(handle) };
} }
} }

View File

@@ -7,7 +7,7 @@ use std::ptr::null_mut;
use futures::{Stream, StreamExt}; use futures::{Stream, StreamExt};
use idevice::core_device::DiagnostisServiceClient; use idevice::core_device::DiagnostisServiceClient;
use idevice::{IdeviceError, ReadWrite, RsdService}; use idevice::{IdeviceError, ReadWrite, RsdService};
use log::debug; use tracing::debug;
use crate::core_device_proxy::AdapterHandle; use crate::core_device_proxy::AdapterHandle;
use crate::rsd::RsdHandshakeHandle; use crate::rsd::RsdHandshakeHandle;

View File

@@ -32,7 +32,7 @@ pub unsafe extern "C" fn core_device_proxy_connect(
client: *mut *mut CoreDeviceProxyHandle, client: *mut *mut CoreDeviceProxyHandle,
) -> *mut IdeviceFfiError { ) -> *mut IdeviceFfiError {
if provider.is_null() || client.is_null() { if provider.is_null() || client.is_null() {
log::error!("Null pointer provided"); tracing::error!("Null pointer provided");
return ffi_err!(IdeviceError::FfiInvalidArg); return ffi_err!(IdeviceError::FfiInvalidArg);
} }
@@ -192,7 +192,7 @@ pub unsafe extern "C" fn core_device_proxy_get_client_parameters(
netmask: *mut *mut c_char, netmask: *mut *mut c_char,
) -> *mut IdeviceFfiError { ) -> *mut IdeviceFfiError {
if handle.is_null() { if handle.is_null() {
log::error!("Passed null handle"); tracing::error!("Passed null handle");
return ffi_err!(IdeviceError::FfiInvalidArg); return ffi_err!(IdeviceError::FfiInvalidArg);
} }
@@ -333,7 +333,7 @@ pub unsafe extern "C" fn core_device_proxy_create_tcp_adapter(
#[unsafe(no_mangle)] #[unsafe(no_mangle)]
pub unsafe extern "C" fn core_device_proxy_free(handle: *mut CoreDeviceProxyHandle) { pub unsafe extern "C" fn core_device_proxy_free(handle: *mut CoreDeviceProxyHandle) {
if !handle.is_null() { if !handle.is_null() {
log::debug!("Freeing core_device_proxy"); tracing::debug!("Freeing core_device_proxy");
let _ = unsafe { Box::from_raw(handle) }; let _ = unsafe { Box::from_raw(handle) };
} }
} }
@@ -349,7 +349,7 @@ pub unsafe extern "C" fn core_device_proxy_free(handle: *mut CoreDeviceProxyHand
#[unsafe(no_mangle)] #[unsafe(no_mangle)]
pub unsafe extern "C" fn adapter_free(handle: *mut AdapterHandle) { pub unsafe extern "C" fn adapter_free(handle: *mut AdapterHandle) {
if !handle.is_null() { if !handle.is_null() {
log::debug!("Freeing adapter"); tracing::debug!("Freeing adapter");
let _ = unsafe { Box::from_raw(handle) }; let _ = unsafe { Box::from_raw(handle) };
} }
} }

View File

@@ -28,7 +28,7 @@ pub unsafe extern "C" fn heartbeat_connect(
client: *mut *mut HeartbeatClientHandle, client: *mut *mut HeartbeatClientHandle,
) -> *mut IdeviceFfiError { ) -> *mut IdeviceFfiError {
if provider.is_null() || client.is_null() { if provider.is_null() || client.is_null() {
log::error!("Null pointer provided"); tracing::error!("Null pointer provided");
return ffi_err!(IdeviceError::FfiInvalidArg); return ffi_err!(IdeviceError::FfiInvalidArg);
} }
@@ -150,7 +150,7 @@ pub unsafe extern "C" fn heartbeat_get_marco(
#[unsafe(no_mangle)] #[unsafe(no_mangle)]
pub unsafe extern "C" fn heartbeat_client_free(handle: *mut HeartbeatClientHandle) { pub unsafe extern "C" fn heartbeat_client_free(handle: *mut HeartbeatClientHandle) {
if !handle.is_null() { if !handle.is_null() {
log::debug!("Freeing installation_proxy_client"); tracing::debug!("Freeing installation_proxy_client");
let _ = unsafe { Box::from_raw(handle) }; let _ = unsafe { Box::from_raw(handle) };
} }
} }

View File

@@ -30,7 +30,7 @@ pub unsafe extern "C" fn installation_proxy_connect(
client: *mut *mut InstallationProxyClientHandle, client: *mut *mut InstallationProxyClientHandle,
) -> *mut IdeviceFfiError { ) -> *mut IdeviceFfiError {
if provider.is_null() || client.is_null() { if provider.is_null() || client.is_null() {
log::error!("Null pointer provided"); tracing::error!("Null pointer provided");
return ffi_err!(IdeviceError::FfiInvalidArg); return ffi_err!(IdeviceError::FfiInvalidArg);
} }
@@ -101,7 +101,7 @@ pub unsafe extern "C" fn installation_proxy_get_apps(
out_result_len: *mut libc::size_t, out_result_len: *mut libc::size_t,
) -> *mut IdeviceFfiError { ) -> *mut IdeviceFfiError {
if client.is_null() || out_result.is_null() || out_result_len.is_null() { if client.is_null() || out_result.is_null() || out_result_len.is_null() {
log::error!("Invalid arguments: {client:?}, {out_result:?}"); tracing::error!("Invalid arguments: {client:?}, {out_result:?}");
return ffi_err!(IdeviceError::FfiInvalidArg); return ffi_err!(IdeviceError::FfiInvalidArg);
} }
let client = unsafe { &mut *client }; let client = unsafe { &mut *client };
@@ -171,7 +171,7 @@ pub unsafe extern "C" fn installation_proxy_client_free(
handle: *mut InstallationProxyClientHandle, handle: *mut InstallationProxyClientHandle,
) { ) {
if !handle.is_null() { if !handle.is_null() {
log::debug!("Freeing installation_proxy_client"); tracing::debug!("Freeing installation_proxy_client");
let _ = unsafe { Box::from_raw(handle) }; let _ = unsafe { Box::from_raw(handle) };
} }
} }

View File

@@ -189,7 +189,7 @@ pub unsafe extern "C" fn idevice_new_tcp_socket(
use crate::util::SockAddr; use crate::util::SockAddr;
if addr.is_null() || label.is_null() || idevice.is_null() { if addr.is_null() || label.is_null() || idevice.is_null() {
log::error!("null pointer(s) to idevice_new_tcp_socket"); tracing::error!("null pointer(s) to idevice_new_tcp_socket");
return ffi_err!(IdeviceError::FfiInvalidArg); return ffi_err!(IdeviceError::FfiInvalidArg);
} }
let addr = addr as *const SockAddr; let addr = addr as *const SockAddr;

View File

@@ -30,7 +30,7 @@ pub unsafe extern "C" fn lockdownd_connect(
client: *mut *mut LockdowndClientHandle, client: *mut *mut LockdowndClientHandle,
) -> *mut IdeviceFfiError { ) -> *mut IdeviceFfiError {
if provider.is_null() || client.is_null() { if provider.is_null() || client.is_null() {
log::error!("Null pointer provided"); tracing::error!("Null pointer provided");
return ffi_err!(IdeviceError::FfiInvalidArg); return ffi_err!(IdeviceError::FfiInvalidArg);
} }
@@ -232,7 +232,7 @@ pub unsafe extern "C" fn lockdownd_get_value(
#[unsafe(no_mangle)] #[unsafe(no_mangle)]
pub unsafe extern "C" fn lockdownd_client_free(handle: *mut LockdowndClientHandle) { pub unsafe extern "C" fn lockdownd_client_free(handle: *mut LockdowndClientHandle) {
if !handle.is_null() { if !handle.is_null() {
log::debug!("Freeing lockdownd_client"); tracing::debug!("Freeing lockdownd_client");
let _ = unsafe { Box::from_raw(handle) }; let _ = unsafe { Box::from_raw(handle) };
} }
} }

View File

@@ -3,75 +3,12 @@
use std::{ use std::{
ffi::{CStr, c_char}, ffi::{CStr, c_char},
fs::File, fs::File,
sync::Once,
}; };
use log::LevelFilter; use tracing::Level;
use simplelog::{ use tracing_subscriber::{EnvFilter, Layer, fmt::writer::BoxMakeWriter};
ColorChoice, CombinedLogger, Config, SharedLogger, TermLogger, TerminalMode, WriteLogger, use tracing_subscriber::{Registry, fmt, layer::SubscriberExt, util::SubscriberInitExt};
};
/// Initializes the logger
///
/// # Arguments
/// * [`console_level`] - The level to log to the file
/// * [`file_level`] - The level to log to the file
/// * [`file_path`] - If not null, the file to write logs to
///
/// ## Log Level
/// 0. Disabled
/// 1. Error
/// 2. Warn
/// 3. Info
/// 4. Debug
/// 5. Trace
///
/// # Returns
/// 0 for success, -1 if the file couldn't be created, -2 if a logger has been initialized, -3 for invalid path string
///
/// # Safety
/// Pass a valid CString for file_path. Pass valid log levels according to the enum
#[unsafe(no_mangle)]
pub unsafe extern "C" fn idevice_init_logger(
console_level: IdeviceLogLevel,
file_level: IdeviceLogLevel,
file_path: *mut c_char,
) -> IdeviceLoggerError {
let mut loggers: Vec<Box<dyn SharedLogger>> = Vec::new();
let level: LevelFilter = console_level.into();
loggers.push(TermLogger::new(
level,
Config::default(),
TerminalMode::Mixed,
ColorChoice::Auto,
));
if !file_path.is_null() {
let file_path = match unsafe { CStr::from_ptr(file_path) }.to_str() {
Ok(f) => f.to_string(),
Err(_) => {
return IdeviceLoggerError::InvalidPathString;
}
};
let level: LevelFilter = file_level.into();
loggers.push(WriteLogger::new(
level,
Config::default(),
match File::create(file_path) {
Ok(f) => f,
Err(e) => {
println!("Failed to create path: {e:?}");
return IdeviceLoggerError::FileError;
}
},
));
}
if CombinedLogger::init(loggers).is_err() {
IdeviceLoggerError::AlreadyInitialized
} else {
IdeviceLoggerError::Success
}
}
#[repr(C)] #[repr(C)]
pub enum IdeviceLoggerError { pub enum IdeviceLoggerError {
@@ -92,33 +29,99 @@ pub enum IdeviceLogLevel {
Trace = 5, Trace = 5,
} }
impl TryFrom<u8> for IdeviceLogLevel { impl From<IdeviceLogLevel> for Level {
type Error = ();
fn try_from(value: u8) -> Result<Self, Self::Error> {
Ok(match value {
0 => Self::Disabled,
1 => Self::ErrorLevel,
2 => Self::Warn,
3 => Self::Info,
4 => Self::Debug,
5 => Self::Trace,
_ => {
return Err(());
}
})
}
}
impl From<IdeviceLogLevel> for LevelFilter {
fn from(value: IdeviceLogLevel) -> Self { fn from(value: IdeviceLogLevel) -> Self {
match value { match value {
IdeviceLogLevel::Disabled => LevelFilter::Off, IdeviceLogLevel::Disabled => Level::ERROR, // won't matter, filter will disable
IdeviceLogLevel::ErrorLevel => LevelFilter::Error, IdeviceLogLevel::ErrorLevel => Level::ERROR,
IdeviceLogLevel::Warn => LevelFilter::Warn, IdeviceLogLevel::Warn => Level::WARN,
IdeviceLogLevel::Info => LevelFilter::Info, IdeviceLogLevel::Info => Level::INFO,
IdeviceLogLevel::Debug => LevelFilter::Debug, IdeviceLogLevel::Debug => Level::DEBUG,
IdeviceLogLevel::Trace => LevelFilter::Trace, IdeviceLogLevel::Trace => Level::TRACE,
} }
} }
} }
impl IdeviceLogLevel {
fn as_filter(&self) -> String {
match self {
IdeviceLogLevel::Disabled => "off",
IdeviceLogLevel::ErrorLevel => "error",
IdeviceLogLevel::Warn => "warn",
IdeviceLogLevel::Info => "info",
IdeviceLogLevel::Debug => "debug",
IdeviceLogLevel::Trace => "trace",
}
.to_string()
}
}
// ensures we only init once
static INIT: Once = Once::new();
/// Initializes the global logger
///
/// # Safety
/// Pass a valid file path string
#[unsafe(no_mangle)]
pub unsafe extern "C" fn idevice_init_logger(
console_level: IdeviceLogLevel,
file_level: IdeviceLogLevel,
file_path: *mut c_char,
) -> IdeviceLoggerError {
let mut init_result = IdeviceLoggerError::Success;
INIT.call_once(|| {
let console_filter = console_level.as_filter();
let file_filter = file_level.as_filter();
let mut layers = Vec::new();
// Console layer
if console_level != IdeviceLogLevel::Disabled {
let console_layer = fmt::layer()
.with_writer(std::io::stdout)
.with_ansi(true)
.with_target(false)
.with_filter(EnvFilter::new(console_filter));
layers.push(console_layer.boxed());
}
// File layer
if !file_path.is_null() && file_level != IdeviceLogLevel::Disabled {
let path = match unsafe { CStr::from_ptr(file_path).to_str() } {
Ok(p) => p,
Err(_) => {
init_result = IdeviceLoggerError::InvalidPathString;
return;
}
};
let file = match File::create(path) {
Ok(f) => f,
Err(_) => {
init_result = IdeviceLoggerError::FileError;
return;
}
};
let file_layer = fmt::layer()
.with_writer(BoxMakeWriter::new(file))
.with_ansi(false)
.with_target(false)
.with_filter(EnvFilter::new(file_filter));
layers.push(file_layer.boxed());
}
// Compose and set as global subscriber
let subscriber = Registry::default().with(layers);
subscriber.init();
});
// If it was already initialized, Once won't run again
if !INIT.is_completed() {
IdeviceLoggerError::AlreadyInitialized
} else {
init_result
}
}

View File

@@ -28,7 +28,7 @@ pub unsafe extern "C" fn misagent_connect(
client: *mut *mut MisagentClientHandle, client: *mut *mut MisagentClientHandle,
) -> *mut IdeviceFfiError { ) -> *mut IdeviceFfiError {
if provider.is_null() || client.is_null() { if provider.is_null() || client.is_null() {
log::error!("Null pointer provided"); tracing::error!("Null pointer provided");
return ffi_err!(IdeviceError::FfiInvalidArg); return ffi_err!(IdeviceError::FfiInvalidArg);
} }
@@ -218,7 +218,7 @@ pub unsafe extern "C" fn misagent_free_profiles(
#[unsafe(no_mangle)] #[unsafe(no_mangle)]
pub unsafe extern "C" fn misagent_client_free(handle: *mut MisagentClientHandle) { pub unsafe extern "C" fn misagent_client_free(handle: *mut MisagentClientHandle) {
if !handle.is_null() { if !handle.is_null() {
log::debug!("Freeing misagent_client"); tracing::debug!("Freeing misagent_client");
let _ = unsafe { Box::from_raw(handle) }; let _ = unsafe { Box::from_raw(handle) };
} }
} }

View File

@@ -30,7 +30,7 @@ pub unsafe extern "C" fn image_mounter_connect(
client: *mut *mut ImageMounterHandle, client: *mut *mut ImageMounterHandle,
) -> *mut IdeviceFfiError { ) -> *mut IdeviceFfiError {
if provider.is_null() || client.is_null() { if provider.is_null() || client.is_null() {
log::error!("Null pointer provided"); tracing::error!("Null pointer provided");
return ffi_err!(IdeviceError::FfiInvalidArg); return ffi_err!(IdeviceError::FfiInvalidArg);
} }
@@ -90,7 +90,7 @@ pub unsafe extern "C" fn image_mounter_new(
#[unsafe(no_mangle)] #[unsafe(no_mangle)]
pub unsafe extern "C" fn image_mounter_free(handle: *mut ImageMounterHandle) { pub unsafe extern "C" fn image_mounter_free(handle: *mut ImageMounterHandle) {
if !handle.is_null() { if !handle.is_null() {
log::debug!("Freeing image_mounter_client"); tracing::debug!("Freeing image_mounter_client");
let _ = unsafe { Box::from_raw(handle) }; let _ = unsafe { Box::from_raw(handle) };
} }
} }

View File

@@ -46,7 +46,7 @@ pub unsafe extern "C" fn os_trace_relay_connect(
client: *mut *mut OsTraceRelayClientHandle, client: *mut *mut OsTraceRelayClientHandle,
) -> *mut IdeviceFfiError { ) -> *mut IdeviceFfiError {
if provider.is_null() { if provider.is_null() {
log::error!("Null pointer provided"); tracing::error!("Null pointer provided");
return ffi_err!(IdeviceError::FfiInvalidArg); return ffi_err!(IdeviceError::FfiInvalidArg);
} }
@@ -78,7 +78,7 @@ pub unsafe extern "C" fn os_trace_relay_connect(
#[unsafe(no_mangle)] #[unsafe(no_mangle)]
pub unsafe extern "C" fn os_trace_relay_free(handle: *mut OsTraceRelayClientHandle) { pub unsafe extern "C" fn os_trace_relay_free(handle: *mut OsTraceRelayClientHandle) {
if !handle.is_null() { if !handle.is_null() {
log::debug!("Freeing os trace relay client"); tracing::debug!("Freeing os trace relay client");
let _ = unsafe { Box::from_raw(handle) }; let _ = unsafe { Box::from_raw(handle) };
} }
} }
@@ -102,7 +102,7 @@ pub unsafe extern "C" fn os_trace_relay_start_trace(
pid: *const u32, pid: *const u32,
) -> *mut IdeviceFfiError { ) -> *mut IdeviceFfiError {
if receiver.is_null() || client.is_null() { if receiver.is_null() || client.is_null() {
log::error!("Null pointer provided"); tracing::error!("Null pointer provided");
return ffi_err!(IdeviceError::FfiInvalidArg); return ffi_err!(IdeviceError::FfiInvalidArg);
} }
@@ -137,7 +137,7 @@ pub unsafe extern "C" fn os_trace_relay_start_trace(
#[unsafe(no_mangle)] #[unsafe(no_mangle)]
pub unsafe extern "C" fn os_trace_relay_receiver_free(handle: *mut OsTraceRelayReceiverHandle) { pub unsafe extern "C" fn os_trace_relay_receiver_free(handle: *mut OsTraceRelayReceiverHandle) {
if !handle.is_null() { if !handle.is_null() {
log::debug!("Freeing syslog relay client"); tracing::debug!("Freeing syslog relay client");
let _ = unsafe { Box::from_raw(handle) }; let _ = unsafe { Box::from_raw(handle) };
} }
} }
@@ -186,7 +186,7 @@ pub unsafe extern "C" fn os_trace_relay_next(
log: *mut *mut OsTraceLog, log: *mut *mut OsTraceLog,
) -> *mut IdeviceFfiError { ) -> *mut IdeviceFfiError {
if client.is_null() { if client.is_null() {
log::error!("Null pointer provided"); tracing::error!("Null pointer provided");
return ffi_err!(IdeviceError::FfiInvalidArg); return ffi_err!(IdeviceError::FfiInvalidArg);
} }

View File

@@ -139,7 +139,7 @@ pub unsafe extern "C" fn idevice_pairing_file_serialize(
#[unsafe(no_mangle)] #[unsafe(no_mangle)]
pub unsafe extern "C" fn idevice_pairing_file_free(pairing_file: *mut IdevicePairingFile) { pub unsafe extern "C" fn idevice_pairing_file_free(pairing_file: *mut IdevicePairingFile) {
if !pairing_file.is_null() { if !pairing_file.is_null() {
log::debug!("Freeing pairing file"); tracing::debug!("Freeing pairing file");
let _ = unsafe { Box::from_raw(pairing_file) }; let _ = unsafe { Box::from_raw(pairing_file) };
} }
} }

View File

@@ -70,7 +70,7 @@ pub unsafe extern "C" fn idevice_tcp_provider_new(
#[unsafe(no_mangle)] #[unsafe(no_mangle)]
pub unsafe extern "C" fn idevice_provider_free(provider: *mut IdeviceProviderHandle) { pub unsafe extern "C" fn idevice_provider_free(provider: *mut IdeviceProviderHandle) {
if !provider.is_null() { if !provider.is_null() {
log::debug!("Freeing provider"); tracing::debug!("Freeing provider");
unsafe { drop(Box::from_raw(provider)) }; unsafe { drop(Box::from_raw(provider)) };
} }
} }
@@ -109,7 +109,7 @@ pub unsafe extern "C" fn usbmuxd_provider_new(
let udid = match unsafe { CStr::from_ptr(udid) }.to_str() { let udid = match unsafe { CStr::from_ptr(udid) }.to_str() {
Ok(u) => u.to_string(), Ok(u) => u.to_string(),
Err(e) => { Err(e) => {
log::error!("Invalid UDID string: {e:?}"); tracing::error!("Invalid UDID string: {e:?}");
return ffi_err!(IdeviceError::FfiInvalidString); return ffi_err!(IdeviceError::FfiInvalidString);
} }
}; };
@@ -117,7 +117,7 @@ pub unsafe extern "C" fn usbmuxd_provider_new(
let label = match unsafe { CStr::from_ptr(label) }.to_str() { let label = match unsafe { CStr::from_ptr(label) }.to_str() {
Ok(l) => l.to_string(), Ok(l) => l.to_string(),
Err(e) => { Err(e) => {
log::error!("Invalid label string: {e:?}"); tracing::error!("Invalid label string: {e:?}");
return ffi_err!(IdeviceError::FfiInvalidArg); return ffi_err!(IdeviceError::FfiInvalidArg);
} }
}; };

View File

@@ -30,7 +30,7 @@ pub unsafe extern "C" fn springboard_services_connect(
client: *mut *mut SpringBoardServicesClientHandle, client: *mut *mut SpringBoardServicesClientHandle,
) -> *mut IdeviceFfiError { ) -> *mut IdeviceFfiError {
if provider.is_null() || client.is_null() { if provider.is_null() || client.is_null() {
log::error!("Null pointer provided"); tracing::error!("Null pointer provided");
return ffi_err!(IdeviceError::FfiInvalidArg); return ffi_err!(IdeviceError::FfiInvalidArg);
} }
@@ -103,7 +103,7 @@ pub unsafe extern "C" fn springboard_services_get_icon(
out_result_len: *mut libc::size_t, out_result_len: *mut libc::size_t,
) -> *mut IdeviceFfiError { ) -> *mut IdeviceFfiError {
if client.is_null() || out_result.is_null() || out_result_len.is_null() { if client.is_null() || out_result.is_null() || out_result_len.is_null() {
log::error!("Invalid arguments: {client:?}, {out_result:?}"); tracing::error!("Invalid arguments: {client:?}, {out_result:?}");
return ffi_err!(IdeviceError::FfiInvalidArg); return ffi_err!(IdeviceError::FfiInvalidArg);
} }
let client = unsafe { &mut *client }; let client = unsafe { &mut *client };
@@ -145,7 +145,7 @@ pub unsafe extern "C" fn springboard_services_get_icon(
#[unsafe(no_mangle)] #[unsafe(no_mangle)]
pub unsafe extern "C" fn springboard_services_free(handle: *mut SpringBoardServicesClientHandle) { pub unsafe extern "C" fn springboard_services_free(handle: *mut SpringBoardServicesClientHandle) {
if !handle.is_null() { if !handle.is_null() {
log::debug!("Freeing springboard_services_client"); tracing::debug!("Freeing springboard_services_client");
let _ = unsafe { Box::from_raw(handle) }; let _ = unsafe { Box::from_raw(handle) };
} }
} }

View File

@@ -23,7 +23,7 @@ pub unsafe extern "C" fn syslog_relay_connect_tcp(
client: *mut *mut SyslogRelayClientHandle, client: *mut *mut SyslogRelayClientHandle,
) -> *mut IdeviceFfiError { ) -> *mut IdeviceFfiError {
if provider.is_null() { if provider.is_null() {
log::error!("Null pointer provided"); tracing::error!("Null pointer provided");
return ffi_err!(IdeviceError::FfiInvalidArg); return ffi_err!(IdeviceError::FfiInvalidArg);
} }
@@ -58,7 +58,7 @@ pub unsafe extern "C" fn syslog_relay_connect_tcp(
#[unsafe(no_mangle)] #[unsafe(no_mangle)]
pub unsafe extern "C" fn syslog_relay_client_free(handle: *mut SyslogRelayClientHandle) { pub unsafe extern "C" fn syslog_relay_client_free(handle: *mut SyslogRelayClientHandle) {
if !handle.is_null() { if !handle.is_null() {
log::debug!("Freeing syslog relay client"); tracing::debug!("Freeing syslog relay client");
let _ = unsafe { Box::from_raw(handle) }; let _ = unsafe { Box::from_raw(handle) };
} }
} }
@@ -96,7 +96,7 @@ pub unsafe extern "C" fn syslog_relay_next(
null_mut() null_mut()
} }
Err(_) => { Err(_) => {
log::error!("Failed to convert log message to C string"); tracing::error!("Failed to convert log message to C string");
ffi_err!(IdeviceError::FfiInvalidString) ffi_err!(IdeviceError::FfiInvalidString)
} }
} }

View File

@@ -15,7 +15,7 @@ use idevice::{
IdeviceError, IdeviceError,
usbmuxd::{UsbmuxdAddr, UsbmuxdConnection, UsbmuxdDevice, UsbmuxdListenEvent}, usbmuxd::{UsbmuxdAddr, UsbmuxdConnection, UsbmuxdDevice, UsbmuxdListenEvent},
}; };
use log::error; use tracing::error;
pub struct UsbmuxdConnectionHandle(pub UsbmuxdConnection); pub struct UsbmuxdConnectionHandle(pub UsbmuxdConnection);
pub struct UsbmuxdAddrHandle(pub UsbmuxdAddr); pub struct UsbmuxdAddrHandle(pub UsbmuxdAddr);
@@ -132,7 +132,7 @@ pub unsafe extern "C" fn idevice_usbmuxd_new_default_connection(
let addr = match UsbmuxdAddr::from_env_var() { let addr = match UsbmuxdAddr::from_env_var() {
Ok(a) => a, Ok(a) => a,
Err(e) => { Err(e) => {
log::error!("Invalid address set: {e:?}"); tracing::error!("Invalid address set: {e:?}");
return ffi_err!(IdeviceError::FfiInvalidArg); return ffi_err!(IdeviceError::FfiInvalidArg);
} }
}; };

View File

@@ -48,7 +48,7 @@ pub(crate) fn c_socket_to_rust(
addr_len: SockLen, addr_len: SockLen,
) -> Result<SocketAddr, IdeviceError> { ) -> Result<SocketAddr, IdeviceError> {
if addr.is_null() { if addr.is_null() {
log::error!("null sockaddr"); tracing::error!("null sockaddr");
return invalid_arg(); return invalid_arg();
} }
@@ -59,7 +59,7 @@ pub(crate) fn c_socket_to_rust(
match family as i32 { match family as i32 {
libc::AF_INET => { libc::AF_INET => {
if (addr_len as usize) < std::mem::size_of::<sockaddr_in>() { if (addr_len as usize) < std::mem::size_of::<sockaddr_in>() {
log::error!("Invalid sockaddr_in size"); tracing::error!("Invalid sockaddr_in size");
return invalid_arg(); return invalid_arg();
} }
let a = &*(addr as *const sockaddr_in); let a = &*(addr as *const sockaddr_in);
@@ -69,7 +69,7 @@ pub(crate) fn c_socket_to_rust(
} }
libc::AF_INET6 => { libc::AF_INET6 => {
if (addr_len as usize) < std::mem::size_of::<sockaddr_in6>() { if (addr_len as usize) < std::mem::size_of::<sockaddr_in6>() {
log::error!("Invalid sockaddr_in6 size"); tracing::error!("Invalid sockaddr_in6 size");
return invalid_arg(); return invalid_arg();
} }
let a = &*(addr as *const sockaddr_in6); let a = &*(addr as *const sockaddr_in6);
@@ -83,7 +83,7 @@ pub(crate) fn c_socket_to_rust(
))) )))
} }
_ => { _ => {
log::error!( tracing::error!(
"Unsupported socket address family: {}", "Unsupported socket address family: {}",
(*addr).sa_family as i32 (*addr).sa_family as i32
); );
@@ -95,7 +95,7 @@ pub(crate) fn c_socket_to_rust(
match family { match family {
AF_INET => { AF_INET => {
if (addr_len as usize) < std::mem::size_of::<sockaddr_in>() { if (addr_len as usize) < std::mem::size_of::<sockaddr_in>() {
log::error!("Invalid SOCKADDR_IN size"); tracing::error!("Invalid SOCKADDR_IN size");
return invalid_arg(); return invalid_arg();
} }
let a = &*(addr as *const sockaddr_in); let a = &*(addr as *const sockaddr_in);
@@ -107,7 +107,7 @@ pub(crate) fn c_socket_to_rust(
} }
AF_INET6 => { AF_INET6 => {
if (addr_len as usize) < std::mem::size_of::<sockaddr_in6>() { if (addr_len as usize) < std::mem::size_of::<sockaddr_in6>() {
log::error!("Invalid SOCKADDR_IN6 size"); tracing::error!("Invalid SOCKADDR_IN6 size");
return invalid_arg(); return invalid_arg();
} }
let a = &*(addr as *const sockaddr_in6); let a = &*(addr as *const sockaddr_in6);
@@ -124,7 +124,7 @@ pub(crate) fn c_socket_to_rust(
))) )))
} }
_ => { _ => {
log::error!("Unsupported socket address family: {}", (*addr).sa_family); tracing::error!("Unsupported socket address family: {}", (*addr).sa_family);
invalid_arg() invalid_arg()
} }
} }
@@ -133,7 +133,7 @@ pub(crate) fn c_socket_to_rust(
pub(crate) fn c_addr_to_rust(addr: *const SockAddr) -> Result<IpAddr, IdeviceError> { pub(crate) fn c_addr_to_rust(addr: *const SockAddr) -> Result<IpAddr, IdeviceError> {
if addr.is_null() { if addr.is_null() {
log::error!("null sockaddr"); tracing::error!("null sockaddr");
return invalid_arg(); return invalid_arg();
} }
@@ -157,7 +157,7 @@ pub(crate) fn c_addr_to_rust(addr: *const SockAddr) -> Result<IpAddr, IdeviceErr
Ok(IpAddr::V6(Ipv6Addr::from(a.sin6_addr.s6_addr))) Ok(IpAddr::V6(Ipv6Addr::from(a.sin6_addr.s6_addr)))
} }
_ => { _ => {
log::error!( tracing::error!(
"Unsupported socket address family: {}", "Unsupported socket address family: {}",
(*addr).sa_family as i32 (*addr).sa_family as i32
); );
@@ -178,7 +178,7 @@ pub(crate) fn c_addr_to_rust(addr: *const SockAddr) -> Result<IpAddr, IdeviceErr
Ok(IpAddr::V6(Ipv6Addr::from(bytes))) Ok(IpAddr::V6(Ipv6Addr::from(bytes)))
} }
_ => { _ => {
log::error!("Unsupported socket address family: {}", (*addr).sa_family); tracing::error!("Unsupported socket address family: {}", (*addr).sa_family);
invalid_arg() invalid_arg()
} }
} }

View File

@@ -24,8 +24,7 @@ serde = { version = "1", features = ["derive"] }
ns-keyed-archive = { version = "0.1.4", optional = true } ns-keyed-archive = { version = "0.1.4", optional = true }
thiserror = { version = "2" } thiserror = { version = "2" }
log = { version = "0.4" } tracing = { version = "0.1.41" }
env_logger = { version = "0.11" }
base64 = { version = "0.22" } base64 = { version = "0.22" }
indexmap = { version = "2.11", features = ["serde"], optional = true } indexmap = { version = "2.11", features = ["serde"], optional = true }

View File

@@ -26,7 +26,6 @@ pub use services::*;
#[cfg(feature = "xpc")] #[cfg(feature = "xpc")]
pub use xpc::RemoteXpcClient; pub use xpc::RemoteXpcClient;
use log::{debug, error, trace};
use provider::{IdeviceProvider, RsdProvider}; use provider::{IdeviceProvider, RsdProvider};
use rustls::{crypto::CryptoProvider, pki_types::ServerName}; use rustls::{crypto::CryptoProvider, pki_types::ServerName};
use std::{ use std::{
@@ -35,6 +34,7 @@ use std::{
}; };
use thiserror::Error; use thiserror::Error;
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
use tracing::{debug, error, trace};
pub use util::{pretty_print_dictionary, pretty_print_plist}; pub use util::{pretty_print_dictionary, pretty_print_plist};
@@ -389,7 +389,7 @@ impl Idevice {
} }
} }
_ => { _ => {
log::error!("Error is not a string or integer from read_plist: {e:?}"); tracing::error!("Error is not a string or integer from read_plist: {e:?}");
return Err(IdeviceError::UnexpectedResponse); return Err(IdeviceError::UnexpectedResponse);
} }
}; };
@@ -488,7 +488,7 @@ impl Idevice {
// My sanity while debugging the workspace crates are more important. // My sanity while debugging the workspace crates are more important.
debug!("Using ring crypto backend, because both were passed"); debug!("Using ring crypto backend, because both were passed");
log::warn!("Both ring && aws-lc are selected as idevice crypto backends!"); tracing::warn!("Both ring && aws-lc are selected as idevice crypto backends!");
rustls::crypto::ring::default_provider() rustls::crypto::ring::default_provider()
} }
}; };
@@ -497,7 +497,7 @@ impl Idevice {
// For whatever reason, getting the default provider will return None on iOS at // For whatever reason, getting the default provider will return None on iOS at
// random. Installing the default provider a second time will return an error, so // random. Installing the default provider a second time will return an error, so
// we will log it but not propogate it. An issue should be opened with rustls. // we will log it but not propogate it. An issue should be opened with rustls.
log::error!("Failed to set crypto provider: {e:?}"); tracing::error!("Failed to set crypto provider: {e:?}");
} }
} }
let config = sni::create_client_config(pairing_file)?; let config = sni::create_client_config(pairing_file)?;

View File

@@ -5,10 +5,10 @@
use std::path::Path; use std::path::Path;
use log::warn;
use plist::Data; use plist::Data;
use rustls::pki_types::{CertificateDer, pem::PemObject}; use rustls::pki_types::{CertificateDer, pem::PemObject};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tracing::warn;
/// Represents a complete iOS device pairing record /// Represents a complete iOS device pairing record
/// ///

View File

@@ -7,9 +7,9 @@ use std::collections::HashMap;
use errors::AfcError; use errors::AfcError;
use file::FileDescriptor; use file::FileDescriptor;
use log::warn;
use opcode::{AfcFopenMode, AfcOpcode}; use opcode::{AfcFopenMode, AfcOpcode};
use packet::{AfcPacket, AfcPacketHeader}; use packet::{AfcPacket, AfcPacketHeader};
use tracing::warn;
use crate::{Idevice, IdeviceError, IdeviceService, obf}; use crate::{Idevice, IdeviceError, IdeviceService, obf};
@@ -508,7 +508,7 @@ impl AfcClient {
let res = AfcPacket::read(&mut self.idevice).await?; let res = AfcPacket::read(&mut self.idevice).await?;
if res.header.operation == AfcOpcode::Status { if res.header.operation == AfcOpcode::Status {
if res.header_payload.len() < 8 { if res.header_payload.len() < 8 {
log::error!("AFC returned error opcode, but not a code"); tracing::error!("AFC returned error opcode, but not a code");
return Err(IdeviceError::UnexpectedResponse); return Err(IdeviceError::UnexpectedResponse);
} }
let code = u64::from_le_bytes(res.header_payload[..8].try_into().unwrap()); let code = u64::from_le_bytes(res.header_payload[..8].try_into().unwrap());

View File

@@ -1,6 +1,6 @@
// Jackson Coxson // Jackson Coxson
use log::debug; use tracing::debug;
use crate::{Idevice, IdeviceError}; use crate::{Idevice, IdeviceError};

View File

@@ -5,7 +5,7 @@
use std::pin::Pin; use std::pin::Pin;
use futures::Stream; use futures::Stream;
use log::warn; use tracing::warn;
use crate::{Idevice, IdeviceError, IdeviceService, obf}; use crate::{Idevice, IdeviceError, IdeviceService, obf};

View File

@@ -1,6 +1,6 @@
//! Companion Proxy is Apple's bridge to connect to the Apple Watch //! Companion Proxy is Apple's bridge to connect to the Apple Watch
use log::warn; use tracing::warn;
use crate::{Idevice, IdeviceError, IdeviceService, RsdService, obf}; use crate::{Idevice, IdeviceError, IdeviceService, RsdService, obf};

View File

@@ -1,7 +1,7 @@
// Jackson Coxson // Jackson Coxson
use log::warn;
use serde::Deserialize; use serde::Deserialize;
use tracing::warn;
use crate::{IdeviceError, ReadWrite, RsdService, obf, xpc::XPCObject}; use crate::{IdeviceError, ReadWrite, RsdService, obf, xpc::XPCObject};

View File

@@ -3,7 +3,7 @@
use std::pin::Pin; use std::pin::Pin;
use futures::Stream; use futures::Stream;
use log::warn; use tracing::warn;
use crate::{IdeviceError, ReadWrite, RsdService, obf}; use crate::{IdeviceError, ReadWrite, RsdService, obf};

View File

@@ -1,7 +1,7 @@
// Jackson Coxson // Jackson Coxson
// Ported from pymobiledevice3 // Ported from pymobiledevice3
use log::warn; use tracing::warn;
use crate::{ use crate::{
IdeviceError, ReadWrite, RemoteXpcClient, IdeviceError, ReadWrite, RemoteXpcClient,

View File

@@ -7,7 +7,7 @@
//! function to trigger a flush of crash logs from system storage into the //! function to trigger a flush of crash logs from system storage into the
//! crash reports directory by connecting to the `com.apple.crashreportmover` service. //! crash reports directory by connecting to the `com.apple.crashreportmover` service.
use log::{debug, warn}; use tracing::{debug, warn};
use crate::{Idevice, IdeviceError, IdeviceService, afc::AfcClient, lockdown::LockdownClient, obf}; use crate::{Idevice, IdeviceError, IdeviceService, afc::AfcClient, lockdown::LockdownClient, obf};

View File

@@ -4,9 +4,9 @@
//! GDB Remote Serial Protocol as documented at: //! GDB Remote Serial Protocol as documented at:
//! https://sourceware.org/gdb/current/onlinedocs/gdb.html/Packets.html#Packets //! https://sourceware.org/gdb/current/onlinedocs/gdb.html/Packets.html#Packets
use log::debug;
use std::fmt::Write; use std::fmt::Write;
use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tracing::debug;
use crate::{IdeviceError, ReadWrite, RsdService, obf}; use crate::{IdeviceError, ReadWrite, RsdService, obf};

View File

@@ -10,8 +10,8 @@ use crate::{
}, },
obf, obf,
}; };
use log::warn;
use plist::Value; use plist::Value;
use tracing::warn;
#[derive(Debug)] #[derive(Debug)]
pub struct NotificationInfo { pub struct NotificationInfo {

View File

@@ -34,8 +34,8 @@
//! } //! }
//! ``` //! ```
use log::warn;
use plist::{Dictionary, Value}; use plist::{Dictionary, Value};
use tracing::warn;
use crate::{IdeviceError, ReadWrite, dvt::message::AuxValue, obf}; use crate::{IdeviceError, ReadWrite, dvt::message::AuxValue, obf};

View File

@@ -51,8 +51,8 @@
use std::collections::{HashMap, VecDeque}; use std::collections::{HashMap, VecDeque};
use log::{debug, warn};
use tokio::io::AsyncWriteExt; use tokio::io::AsyncWriteExt;
use tracing::{debug, warn};
use crate::{ use crate::{
IdeviceError, ReadWrite, IdeviceError, ReadWrite,

View File

@@ -5,8 +5,8 @@
use std::collections::HashMap; use std::collections::HashMap;
use log::warn;
use plist::Dictionary; use plist::Dictionary;
use tracing::warn;
use crate::{Idevice, IdeviceError, IdeviceService, obf}; use crate::{Idevice, IdeviceError, IdeviceService, obf};

View File

@@ -3,8 +3,8 @@
//! Provides functionality for interacting with the lockdown service on iOS devices, //! Provides functionality for interacting with the lockdown service on iOS devices,
//! which is the primary service for device management and service discovery. //! which is the primary service for device management and service discovery.
use log::error;
use plist::Value; use plist::Value;
use tracing::error;
use crate::{Idevice, IdeviceError, IdeviceService, obf, pairing_file}; use crate::{Idevice, IdeviceError, IdeviceService, obf, pairing_file};
@@ -256,7 +256,7 @@ impl LockdownClient {
let pub_key = match pub_key.as_data().map(|x| x.to_vec()) { let pub_key = match pub_key.as_data().map(|x| x.to_vec()) {
Some(p) => p, Some(p) => p,
None => { None => {
log::warn!("Did not get public key data response"); tracing::warn!("Did not get public key data response");
return Err(IdeviceError::UnexpectedResponse); return Err(IdeviceError::UnexpectedResponse);
} }
}; };
@@ -265,7 +265,7 @@ impl LockdownClient {
let wifi_mac = match wifi_mac.as_string() { let wifi_mac = match wifi_mac.as_string() {
Some(w) => w, Some(w) => w,
None => { None => {
log::warn!("Did not get WiFiAddress string"); tracing::warn!("Did not get WiFiAddress string");
return Err(IdeviceError::UnexpectedResponse); return Err(IdeviceError::UnexpectedResponse);
} }
}; };

View File

@@ -3,7 +3,7 @@
//! Provides functionality for interacting with the misagent service on iOS devices, //! Provides functionality for interacting with the misagent service on iOS devices,
//! which manages provisioning profiles and certificates. //! which manages provisioning profiles and certificates.
use log::warn; use tracing::warn;
use crate::{Idevice, IdeviceError, IdeviceService, RsdService, obf}; use crate::{Idevice, IdeviceError, IdeviceService, RsdService, obf};

View File

@@ -7,7 +7,7 @@
//! //!
//! Handles the complete workflow from uploading images to mounting them with proper signatures. //! Handles the complete workflow from uploading images to mounting them with proper signatures.
use log::debug; use tracing::debug;
use crate::{Idevice, IdeviceError, IdeviceService, obf}; use crate::{Idevice, IdeviceError, IdeviceService, obf};
use sha2::{Digest, Sha384}; use sha2::{Digest, Sha384};
@@ -145,7 +145,7 @@ impl ImageMounter {
let image_size = match u64::try_from(image.len()) { let image_size = match u64::try_from(image.len()) {
Ok(i) => i, Ok(i) => i,
Err(e) => { Err(e) => {
log::error!("Could not parse image size as u64: {e:?}"); tracing::error!("Could not parse image size as u64: {e:?}");
return Err(IdeviceError::UnexpectedResponse); return Err(IdeviceError::UnexpectedResponse);
} }
}; };
@@ -162,7 +162,7 @@ impl ImageMounter {
match res.get("Status") { match res.get("Status") {
Some(plist::Value::String(s)) => { Some(plist::Value::String(s)) => {
if s.as_str() != "ReceiveBytesAck" { if s.as_str() != "ReceiveBytesAck" {
log::error!("Received bad response to SendBytes: {s:?}"); tracing::error!("Received bad response to SendBytes: {s:?}");
return Err(IdeviceError::UnexpectedResponse); return Err(IdeviceError::UnexpectedResponse);
} }
} }
@@ -178,7 +178,7 @@ impl ImageMounter {
match res.get("Status") { match res.get("Status") {
Some(plist::Value::String(s)) => { Some(plist::Value::String(s)) => {
if s.as_str() != "Complete" { if s.as_str() != "Complete" {
log::error!("Image send failure: {s:?}"); tracing::error!("Image send failure: {s:?}");
return Err(IdeviceError::UnexpectedResponse); return Err(IdeviceError::UnexpectedResponse);
} }
} }
@@ -221,7 +221,7 @@ impl ImageMounter {
match res.get("Status") { match res.get("Status") {
Some(plist::Value::String(s)) => { Some(plist::Value::String(s)) => {
if s.as_str() != "Complete" { if s.as_str() != "Complete" {
log::error!("Image send failure: {s:?}"); tracing::error!("Image send failure: {s:?}");
return Err(IdeviceError::UnexpectedResponse); return Err(IdeviceError::UnexpectedResponse);
} }
} }
@@ -537,7 +537,7 @@ impl ImageMounter {
build_manifest: &plist::Dictionary, build_manifest: &plist::Dictionary,
unique_chip_id: u64, unique_chip_id: u64,
) -> Result<Vec<u8>, IdeviceError> { ) -> Result<Vec<u8>, IdeviceError> {
use log::{debug, warn}; use tracing::{debug, warn};
let mut request = TSSRequest::new(); let mut request = TSSRequest::new();

View File

@@ -3,12 +3,12 @@
//! Provides functionality for interacting with the mobilebackup2 service on iOS devices, //! Provides functionality for interacting with the mobilebackup2 service on iOS devices,
//! which allows creating, restoring, and managing device backups. //! which allows creating, restoring, and managing device backups.
use log::{debug, warn};
use plist::Dictionary; use plist::Dictionary;
use std::fs; use std::fs;
use std::io::{Read, Write}; use std::io::{Read, Write};
use std::path::Path; use std::path::Path;
use tokio::io::AsyncReadExt; use tokio::io::AsyncReadExt;
use tracing::{debug, warn};
use crate::{Idevice, IdeviceError, IdeviceService, obf}; use crate::{Idevice, IdeviceError, IdeviceService, obf};

View File

@@ -44,11 +44,11 @@ impl PreboardServiceClient {
let res = self.idevice.read_plist().await?; let res = self.idevice.read_plist().await?;
if let Some(res) = res.get("ShowDialog").and_then(|x| x.as_boolean()) { if let Some(res) = res.get("ShowDialog").and_then(|x| x.as_boolean()) {
if !res { if !res {
log::warn!("ShowDialog is not true"); tracing::warn!("ShowDialog is not true");
return Err(IdeviceError::UnexpectedResponse); return Err(IdeviceError::UnexpectedResponse);
} }
} else { } else {
log::warn!("No ShowDialog in response from service"); tracing::warn!("No ShowDialog in response from service");
return Err(IdeviceError::UnexpectedResponse); return Err(IdeviceError::UnexpectedResponse);
} }

View File

@@ -1,7 +1,7 @@
//! Restore Service //! Restore Service
use log::warn;
use plist::Dictionary; use plist::Dictionary;
use tracing::warn;
use crate::{IdeviceError, ReadWrite, RemoteXpcClient, RsdService, obf}; use crate::{IdeviceError, ReadWrite, RemoteXpcClient, RsdService, obf};

View File

@@ -3,8 +3,8 @@
use std::collections::HashMap; use std::collections::HashMap;
use log::{debug, warn};
use serde::Deserialize; use serde::Deserialize;
use tracing::{debug, warn};
use crate::{IdeviceError, ReadWrite, RemoteXpcClient, provider::RsdProvider}; use crate::{IdeviceError, ReadWrite, RemoteXpcClient, provider::RsdProvider};

View File

@@ -4,9 +4,9 @@
//! which allows taking screenshots. //! which allows taking screenshots.
use crate::{Idevice, IdeviceError, IdeviceService, obf}; use crate::{Idevice, IdeviceError, IdeviceService, obf};
use log::{debug, warn};
use std::borrow::Cow; use std::borrow::Cow;
use tokio::io::AsyncReadExt; use tokio::io::AsyncReadExt;
use tracing::{debug, warn};
pub struct ScreenshotService { pub struct ScreenshotService {
/// Underlying device connection /// Underlying device connection
pub idevice: Idevice, pub idevice: Idevice,

View File

@@ -62,11 +62,11 @@
use std::{collections::HashMap, io::ErrorKind, net::IpAddr, path::Path, sync::Arc}; use std::{collections::HashMap, io::ErrorKind, net::IpAddr, path::Path, sync::Arc};
use log::{debug, trace, warn};
use tokio::{ use tokio::{
io::{AsyncReadExt, AsyncWriteExt}, io::{AsyncReadExt, AsyncWriteExt},
sync::Mutex, sync::Mutex,
}; };
use tracing::{debug, trace, warn};
use crate::{ReadWrite, tcp::packets::IpParseError}; use crate::{ReadWrite, tcp::packets::IpParseError};

View File

@@ -8,12 +8,12 @@ use std::{collections::HashMap, path::PathBuf, sync::Mutex, task::Poll};
use crossfire::{AsyncRx, MTx, Tx, mpsc, spsc, stream::AsyncStream}; use crossfire::{AsyncRx, MTx, Tx, mpsc, spsc, stream::AsyncStream};
use futures::{StreamExt, stream::FuturesUnordered}; use futures::{StreamExt, stream::FuturesUnordered};
use log::trace;
use tokio::{ use tokio::{
io::{AsyncRead, AsyncWrite}, io::{AsyncRead, AsyncWrite},
sync::oneshot, sync::oneshot,
time::timeout, time::timeout,
}; };
use tracing::trace;
use crate::tcp::adapter::ConnectionStatus; use crate::tcp::adapter::ConnectionStatus;

View File

@@ -5,8 +5,8 @@ use std::{
time::{SystemTime, UNIX_EPOCH}, time::{SystemTime, UNIX_EPOCH},
}; };
use log::trace;
use tokio::io::AsyncWriteExt; use tokio::io::AsyncWriteExt;
use tracing::trace;
use crate::{ReadWrite, provider::RsdProvider}; use crate::{ReadWrite, provider::RsdProvider};
@@ -158,8 +158,6 @@ mod tests {
#[tokio::test] #[tokio::test]
async fn local_tcp() { async fn local_tcp() {
env_logger::init();
let our_ip = Ipv6Addr::from_str("fd12:3456:789a::1").unwrap(); let our_ip = Ipv6Addr::from_str("fd12:3456:789a::1").unwrap();
let their_ip = Ipv6Addr::from_str("fd12:3456:789a::2").unwrap(); let their_ip = Ipv6Addr::from_str("fd12:3456:789a::2").unwrap();
let dev = DeviceBuilder::new() let dev = DeviceBuilder::new()

View File

@@ -6,11 +6,11 @@ use std::{
sync::Arc, sync::Arc,
}; };
use log::debug;
use tokio::{ use tokio::{
io::{AsyncRead, AsyncReadExt}, io::{AsyncRead, AsyncReadExt},
sync::Mutex, sync::Mutex,
}; };
use tracing::debug;
pub enum ProtocolNumber { pub enum ProtocolNumber {
Tcp = 6, Tcp = 6,

View File

@@ -2,8 +2,8 @@
use std::{future::Future, task::Poll}; use std::{future::Future, task::Poll};
use log::trace;
use tokio::io::{AsyncRead, AsyncWrite}; use tokio::io::{AsyncRead, AsyncWrite};
use tracing::trace;
use crate::tcp::adapter::ConnectionStatus; use crate::tcp::adapter::ConnectionStatus;

View File

@@ -5,8 +5,8 @@
//! - Apply restore request rules for device-specific parameters //! - Apply restore request rules for device-specific parameters
//! - Handle cryptographic signing operations //! - Handle cryptographic signing operations
use log::{debug, warn};
use plist::Value; use plist::Value;
use tracing::{debug, warn};
use crate::{IdeviceError, util::plist_to_xml_bytes}; use crate::{IdeviceError, util::plist_to_xml_bytes};

View File

@@ -5,9 +5,9 @@
use std::{collections::HashMap, net::SocketAddr}; use std::{collections::HashMap, net::SocketAddr};
use log::warn;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::Value; use serde_json::Value;
use tracing::warn;
use crate::IdeviceError; use crate::IdeviceError;

View File

@@ -2,8 +2,8 @@
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
use log::{debug, warn};
use serde::Deserialize; use serde::Deserialize;
use tracing::{debug, warn};
use crate::{ use crate::{
IdeviceError, IdeviceError,

View File

@@ -13,8 +13,8 @@ use std::{
use std::net::{Ipv4Addr, SocketAddrV4}; use std::net::{Ipv4Addr, SocketAddrV4};
use futures::Stream; use futures::Stream;
use log::{debug, warn};
use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tracing::{debug, warn};
use crate::{ use crate::{
Idevice, IdeviceError, ReadWrite, pairing_file::PairingFile, provider::UsbmuxdProvider, Idevice, IdeviceError, ReadWrite, pairing_file::PairingFile, provider::UsbmuxdProvider,

View File

@@ -1,7 +1,7 @@
// Jackson Coxson // Jackson Coxson
use crate::util::plist_to_xml_bytes; use crate::util::plist_to_xml_bytes;
use log::warn; use tracing::warn;
#[derive(Debug)] #[derive(Debug)]
pub struct RawPacket { pub struct RawPacket {

View File

@@ -5,8 +5,8 @@ use std::{
}; };
use indexmap::IndexMap; use indexmap::IndexMap;
use log::{debug, warn};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tracing::{debug, warn};
use crate::IdeviceError; use crate::IdeviceError;

View File

@@ -1,9 +1,9 @@
// Jackson Coxson // Jackson Coxson
use frame::HttpFrame; use frame::HttpFrame;
use log::{debug, warn};
use std::collections::{HashMap, VecDeque}; use std::collections::{HashMap, VecDeque};
use tokio::io::AsyncWriteExt; use tokio::io::AsyncWriteExt;
use tracing::{debug, warn};
use crate::{IdeviceError, ReadWrite}; use crate::{IdeviceError, ReadWrite};

View File

@@ -3,7 +3,7 @@
use async_stream::try_stream; use async_stream::try_stream;
use futures::Stream; use futures::Stream;
use http2::Setting; use http2::Setting;
use log::debug; use tracing::debug;
use crate::{IdeviceError, ReadWrite}; use crate::{IdeviceError, ReadWrite};

View File

@@ -146,8 +146,8 @@ path = "src/installcoordination_proxy.rs"
[dependencies] [dependencies]
idevice = { path = "../idevice", features = ["full"], default-features = false } idevice = { path = "../idevice", features = ["full"], default-features = false }
tokio = { version = "1.43", features = ["full"] } tokio = { version = "1.43", features = ["full"] }
log = { version = "0.4" } tracing = { version = "0.1.41" }
env_logger = { version = "0.11" } tracing-subscriber = { version = "0.3", features = ["env-filter"] }
# tun-rs = { version = "1.5", features = ["async"] } # tun-rs = { version = "1.5", features = ["async"] }
sha2 = { version = "0.10" } sha2 = { version = "0.10" }
ureq = { version = "3" } ureq = { version = "3" }

View File

@@ -9,7 +9,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("activation") let matches = Command::new("activation")
.about("mobileactivationd") .about("mobileactivationd")

View File

@@ -13,7 +13,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("afc") let matches = Command::new("afc")
.about("Manage files on the device") .about("Manage files on the device")

View File

@@ -7,7 +7,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("amfi") let matches = Command::new("amfi")
.about("Mess with developer mode") .about("Mess with developer mode")

View File

@@ -12,7 +12,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("remotexpc") let matches = Command::new("remotexpc")
.about("Get services from RemoteXPC") .about("Get services from RemoteXPC")

View File

@@ -12,7 +12,7 @@ mod pcap;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("amfi") let matches = Command::new("amfi")
.about("Capture Bluetooth packets") .about("Capture Bluetooth packets")

View File

@@ -11,7 +11,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("companion_proxy") let matches = Command::new("companion_proxy")
.about("Apple Watch things") .about("Apple Watch things")

View File

@@ -10,7 +10,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("crash_logs") let matches = Command::new("crash_logs")
.about("Manage crash logs") .about("Manage crash logs")

View File

@@ -12,7 +12,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("remotexpc") let matches = Command::new("remotexpc")
.about("Get services from RemoteXPC") .about("Get services from RemoteXPC")

View File

@@ -8,7 +8,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("idevicediagnostics") let matches = Command::new("idevicediagnostics")
.about("Interact with the diagnostics interface of a device") .about("Interact with the diagnostics interface of a device")

View File

@@ -12,7 +12,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("remotexpc") let matches = Command::new("remotexpc")
.about("Gets a sysdiagnose") .about("Gets a sysdiagnose")

View File

@@ -8,7 +8,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("core_device_proxy_tun") let matches = Command::new("core_device_proxy_tun")
.about("Start a tunnel") .about("Start a tunnel")
.arg( .arg(

View File

@@ -6,7 +6,7 @@ use idevice::usbmuxd::UsbmuxdConnection;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let mut muxer = UsbmuxdConnection::default().await.unwrap(); let mut muxer = UsbmuxdConnection::default().await.unwrap();
let res = muxer.get_devices().await.unwrap(); let res = muxer.get_devices().await.unwrap();

View File

@@ -8,7 +8,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("core_device_proxy_tun") let matches = Command::new("core_device_proxy_tun")
.about("Start a tunnel") .about("Start a tunnel")

View File

@@ -7,7 +7,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("ideviceinstaller") let matches = Command::new("ideviceinstaller")
.about("Install/upgrade apps on an iOS device (AFC + InstallationProxy)") .about("Install/upgrade apps on an iOS device (AFC + InstallationProxy)")

View File

@@ -10,7 +10,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("installationcoordination_proxy") let matches = Command::new("installationcoordination_proxy")
.about("") .about("")

View File

@@ -8,7 +8,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("core_device_proxy_tun") let matches = Command::new("core_device_proxy_tun")
.about("Start a tunnel") .about("Start a tunnel")

View File

@@ -10,7 +10,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("simulate_location") let matches = Command::new("simulate_location")
.about("Simulate device location") .about("Simulate device location")

View File

@@ -8,7 +8,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("lockdown") let matches = Command::new("lockdown")
.about("Start a tunnel") .about("Start a tunnel")

View File

@@ -9,7 +9,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("core_device_proxy_tun") let matches = Command::new("core_device_proxy_tun")
.about("Start a tunnel") .about("Start a tunnel")

View File

@@ -15,7 +15,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("mobilebackup2") let matches = Command::new("mobilebackup2")
.about("Mobile Backup 2 tool for iOS devices") .about("Mobile Backup 2 tool for iOS devices")

View File

@@ -13,7 +13,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("core_device_proxy_tun") let matches = Command::new("core_device_proxy_tun")
.about("Start a tunnel") .about("Start a tunnel")

View File

@@ -6,7 +6,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("notifications") let matches = Command::new("notifications")
.about("start notifications") .about("start notifications")
.arg( .arg(

View File

@@ -7,7 +7,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("os_trace_relay") let matches = Command::new("os_trace_relay")
.about("Relay system logs") .about("Relay system logs")

View File

@@ -9,7 +9,7 @@ use idevice::{
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("pair") let matches = Command::new("pair")
.about("Pair with the device") .about("Pair with the device")

View File

@@ -1,6 +1,6 @@
use idevice::bt_packet_logger::BtPacketKind; use idevice::bt_packet_logger::BtPacketKind;
use log::warn;
use tokio::io::{AsyncWrite, AsyncWriteExt}; use tokio::io::{AsyncWrite, AsyncWriteExt};
use tracing::warn;
// Classic PCAP (big-endian) global header for DLT_BLUETOOTH_HCI_H4_WITH_PHDR (201) // Classic PCAP (big-endian) global header for DLT_BLUETOOTH_HCI_H4_WITH_PHDR (201)
const PCAP_GLOBAL_HEADER_BE: [u8; 24] = [ const PCAP_GLOBAL_HEADER_BE: [u8; 24] = [

View File

@@ -10,7 +10,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("pcapd") let matches = Command::new("pcapd")
.about("Capture IP packets") .about("Capture IP packets")

View File

@@ -7,7 +7,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("preboard") let matches = Command::new("preboard")
.about("Mess with developer mode") .about("Mess with developer mode")

View File

@@ -8,7 +8,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("process_control") let matches = Command::new("process_control")
.about("Query process control") .about("Query process control")

View File

@@ -11,7 +11,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("remotexpc") let matches = Command::new("remotexpc")
.about("Get services from RemoteXPC") .about("Get services from RemoteXPC")

View File

@@ -10,7 +10,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("restore_service") let matches = Command::new("restore_service")
.about("Interact with the Restore Service service") .about("Interact with the Restore Service service")

View File

@@ -8,7 +8,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("screen_shot") let matches = Command::new("screen_shot")
.about("take screenshot") .about("take screenshot")
.arg( .arg(

View File

@@ -7,7 +7,7 @@ mod common;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
env_logger::init(); tracing_subscriber::fmt::init();
let matches = Command::new("syslog_relay") let matches = Command::new("syslog_relay")
.about("Relay system logs") .about("Relay system logs")