Programmatically login to your dyndns.org account

Per the discussion and script provided by azertx here, I’ve decided to document things a little more clearly in the hopes that more people are able to continue using the dyndns.org FREE dynamic hostname service.

Create a perl script called ‘dyndns-refresh.pl’ containing the following code:

#!/usr/bin/perl

use strict;
use warnings;

use Data::Dumper;
use WWW::Mechanize;

use vars qw($dyn_username $dyn_password $R);

# Set $dyn_username and $dyn_password in this file.
do "$ENV{'HOME'}/.dyn_account_info";

my $ua = WWW::Mechanize->new() or die;
$ua->get("https://account.dyn.com/") or die;
$R = $ua->submit_form(
    form_number => 2,
    "fields" => {
       'username' => $dyn_username,
       'password' => $dyn_password}
    ) or die;

# Check if login is successful
die "Login has failed" unless ($R->decoded_content =~ /Welcome......<b>$dyn_username/ );

Create a configuration file in your home directory called ‘.dyn_account_info’ (no file extension, and don’t forget the leading . ) with this text:

$dyn_username='username';
$dyn_password='password';

Run your script and check that it works:

perl dyndns-refresh.pl

If there is no output, it worked successfully, otherwise it will tell you the login failed.

If it was successful, it’s time to set up a scheduled task or cron job to have it run on a regular basis.

SLA Update For Dyn Non-Paid Users

Starting now, if you would like to maintain your free Dyn account, you must log into your account once a month. Failure to do so will result in expiration and loss of your hostname. This activity helps us eliminate hostnames that are no longer needed and/or dormant. Note that using an update client will no longer suffice for this monthly login.