Subject: | Bug in Net::SSH2::Cisco |
Date: | Wed, 26 Apr 2017 08:21:10 +0000 |
To: | "'bug-Net-SSH2-Cisco [...] rt.cpan.org'" <bug-Net-SSH2-Cisco [...] rt.cpan.org> |
From: | "Novak Stefan (Kabelplus)" <Stefan.Novak [...] kabelplus.co.at> |
Hello!
I've just made a trivial script to get the output of show version:
my $ssh = Net::SSH2::Cisco->new( host => $host,
errmode => 'return',
Timeout => $timeout,
Binmode => 0);
print "Use Net:SSH2:CISCO to connect.\n" if ($DEBUG == 1);
if($ssh && $ssh->login($username, $password)){
$ssh->input_log("./ssh.log");
# Enable mode
if ($ssh->enable($enable_password) ) {
$ssh->cmd('terminal length 0');
@output = $ssh->cmd($cmd);
#$ok = $ssh->print(@output);
#print $ok;
#for (@config) {
# s/\\n//
#}
$return->{'type'} = "ssh2";
$return->{'output'} = \@output;
return $return;
}
}
On the output 2 chars at the beginning are missing: (fist line is correct, second one and following are wrong)
Objects $VAR1 = {
'output' => [
', 'Cisco IOS Software, C800 Software (C800-UNIVERSALK9-M), Version 15.5(3)M4a, RELEASE SOFTWARE (fc1)
'
',chnical Support: http://www.cisco.com/techsupport
'
',pyright (c) 1986-2016 by Cisco Systems, Inc.
'
In the input_log is everything corret:
enable
Password:
hostname#terminal length 0
hostname#show version
Cisco IOS Software, C800 Software (C800-UNIVERSALK9-M), Version 15.5(3)M4a, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2016 by Cisco Systems, Inc.
Compiled Thu 06-Oct-16 14:23 by prod_rel_team
Kind regards,
Stefan