Hi,
This is my first Perl Script. I am trying to telnet to a cisco router and get the output from a command. I am running my script from a Windows XP machine from the command prompt.
I do not see the router output of the show command in the inputlog file. Please help.
My script is as follows.
#!C/Perl -w
use strict;
use warnings;
use Net::Telnet;
my $telnet = new Net::Telnet ( Timeout=>10, Binmode=> 1, telnetmode =>
+ 0, Input_log=>"input.log", Dump_log=>"dump.log", Output_log=>"output
+.log", Errmode=>'die', Prompt=>'/(?m:^[\w.-]+\s?(?:\(config[^\)]*\))?
+\s?[\$#>]\s?(?:\(enable\))?\s*$)/');
print "I am opening a connection\n";
$telnet->open('x.y.z.x');
print "i established a connection\n";
$telnet->waitfor('/Username: $/i');
$telnet->print('xxx');
print "i entered username\n";
$telnet->waitfor('/Password: $/i');
$telnet->print('yyy');
print "i entered password\n";
$telnet->waitfor('/.*$/i');
print $telnet->cmd('show platform');
print 'I am done executing the show command';
$telnet->close();
The input.log file does show me that it has connected to the router prompt and dump_log does have these lines at the end.
> 0x00000: 73 68 6f 77 20 70 6c 61 74 66 6f 72 6d 0a show platform.
< 0x00000: 0d 0a 56 50 4e 76 34 2d 31 6b 2d 52 52 30 33 23 ..VPNv4-1k-RR03#
But i dont see the output of the command "show platform" anywhere..
Please help.
TIA.