#!/usr/bin/perl
use strict;
use warnings;
use POSIX;
use utf8;
use Encode;
use LWP::UserAgent;
die "Benutzung:\n\tFreeDNS.pl <Benutzername> <Passwort>\n" unless $ARGV[1];
my $FDNSUser=$ARGV[0];
my $FDNSPass=$ARGV[1];
my $FDNSbaseurl="
Sie müssen registriert sein, um Links zu sehen.
";
my $FDNSBrowser = LWP::UserAgent->new;
$FDNSBrowser->agent("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36");
$FDNSBrowser->default_header('Accept-Encoding' => "deflate");
$FDNSBrowser->cookie_jar( {} );
$FDNSBrowser->timeout(20);
print(encode("utf-8","Verlängern des FreeDNS-Accounts ...\n"));
my $response = $FDNSBrowser->post( $FDNSbaseurl."/zc.php",
[
'username' => $FDNSUser,
'password' => $FDNSPass,
'action' => 'auth',
'submit' => qq{Login},
]
);
$response = $FDNSBrowser->get( $FDNSbaseurl."/menu/?ls=1" );
if ($response->content=~ m/.*UserID:<\/td><td bgcolor="#eeeeee" align="right">([^<]+)<\/.+/gis and (lc($1) eq lc($FDNSUser))) {
print(encode("utf-8","Anmeldung als User ".$1." erfolgreich!\n"));
exit 0;
} else {
print(encode("utf-8","Anmeldung als User ".$FDNSUser." gescheitert!\n"));
exit 1;
}