my ($hostname, @lines, $nick, $channel);
$hostname = "213.91.4.37";
$nick = $ARGV[0];
$channel = "#test32654";
use Net::Telnet ();
$irc = new Net::Telnet (Telnetmode => 0);
$ftp = new Net::Telnet (Telnetmode => 0);
$irc->open(Host => $hostname,Port => 6667);
sub irc_cmd {
$irc->print("$_[0]\n" );
}
sub ftp_check
{
my ($reponse);
$ftp->open(Host => "127.0.0.1" ,Port => 25001);
$ftp->print("user kjlkjlj" );
$ftp->print("pass xxxxxx" );
$ftp->print("quit" );
@line = $ftp->getlines(TimeOut => 5);
foreach $line (@line) {
if ( $line =~ /(.*)time is (.*),/i ) {
$reponse=$reponse."2Time1[$2] ";
}
if ( $line =~ /(.*)up for (.*)/i ) {
$reponse=$reponse."2UpTime1[$2] ";
}
if ( $line =~ /(.*)Current users : (.*)/i ) {
$reponse=$reponse."2Nb users1[$2] ";
}
if ( $line =~ /(.*)Kb downloaded : (.*) K/i ) {
$reponse=$reponse."2Kb down1[$2 Kb] ";
}
if ( $line =~ /(.*)Average througput : (.*) /i ) {
$reponse=$reponse."2Speed moy1[$2 Kb/s] ";
}
if ( $line =~ /(.*)Current througput : (.*) /i ) {
$reponse=$reponse."2Speed1[$2 Kb/s] ";
}
}
$irc->print("privmsg #moi:$reponse" );
}
&irc_cmd("user $nick 127.0.0.1 127.0.0.1 :coucou" );
&irc_cmd("nick $nick" );
$joined=0;
$irc->errmode ("return" );
$ftp->errmode ("return" );
while (1) {
$line = $irc->getline(TimeOut => 3000);
if ( $line =~ /(.*)ping :(.*)/i ) {
&irc_cmd("PONG :$2" );
if ($joined==0) {
$joined=1;
&irc_cmd("join $channel" );
&ftp_check;
}
}
if ( $line =~ /(.*)stat $nick(.*)/i ) {
&ftp_check;
}
}
|