#!/usr/bin/perl
 # A Script to get LiveBox ADSL status by Bodman@wanadoo.fr modified by Maxence Bitterli - antispam@dga-studio.org
 # http://www.websweet.fr
# Get host,user,pass ( root / 1234 default )
 if ($ARGV[0] ne "") { $host = $ARGV[0]; } else { $host = '192.168.1.1' }
 if ($ARGV[1] ne "") { $user = $ARGV[1]; } else { $user = 'root' }
 if ($ARGV[2] ne "") { $pass = $ARGV[2]; } else { $pass = '1234' }
# Get Telnet env
 use Net::Telnet;
 $telnet = new Net::Telnet ( Timeout=>20 );
 $telnet->errmode(sub {die @_ unless $_[0] =~ /eof/});
# Telnet Login
 $telnet->open($host);
 $telnet->login($user,$pass);
#Go to adsl env and get monitoring
 $telnet->cmd("shell");
 @tableau = $telnet->cmd("ifconfig br0");
#End Telnet session in good condition
 $telnet->cmd("exit");
 $telnet->cmd("exit");
 $telnet->close;
#print @tableau;
#print data
 print @tableau[6];
exit();