Resource icon

TR064.pl

Programmiersprache(n)
Perl
TR-064 ist ein vom DSL-Forum entwickeltes Protokoll, um DSL-Internetzugangsgeräte aus dem lokalen Netz zu
konfigurieren. Es basiert auf dem UPnP-Standard (Universal Plug and Play), der allgemein zur herstellerübergreifenden Ansteuerung von Geräten in IP-basierten Netzwerken dient.

Hier hab ich mal ein Perl Modul begonnen um Informationen aus einer Fritz!Box auszulesen und Einstellungen per TR-064 zu ändern.

Das Modul:
Perl:
#!/usr/bin/perl

package TR064;

#use strict;
use Exporter;
use Net::Fritz::Box;
use LWP::Simple;
use Text::CSV;
use Text::CSV_XS;

use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);

$VERSION     = 1.00;
@ISA         = qw(Exporter);
@EXPORT      = ();
@EXPORT_OK   = qw(scaleIt sec2human DeviceInfo);
%EXPORT_TAGS = ( DEFAULT => [qw(&DeviceInfo)],
                 Both    => [qw(&DeviceInfo &func2)]);




sub scaleIt {
my $value = shift;
  my @prefix = ('', qw(K M G T));
  while (@prefix>1 && $value >= 1000) {
    shift @prefix;
    $value /= 1024;
  }
  return sprintf '%.2f %sByte', $value, $prefix[0];
}

sub sec2human {
    my $secs = shift;
    if    ($secs >= 365*24*60*60) { return sprintf '%.1fy', $secs/(365*24*60*60) }
    elsif ($secs >=     24*60*60) { return sprintf '%.1fd', $secs/(    24*60*60) }
    elsif ($secs >=        60*60) { return sprintf '%.1fh', $secs/(       60*60) }
    elsif ($secs >=           60) { return sprintf '%.1fm', $secs/(          60) }
    else                          { return sprintf '%.1fs', $secs                }
}

##############
sub Connect {
    my $ip = shift;
    my $user = shift;
    my $passwd = shift;

    my $fritz = Net::Fritz::Box->new(
        upnp_url => ''.$ip.'',
        username => ''.$user.'',
        password => ''.$passwd.''
    );

   if ($fritz->error) {
       return 0;
   }

    my $device = $fritz->discover();
   if ($device->error) {
       return 0;
   }
return $device;
}


###############
sub Set {

    my $device = shift;
    my $service_name = shift;
    my $action_name  = shift;
    my %hash = %{(shift)};;


    printf "$service_name:\n";

    my $service = $device->find_service($service_name);
        if ( ! $service->error ) {
            my $response = $service->call($action_name, %hash);
            if ( $response->error ) {
                printf "\t$action_name failed.\n";
            } else {
                printf "\t$action_name OK.\n";
            }
        } else {
            printf "\tkeine Informationen.\n";
        }
return;
}

#####################################
sub Get {

    my $device = shift;
    my $service_name = shift;
    my $action_name = shift;
    my $variable_name = shift;
    my (%hash) = %{(shift)};

    my $return = "0";

#    printf "$service_name:\n";

    my $service = $device->find_service($service_name);
        if ( ! $service->error ) {
#            printf "\t".$action_name.":\n" ;
            my $response = $service->call($action_name, %hash);
            if ( ! $response->error ) {
#                printf "\t\t$variable_name = %s\n",$response->data->{$variable_name};
                $return = $response->data->{$variable_name}
            }
        } else {
            printf "\tno service found.\n";
        }
chomp($return);
return $return;
}



####################################
sub DeviceInfo {

    my $device = shift;

    printf "DeviceInfo:\n";

    my $service = $device->find_service('DeviceInfo:1');
    if ( ! $service->error ) {

        my $response = $service->call('GetInfo');
        if ( ! $response->error ) {

            printf "\tManufacturerName: %s\n", $response->data->{NewManufacturerName};
            printf "\tManufacturerOUI: %s\n", $response->data->{NewManufacturerOUI};
            printf "\tModelName: %s\n", $response->data->{NewModelName};
            printf "\tDescription: %s\n", $response->data->{NewDescription};
            printf "\tProductClass: %s\n", $response->data->{NewProductClass};
            printf "\tSerialNumber: %s\n", $response->data->{NewSerialNumber};
            printf "\tSoftwareVersion: %s\n", $response->data->{NewSoftwareVersion};
            printf "\tHardwareVersion: %s\n", $response->data->{NewHardwareVersion};
            printf "\tSpecVersion: %s\n", $response->data->{NewSpecVersion};
            printf "\tProvisoring: %s\n", $response->data->{NewProvisioningCode};
            printf "\tUptime: ". sec2human($response->data->{NewUpTime})."\n";
#            printf "\tFirstUseDate: ". $response->data->{NewFirstUseDate}."\n";
            my $log = $response->data->{NewDeviceLog};
            $log =~ s/\n/\n\t\t/g;
            printf "\tDeviceLog: %s\n", $log;

        }
    } else {
        printf "\tkeine Informationen.\n";
    }
return;
}

####################################
sub DeviceConfig {

    my $device = shift;

    printf "DeviceConfig:\n";

    my $service = $device->find_service('DeviceConfig:1');
    if ( ! $service->error ) {

        my $response = $service->call('GetPersistentData');
        if ( ! $response->error ) {
            printf "\tNewPersistentData: %s\n", $response->data->{NewPersistentData};
        }

        $response = $service->call('ConfigurationFinished');
        if ( ! $response->error ) {
            printf "\tNewStatus: %s\n", $response->data->{NewStatus};
        }



    } else {
        printf "\tkeine Informationen.\n";
    }
return;
}

####################################
sub GetConfigFile {

    my $device = shift;
    my $passwd = shift;

    printf "X_AVM-DE_GetConfigFile:\n";

    my $service = $device->find_service('DeviceConfig:1');
    if ( ! $service->error ) {

        my (%hash) = ( 'NewX_AVM-DE_Password' => '1234' );
        my $response = $service->call('X_AVM-DE_GetConfigFile', %hash);
        if ( ! $response->error ) {
            printf "\tNewX_AVM-DE_ConfigFileUrl: ". $response->data->{"NewX_AVM-DE_ConfigFileUrl"}."\n";
        } else {
            printf $response->error."\n";
        }


    } else {
        printf "\tkeine Informationen.\n";
    }
return;
}


####################################
sub X_AVM_DE_Speedtest  {

    my $device = shift;

    printf "X_AVM-DE_Speedtest:\n";

    my $service = $device->find_service('X_AVM-DE_Speedtest:1');
    if ( ! $service->error ) {

        my $response = $service->call('GetInfo');
        if ( ! $response->error ) {
            printf "\tNewEnableTcp: %s\n", $response->data->{NewEnableTcp};
            printf "\tNewEnableUdp: %s\n", $response->data->{NewEnableUdp};
            printf "\tNewEnableUdpBidirect: %s\n", $response->data->{NewEnableUdpBidirect};
            printf "\tNewWANEnableTcp: %s\n", $response->data->{NewWANEnableTcp};
            printf "\tNewWANEnableUdp: %s\n", $response->data->{NewWANEnableUdp};
            printf "\tNewPortTcp: %s\n", $response->data->{NewPortTcp};
            printf "\tNewPortUdp: %s\n", $response->data->{NewPortUdp};
            printf "\tNewPortUdpBidirect: %s\n", $response->data->{NewPortUdpBidirect};
        }
    } else {
        printf "\tkeine Informationen.\n";
    }
return;
}


####################################
sub Time {

    my $device = shift;

    printf "Time:\n";

    my $service = $device->find_service('Time:1');
        if ( ! $service->error ) {
            my $response = $service->call('GetInfo');
            if ( ! $response->error ) {
                printf "\tNTP-Server: %s\n",$response->data->{NewNTPServer1};
                printf "\tNTP-Server: %s\n",$response->data->{NewNTPServer2};
                printf "\tDate/Time: %s\n",$response->data->{NewCurrentLocalTime};

                my(%hash) = ( 'NewNTPServer1' => 'ntp.net.ows', 'NewNTPServer2' => '' );
                $response = $service->call('SetNTPServers', %hash);
                printf $response->error;
            }
        } else {
            printf "\tkeine Informationen.\n";
        }
return;
}


####################################
sub WLANConfiguration {

    my $device = shift;

    printf "WLANConfiguration:\n";

    my $service = $device->find_service('WLANConfiguration:1');
        if ( ! $service->error ) {
            my $response = $service->call('GetInfo');
            if ( ! $response->error ) {
                printf "\tNewEnable: %s\n",$response->data->{NewEnable};
                printf "\tNewStatus: %s\n",$response->data->{NewStatus};
                printf "\tNewMaxBitRate: %s\n",$response->data->{NewMaxBitRate};
                printf "\tNewChannel: %s\n",$response->data->{NewChannel};
                printf "\tNewSSID: %s\n",$response->data->{NewSSID};
                printf "\tNewBeaconType: %s\n",$response->data->{NewBeaconType};
                printf "\tNewMACAddressControlEnabled: %s\n",$response->data->{NewMACAddressControlEnabled};
                printf "\tNewStandard: %s\n",$response->data->{NewStandard};
                printf "\tNewBSSID: %s\n",$response->data->{NewBSSID};
                printf "\tNewBasicEncryptionModes: %s\n",$response->data->{NewBasicEncryptionModes};
                printf "\tNewBasicAuthenticationMode: %s\n",$response->data->{NewBasicAuthenticationMode};
                printf "\tNewMaxCharsSSID: %s\n",$response->data->{NewMaxCharsSSID};
                printf "\tNewMinCharsSSID: %s\n",$response->data->{NewMinCharsSSID};
                printf "\tNewAllowedCharsSSID: %s\n",$response->data->{NewAllowedCharsSSID};
                printf "\tNewMinCharsPSK: %s\n",$response->data->{NewMinCharsPSK};
                printf "\tNewMaxCharsPSK: %s\n",$response->data->{NewMaxCharsPSK};
                printf "\tNewAllowedCharsPSK: %s\n",$response->data->{NewAllowedCharsPSK};
            }

            $response = $service->call('X_AVM-DE_GetWLANHybridMode');
            if ( ! $response->error ) {
                printf "\tNewEnable: %s\n",$response->data->{NewEnable};
                printf "\tNewBeaconType: %s\n",$response->data->{NewBeaconType};
                printf "\tNewKeyPassphrase: %s\n",$response->data->{NewKeyPassphrase};
                printf "\tNewSSID: %s\n",$response->data->{NewSSID};
                printf "\tNewBSSID: %s\n",$response->data->{NewBSSID};
                printf "\tNewTrafficMode: %s\n",$response->data->{NewTrafficMode};
                printf "\tNewManualSpeed: %s\n",$response->data->{NewManualSpeed};
                printf "\tNewMaxSpeedDS: %s\n",$response->data->{NewMaxSpeedDS};
                printf "\tNewMaxSpeedUS: %s\n",$response->data->{NewMaxSpeedUS};
            }


            $response = $service->call('GetSecurityKeys');
            if ( ! $response->error ) {
                printf "\tNewWEPKey0: %s\n",$response->data->{NewWEPKey0};
                printf "\tNewWEPKey1: %s\n",$response->data->{NewWEPKey1};
                printf "\tNewWEPKey2: %s\n",$response->data->{NewWEPKey2};
                printf "\tNewWEPKey3: %s\n",$response->data->{NewWEPKey3};
                printf "\tNewPreSharedKey: %s\n",$response->data->{NewPreSharedKey};
                printf "\tNewKeyPassphrase: %s\n",$response->data->{NewKeyPassphrase};
            }

            $response = $service->call('GetTotalAssociations');
            if ( ! $response->error ) {
                printf "\tNewTotalAssociations : %s\n",$response->data->{NewTotalAssociations};
            }

            if ($response->data->{NewTotalAssociations} > 0) {
                my $i;
                for ( $i=0; $i < $response->data->{NewTotalAssociations};$i++) {
                    printf "\tAssociaton #$i:\n";

                    my(%hash) = ( 'NewAssociatedDeviceIndex' => $i );
                    $response = $service->call('GetGenericAssociatedDeviceInfo', %hash);
                    if( ! $response->error ) {
                        printf "\t\tNewAssociatedDeviceMACAddress: %s\n",$response->data->{NewAssociatedDeviceMACAddress};
                        printf "\t\tNewAssociatedDeviceIPAddress: %s\n",$response->data->{NewAssociatedDeviceIPAddress};
                        printf "\t\tNewAssociatedDeviceAuthState: %s\n",$response->data->{NewAssociatedDeviceAuthState};
                        printf "\t\tNewX_AVM-DE_Speed: %s\n",$response->data->{"NewX_AVM-DE_Speed"};
                        printf "\t\tNewX_AVM-DE_SignalStrength: %s\n",$response->data->{"NewX_AVM-DE_SignalStrength"};
                    }
                }
            }

        } else {
            printf "\tkeine Informationen.\n";
        }
return;
}

###################################
sub WANEthernetLinkConfig {

    my $device = shift;

    printf "WANEthernetLinkConfig:\n";

    my $service = $device->find_service('WANEthernetLinkConfig:1');
    if( ! $service->error) {
        my $response = $service->call('GetEthernetLinkStatus');
        if ( ! $response->error ) {
            printf "\tNewEthernetLinkStatus: %s\n",$response->data->{NewEthernetLinkStatus};
        }
    } else {
        printf "\tkeine Informationen.\n";
    }
return;
}



####################################
sub WANPPPConnection {

    my $device = shift;

    printf "WANPPPConnection:\n";

    my $service = $device->find_service('WANPPPConnection:1');
    if( ! $service->error ) {
        my $response = $service->call('GetInfo');
        if ( ! $response->error ) {
            printf "\tNewEnable: %s\n", $response->data->{NewEnable};
            printf "\tNewConnectionStatus: %s\n", $response->data->{NewConnectionStatus};
            printf "\tNewPossibleConnectionTypes: %s\n", $response->data->{NewPossibleConnectionTypes};
            printf "\tNewConnectionType: %s\n", $response->data->{NewConnectionType};
            printf "\tNewName: %s\n", $response->data->{NewName};
            printf "\tNewUptime: %s\n", $response->data->{NewUptime};
            printf "\tNewUpstreamMaxBitRate: %s\n", $response->data->{NewUpstreamMaxBitRate};
            printf "\tNewDownstreamMaxBitRate: %s\n", $response->data->{NewDownstreamMaxBitRate};
            printf "\tNewLastConnectionError: %s\n", $response->data->{NewLastConnectionError};
            printf "\tNewIdleDisconnectTime: %s\n", $response->data->{NewIdleDisconnectTime};
            printf "\tNewRSIPAvailable: %s\n", $response->data->{NewRSIPAvailable};
            printf "\tNewUserName: %s\n", $response->data->{NewUserName};
            printf "\tNewNATEnabled: %s\n", $response->data->{NewNATEnabled};
            printf "\tNewExternalIPAddress: %s\n", $response->data->{NewExternalIPAddress};
            printf "\tNewDNSServers: %s\n", $response->data->{NewDNSServers};
            printf "\tNewMACAddress: %s\n", $response->data->{NewMACAddress};
            printf "\tNewLastAuthErrorInfo: %s\n", $response->data->{NewLastAuthErrorInfo};
            printf "\tNewConnectionTrigger: %s\n", $response->data->{NewConnectionTrigger};
            printf "\tNewMaxCharsUsername: %s\n", $response->data->{NewMaxCharsUsername};
            printf "\tNewMinCharsUsername: %s\n", $response->data->{NewMinCharsUsername};
            printf "\tNewAllowedCharsUsername: %s\n", $response->data->{NewAllowedCharsUsername};
            printf "\tNewMaxCharsPassword: %s\n", $response->data->{NewMaxCharsPassword};
            printf "\tNewMinCharsPassword: %s\n", $response->data->{NewMinCharsPassword};
            printf "\tNewAllowedCharsPassword: %s\n", $response->data->{NewAllowedCharsPassword};
            printf "\tNewTransportType: %s\n", $response->data->{NewTransportType};
            printf "\tNewRouteProtocolRx: %s\n", $response->data->{NewRouteProtocolRx};
            printf "\tNewPPPoEServiceName: %s\n", $response->data->{NewPPPoEServiceName};
            printf "\tNewRemoteIPAddress: %s\n", $response->data->{NewRemoteIPAddress};
            printf "\tNewPPPoEACName: %s\n", $response->data->{NewPPPoEACName};
            printf "\tNewDNSEnabled: %s\n", $response->data->{NewDNSEnabled};
            printf "\tNewDNSOverrideAllowed: %s\n", $response->data->{NewDNSOverrideAllowed};

        }
    } else {
        printf "\tkeine Informationen.\n";
    }
return;
}


##################################
sub WANCommonInterfaceConfig {

    my $device = shift;

    printf "WANCommonInterfaceConfig:\n";

    my $service = $device->find_service('WANCommonInterfaceConfig:1');
    if( ! $service->error) {

        my $response = $service->call('GetCommonLinkProperties');
        if( ! $response->error) {
            printf "\tNewWANAccessType: %s\n",$response->data->{NewWANAccessType};
            printf "\tNewLayer1UpstreamMaxBitRate: %s\n",$response->data->{NewLayer1UpstreamMaxBitRate};
            printf "\tNewLayer1DownstreamMaxBitRate: %s\n",$response->data->{NewLayer1DownstreamMaxBitRate};
            printf "\tNewPhysicalLinkStatus: %s\n",$response->data->{NewPhysicalLinkStatus};
        }

        $response = $service->call('GetTotalBytesSent');
        if( ! $response->error){
            print "\tNewTotalBytesSent: ".scaleIt($response->data->{NewTotalBytesSent})."\n";
        }

        $response = $service->call('GetTotalBytesReceived');
        if( ! $response->error) {
            print "\tNewTotalBytesReceived: ".scaleIt($response->data->{NewTotalBytesReceived})."\n";
        }

        $response = $service->call('GetTotalPacketsSent');
        if ( ! $response->error ) {
            printf "\tNewTotalPacketsSent: %s\n",$response->data->{NewTotalPacketsSent};
        }

        $response = $service->call('GetTotalPacketsReceived');
        if ( ! $response->error ) {
            printf "\tNewTotalPacketsReceived: %s\n",$response->data->{NewTotalPacketsReceived};
        }

    } else {
        printf "\tkeine Informationen.\n";
    }
return;
}


###################################
sub Layer3Forwarding {

    my $device = shift;

    printf "Layer3Forwarding:\n";

    my $service = $device->find_service('Layer3Forwarding:1');
    if( ! $service->error) {
        my $response = $service->call('GetDefaultConnectionService');
        if ( ! $response->error ) {
            printf "\tNewDefaultConnectionService: %s\n",$response->data->{NewDefaultConnectionService};
        }
    } else {
        printf "\tkeine Informationen.\n";
    }
return;
}


###################################
sub WANIPConnection {

    my $device = shift;

    printf "WANIPConnection:\n";

    my $service = $device->find_service('WANIPConnection:1');
    if( ! $service->error) {
        my $response = $service->call('GetInfo');
        if ( ! $response->error ) {
            printf "\tNewEnable: %s\n",$response->data->{NewEnable};
            printf "\tNewConnectionStatus: %s\n",$response->data->{NewConnectionStatus};
            printf "\tNewPossibleConnectionTypes: %s\n",$response->data->{NewPossibleConnectionTypes};
            printf "\tNewConnectionType: %s\n",$response->data->{NewConnectionType};
            printf "\tNewName: %s\n",$response->data->{NewName};
            printf "\tNewUptime: %s\n",$response->data->{NewUptime};
            printf "\tNewLastConnectionError: %s\n",$response->data->{NewLastConnectionError};
            printf "\tNewRSIPAvailable: %s\n",$response->data->{NewRSIPAvailable};
            printf "\tNewNATEnabled: %s\n",$response->data->{NewNATEnabled};
            printf "\tNewExternalIPAddress: %s\n",$response->data->{NewExternalIPAddress};
            printf "\tNewDNSServers: %s\n",$response->data->{NewDNSServers};
            printf "\tNewMACAddress: %s\n",$response->data->{NewMACAddress};
            printf "\tNewConnectionTrigger: %s\n",$response->data->{NewConnectionTrigger};
            printf "\tNewRouteProtocolRx: %s\n",$response->data->{NewRouteProtocolRx};
            printf "\tNewDNSEnabled: %s\n",$response->data->{NewDNSEnabled};
            printf "\tNewDNSOverrideAllowed: %s\n",$response->data->{NewDNSOverrideAllowed};
        }

            $response = $service->call('GetPortMappingNumberOfEntries');
            if ( ! $response->error ) {
                if ($response->data->{NewPortMappingNumberOfEntries} > 0) {
                    my $i;
                    for ( $i=0; $i < $response->data->{NewPortMappingNumberOfEntries};$i++) {
                        printf "\tPort #$i:\n";

                        my(%hash) = ( 'NewPortMappingIndex' => $i );
                        $response = $service->call('GetGenericPortMappingEntry', %hash);
                        if( ! $response->error ) {
                            printf "\t\tNewRemoteHost: %s\n",$response->data->{NewRemoteHost};
                            printf "\t\tNewExternalPort: %s\n",$response->data->{NewExternalPort};
                            printf "\t\tNewProtocol: %s\n",$response->data->{NewProtocol};
                            printf "\t\tNewInternalPort: %s\n",$response->data->{NewInternalPort};
                            printf "\t\tNewInternalClient: %s\n",$response->data->{NewInternalClient};
                            printf "\t\tNewEnabled: %s\n",$response->data->{NewEnabled};
                            printf "\t\tNewPortMappingDescription: %s\n",$response->data->{NewPortMappingDescription};
                            printf "\t\tNewLeaseDuration: %s\n",$response->data->{NewLeaseDuration};
                        }
                    }
                }
            }

    } else {
        printf "\tkeine Informationen.\n";
    }
return;
}


###################################
sub X_AVM_DE_AppSetup {

    my $device = shift;

    printf "X_AVM_DE_AppSetup:\n";

    my $service = $device->find_service('X_AVM_DE_AppSetup:1');
    if( ! $service->error) {
        my $response = $service->call('GetInfo');
        if ( ! $response->error ) {
            printf "\tMinCharsAppId: %s\n",$response->data->{MinCharsAppId};
            printf "\tMaxCharsAppId: %s\n",$response->data->{MaxCharsAppId};
            printf "\tAllowedCharsAppId: %s\n",$response->data->{AllowedCharsAppId};
            printf "\tMinCharsAppDisplayName: %s\n",$response->data->{MinCharsAppDisplayName};
            printf "\tMaxCharsAppDisplayName: %s\n",$response->data->{MaxCharsAppDisplayName};
            printf "\tMinCharsAppUsername: %s\n",$response->data->{MinCharsAppUsername};
            printf "\tMaxCharsAppUsername: %s\n",$response->data->{MaxCharsAppUsername};
            printf "\tAllowedCharsAppUsername: %s\n",$response->data->{AllowedCharsAppUsername};
            printf "\tMinCharsAppPassword: %s\n",$response->data->{MinCharsAppPassword};
            printf "\tMaxCharsAppPassword: %s\n",$response->data->{MaxCharsAppPassword};
            printf "\tAllowedCharsAppPassword: %s\n",$response->data->{AllowedCharsAppPassword};
            printf "\tMinCharsIPSecIdentifier: %s\n",$response->data->{MinCharsIPSecIdentifier};
            printf "\tMaxCharsIPSecIdentifier: %s\n",$response->data->{MaxCharsIPSecIdentifier};
            printf "\tAllowedCharsIPSecIdentifier: %s\n",$response->data->{AllowedCharsIPSecIdentifier};
            printf "\tMinCharsIPSecPreSharedKey: %s\n",$response->data->{MinCharsIPSecPreSharedKey};
            printf "\tMaxCharsIPSecPreSharedKey: %s\n",$response->data->{MaxCharsIPSecPreSharedKey};
            printf "\tAllowedCharsIPSecPreSharedKey: %s\n",$response->data->{AllowedCharsIPSecPreSharedKey};
            printf "\tMinCharsIPSecXauthUsername: %s\n",$response->data->{MinCharsIPSecXauthUsername};
            printf "\tMaxCharsIPSecXauthUsername: %s\n",$response->data->{MaxCharsIPSecXauthUsername};
            printf "\tAllowedCharsIPSecXauthUsername: %s\n",$response->data->{AllowedCharsIPSecXauthUsername};
            printf "\tMinCharsIPSecXauthPassword: %s\n",$response->data->{MinCharsIPSecXauthPassword};
            printf "\tMaxCharsIPSecXauthPassword: %s\n",$response->data->{MaxCharsIPSecXauthPassword};
            printf "\tAllowedCharsIPSecXauthPassword: %s\n",$response->data->{AllowedCharsIPSecXauthPassword};
            printf "\tAllowedCharsCryptAlgos: %s\n",$response->data->{AllowedCharsCryptAlgos};
            printf "\tAllowedCharsAppAVMAddress: %s\n",$response->data->{AllowedCharsAppAVMAddress};
        }
    } else {
        printf "\tkeine Informationen.\n";
    }
return;
}


####################################
sub LANConfigSecurity {

    my $device = shift;

    printf "LANConfigSecurity:\n";

my $service = $device->find_service('LANConfigSecurity:1');
    if( ! $service->error ) {
        my $response = $service->call('X_AVM-DE_GetCurrentUser');

        if ( ! $response->error ) {
            printf "\tNewX_AVM-DE_CurrentUsername: %s\n",$response->data->{"NewX_AVM-DE_CurrentUsername"};
            printf "\tNewX_AVM-DE_CurrentUserRights: %s\n",$response->data->{"NewX_AVM-DE_CurrentUserRights"};
        }

        $response = $service->call('GetInfo');
        if ( ! $response->error ) {
            printf "\tNewMaxCharsPassword: %s\n",$response->data->{NewMaxCharsPassword};
            printf "\tNewMinCharsPassword: %s\n",$response->data->{NewMinCharsPassword};
            printf "\tNewAllowedCharsPassword: %s\n",$response->data->{NewAllowedCharsPassword};
        }

        $response = $service->call('X_AVM-DE_GetAnonymousLogin');
        if ( ! $response->error ) {
            printf "\tNewX_AVM-DE_AnonymousLoginEnabled: %d\n",$response->data->{"NewX_AVM-DE_AnonymousLoginEnabled"};
        }
    } else {
        printf "\tkeine Informationen.\n";
    }
}


#####################################
sub X_AVM_DE_RemoteAccess {

    my $device = shift;

    printf "X_AVM-DE_RemoteAccess:\n";

my $service = $device->find_service('X_AVM-DE_RemoteAccess:1');
    if ( ! $service->error ) {
        my $response = $service->call('GetDDNSInfo');
        if ( ! $response->error ) {
            printf "\tNewEnabled: %s\n",$response->data->{NewEnabled};
            printf "\tNewProviderName: %s\n",$response->data->{NewProviderName};
            printf "\tNewUpdateURL: %s\n",$response->data->{NewUpdateURL};
            printf "\tNewDomain: %s\n",$response->data->{NewDomain};
            printf "\tNewStatusIPv4: %s\n",$response->data->{NewStatusIPv4};
            printf "\tNewStatusIPv6: %s\n",$response->data->{NewStatusIPv6};
            printf "\tNewUsername: %s\n",$response->data->{NewUsername};
            printf "\tNewMode: %s\n",$response->data->{NewMode};
            printf "\tNewServerIPv4: %s\n",$response->data->{NewServerIPv4};
            printf "\tNewServerIPv6: %s\n",$response->data->{NewServerIPv6};
        }
    } else {
        printf "\tkeine Informationen.\n";
    }
}

#####################################
sub X_AVM_DE_WebDAVClient {

    my $device = shift;

    printf "X_AVM-DE_WebDAVClient:\n";

my $service = $device->find_service('X_AVM-DE_WebDAVClient:1');
    if ( ! $service->error ) {
        my $response = $service->call('GetInfo');
        if ( ! $response->error ) {
            printf "\tNewEnabled: %s\n",$response->data->{NewEnabled};
            printf "\tNewHostURL: %s\n",$response->data->{NewHostURL};
            printf "\tNewUsername: %s\n",$response->data->{NewUsername};
            printf "\tNewMountpointName: %s\n",$response->data->{NewMountpointName};
        }
    } else {
        printf "\tkeine Informationen.\n";
    }
}


#####################################
sub ManagementServer {

    my $device = shift;

    printf "ManagementServer:\n";

my $service = $device->find_service('ManagementServer:1');
    if ( ! $service->error ) {
        my $response = $service->call('GetInfo');
        if ( ! $response->error ) {
            printf "\tNewURL: %s\n",$response->data->{NewURL};
            printf "\tNewUsername: %s\n",$response->data->{NewUsername};
            printf "\tNewPeriodicInformEnable: %s\n",$response->data->{NewPeriodicInformEnable};
            printf "\tNewPeriodicInformInterval: %s\n",$response->data->{NewPeriodicInformInterval};
            printf "\tNewPeriodicInformTime: %s\n",$response->data->{NewPeriodicInformTime};
            printf "\tNewParameterKey: %s\n",$response->data->{NewParameterKey};
            printf "\tNewParameterHash: %s\n",$response->data->{NewParameterHash};
            printf "\tNewConnectionRequestURL: %s\n",$response->data->{NewConnectionRequestURL};
            printf "\tNewConnectionRequestUsername: %s\n",$response->data->{NewConnectionRequestUsername};
            printf "\tNewUpgradesManaged: %s\n",$response->data->{NewUpgradesManaged};
        }
    } else {
        printf "\tkeine Informationen.\n";
    }
}


#####################################
sub UserInterface {

    my $device = shift;

    printf "UserInterface:\n";

my $service = $device->find_service('UserInterface:1');
    if ( ! $service->error ) {
        my $response = $service->call('GetInfo');
        if ( ! $response->error ) {

            printf "\tNewUpgradeAvailable: %s\n",$response->data->{NewUpgradeAvailable};
            printf "\tNewPasswordRequired: %s\n",$response->data->{NewPasswordRequired};
            printf "\tNewPasswordUserSelectable: %s\n",$response->data->{NewPasswordUserSelectable};
            printf "\tNewWarrantyDate: %s\n",$response->data->{NewWarrantyDate};
            printf "\tNewX_AVM-DE_Version: %s\n",$response->data->{"NewX_AVM-DE_Version"};
            printf "\tNewX_AVM-DE_DownloadURL: %s\n",$response->data->{"NewX_AVM-DE_DownloadURL"};
            printf "\tNewX_AVM-DE_InfoURL: %s\n",$response->data->{"NewX_AVM-DE_InfoURL"};
            printf "\tNewX_AVM-DE_UpdateState: %s\n",$response->data->{"NewX_AVM-DE_UpdateState"};
            printf "\tNewX_AVM-DE_LaborVersion: %s\n",$response->data->{"NewX_AVM-DE_LaborVersion"};

        }

        $response = $service->call('X_AVM-DE_GetInternationalConfig');
        if ( ! $response->error ) {

            printf "\tNewX_AVM-DE_Language: %s\n",$response->data->{"NewX_AVM-DE_Language"};
            printf "\tNewX_AVM-DE_Country: %s\n",$response->data->{"NewX_AVM-DE_Country"};
            printf "\tNewX_AVM-DE_Annex: %s\n",$response->data->{"NewX_AVM-DE_Annex"};
            printf "\tNewX_AVM-DE_LanguageList: %s\n",$response->data->{"NewX_AVM-DE_LanguageList"};
            printf "\tNewX_AVM-DE_CountryList: %s\n",$response->data->{"NewX_AVM-DE_CountryList"};
            printf "\tNewX_AVM-DE_AnnexList: %s\n",$response->data->{"NewX_AVM-DE_AnnexList"};
        }

        $response = $service->call('X_AVM-DE_GetInfo');
        if ( ! $response->error ) {
            printf "\tNewX_AVM-DE_AutoUpdateMode : %s\n",$response->data->{"NewX_AVM-DE_AutoUpdateMode"};
            printf "\tNewX_AVM-DE_UpdateTime: %s\n",$response->data->{"NewX_AVM-DE_UpdateTime"};
            printf "\tNewX_AVM-DE_LastFwVersion: %s\n",$response->data->{"NewX_AVM-DE_LastFwVersion"};
            printf "\tNewX_AVM-DE_LastInfoUrl: %s\n",$response->data->{"NewX_AVM-DE_LastInfoUrl"};
            printf "\tNewX_AVM-DE_CurrentFwVersion: %s\n",$response->data->{"NewX_AVM-DE_CurrentFwVersion"};
            printf "\tNewX_AVM-DE_UpdateSuccessful: %s\n",$response->data->{"NewX_AVM-DE_UpdateSuccessful"};

        }

    } else {
        printf "\tkeine Informationen.\n";
    }
}

####################################
sub LANHostConfigManagement {

    my $device = shift;

    printf "LANHostConfigManagement:\n";

    my $service = $device->find_service('LANHostConfigManagement:1');
        if ( ! $service->error ) {
            my $response = $service->call('GetInfo');
            if ( ! $response->error ) {
                printf "\tNewDHCPServerConfigurable: %s\n",$response->data->{NewDHCPServerConfigurable};
                printf "\tNewDHCPRelay: %s\n",$response->data->{NewDHCPRelay};
                printf "\tNewMinAddress: %s\n",$response->data->{NewMinAddress};
                printf "\tNewMaxAddress: %s\n",$response->data->{NewMaxAddress};
                printf "\tNewReservedAddresses: %s\n",$response->data->{NewReservedAddresses};
                printf "\tNewDHCPServerEnable: %s\n",$response->data->{NewDHCPServerEnable};
                printf "\tNewDNSServers: %s\n",$response->data->{NewDNSServers};
                printf "\tNewDomainName: %s\n",$response->data->{NewDomainName};
                printf "\tNewIPRouters: %s\n",$response->data->{NewIPRouters};
                printf "\tNewSubnetMask: %s\n",$response->data->{NewSubnetMask};
            }
        } else {
            printf "\tkeine Informationen.\n";
        }
return;
}




####################################
sub Hosts {

    my $device = shift;

    printf "Hosts:\n";

    my $service = $device->find_service('Hosts:1');
        if ( ! $service->error ) {
            my $response = $service->call('GetHostNumberOfEntries');
            if ( ! $response->error ) {
                printf "\tNewHostNumberOfEntries: %s\n",$response->data->{NewHostNumberOfEntries};
            }
            if ($response->data->{NewHostNumberOfEntries} > 0) {
                my $i;
                for ( $i=0; $i < $response->data->{NewHostNumberOfEntries};$i++) {
                    printf "\tHost #$i:\n";

                    my(%hash) = ( 'NewIndex' => $i );
                    $response = $service->call('GetGenericHostEntry', %hash);
                    if( ! $response->error ) {
                        printf "\t\tNewAddressSource: %s\n",$response->data->{NewAddressSource};
                        printf "\t\tNewLeaseTimeRemaining: %s\n",$response->data->{NewLeaseTimeRemaining};
                    }

                    $response = $service->call('X_AVM-DE_GetGenericHostEntryExt', %hash);
                    if( ! $response->error ) {
                        printf "\t\tNewMACAddress: %s\n",$response->data->{NewMACAddress};
                        printf "\t\tNewIPAddress: %s\n",$response->data->{NewIPAddress};
                        printf "\t\tNewActive: %s\n",$response->data->{NewActive};
                        printf "\t\tNewHostName: %s\n",$response->data->{NewHostName};
                        printf "\t\tNewInterfaceType: %s\n",$response->data->{NewInterfaceType};
                        printf "\t\tNewX_AVM-DE_Port: %s\n",$response->data->{"NewX_AVM-DE_Port"};
                        printf "\t\tNewX_AVM-DE_Speed: %s\n",$response->data->{"NewX_AVM-DE_Speed"};
                        printf "\t\tNewX_AVM-DE_UpdateAvailable: %s\n",$response->data->{"NewX_AVM-DE_UpdateAvailable"};
                        printf "\t\tNewX_AVM-DE_UpdateSuccessful: %s\n",$response->data->{"NewX_AVM-DE_UpdateSuccessful"};
                        printf "\t\tNewX_AVM-DE_InfoURL: %s\n",$response->data->{"NewX_AVM-DE_InfoURL"};
                        printf "\t\tNewX_AVM-DE_Model: %s\n",$response->data->{"NewX_AVM-DE_Model"};
                        printf "\t\tNewX_AVM-DE_URL: %s\n",$response->data->{"NewX_AVM-DE_URL"};

                    }

                }
            }




        } else {
            printf "\tkeine Informationen.\n";
        }
return;
}

####################################
sub X_AVM_DE_Dect {

    my $device = shift;

    printf "X_AVM-DE_Dect:\n";

    my $service = $device->find_service('X_AVM-DE_Dect:1');
        if ( ! $service->error ) {

            my $response = $service->call('GetNumberOfDectEntries');
            if ( ! $response->error ) {
                printf "\tNewNumberOfEntries : %s\n",$response->data->{NewNumberOfEntries};
            }

            if ($response->data->{NewNumberOfEntries} > 0) {
                my $i;
                for ( $i=0; $i < $response->data->{NewNumberOfEntries};$i++) {
                    printf "\tPhone #$i:\n";

                    my(%hash) = ( 'NewIndex' => $i );
                    $response = $service->call('GetGenericDectEntry', %hash);
                    if( ! $response->error ) {
                        printf "\t\tNewID: %s\n",$response->data->{NewID};
                        printf "\t\tNewActive: %s\n",$response->data->{NewActive};
                        printf "\t\tNewName: %s\n",$response->data->{NewName};
                        printf "\t\tNewModel: %s\n",$response->data->{NewModel};
                        printf "\t\tNewUpdateAvailable: %s\n",$response->data->{NewUpdateAvailable};
                        printf "\tNewUpdateSuccessful: %s\n",$response->data->{NewUpdateSuccessful};
                        printf "\tNewUpdateInfo: %s\n",$response->data->{NewUpdateInfo};
                    }
                }
            }

        } else {
            printf "\tkeine Informationen.\n";
        }
return;
}

####################################
sub X_AVM_DE_MyFritz {

    my $device = shift;

    printf "X_AVM-DE_MyFritz:\n";

    my $service = $device->find_service('X_AVM-DE_MyFritz:1');
        if ( ! $service->error ) {

            my $response = $service->call('GetNumberOfServices');
            if ( ! $response->error ) {
                printf "\tNewNumberOfEntries : %s\n",$response->data->{NewNumberOfServices};
            }

            if ($response->data->{NewNumberOfServices} > 0) {
                my $i;
                for ( $i=0; $i < $response->data->{NewNumberOfServices};$i++) {
                    printf "\tPhone #$i:\n";

                    my(%hash) = ( 'NewIndex' => $i );
                    $response = $service->call('GetServiceByIndex', %hash);
                    if( ! $response->error ) {
                        printf "\t\tNewEnabled: %s\n",$response->data->{NewEnabled};
                        printf "\t\tNewName: %s\n",$response->data->{NewName};
                        printf "\t\tNewScheme: %s\n",$response->data->{NewScheme};
                        printf "\t\tNewPort: %s\n",$response->data->{NewPort};
                        printf "\t\tNewURLPath: %s\n",$response->data->{NewURLPath};
                        printf "\t\tNewType: %s\n",$response->data->{NewType};
                        printf "\t\tNewIPv4ForwardingWarning: %s\n",$response->data->{NewIPv4ForwardingWarning};
                        printf "\t\tNewIPv4Addresses: %s\n",$response->data->{NewIPv4Addresses};
                        printf "\t\tNewIPv6Addresses: %s\n",$response->data->{NewIPv6Addresses};
                        printf "\t\tNewIPv6InterfaceIDs: %s\n",$response->data->{NewIPv6InterfaceIDs};
                        printf "\t\tNewMACAddress: %s\n",$response->data->{NewMACAddress};
                        printf "\t\tNewHostName: %s\n",$response->data->{NewHostName};
                        printf "\t\tNewDynDnsLabel: %s\n",$response->data->{NewDynDnsLabel};
                        printf "\t\tNewStatus: %s\n",$response->data->{NewStatus};
                    }
                }
            }

        } else {
            printf "\tkeine Informationen.\n";
        }
return;
}


#####################################
sub LANEthernetInterfaceConfig {

    my $device = shift;

    printf "LANEthernetInterfaceConfig:\n";

    my $service = $device->find_service('LANEthernetInterfaceConfig:1');
        if ( ! $service->error ) {
            my $response = $service->call('GetInfo');
            if ( ! $response->error ) {
                printf "\tNewEnable: %s\n",$response->data->{NewEnable};
                printf "\tNewStatus: %s\n",$response->data->{NewStatus};
                printf "\tNewMACAddress: %s\n",$response->data->{NewMACAddress};
                printf "\tNewMaxBitRate: %s\n",$response->data->{NewMaxBitRate};
                printf "\tNewDuplexMode: %s\n",$response->data->{NewDuplexMode};
            }
            $response = $service->call('GetStatistics');
            if ( ! $response->error ) {
                printf "\tNewBytesSent: %s\n",$response->data->{NewBytesSent};
                printf "\tNewBytesReceived: %s\n",$response->data->{NewBytesReceived};
                printf "\tNewPacketsSent: %s\n",$response->data->{NewPacketsSent};
                printf "\tNewPacketsReceived: %s\n",$response->data->{NewPacketsReceived};
            }
        } else {
            printf "\tkeine Informationen.\n";
        }
return;
}


#####################################
sub WANDSLLinkConfig {

    my $device = shift;

    printf "WANDSLLinkConfig:\n";

    my $service = $device->find_service('WANDSLLinkConfig:1');
        if ( ! $service->error ) {
            my $response = $service->call('GetInfo');
            if ( ! $response->error ) {
                printf "\tNewEnable: %s\n",$response->data->{NewEnable};
                printf "\tNewLinkStatus: %s\n",$response->data->{NewLinkStatus};
                printf "\tNewLinkType: %s\n",$response->data->{NewLinkType};
                printf "\tNewDestinationAddress: %s\n",$response->data->{NewDestinationAddress};
                printf "\tNewATMEncapsulation: %s\n",$response->data->{NewATMEncapsulation};
                printf "\tNewAutoConfig: %s\n",$response->data->{NewAutoConfig};
                printf "\tNewATMQoS: %s\n",$response->data->{NewATMQoS};
                printf "\tNewATMPeakCellRate: %s\n",$response->data->{NewATMPeakCellRate};
                printf "\tNewATMSustainableCellRate: %s\n",$response->data->{NewATMSustainableCellRate};
            }
        } else {
            printf "\tkeine Informationen.\n";
        }
return;
}


#####################################
sub X_UPnP {

    my $device = shift;

    printf "X_UPnP:\n";

    my $service = $device->find_service('X_UPnP:1');
        if ( ! $service->error ) {
            my $response = $service->call('GetInfo');
            if ( ! $response->error ) {
                printf "\tNewEnable: %s\n",$response->data->{NewEnable};
                printf "\tNewUPnPMediaServer: %s\n",$response->data->{NewUPnPMediaServer};
            }
        } else {
            printf "\tkeine Informationen.\n";
        }
return;
}




#####################################
sub X_AVM_DE_OnTel {

    my $device = shift;

    printf "X_AVM-DE_OnTel:\n";

    my $service = $device->find_service('X_AVM-DE_OnTel:1');
        if ( ! $service->error ) {
            my $response = $service->call('GetNumberOfEntries');
            if ( ! $response->error ) {
                printf "\tNewOntelNumberOfEntries: %s\n",$response->data->{NewOntelNumberOfEntries};
            }
            my %hash = ( "type" => "csv");
            my $response = $service->call('GetCallList');
            if ( ! $response->error ) {
                printf "\tNewCallListURL: %s\n",$response->data->{NewCallListURL};
                printf "Loading CallList...\n";
#                sleep(2);
                my  $calllist = get($response->data->{NewCallListURL}."&type=csv");
                my $filename = 'CallList.csv';
                open(my $fh, '>', $filename) or die "Could not open file '$filename' $!";
                print $fh $calllist;;
                close $fh;

#                my $csv = Text::CSV_XS->new;
#                open my $fh, '<', \$calllist;
#                my $i = 0;
#                while (my $row = $csv->getline($fh)) {
#                    if ($i >0) {
#                          print "\tCall #$i\n";
#                          print "\t\tTyp: $row->[0]\n";
#                          print "\t\tDatum: $row->[1]\n";
#                          print "\t\tName: $row->[2]\n";
#                          print "\t\tRufnummer: $row->[3]\n";
#                          print "\t\tNebenstelle: $row->[4]\n";
#                          print "\t\tVon: $row->[5]\n";
#                          print "\t\tDauer: $row->[6]\n";
#                    }
#                    $i++;
#                }

            }

        } else {
            printf "\tkeine Informationen.\n";
        }
return;
}


#####################################
sub WANDSLInterfaceConfig {

    my $device = shift;

    printf "WANDSLInterfaceConfig:\n";

    my $service = $device->find_service('WANDSLInterfaceConfig:1');
        if ( ! $service->error ) {
            my $response = $service->call('GetInfo');
            if ( ! $response->error ) {
                printf "\tNewEnable: %s\n",$response->data->{NewEnable};
                printf "\tNewStatus: %s\n",$response->data->{NewStatus};
                printf "\tNewDataPath: %s\n",$response->data->{NewDataPath};
                printf "\tNewUpstreamCurrRate: %s\n",$response->data->{NewUpstreamCurrRate};
                printf "\tNewDownstreamCurrRate: %s\n",$response->data->{NewDownstreamCurrRate};
                printf "\tNewUpstreamMaxRate: %s\n",$response->data->{NewUpstreamMaxRate};
                printf "\tNewDownstreamMaxRate: %s\n",$response->data->{NewDownstreamMaxRate};
                printf "\tNewUpstreamNoiseMargin: %s\n",$response->data->{NewUpstreamNoiseMargin};
                printf "\tNewDownstreamNoiseMargin: %s\n",$response->data->{NewDownstreamNoiseMargin};
                printf "\tNewUpstreamAttenuation: %s\n",$response->data->{NewUpstreamAttenuation};
                printf "\tNewDownstreamAttenuation: %s\n",$response->data->{NewDownstreamAttenuation};
                printf "\tNewATURVendor: %s\n",$response->data->{NewATURVendor};
                printf "\tNewATURCountry: %s\n",$response->data->{NewATURCountry};
                printf "\tNewUpstreamPower: %s\n",$response->data->{NewUpstreamPower};
                printf "\tNewDownstreamPower: %s\n",$response->data->{NewDownstreamPower};
            }

            $response = $service->call('GetStatisticsTotal');
            if ( ! $response->error ) {
                printf "\tNewReceiveBlocks: %s\n",$response->data->{NewReceiveBlocks};
                printf "\tNewTransmitBlocks: %s\n",$response->data->{NewTransmitBlocks};
                printf "\tNewCellDelin: %s\n",$response->data->{NewCellDelin};
                printf "\tNewLinkRetrain: %s\n",$response->data->{NewLinkRetrain};
                printf "\tNewInitErrors: %s\n",$response->data->{NewInitErrors};
                printf "\tNewInitTimeouts: %s\n",$response->data->{NewInitTimeouts};
                printf "\tNewLossOfFraming: %s\n",$response->data->{NewLossOfFraming};
                printf "\tNewErroredSecs: %s\n",$response->data->{NewErroredSecs};
                printf "\tNewSeverelyErroredSecs: %s\n",$response->data->{NewSeverelyErroredSecs};
                printf "\tNewFECErrors: %s\n",$response->data->{NewFECErrors};
                printf "\tNewATUCFECErrors: %s\n",$response->data->{NewATUCFECErrors};
                printf "\tNewHECErrors: %s\n",$response->data->{NewHECErrors};
                printf "\tNewATUCHECErrors: %s\n",$response->data->{NewATUCHECErrors};
                printf "\tNewATUCCRCErrors: %s\n",$response->data->{NewATUCCRCErrors};
                printf "\tNewCRCErrors: %s\n",$response->data->{NewCRCErrors};
            }


        } else {
            printf "\tkeine Informationen.\n";
        }
return;
}


#####################################
sub X_AVM_DE_Homeauto {

    my $device = shift;

    printf "X_AVM_DE_Homeauto: ToDo\n";

    my $service = $device->find_service('X_AVM_DE_Homeauto:1');
        if ( ! $service->error ) {
            my (%hash) = ( 'Index' => 16);
            my $response = $service->call('GetGenericDeviceInfos', %hash);
            if ( ! $response->error ) {
                printf "\tAIN: %s\n",$response->data->{AIN};
                printf "\tDeviceId: %s\n",$response->data->{DeviceId};
                printf "\tFunctionBitMask: %s\n",$response->data->{FunctionBitMask};
                printf "\tFirmwareVersion: %s\n",$response->data->{FirmwareVersion};
                printf "\tManufacturer: %s\n",$response->data->{Manufacturer};
                printf "\tProductName: %s\n",$response->data->{ProductName};
                printf "\tDeviceName: %s\n",$response->data->{DeviceName};
                printf "\tPresent: %s\n",$response->data->{Present};
                printf "\tMultimeterIsEnabled: %s\n",$response->data->{MultimeterIsEnabled};
                printf "\tMultimeterIsValid: %s\n",$response->data->{MultimeterIsValid};
                printf "\tMultimeterPower: %s\n",$response->data->{MultimeterPower};
                printf "\tMultimeterEnergy: %s\n",$response->data->{MultimeterEnergy};
                printf "\tTemperatureIsEnabled: %s\n",$response->data->{TemperatureIsEnabled};
                printf "\tTemperatureIsValid: %s\n",$response->data->{TemperatureIsValid};
                printf "\tTemperatureCelsius: %s\n",$response->data->{TemperatureCelsius};
                printf "\tTemperatureOffset: %s\n",$response->data->{TemperatureOffset};
                printf "\tSwitchIsEnabled: %s\n",$response->data->{SwitchIsEnabled};
                printf "\tSwitchIsValid: %s\n",$response->data->{SwitchIsValid};
                printf "\tSwitchState: %s\n",$response->data->{SwitchState};
                printf "\tSwitchMode: %s\n",$response->data->{SwitchMode};
                printf "\tSwitchLock: %s\n",$response->data->{SwitchLock};
                printf "\tHkrIsEnabled: %s\n",$response->data->{HkrIsEnabled};
                printf "\tHkrIsValid: %s\n",$response->data->{HkrIsValid};
                printf "\tHkrIsTemperature: %s\n",$response->data->{HkrIsTemperature};
                printf "\tHkrSetVentilStatus: %s\n",$response->data->{HkrSetVentilStatus};
                printf "\tHkrSetTemperature: %s\n",$response->data->{HkrSetTemperature};
                printf "\tHkrReduceVentilStatus: %s\n",$response->data->{HkrReduceVentilStatus};
                printf "\tHkrReduceTemperature: %s\n",$response->data->{HkrReduceTemperature};
                printf "\tHkrComfortVentilStatus: %s\n",$response->data->{HkrComfortVentilStatus};
                printf "\tHkrComfortTemperature: %s\n",$response->data->{HkrComfortTemperature};
            }
        } else {
            printf "\tkeine Informationen.\n";
        }
return;
}


######################################
sub FactoryReset {
    my $device = shift;
    my (%hash) = (  );
    Set ( $device, "DeviceConfig","FactoryReset", \%hash );
return;
}

#####################################
sub Reboot {
    my $device = shift;
    my (%hash) = (  );
    Set ( $device, "DeviceConfig","Reboot", \%hash );
return;
}



1;
Kleines Skript:
Perl:
#!/usr/bin/perl

use TR064;



printf "\nFritz!Box Configuration Tool 1.0.0-1\n";
printf "(c) by lano 2017\n";


if (!$ARGV[0]){
$ip="192.168.178.1";
} else {
$ip=$ARGV[0];
}

if (!$ARGV[1]){
$port="49000";
} else {
$port=$ARGV[1];
}



    $device = TR064::Connect("http://".$ip.":".$port."",'dslf-config','Bu2Hu5re');
    if ($device == 0 ) {
        printf "Konnte keine Verbindung herstellen.\n";
        exit 1;
    } else {
        printf "Verbindung zu ".$ip.":".$port." hergestellt.\nLese Konfiguration...\n\n";
    }





    TR064::DeviceInfo($device);
#    TR064::FactoryReset($device);

    TR064::DeviceConfig($device);
    TR064::GetConfigFile($device,"1234"); # ToDo

    TR064::UserInterface($device);

    TR064::Time($device);

    TR064::ManagementServer($device);
    TR064::LANEthernetInterfaceConfig($device);
    TR064::LANHostConfigManagement($device);
    TR064::Hosts($device);

    TR064::WLANConfiguration($device);
    TR064::WANCommonInterfaceConfig($device);
    TR064::LANConfigSecurity($device);
    TR064::WANEthernetLinkConfig($device);
    TR064::Layer3Forwarding($device);

    TR064::WANPPPConnection($device);
    TR064::WANIPConnection($device);
    TR064::WANDSLLinkConfig($device);
    TR064::WANDSLInterfaceConfig($device);

    TR064::X_AVM_DE_Speedtest($device);
    TR064::X_AVM_DE_AppSetup($device);
    TR064::X_AVM_DE_RemoteAccess($device);
    TR064::X_AVM_DE_Dect($device);
    TR064::X_AVM_DE_WebDAVClient($device);
    TR064::X_AVM_DE_MyFritz($device);
    TR064::X_AVM_DE_Homeauto($device);
    TR064::X_AVM_DE_OnTel($device);
    TR064::X_UPnP($device);

#TR064::Reboot($device);



# WebDAV
#        my (%hash) = ( 'NewEnable' => '1','NewHostURL' => 'http://ip/','NewUsername' => 'user','NewPassword' => 'passwd','NewMountpointName' => 'WebDAV' );
#       TR064::Set ( $device, "X_AVM-DE_WebDAVClient:1","SetConfig", \%hash );
Beispiel:
Code:
Fritz!Box Configuration Tool 1.0.0-1
(c) by lano 2017
Verbindung zu 192.168.178.1:49000 hergestellt.
Lese Konfiguration...

DeviceInfo:
        ManufacturerName: AVM
        ManufacturerOUI: 00040E
        ModelName: FRITZ!Box 7330 SL
        Description: FRITZ!Box 7330 SL 116.06.50
        ProductClass: FRITZ!Box
        SerialNumber: 2465119131A7
        SoftwareVersion: 116.06.50
        HardwareVersion: FRITZ!Box 7330 SL
        SpecVersion: 1.0
        Provisoring:
        Uptime: 48.2m
        DeviceLog:
DeviceConfig:
        NewPersistentData:
X_AVM-DE_GetConfigFile:
        NewX_AVM-DE_ConfigFileUrl: https://192.168.178.1:54045/TR064/8C865678
UserInterface:
        NewUpgradeAvailable: 0
        NewPasswordRequired: 0
        NewPasswordUserSelectable: 1
        NewWarrantyDate: 0001-01-01T00:00:00
        NewX_AVM-DE_Version:
        NewX_AVM-DE_DownloadURL:
        NewX_AVM-DE_InfoURL:
        NewX_AVM-DE_UpdateState: Stopped
        NewX_AVM-DE_LaborVersion:
        NewX_AVM-DE_Language: de
        NewX_AVM-DE_Country: 049
        NewX_AVM-DE_Annex: B
        NewX_AVM-DE_LanguageList:
        NewX_AVM-DE_CountryList:
        NewX_AVM-DE_AnnexList:
        NewX_AVM-DE_AutoUpdateMode : important
        NewX_AVM-DE_UpdateTime: 0001-01-01T00:00:00
        NewX_AVM-DE_LastFwVersion:
        NewX_AVM-DE_LastInfoUrl:
        NewX_AVM-DE_CurrentFwVersion: 116.06.50
        NewX_AVM-DE_UpdateSuccessful: unknown
Time:
        NTP-Server: ntp.net.ows
        NTP-Server:
        Date/Time: 0001-01-01T00:48:15
ManagementServer:
        NewURL:
        NewUsername:
        NewPeriodicInformEnable: 0
        NewPeriodicInformInterval: 0
        NewPeriodicInformTime: 0001-01-01T00:00:00
        NewParameterKey:
        NewParameterHash:
        NewConnectionRequestURL: http://0.0.0.0:8089
        NewConnectionRequestUsername:
        NewUpgradesManaged: 0
LANEthernetInterfaceConfig:
        NewEnable: 1
        NewStatus: Up
        NewMACAddress: 24:65:11:91:31:a7
        NewMaxBitRate: Auto
        NewDuplexMode: Auto
        NewBytesSent: 0
        NewBytesReceived: 0
        NewPacketsSent: 0
        NewPacketsReceived: 0
LANHostConfigManagement:
        NewDHCPServerConfigurable: 1
        NewDHCPRelay: 0
        NewMinAddress: 192.168.178.20
        NewMaxAddress: 192.168.178.200
        NewReservedAddresses:
        NewDHCPServerEnable: 1
        NewDNSServers: 192.168.178.1
        NewDomainName: (none)
        NewIPRouters: 192.168.178.1
        NewSubnetMask: 255.255.255.0
Hosts:
        NewHostNumberOfEntries: 4
        Host #0:
                NewAddressSource: DHCP
                NewLeaseTimeRemaining: 0
                NewMACAddress: 00:26:B9:B4:4F:10
                NewIPAddress: 192.168.178.222
                NewActive: 1
                NewHostName: alien
                NewInterfaceType: Ethernet
                NewX_AVM-DE_Port: 2
                NewX_AVM-DE_Speed: 100
                NewX_AVM-DE_UpdateAvailable: 0
                NewX_AVM-DE_UpdateSuccessful: unknown
                NewX_AVM-DE_InfoURL:
                NewX_AVM-DE_Model:
                NewX_AVM-DE_URL: http://192.168.178.222
WLANConfiguration:
        NewEnable: 1
        NewStatus: Up
        NewMaxBitRate: Auto
        NewChannel: 1
        NewSSID: FRITZ!Box 7330 SL
        NewBeaconType: WPAand11i
        NewMACAddressControlEnabled: 0
        NewStandard: n
        NewBSSID: 24:65:11:91:31:A9
        NewBasicEncryptionModes: None
        NewBasicAuthenticationMode: None
        NewMaxCharsSSID: 32
        NewMinCharsSSID: 1
        NewAllowedCharsSSID: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
        NewMinCharsPSK: 64
        NewMaxCharsPSK: 64
        NewAllowedCharsPSK: 0123456789ABCDEFabcdef
        NewEnable: 0
        NewBeaconType: None
        NewKeyPassphrase:
        NewSSID:
        NewBSSID: 00:00:00:00:00:00
        NewTrafficMode: disabled
        NewManualSpeed: 0
        NewMaxSpeedDS: 0
        NewMaxSpeedUS: 0
        NewWEPKey0:
        NewWEPKey1:
        NewWEPKey2:
        NewWEPKey3:
        NewPreSharedKey: 3E202D8B705DDD793835F02F7A9AEE65C484CD713368EA455192EDC733E0E8E9
        NewKeyPassphrase: 36470570865341410567
        NewTotalAssociations : 0
WANCommonInterfaceConfig:
        NewWANAccessType: DSL
        NewLayer1UpstreamMaxBitRate: 0
        NewLayer1DownstreamMaxBitRate: 0
        NewPhysicalLinkStatus: Unavailable
        NewTotalBytesSent: 0.00 Byte
        NewTotalBytesReceived: 0.00 Byte
        NewTotalPacketsSent: 0
        NewTotalPacketsReceived: 0
LANConfigSecurity:
        NewX_AVM-DE_CurrentUsername:
        NewX_AVM-DE_CurrentUserRights: <rights><path>BoxAdmin</path><access>readwrite</access><path>Phone</path><access>readwrite</access><path>Dial</path><access>none</access><path>NAS</path><access>readwrite</access><path>HomeAuto</path><access>readwrite</access><path>App</path><access>readwrite</access></rights>
        NewMaxCharsPassword: 32
        NewMinCharsPassword: 0
        NewAllowedCharsPassword: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
        NewX_AVM-DE_AnonymousLoginEnabled: 1
WANEthernetLinkConfig:
        NewEthernetLinkStatus: Unavailable
Layer3Forwarding:
        NewDefaultConnectionService: 1.WANPPPConnection.1
WANPPPConnection:
        NewEnable: 0
        NewConnectionStatus: Disconnected
        NewPossibleConnectionTypes: IP_Routed, IP_Bridged
        NewConnectionType: IP_Routed
        NewName: internet
        NewUptime: 0
        NewUpstreamMaxBitRate: 0
        NewDownstreamMaxBitRate: 0
        NewLastConnectionError: ERROR_NONE
        NewIdleDisconnectTime: 300
        NewRSIPAvailable: 0
        NewUserName:
        NewNATEnabled: 1
        NewExternalIPAddress: 0.0.0.0
        NewDNSServers: 0.0.0.0, 0.0.0.0
        NewMACAddress: 24:65:11:91:31:AA
        NewLastAuthErrorInfo:
        NewConnectionTrigger: OnDemand
        NewMaxCharsUsername: 128
        NewMinCharsUsername: 3
        NewAllowedCharsUsername: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-._@()#/%[]{}*+�$&=?!:;,
        NewMaxCharsPassword: 64
        NewMinCharsPassword: 3
        NewAllowedCharsPassword: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-._@()#/%[]{}*+�$&=?!:;,
        NewTransportType: PPPoE
        NewRouteProtocolRx: Off
        NewPPPoEServiceName:
        NewRemoteIPAddress:
        NewPPPoEACName:
        NewDNSEnabled: 1
        NewDNSOverrideAllowed: 1
WANIPConnection:
WANDSLLinkConfig:
        NewEnable: 1
        NewLinkStatus: Up
        NewLinkType: PPPoE
        NewDestinationAddress: PVC: 1/32
        NewATMEncapsulation: LLC
        NewAutoConfig: 0
        NewATMQoS: UBR
        NewATMPeakCellRate: 0
        NewATMSustainableCellRate: 0
WANDSLInterfaceConfig:
        NewEnable: 1
        NewStatus: Disabled
        NewDataPath: Fast
        NewUpstreamCurrRate: 0
        NewDownstreamCurrRate: 0
        NewUpstreamMaxRate: 0
        NewDownstreamMaxRate: 0
        NewUpstreamNoiseMargin: 0
        NewDownstreamNoiseMargin: 0
        NewUpstreamAttenuation: 0
        NewDownstreamAttenuation: 0
        NewATURVendor: 41564d00
        NewATURCountry: 0400
        NewUpstreamPower: 500
        NewDownstreamPower: 500
        NewReceiveBlocks: 0
        NewTransmitBlocks: 0
        NewCellDelin: 0
        NewLinkRetrain: 0
        NewInitErrors: 0
        NewInitTimeouts: 0
        NewLossOfFraming: 0
        NewErroredSecs: 0
        NewSeverelyErroredSecs: 0
        NewFECErrors: 0
        NewATUCFECErrors: 0
        NewHECErrors: 0
        NewATUCHECErrors: 0
        NewATUCCRCErrors: 0
        NewCRCErrors: 0
X_AVM-DE_Speedtest:
        NewEnableTcp: 0
        NewEnableUdp: 0
        NewEnableUdpBidirect: 0
        NewWANEnableTcp: 0
        NewWANEnableUdp: 0
        NewPortTcp: 4711
        NewPortUdp: 4711
        NewPortUdpBidirect: 4712
X_AVM_DE_AppSetup:
        keine Informationen.
X_AVM-DE_RemoteAccess:
        NewEnabled: 0
        NewProviderName: dyndns.org
        NewUpdateURL: /nic/update?system=dyndns&hostname=<domain>&myip=<ipaddr>&wildcard=NOCHG
        NewDomain:
        NewStatusIPv4: undefined
        NewStatusIPv6: undefined
        NewUsername:
        NewMode: ddns_both
        NewServerIPv4: members.dyndns.org
        NewServerIPv6:
X_AVM-DE_Dect:
        NewNumberOfEntries : 0
X_AVM-DE_WebDAVClient:
        NewEnabled:
        NewHostURL:
        NewUsername:
        NewMountpointName: Online-Speicher
X_AVM-DE_MyFritz:
        NewNumberOfEntries : 0
X_AVM_DE_Homeauto: ToDo
        keine Informationen.
X_AVM-DE_OnTel:
        NewOntelNumberOfEntries:
        NewCallListURL: http://192.168.178.1:49000/calllist.lua?sid=ae1d64ac5e2cc348
Loading CallList...
X_UPnP:
        keine Informationen.
Gefällt mir: Al_
Autor
lano
First release
Last update
Bewertung
0,00 Stern(e) 0 Bewertungen

More resources from lano

Oben