From 7ebdc14b6e6aa1846402641e8a1fc32c0e9d2826 Mon Sep 17 00:00:00 2001 From: Roberto Frenna Date: Tue, 12 Sep 2023 23:06:49 +0100 Subject: [PATCH] v1.2.3: Support Fritz!OS 7.57+ in `fritzbox` renewer The folks at AVM have decided to switch things up again, this time by removing the endpoints usable for connection renewals (`/internet/inetstat_monitor.lua`). Those have been replaced with a single endpoint - `/data.lua` - that accepts a command name as an input. --- CHANGELOG.md | 4 ++++ Cargo.toml | 2 +- src/renewer/fritzbox.rs | 26 +++++++++++++++----------- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1409735..11f617f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# v1.2.3 + +- FIXED: fix the `fritzbox` renewer to work on FRITZ!OS 7.57+. + # v1.2.2 - FIXED: new FritzOS versions do not return _403_ anymore when the SID expires, but redirect. diff --git a/Cargo.toml b/Cargo.toml index 0fe8969..dfb1b08 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "oxixenon" -version = "1.2.2" +version = "1.2.3" authors = ["Roberto Frenna "] edition = "2018" diff --git a/src/renewer/fritzbox.rs b/src/renewer/fritzbox.rs index 0bb635e..788a15d 100644 --- a/src/renewer/fritzbox.rs +++ b/src/renewer/fritzbox.rs @@ -149,12 +149,14 @@ impl RenewerTrait for Renewer { Some(sid) => sid }; - // Try to use a pre-existing SID first. - let disconnect_url = format!( - "http://{}/internet/inetstat_monitor.lua?sid={}&action=disconnect&xhr=1&myXhr=1", - self.ip, sid - ); - let res = http_client::get(&disconnect_url) + let data_url = format!("http://{}/data.lua", self.ip); + let res = http_client::build_post(&data_url) + .put("xhr", "1") + .put("sid", sid) + .put("page", "netMoni") + .put("xhrId", "reconnect") + .put("disconnect", "true") + .build_and_execute() .chain_err(|| "HTTP request to renewal URL failed")?; // New versions of FritzOS do not return a 403 anymore when the SID is invalid, but just @@ -172,11 +174,13 @@ impl RenewerTrait for Renewer { // Send a "connect" request too to speed things up. Ignore errors. { - let connect_url = format!( - "http://{}/internet/inetstat_monitor.lua?sid={}&action=connect&xhr=1&myXhr=1", - self.ip, sid - ); - let _ = http_client::get(&connect_url); + let _ = http_client::build_post(&data_url) + .put("xhr", "1") + .put("sid", sid) + .put("page", "netMoni") + .put("xhrId", "reconnect") + .put("connect", "true") + .build_and_execute(); } info!(target: "renewer::fritzbox", "successfully asked for another IP");