Posted on 2008-12-09 21:47:57-08 by drfunk in response to 9502
Re: SSH2 0.18 on windows
#!C:\perl\bin\perl -w use strict; use Net::SSH2; use MIME::Base64; my $user="user1"; my $pass="somepasswd"; my $ssh2 = Net::SSH2->new(); $ssh2->debug(1); $ssh2->connect(host1) or die "Unable to connect host $@ \n"; my $dp=decode_base64("$pass"); $ssh2->auth_password("$user","$dp"); my $chan = $ssh2->channel(); $chan->exec('sh ver'); my $buflen = 30000; my $buf1 = '0' x $buflen; $chan->read($buf1, $buflen); print "BUF1:\n", $buf1,"\nEND BUF1:\n\n"; $chan = $ssh2->channel(); $chan->exec('sh int'); $chan->read($buf1, $buflen); print "BUF2:\n", $buf1,"\n";
Direct Responses: 9542 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.