#!/usr/pkg/bin/perl # a very basic script using Net::Telnet to retreive your IP address # on a Zyxel DSL modem / router # just replace "zyxel" with your zyxel hostname and "your_passwd" with... guess # # iMil use Net::Telnet; my $t = new Net::Telnet (-host => "zyxel"); my $screen; $t->waitfor('/password:/i'); $t->print("your_passwd"); $t->waitfor('/Number:/i'); $t->print("24"); $t->waitfor('/Number:/i'); $t->print("8"); $t->waitfor('/zyxel>/'); $t->buffer_empty; my @screen = $t->cmd(String => "ip ifconfig wanif0", Prompt => '/zyxel>/i'); $t->close; my $ip; foreach my $item (@screen) { if ($item =~ /.*inet\ *([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}).*netmask.*broadcast,*/) { $ip=$1; } } print "Current IP address: $ip\n";