Empty output [Fermé]

Signaler
Messages postés
69
Date d'inscription
jeudi 4 septembre 2014
Statut
Membre
Dernière intervention
18 mars 2016
-
Bonsoir,
when I run my script to connect to my switch via ssh, it does not display anything, I did not understand where is the problem

use Net::SSH::Perl;
 
my $mypass_ena="admin";
 
my $cmd="
enable
$mypass_ena
show arp

";
 
my $host='192.65.36.95';
my $user='admin';
my $pass='admin';
 
 
 
my $ssh = Net::SSH::Perl->new($host,debug=>true,
                  options => ["BatchMode yes", "RhostsAuthentication no" ]);


                 
$ssh->login($user,$pass);
 
 
my ($stdout, $stderr, $exit) = $ssh->cmd("",$cmd);
 
print "stdout:$stdout \n";
print "stderr: $stderr \n";
#print "$exit\n"



The out put is :
VM-Ocsinventory-ng: Reading configuration data /root/.ssh/config
VM-Ocsinventory-ng: Reading configuration data /etc/ssh_config
VM-Ocsinventory-ng: Allocated local port 1023.
VM-Ocsinventory-ng: Connecting to 192.65.36.95, port 22.
VM-Ocsinventory-ng: Remote version string: SSH-2.0-Cisco-1.25

VM-Ocsinventory-ng: Remote protocol version 2.0, remote software version Cisco-1.25
VM-Ocsinventory-ng: Net::SSH::Perl Version 1.38, protocol version 2.0.
VM-Ocsinventory-ng: No compat match: Cisco-1.25.
VM-Ocsinventory-ng: Connection established.
VM-Ocsinventory-ng: Sent key-exchange init (KEXINIT), wait response.
VM-Ocsinventory-ng: Algorithms, c->s: 3des-cbc hmac-sha1 none
VM-Ocsinventory-ng: Algorithms, s->c: 3des-cbc hmac-sha1 none
VM-Ocsinventory-ng: Entering Diffie-Hellman Group 1 key exchange.
VM-Ocsinventory-ng: Sent DH public key, waiting for reply.
VM-Ocsinventory-ng: Received host key, type 'ssh-rsa'.
VM-Ocsinventory-ng: Host '192.65.36.95' is known and matches the host key.
VM-Ocsinventory-ng: Computing shared secret key.
VM-Ocsinventory-ng: Verifying server signature.
VM-Ocsinventory-ng: Waiting for NEWKEYS message.
VM-Ocsinventory-ng: Send NEWKEYS.
VM-Ocsinventory-ng: Enabling encryption/MAC/compression.
VM-Ocsinventory-ng: Sending request for user-authentication service.
VM-Ocsinventory-ng: Service accepted: ssh-userauth.
VM-Ocsinventory-ng: Trying empty user-authentication request.
VM-Ocsinventory-ng: Authentication methods that can continue: keyboard-interactive,password.
VM-Ocsinventory-ng: Next method to try is password.
VM-Ocsinventory-ng: Trying password authentication.
VM-Ocsinventory-ng: Login completed, opening dummy shell channel.
VM-Ocsinventory-ng: channel 0: new [client-session]
VM-Ocsinventory-ng: Requesting channel_open for channel 0.
VM-Ocsinventory-ng: channel 0: open confirm rwindow 8192 rmax 4096
VM-Ocsinventory-ng: Got channel open confirmation, requesting shell.
VM-Ocsinventory-ng: Requesting service shell on channel 0.
VM-Ocsinventory-ng: channel 1: new [client-session]
VM-Ocsinventory-ng: Requesting channel_open for channel 1.
VM-Ocsinventory-ng: Entering interactive session.
VM-Ocsinventory-ng: Channel open failure: 1: reason 4:
stdout:
stderr: