Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use Net::SSH::Perl;
- open (my $fh,"<", "iplist.txt") or die $!;
- my @hosts = <$fh>;
- my $user = "guest";
- my $pass = 'p@ssw0rd';
- my $cmd = "ls /etc";
- for my $host (@hosts) {
- my $ssh = Net::SSH::Perl->new($host);
- $ssh->login($user, $pass);
- my($stdout, $stderr, $exit) = $ssh->cmd($cmd);
- print "$stdout";
- }
Add Comment
Please, Sign In to add comment