#!/opt/csw/bin/perl use strict; use warnings; use Net::SSH2; use constant BUFLEN => 10_0000; my $host = ""; my $user = ""; my $pass = ""; my $buf; my $ssh2 = Net::SSH2->new(); my $ok = 1; print "==> $host\n"; $ssh2->connect($host) or $ok = 0; if ( !$ok ) { print "Probable telnet\n"; exit(1); } if ( !$ssh2->auth_password( $user, $pass ) ) { print "==> 4 pass fail\n"; exit(1); } my $chan2 = $ssh2->channel(); $chan2->shell(); print $chan2 ("term len 0\n"); $chan2->read( $buf, BUFLEN ); print $buf; print $chan2 ("dir\n"); $chan2->read( $buf, BUFLEN ); print $buf;