Fritz!Box DSL monitoring in Python

Let’s start off the year with a small home project. I have a Fritz!Box 7430 DSL gateway (wireless router and VDSL modem). After I ran into degraded performance, I wanted to record how my line performs. The box has a web interface with mighty functionalities and it exposes nerdy data - although I’m still looking for the obvious "disconnect DSL" button, dude please. The interface is surprinsgly clear compared to the standard market crap (bbox I’m looking at you). It’s more expansive than a Sagem counterpart but it’s well worth it.

DSL Summary screen

So you can get info like:

  • Current throughput

  • Maximum attainable throughput

  • S/N ratio

  • CRC error count

  • Approximate cable length

and much more that I can imagine a usecase for.

DSL Info screen

But it does not record historic info, so I have no way to nag my ISP about reduced performance over the long run. And an error may be present long before I realise it (for instance after I started playing an online game or after I elected to Netflix and chill).

The obvious geeky thing to do was to write a tool that collects the relevant data. Python was the tool I needed for the job.

The main obstacle was to figure out how to simulate the login screen. For some reason (maybe an illusion of security by obfuscation?), the login process relies on a javascript md5 encoded challenge. After I figured out what was going on, I found code emulating that process on GitHub and re-used it.

Too bad the FritzBox firmware is confused about how to handle data. On some pages, you can see JSON served by the box. But unfortunally, the info I need where stored on a page fully generated in HTML. So I went for good old ugly HTML scraping.

I still have to figure out how to interpret data and how to act on them. Probably I’ll add simple alerts for obvious cases.

In the meantime, here it is, licensed under GNU GPL.

Happy hacking

Sharing is caring!