#!/usr/bin/perl # # This script requires LWP::UserAgent and Crypt::SSLeay (Latter for HTTPS ONLY) # # # # # This script requires the command ifconfig. When running on ppp you should have an interface ppp0. # If this is true the IP info line for ppp0 should have 3 IP addys, one local, one remote and one netmask. # If your ppp0 info does not have P-t-P in it this script wont work!!! # # # You may use this script to update your dyndns.org records for your home linux box # but NOT for commercial purposes!!! # # If you want to use it commercially email me: wearenot_spam@thegeakes.co.uk # # Robert Geake # Required modules use strict; use LWP; # # Start Config # # your dyndns username my $username = ''; my $password = ''; # your dyndns password my $url = "$username:$password\@members.dyndns.org/nic/update?system=dyndns"; # your dyndns hostname my $hostname = ''; # should i use htps?? my $https = 'yes'; # # End Config # # # Dont change anything below!!! (unless you know what you are doing) # my ($temp); my @info = split('\n', `ifconfig`); foreach (@info) { if ($_ =~ /P-t-P/) { # get the line we need from the outputof ifconfig (the one with P-t-P in it!) $temp = $_; } } my @ip = split(' ', $temp); my $ip = @ip[1]; $ip =~ s/addr://ig; print qq~\n\n\tUpdating members.dyndns.org ($hostname) with: $ip\n~; my $ua = LWP::UserAgent->new; my $response = $ua->get("http://$url&hostname=$hostname&myip=$ip&wildcard=no"); if ($https eq "yes") { my $response = $ua->get("https://$url&hostname=$hostname&myip=$ip&wildcard=no"); } else { my $response = $ua->get("http://$url&hostname=$hostname&myip=$ip&wildcard=no"); } if ($response->is_success) { print "\t Success: " . $response->content . "\n\n"; } else { print "\tFailed....!" . $response->status_line . "\n\n"; }