uz801: Update installer usb backdoor trigger code

This commit is contained in:
Andrej
2025-08-03 11:12:46 -04:00
parent c26ad29ffb
commit 4d2d49326a

View File

@@ -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(())
}