Subject: | ssh1 : enable mode not working |
Date: | Sun, 16 Aug 2009 12:36:54 +0530 |
To: | bug-Net-SSH-Perl [...] rt.cpan.org |
From: | Mahantesh Meti <msmeti [...] gmail.com> |
Hi,
I'm not able to login to the enable mode and execute the "Show
running-config" command using SSH1,
Please help me,
Here is my pgm,
#!/usr/bin/perl
use Net::SSH::Perl;
my $host = "172.16.15.32";
my $user = "cisco";
my $password = "cisco";
my $enablePass = "test1";
#-- set up a new connection
#my $ssh = Net::SSH::Perl->new($host);
my $ssh = Net::SSH::Perl->new("$host", debug => 1,use_pty => 0, protocol
=> 1 );
#-- authenticate
$ssh->login($user, $password, );
$ssh->cmd("en\n", "test1\n" ); # enable mode is not supported !
#-- execute the command
$ssh->cmd("\n");
my($stdout, $stderr, $exit) = $ssh->cmd("show running-config");
print " $stdout, $stderr, $exit \n" ;
my($stdout, $stderr, $exit) = $ssh->cmd("exit");
print " $stdout, $stderr, $exit \n" ;
output
[root@localhost perl]# perl ssh1.pl
localhost.localdomain: Reading configuration data /root/.ssh/config
localhost.localdomain: Reading configuration data /etc/ssh_config
localhost.localdomain: Allocated local port 1019.
localhost.localdomain: Connecting to 172.16.15.32, port 22.
localhost.localdomain: Remote protocol version 1.5, remote software version
Cisco-1.25
localhost.localdomain: Net::SSH::Perl Version 1.34, protocol version 1.5.
localhost.localdomain: No compat match: Cisco-1.25.
localhost.localdomain: Connection established.
localhost.localdomain: Waiting for server public key.
localhost.localdomain: Received server public key (640 bits) and host key
(800 bits).
localhost.localdomain: Host '172.16.15.32' is known and matches the host
key.
localhost.localdomain: Encryption type: DES3
localhost.localdomain: Sent encrypted session key.
localhost.localdomain: Received encryption confirmation.
localhost.localdomain: Trying password authentication.
localhost.localdomain: Sending command: en
localhost.localdomain: Entering interactive session.
localhost.localdomain: Allocated local port 1018.
localhost.localdomain: Connecting to 172.16.15.32, port 22.
localhost.localdomain: Remote protocol version 1.5, remote software version
Cisco-1.25
localhost.localdomain: Net::SSH::Perl Version 1.34, protocol version 1.5.
localhost.localdomain: No compat match: Cisco-1.25.
localhost.localdomain: Connection established.
localhost.localdomain: Waiting for server public key.
localhost.localdomain: Received server public key (640 bits) and host key
(800 bits).
localhost.localdomain: Host '172.16.15.32' is known and matches the host
key.
localhost.localdomain: Encryption type: DES3
localhost.localdomain: Sent encrypted session key.
localhost.localdomain: Received encryption confirmation.
localhost.localdomain: Trying password authentication.
localhost.localdomain: Sending command:
localhost.localdomain: Entering interactive session.
localhost.localdomain: Allocated local port 1019.
localhost.localdomain: Connecting to 172.16.15.32, port 22.
localhost.localdomain: Remote protocol version 1.5, remote software version
Cisco-1.25
localhost.localdomain: Net::SSH::Perl Version 1.34, protocol version 1.5.
localhost.localdomain: No compat match: Cisco-1.25.
localhost.localdomain: Connection established.
localhost.localdomain: Waiting for server public key.
localhost.localdomain: Received server public key (640 bits) and host key
(800 bits).
localhost.localdomain: Host '172.16.15.32' is known and matches the host
key.
localhost.localdomain: Encryption type: DES3
localhost.localdomain: Sent encrypted session key.
localhost.localdomain: Received encryption confirmation.
localhost.localdomain: Trying password authentication.
localhost.localdomain: Sending command: show running-config
localhost.localdomain: Entering interactive session.
Line has invalid autocommand "show running-config", , 0
localhost.localdomain: Allocated local port 1017.
localhost.localdomain: Connecting to 172.16.15.32, port 22.
localhost.localdomain: Remote protocol version 1.5, remote software version
Cisco-1.25
localhost.localdomain: Net::SSH::Perl Version 1.34, protocol version 1.5.
localhost.localdomain: No compat match: Cisco-1.25.
localhost.localdomain: Connection established.
localhost.localdomain: Waiting for server public key.
localhost.localdomain: Received server public key (640 bits) and host key
(800 bits).
localhost.localdomain: Host '172.16.15.32' is known and matches the host
key.
localhost.localdomain: Encryption type: DES3
localhost.localdomain: Sent encrypted session key.
localhost.localdomain: Received encryption confirmation.
localhost.localdomain: Trying password authentication.
localhost.localdomain: Sending command: exit
localhost.localdomain: Entering interactive session.
, , 0
Thanks
-Mahantesh