Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use Net::SSH2;
- use strict;
- my $ssh = Net::SSH2->new();
- $ssh->connect('xx.xx.xx.xx');
- $ssh->auth(username => 'xxxxxx', password => 'xxxxx');
- my $channel = $ssh->channel() or do { print" [LOG ERROR]: Failed to create channel. Exiting ...n"};
- $channel->blocking(0);
- $channel->shell() ;
- sleep(5);
- my $cmd='df -h';
- print $channel "$cmdn";
- sleep(5);
- while(<$channel>)
- {
- print $_;
- }
- $channel->close();
- $ssh->disconnect();
Add Comment
Please, Sign In to add comment