/Fritz

FRITZ!Box TR064 implementation

Primary LanguageC#OtherNOASSERTION

Nuget version Nuget downloads CI Actions Status

Fritz#

The FRITZ!Box is a popular device that provides internet access, telephony, and home networking services. It supports a protocol called TR064, which allows remote management and configuration of the device. However, the official TR064 implementation is proprietary and closed-source, which limits the users' freedom and control over their own devices. That's why we have developed a free and open-source TR064 implementation for the FRITZ!Box, which aims to provide a more transparent, secure, and customizable alternative. Our implementation is based on the TR064 specification and compatible with the existing FRITZ!Box features. With our free and open-source TR064 implementation, you can take full advantage of your FRITZ!Box and enjoy a better internet experience.

Installing

To use the package in your project, you need to edit your csproj file and insert the following line, where x.x.x is the latest version number (you can check it at the beginning of this file):

<PackageReference Include="Fritz" Version="x.x.x" />

You can also install via the Package Manager Console in Visual Studio with the following command:

PM> Install-Package Fritz -Version 1.1.0

If you're using Visual Studio you can also install via the built in NuGet package manager.

Another option to install is using the .NET CLI tool. Just run this command in your terminal:

dotnet add package Fritz

Example

Write phonebook to csv file

To write a phonebook to a csv file, you need to follow these steps:

  1. Open Visual Studio
  2. Create a new Console App
  3. Add the Fritz NuGet package to your project.
PM> Install-Package Fritz -Version 1.1.0
  1. Add the following code to the main method:
namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var fritzBox = new FritzClient()
            {
                UserName = "{YOUR_USERNAME}",
                Password = "{YOUR_PASSWORD}"
            };
                    
            // Write csv file to the application folder
            fritzBox.WritePhonebookCsv(name: "Test Phonebook", folder: AppDomain.CurrentDomain.BaseDirectory, separator: ";");
        }
    }
}
  1. Run the program

Testing

You can find the project Fritz.Test with many unit tests in this repository. These tests are useful for learning how to write your own code using Fritz#. You can see how they are structured, what they test, and how they report the results.

[TestMethod]
public void TestTamGetInfo()
{
    Tam service = new Tam(_fb.Url);
    service.SoapHttpClientProtocol.Credentials = new NetworkCredential(userName: _fb.UserName, password: _fb.Password);

    ushort index = 0;
    bool enable;
    string name;
    bool tamRunning;
    ushort stick;
    ushort status;

    service.GetInfo(index, out enable, out name, out tamRunning, out stick, out status);
}

License

Fritz# is licensed under the MIT license.

External links