From 4d2d49326afa255cc61d819a6d446fd4c9a9dc22 Mon Sep 17 00:00:00 2001 From: Andrej Date: Sun, 3 Aug 2025 11:12:46 -0400 Subject: [PATCH] uz801: Update installer usb backdoor trigger code --- installer/src/uz801.rs | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/installer/src/uz801.rs b/installer/src/uz801.rs index f612cca..58888fc 100644 --- a/installer/src/uz801.rs +++ b/installer/src/uz801.rs @@ -53,13 +53,30 @@ async fn run_install(admin_ip: String) -> Result<()> { } pub async fn activate_usb_debug(admin_ip: &str) -> Result<()> { - let url = format!("http://{}/usbdebug.html", admin_ip); - let client = reqwest::Client::new(); - let response = client.get(&url).send().await?; - - if !response.status().is_success() { - anyhow::bail!("Failed to activate USB debug: HTTP {}", response.status()); - } + let url = format!("http://{}/ajax", admin_ip); + let referer = format!("http://{}/usbdebug.html", admin_ip); + let origin = format!("http://{}", admin_ip); + + let _handle = tokio::spawn(async move { + let client = reqwest::Client::builder() + .timeout(Duration::from_secs(5)) + .build() + .unwrap(); + + let _response = client + .post(&url) + .header("Accept", "application/json, text/javascript, */*; q=0.01") + .header("Accept-Encoding", "gzip, deflate") + .header("Referer", &referer) + .header("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8") + .header("X-Requested-With", "XMLHttpRequest") + .header("Origin", &origin) + .header("Connection", "keep-alive") + .body(r#"{"funcNo":2001}"#) + .send() + .await; + // Ignore any errors - the device will reboot and connection will be lost + }); Ok(()) }