PERL Telnet Script problem
by Saqib Rafique other posts by this author
Apr 25 2008 4:58AM messages near this date
DB_File Module not working
|
Re: PERL Telnet Script problem
Hi All,
Please review following code.
there is no output against the code.
the script runs and prints the starting strings and nothing more.
More over I was missing Net::Telnet module. So I downloaded it from CPAN.
Unzipped it , then I manually copied the Telnet.pm extracted from zip at
path /usr/perl5/5.00503/Net
Any help.
#!/usr/bin/perl -w
# A TELNET SCRIPT
#
# REMOTE TELNET FETCH UPTIME
#
#!/usr/bin/perl -w
print "***************************************\n";
print "***** A TELNET Script ******************** \n";
print "***************************************\n\n";
print "TELNET Tunnels in progress, Hold on. \n";
use Net::Telnet;
$telnet = new Net::Telnet ( Timeout=> 10, Errmode=>'die');
$telnet-> open('xx.xx.xx.xx');
$telnet-> waitfor('/login: $/i');
$telnet-> print('root');
$telnet-> waitfor('/Password: $/i');
$telnet-> print('xxxxxxxxxx');
$telnet-> waitfor('/# $/i');
$telnet-> print('uname -a');
$output = $telnet-> waitfor('/# $/i');
print $output;
--
Saqib Rafique
Thread:
Saqib Rafique
Basil A. Daoust
|