SoldatXwing.FritzBoxClient 1.0.1

dotnet add package SoldatXwing.FritzBoxClient --version 1.0.1                
NuGet\Install-Package SoldatXwing.FritzBoxClient -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SoldatXwing.FritzBoxClient" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SoldatXwing.FritzBoxClient --version 1.0.1                
#r "nuget: SoldatXwing.FritzBoxClient, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SoldatXwing.FritzBoxClient as a Cake Addin
#addin nuget:?package=SoldatXwing.FritzBoxClient&version=1.0.1

// Install SoldatXwing.FritzBoxClient as a Cake Tool
#tool nuget:?package=SoldatXwing.FritzBoxClient&version=1.0.1                

FritzBoxClient

This simple client library logs in to your local FRITZ!Box using the provided password and URL (default: https://fritz.box) and provides access to a range of network management features, including retrieving all connected devices and more.

What makes this wrapper special

This wrapper does not use either the TR-064 or the AHA-HTTP interface. It uses the "proprietary" API of the Fritzbox. Due to the lack of official API documentation (as of 2024), I had to figure out the endpoints myself, test them, and implement them in the client.

FritzBoxAccessor Usage

This simple approach shows how to initialize the FritzBoxAccessor and get the devices from the FritzBox:

using FritzBoxClient;

using FritzBoxAccessor accessor = await FritzBoxAccessor.CreateAsync("password");
var devices = await accessor.GetAllConnectedDevciesInNetworkAsync();

foreach (var device in devices)
    Console.WriteLine($"Device: {device.Name}, Ip: {device.Ip}");

Specify more details for the access:

FritzBoxAccessor fritzBoxAccessor = await FritzBoxAccessor.CreateAsync(fritzBoxPassword: "password", fritzBoxUrl: "https://192.168.178.1", userName: "fritz3000");

To change a device's internet access state, do the following:

using FritzBoxClient;
using FritzBoxClient.Models;

using FritzBoxAccessor accessor = await FritzBoxAccessor.CreateAsync(fritzBoxPassword: "password");
var device = await accessor.GetSingleDeviceAsync(deviceName: "DESKTOP123");

await accessor.ChangeInternetAccessStateForDeviceAsync(device, InternetState.Blocked);

FritzBoxNasAccessor usage

This simple approach shows how to initialize the FritzBoxNasAccessor and get the NAS storage disk information.

using FritzBoxClient;

using FritzBoxNasAccessor nasAccessor = await FritzBoxNasAccessor.CreateAsync(fritzBoxPassword: "password", fritzBoxUrl: "https://192.168.178.1");
var diskInformation = await nasAccessor.GetNasStorageDiskInfoAsync(path: "/Files/");

Console.WriteLine($"Total storage: {diskInformation.TotalInMb}Mb, free storage: {diskInformation.FreeInMb}Mb, used storage: {diskInformation.UsedInMb}Mb");

To get the bytes of a file, do the following:

byte[] fileBytes = await nasAccessor.GetNasFileBytes("/path/to/file.png");

Disclaimer

This tool is only for testing and academic purposes and can only be used where strict consent has been given. Do not use it for illegal purposes! It is the end user’s responsibility to obey all applicable local, state, and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this tool and software in general.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 40 11/25/2024