ryder has asked for the wisdom of the Perl Monks concerning the following question:
Heelo Perl Monks,
I try to connect to a network appliance using Net::Openssh. Simple commands like ls /tmp or cat /etc/hosts are working.
But I try to capture the output from a proprietary command, called dbedit. The appliance have a standard Openssh server installed, version OpenSSH_4.3p2, OpenSSL 0.9.8b 04 May 2006 The server cannot be updated. here my test programm:
#!/usr/bin/perl use Net::OpenSSH; my $host = "10.100.110.51"; my $user = "admin"; my $pass = "my_pw"; #$Net::OpenSSH::debug=-1; my $ssh = Net::OpenSSH->new(host=>$host, user=>$user, password=>$pass, master_opts => [-v, -o => "StrictHostKeyCh +ecking=no"], ); $ssh->error and die "Couldn't establish SSH connection: ". $ssh->error +; my $xxx = "source /opt/CPshrd-R77/tmp/.CPprofile.sh ; /opt/CPsuite-R7 +7/fw1/bin/dbedit --h"; #my (@ls,$errput) = $ssh->capture2({tty => 1},"/opt/CPsuite-R77/fw1/ +bin/dbedit --h"); my (@ls,$errput) = $ssh->capture2({tty => 1},$xxx); $ssh->error and die "remote ls command failed: " . $ssh->error; print"LS:@ls\n"; print"ERR:$errput\n";
As you can see by the code. I already tried some hacks to solve the problem. But any additional option I integrated into the code. Did not solve the problem. Interesting ist that the Debug-Output is showing the output from the command, but it seems this output did not get back through the tunnel to the ssh client. Please finde following the debug output from a connection establishment test:
Is there anybody out there who can help me to capture the output from this command.
ciao ryder
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Q: Cannot get the capture from connection with Net::Openssh?
by salva (Canon) on May 05, 2015 at 08:25 UTC | |
by ryder (Initiate) on May 05, 2015 at 09:54 UTC |