Skip to content

Commit

Permalink
v1.2.3: Support Fritz!OS 7.57+ in fritzbox renewer
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Robertof committed Sep 12, 2023
1 parent 769d4dc commit 7ebdc14
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oxixenon"
version = "1.2.2"
version = "1.2.3"
authors = ["Roberto Frenna <[email protected]>"]
edition = "2018"

Expand Down
26 changes: 15 additions & 11 deletions src/renewer/fritzbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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");
Expand Down

0 comments on commit 7ebdc14

Please sign in to comment.