Skip to content

Rans4ckeR/RS.Fritz.Manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

aceefae Β· Jan 15, 2025
Jan 1, 2025
Jan 15, 2025
Jan 15, 2025
Jan 15, 2025
Jan 15, 2025
Aug 17, 2021
Dec 15, 2024
Dec 15, 2024
Jun 23, 2023
Jan 8, 2025
Jan 1, 2025
Dec 15, 2024

Repository files navigation

RS.Fritz.Manager

Allows FritzBox device detection, monitoring, configuring and packet capturing.

Available as a standalone Windows application (UI) and as a NuGet package (API).

For a list of implemented services check the Service implementation status

RS.Fritz.Manager.UI

A Windows .NET WPF application for x64 and ARM64.

Untitled

Untitled1

Untitled3

Untitled4

RS.Fritz.Manager.API

A NuGet package to manage FritzBox devices using pure WCF calls.

Usage Examples

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using RS.Fritz.Manager.API;

// Register the Fritz services in the dependency container using AddFritzApi()
using IHost host = Host.CreateDefaultBuilder(args)
    .ConfigureServices((_, services) => services.AddFritzApi())
    .Build();

using IServiceScope serviceScope = host.Services.CreateScope();

// Search for routers and take the first one
IDeviceSearchService deviceSearchService = serviceScope.ServiceProvider.GetRequiredService<IDeviceSearchService>();
GroupedInternetGatewayDevice groupedInternetGatewayDevice = (await deviceSearchService.GetInternetGatewayDevicesAsync()).First();

// Select the router's internal AVM (FritzBox) device, as opposed to a generic UPnP device
InternetGatewayDevice device = groupedInternetGatewayDevice.Devices.First(q => q.IsAvm);

// Show the device model from UPnP data
Console.WriteLine($"Device model: {device.UPnPDescription?.Device?.ModelDescription}");

// Initialize the device for TR-064, retrieves the security port and the users
await device.InitializeAsync();

// Provide the password for the last logged on user
string lastUsedUserName = device.Users!.OrderByDescending(q => q.LastUser).First().Name;
Console.WriteLine($"Enter password for {lastUsedUserName}:");
device.NetworkCredential = new(lastUsedUserName, Console.ReadLine());

// TR-064 example; show the device uptime from the TR-064 DeviceInfo service
DeviceInfoGetInfoResponse deviceInfo = await device.DeviceInfoGetInfoAsync();
Console.WriteLine($"Device uptime: {TimeSpan.FromSeconds(deviceInfo.Uptime)}");

// Special services

// Retrieving the device users manually
IUsersService usersService = serviceScope.ServiceProvider.GetRequiredService<IUsersService>();
IEnumerable<User> users = await usersService.GetUsersAsync(device);
users.ToList().ForEach(q => Console.WriteLine($"User: {q.Name}"));

// Retrieving a list of device hosts in the network
IDeviceHostsService deviceHostsService = serviceScope.ServiceProvider.GetRequiredService<IDeviceHostsService>();
DeviceHostInfo deviceHostInfo = await deviceHostsService.GetDeviceHostsAsync(device);
deviceHostInfo.DeviceHosts.ToList().ForEach(q => Console.WriteLine($"Device host: {q.HostName}"));

// Retrieving a list of mesh hosts in the network
IDeviceMeshService deviceMeshService = serviceScope.ServiceProvider.GetRequiredService<IDeviceMeshService>();
DeviceMeshInfo deviceMeshInfo = await deviceMeshService.GetDeviceMeshAsync(device);
deviceMeshInfo.DeviceMesh.Nodes.ToList().ForEach(q => Console.WriteLine($"Mesh host: {q.DeviceName}"));

// Retrieving a list of WLAN devices in the network
IWlanDeviceService wlanDeviceService = serviceScope.ServiceProvider.GetRequiredService<IWlanDeviceService>();
WlanDeviceInfo wlanDeviceInfo = await wlanDeviceService.GetWlanDevicesAsync(device);
wlanDeviceInfo.WlanDeviceList.Items.ToList().ForEach(q => Console.WriteLine($"WLAN device: {q.AssociatedDeviceIpAddress}"));

// Retrieve a new session for use in the WebUI
IWebUiService webUiService = serviceScope.ServiceProvider.GetRequiredService<IWebUiService>();
WebUiSessionInfo webUiSessionInfo = await webUiService.LogonAsync(device);
Console.WriteLine($"Session: {webUiSessionInfo.Sid}");

// Capture live network traffic from router to file
ICaptureControlService captureControlService = serviceScope.ServiceProvider.GetRequiredService<ICaptureControlService>();
IEnumerable<CaptureInterfaceGroup> interfaceGroups = await captureControlService.GetInterfacesAsync(device);
CaptureInterface captureInterface = interfaceGroups.First().CaptureInterfaces.First();
var fileInfo = new FileInfo(FormattableString.Invariant($@"c:\temp\{captureInterface.Name}_{DateTime.Now.ToString("s").Replace(":", string.Empty)}.eth"));

Task.Run(() => StopCaptureAsync(device, captureInterface, TimeSpan.FromSeconds(10), captureControlService));

await captureControlService.StartCaptureAsync(device, fileInfo, captureInterface);
Console.WriteLine($"Network trace written to file: {fileInfo}");

return;

static async Task StopCaptureAsync(InternetGatewayDevice device, CaptureInterface captureInterface, TimeSpan timeSpan, ICaptureControlService captureControlService)
{
    await Task.Delay(timeSpan);
    await captureControlService.StopCaptureAsync(device, captureInterface);
}

TR-064 Service implementation status

WAN

  • πŸ”Ά urn:dslforum-org:service:WANIPConnection
    • βœ… GetInfo
    • βœ… GetConnectionTypeInfo
    • ❌ SetConnectionType
    • βœ… GetStatusInfo
    • βœ… GetNATRSIPStatus
    • ❌ SetConnectionTrigger
    • ❌ ForceTermination
    • ❌ RequestConnection
    • βœ… X_GetDNSServers
    • βœ… GetPortMappingNumberOfEntries
    • βœ… GetGenericPortMappingEntry
    • ❌ GetSpecificPortMappingEntry
    • ❌ AddPortMapping
    • ❌ DeletePortMapping
    • βœ… GetExternalIPAddress
    • ❌ SetRouteProtocolRx
    • ❌ SetIdleDisconnectTime
  • πŸ”Ά urn:dslforum-org:service:WANPPPConnection
    • βœ… GetInfo
    • βœ… GetConnectionTypeInfo
    • ❌ SetConnectionType
    • βœ… GetStatusInfo
    • βœ… GetLinkLayerMaxBitRates
    • βœ… GetUserName
    • ❌ SetUserName
    • ❌ SetPassword
    • βœ… GetNATRSIPStatus
    • ❌ SetConnectionTrigger
    • ❌ ForceTermination
    • ❌ RequestConnection
    • βœ… X_GetDNSServers
    • βœ… GetPortMappingNumberOfEntries
    • βœ… GetGenericPortMappingEntry
    • ❌ GetSpecificPortMappingEntry
    • ❌ AddPortMapping
    • ❌ DeletePortMapping
    • βœ… GetExternalIPAddress
    • ❌ SetRouteProtocolRx
    • ❌ SetIdleDisconnectTime
    • βœ… X_AVM-DE_GetAutoDisconnectTimeSpan
    • ❌ X_AVM-DE_SetAutoDisconnectTimeSpan
  • βœ… urn:dslforum-org:service:WANCommonInterfaceConfig
    • βœ… GetCommonLinkProperties
    • βœ… GetTotalBytesSent
    • βœ… GetTotalBytesReceived
    • βœ… GetTotalPacketsSent
    • βœ… GetTotalPacketsReceived
    • βœ… X_AVM-DE_SetWANAccessType
    • βœ… X_AVM-DE_GetOnlineMonitor
  • βœ… urn:dslforum-org:service:WANEthernetLinkConfig
    • βœ… GetEthernetLinkStatus
  • βœ… urn:dslforum-org:service:WANDSLInterfaceConfig
    • βœ… GetInfo
    • βœ… GetStatisticsTotal
    • βœ… X_AVM-DE_GetDSLDiagnoseInfo
    • βœ… X_AVM-DE_GetDSLInfo
  • πŸ”Ά urn:dslforum-org:service:WANDSLLinkConfig
    • βœ… GetInfo
    • ❌ SetEnable
    • ❌ SetDSLLinkType
    • βœ… GetDSLLinkInfo
    • ❌ SetDestinationAddress
    • βœ… GetDestinationAddress
    • ❌ SetATMEncapsulation
    • βœ… GetATMEncapsulation
    • βœ… GetAutoConfig
    • βœ… GetStatistics
  • ❌ urn:dslforum-org:service:X_AVM-DE_WANMobileConnection
  • πŸ”Ά urn:dslforum-org:service:X_AVM-DE_Speedtest
    • βœ… GetInfo
    • ❌ SetConfig
    • βœ… GetStatistics
    • ❌ ResetStatistics
  • ❌ urn:dslforum-org:service:X_AVM-DE_RemoteAccess
  • ❌ urn:dslforum-org:service:X_AVM-DE_MyFritz
  • ❌ urn:dslforum-org:service:X_AVM-DE_HostFilter
  • πŸ”Ά urn:dslforum-org:service:Layer3Forwarding
    • ❌ SetDefaultConnectionService
    • βœ… GetDefaultConnectionService
    • βœ… GetForwardNumberOfEntries
    • ❌ AddForwardingEntry
    • ❌ DeleteForwardingEntry
    • ❌ GetSpecificForwardingEntry
    • βœ… GetGenericForwardingEntry
    • ❌ SetForwardingEntryEnable

Telephony

  • ❌ urn:dslforum-org:service:X_AVM-DE_OnTel
  • ❌ urn:dslforum-org:service:X_AVM-DE_TAM
  • ❌ urn:dslforum-org:service:X_VoIP

Home network

  • πŸ”Ά urn:dslforum-org:service:Hosts
    • βœ… GetHostNumberOfEntries
    • ❌ GetSpecificHostEntry
    • βœ… GetGenericHostEntry
    • βœ… X_AVM-DE_GetInfo
    • βœ… X_AVM-DE_GetChangeCounter
    • ❌ X_AVM-DE_GetAutoWakeOnLANByMACAddress
    • ❌ X_AVM-DE_SetAutoWakeOnLANByMACAddress
    • ❌ X_AVM-DE_SetHostNameByMACAddress
    • ❌ X_AVM-DE_WakeOnLANByMACAddress
    • ❌ X_AVM-DE_GetSpecificHostEntryByIp
    • βœ… X_AVM-DE_HostsCheckUpdate
    • ❌ X_AVM-DE_HostDoUpdate
    • ❌ X_AVM-DE_SetPrioritizationByIP
    • βœ… X_AVM-DE_GetHostListPath
    • βœ… X_AVM-DE_GetMeshListPath
    • βœ… X_AVM-DE_GetFriendlyName
    • ❌ X_AVM-DE_SetFriendlyName
    • ❌ X_AVM-DE_SetFriendlyNameByIP
    • ❌ X_AVM-DE_SetFriendlyNameByMAC
  • πŸ”Ά urn:dslforum-org:service:WLANConfiguration
    • ❌ SetEnable
    • βœ… GetInfo
    • ❌ SetConfig
    • ❌ SetSecurityKeys
    • ❌ GetSecurityKeys
    • ❌ SetBasBeaconSecurityProperties
    • βœ… GetBasBeaconSecurityProperties
    • βœ… GetBSSID
    • βœ… GetSSID
    • ❌ SetSSID
    • βœ… GetBeaconType
    • ❌ SetBeaconType
    • βœ… GetChannelInfo
    • ❌ SetChannel
    • βœ… GetBeaconAdvertisement
    • ❌ SetBeaconAdvertisement
    • βœ… GetTotalAssociations
    • ❌ GetGenericAssociatedDeviceInfo
    • ❌ GetSpecificAssociatedDeviceInfo
    • ❌ X_AVM-DE_GetSpecificAssociatedDeviceInfoByIp
    • βœ… X_AVM-DE_GetWLANDeviceListPath
    • ❌ X_AVM-DE_SetStickSurfEnable
    • βœ… X_AVM-DE_GetIPTVOptimized
    • ❌ X_AVM-DE_SetIPTVOptimized
    • βœ… GetStatistics
    • βœ… GetPacketStatistics
    • βœ… X_AVM-DE_GetNightControl
    • ❌ X_SetHighFrequencyBand
    • βœ… X_AVM-DE_GetWLANHybridMode
    • ❌ X_AVM-DE_SetWLANHybridMode
    • βœ… X_AVM-DE_GetWLANExtInfo
    • ❌ X_AVM-DE_SetWLANGlobalEnable
    • βœ… X_AVM-DE_GetWPSInfo
    • ❌ X_AVM-DE_SetWPSConfig
    • ❌ X_AVM-DE_SetWPSEnable
    • βœ… X_AVM-DE_GetWLANConnectionInfo
  • πŸ”Ά urn:dslforum-org:service:LANHostConfigManagement
    • βœ… GetInfo
    • ❌ SetDHCPServerEnable
    • ❌ SetSubnetMask
    • βœ… GetSubnetMask
    • ❌ SetIPRouter
    • βœ… GetIPRoutersList
    • ❌ SetIPInterface
    • βœ… GetAddressRange
    • ❌ SetAddressRange
    • βœ… GetIPInterfaceNumberOfEntries
    • βœ… GetDNSServers
  • πŸ”Ά urn:dslforum-org:service:LANEthernetInterfaceConfig
    • ❌ SetEnable
    • βœ… GetInfo
    • βœ… GetStatistics
  • ❌ urn:dslforum-org:service:X_AVM-DE_Dect
  • ❌ urn:dslforum-org:service:X_AVM-DE_Media
  • ❌ urn:dslforum-org:service:X_AVM-DE_Homeauto
  • ❌ urn:dslforum-org:service:X_AVM-DE_Homeplug

Storage/NAS

  • ❌ urn:dslforum-org:service:X_AVM-DE_Storage
  • ❌ urn:dslforum-org:service:X_AVM-DE_UPnP
  • ❌ urn:dslforum-org:service:X_AVM-DE_WebDAVClient
  • ❌ urn:dslforum-org:service:X_AVM-DE_Filelinks

System

  • βœ… urn:dslforum-org:service:DeviceInfo
    • βœ… GetInfo
    • βœ… SetProvisioningCode
    • βœ… GetDeviceLog
    • βœ… GetSecurityPort
  • πŸ”Ά urn:dslforum-org:service:DeviceConfig
    • βœ… GetPersistentData
    • ❌ SetPersistentData
    • ❌ ConfigurationStarted
    • ❌ ConfigurationFinished
    • ❌ FactoryReset
    • ❌ Reboot
    • βœ… X_GenerateUUID
    • βœ… X_AVM-DE_GetConfigFile
    • ❌ X_AVM-DE_SetConfigFile
    • βœ… X_AVM-DE_CreateUrlSID
    • βœ… X_AVM-DE_GetSupportDataInfo
    • ❌ X_AVM-DE_SendSupportData
    • ❌ X_AVM-DE_GetSupportDataEnable
    • ❌ X_AVM-DE_SetSupportDataEnable
  • βœ… urn:dslforum-org:service:LANConfigSecurity
    • βœ… GetInfo
    • βœ… X_AVM-DE_GetAnonymousLogin
    • βœ… X_AVM-DE_GetCurrentUser
    • βœ… SetConfigPassword
    • βœ… X_AVM-DE_GetUserList
  • ❌ urn:dslforum-org:service:X_AVM-DE_AppSetup
  • βœ… urn:dslforum-org:service:ManagementServer
    • βœ… GetInfo
    • βœ… SetManagementServerURL
    • βœ… SetManagementServerUsername
    • βœ… SetManagementServerPassword
    • βœ… SetPeriodicInform
    • βœ… SetConnectionRequestAuthentication
    • βœ… SetUpgradeManagement
    • βœ… X_SetTR069Enable
    • βœ… X_AVM-DE_GetTR069FirmwareDownloadEnabled
    • βœ… X_AVM-DE_SetTR069FirmwareDownloadEnabled
  • ❌ urn:dslforum-org:service:X_AVM-DE_USPController
  • ❌ urn:dslforum-org:service:X_AVM-DE_Auth
  • βœ… urn:dslforum-org:service:Time
    • βœ… GetInfo
    • βœ… SetNTPServers
  • βœ… urn:dslforum-org:service:UserInterface
    • βœ… GetInfo
    • βœ… X_AVM-DE_CheckUpdate
    • βœ… X_AVM-DE_DoPrepareCGI
    • βœ… X_AVM-DE_DoUpdate
    • βœ… X_AVM-DE_DoManualUpdate
    • βœ… X_AVM-DE_GetInternationalConfig
    • βœ… X_AVM-DE_SetInternationalConfig
    • βœ… X_AVM-DE_GetInfo
    • βœ… X_AVM-DE_SetConfig