Alcatel Speedtouch IP hack

Beatnik on 2004-01-17T14:46:14

Quick hack for getting the current IP from my ADSL modem (since it changes every week or so..)
#!/usr/bin/perl

use strict;
use Net::Telnet;

my $host = '10.0.0.1'; #Fill in modem IP here
my $user = ''; #You do have a user defined?
my $c = new Net::Telnet (Prompt => '/\=>$/i');
$c->open($host);
$c->waitfor('/user : $/i');
$c->print($user);

my @output = $c->cmd("ip aplist");
$c->close;
my @ips = grep { /inet/ } @output;
my ($currentip) = $ips[0] =~ /^.*?addr:([\d\.]+) .*$/;
print $currentip;
Now all I need is some WWW::Mechanize magic :)