Net-SSH-W32Perl strange behaviour.

F

fhornain

Hi,

Well, I am currently stuck with a stange Perl behaviour.
Indeed, I am trying to create a Perl SSH client script on Windows -
but you have already noticed that in the title of this message :) -
which could be connected on a Vandyke Vshell - SSH deamon for Ms
Windows -.

This is the content of my script I have mostly retreived from the CPAN
web site - http://search.cpan.org/~scotts/Net-SSH-W32Perl-0.05/lib/Net/SSH/W32Perl.pm
- :

use strict;
use warnings;
use Net::SSH::W32Perl;

&windows();

sub windows ()
{
my ($user,$pass,$host,$cmd)
=("MY_USER","MY_PASSWORD","MY_MACHINE_ADDRESS","MY_NICE _COMMAND");
my $ssh = Net::SSH::W32Perl->new($host,protocole =>2, debug
=> 0);
$ssh->login($user, $pass);
my($stdout, $stderr, $exit) = $ssh->cmd($cmd);
print "Standard out: $stdout\nStandard Error: $stderr\nExit
code: $exit\n";
}

The problem is firstly it returns the following messages :

IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 118
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110

Ok, I agree despite this message it return the correct result.
Well, sometime ! - I am going to explain below -

In fact, it returns the correct result only the first or the second
time you launch it.
Otherwise, it freezes.
Behaviour that I do not really want. ;)

So, this is the ouput of this program during its execution but in
debug mode :

machinename: Reading configuration data /.ssh/config
machinename: Reading configuration data /etc/ssh_config
machinename: Connecting to localhost, port 22.
machinename: Socket created, turning on blocking...
machinename: Remote protocol version 2.0, remote software version
VShell_2_6_4_4
8 VShell
machinename: Net::SSH::perl Version 1.23_01, protocol version 2.0.
machinename: No compat match: VShell_2_6_4_448 VShell
machinename: Connection established.
machinename: Sent key-exchange init (KEXINIT), wait response.
machinename: Algorithms, c->s: 3des-cbc hmac-sha1 none
machinename: Algorithms, s->c: 3des-cbc hmac-sha1 none
machinename: Entering Diffie-Hellman Group 1 key exchange.
machinename: Sent DH public key, waiting for reply.
machinename: Received host key, type 'ssh-dss'.
machinename: Host 'localhost' is known and matches the host key.
machinename: Computing shared secret key.
machinename: Verifying server signature.
machinename: Waiting for NEWKEYS message.
machinename: Enabling incoming encryption/MAC/compression.
machinename: Send NEWKEYS, enable outgoing encryption/MAC/
compression.
machinename: Sending request for user-authentication service.
machinename: Service accepted: ssh-userauth.
machinename: Trying empty user-authentication request.
machinename: Authentication methods that can continue: password.
machinename: Next method to try is password.
machinename: Trying password authentication.
machinename: Login completed, opening dummy shell channel.
machinename: channel 0: new [client-session]
machinename: Requesting channel_open for channel 0.
machinename: channel 0: open confirm rwindow 32768 rmax 16384
machinename: Got channel open confirmation, requesting shell.
machinename: Requesting service shell on channel 0.
machinename: channel 1: new [client-session]
machinename: Requesting channel_open for channel 1.
machinename: Entering interactive session.
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
machinename: Sending command: cluster localhost group /status
machinename: Requesting service exec on channel 1.
machinename: channel 1: open confirm rwindow 32768 rmax 16384
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 118
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110

Now, cherry on the cake!
I have tried to do the same test with an OpenSSH deamon - for the
server side, I mean -.
Ok, I always have the error message :

IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
BlaBla...

But in contrary of Vshell the Perl SSH client script does not seem
stuck.
it runs every time.

This what I have noticed :
With Vandyke VShell, the script uses

machinename: channel 0: open confirm rwindow 32768 rmax 16384

However with OpenSSH, the script uses :

machinename: channel 1: open confirm rwindow 0 rmax 32768


So I have got five questions :


- How can I make my little Perl SSH Client script work ?
- How can I fix error message during the Perl script execution ?
- Why there is difference between Vshell and OpenSsh with the SSH
packet window size ?
- Is there a way to specify the SSH packet window size in Perl?
- Could you give me a hand please ?

Thanks a lot in advance.
BR
Fred
 
F

fhornain

Hi again,

I think that I forgot two important information.

Well, I use active perl and Net-SSH-W32Perl modules comming from
http://www.soulcage.net/PPDS.58/.

And yes, I have still got one little questions.

- Knowing that I can not use public key, do you know another mean
in perl to access SSH Server on Windows platform ?

Thanks in advance for your help.
BR
Fred
 
F

fhornain

s/protocole/protocol/
Done ! But the problem is still there.
Please do read and follow the posting guidelines for this group.
I already done that.
What is wrong with my post ?

Thanks a lot for your help.
BR
Fred
 
C

chenws3000

Hi,

Well, I am currently stuck with a stange Perl behaviour.
Indeed, I am trying to create a Perl SSH client script on Windows -
but you have already noticed that in the title of this message :) -
which could be connected on a Vandyke Vshell - SSH deamon for Ms
Windows -.

This is the content of my script I have mostly retreived from the CPAN
web site -http://search.cpan.org/~scotts/Net-SSH-W32Perl-0.05/lib/Net/SSH/W32Pe...
- :

use strict;
use warnings;
use Net::SSH::W32Perl;

&windows();

sub windows ()
{
my ($user,$pass,$host,$cmd)
=("MY_USER","MY_PASSWORD","MY_MACHINE_ADDRESS","MY_NICE _COMMAND");
my $ssh = Net::SSH::W32Perl->new($host,protocole =>2, debug
=> 0);
$ssh->login($user, $pass);
my($stdout, $stderr, $exit) = $ssh->cmd($cmd);
print "Standard out: $stdout\nStandard Error: $stderr\nExit
code: $exit\n";
}

The problem is firstly it returns the following messages :

IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 118
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110

Ok, I agree despite this message it return the correct result.
Well, sometime ! - I am going to explain below -

In fact, it returns the correct result only the first or the second
time you launch it.
Otherwise, it freezes.
Behaviour that I do not really want. ;)

So, this is the ouput of this program during its execution but in
debug mode :

machinename: Reading configuration data /.ssh/config
machinename: Reading configuration data /etc/ssh_config
machinename: Connecting to localhost, port 22.
machinename: Socket created, turning on blocking...
machinename: Remote protocol version 2.0, remote software version
VShell_2_6_4_4
8 VShell
machinename: Net::SSH::perl Version 1.23_01, protocol version 2.0.
machinename: No compat match: VShell_2_6_4_448 VShell
machinename: Connection established.
machinename: Sent key-exchange init (KEXINIT), wait response.
machinename: Algorithms, c->s: 3des-cbc hmac-sha1 none
machinename: Algorithms, s->c: 3des-cbc hmac-sha1 none
machinename: Entering Diffie-Hellman Group 1 key exchange.
machinename: Sent DH public key, waiting for reply.
machinename: Received host key, type 'ssh-dss'.
machinename: Host 'localhost' is known and matches the host key.
machinename: Computing shared secret key.
machinename: Verifying server signature.
machinename: Waiting for NEWKEYS message.
machinename: Enabling incoming encryption/MAC/compression.
machinename: Send NEWKEYS, enable outgoing encryption/MAC/
compression.
machinename: Sending request for user-authentication service.
machinename: Service accepted: ssh-userauth.
machinename: Trying empty user-authentication request.
machinename: Authentication methods that can continue: password.
machinename: Next method to try is password.
machinename: Trying password authentication.
machinename: Login completed, opening dummy shell channel.
machinename: channel 0: new [client-session]
machinename: Requesting channel_open for channel 0.
machinename: channel 0: open confirm rwindow 32768 rmax 16384
machinename: Got channel open confirmation, requesting shell.
machinename: Requesting service shell on channel 0.
machinename: channel 1: new [client-session]
machinename: Requesting channel_open for channel 1.
machinename: Entering interactive session.
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
machinename: Sending command: cluster localhost group /status
machinename: Requesting service exec on channel 1.
machinename: channel 1: open confirm rwindow 32768 rmax 16384
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 118
IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110

Now, cherry on the cake!
I have tried to do the same test with an OpenSSH deamon - for the
server side, I mean -.
Ok, I always have the error message :

IO::Socket::INET at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm line 295
IO::String at C:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 110
BlaBla...

But in contrary of Vshell the Perl SSH client script does not seem
stuck.
it runs every time.

This what I have noticed :
With Vandyke VShell, the script uses

machinename: channel 0: open confirm rwindow 32768 rmax 16384

However with OpenSSH, the script uses :

machinename: channel 1: open confirm rwindow 0 rmax 32768

So I have got five questions :

- How can I make my little Perl SSH Client script work ?
- How can I fix error message during the Perl script execution ?
- Why there is difference between Vshell and OpenSsh with the SSH
packet window size ?
- Is there a way to specify the SSH packet window size in Perl?
- Could you give me a hand please ?

Thanks a lot in advance.
BR
Fred

RE: How can I fix error message during the Perl script execution ?

I meet the same problem those days, and I try to find the solution
from internet.
However, there are few info about this issue. So I decide to dug it by
myself. When I debug the script into Carp.pm (version 1.04). I find
the reason.

in line 271 just replace

sub carp { warn shortmess @_ }

to

sub carp { }

all strange messages are gone.

Vincent Chen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top