Advertisement
Guest User

Untitled

a guest
Jun 30th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #!/usr/bin/env perl
  2. use Net::LDAP;
  3. use feature 'say';
  4. use POSIX qw(strftime);
  5.  
  6. use strict;
  7. use warnings;
  8.  
  9. my $user = '';
  10. my $pass = '';
  11.  
  12. my $strftime_format = "%m/%d/%Y %H:%M:%S";
  13.  
  14. my @servers = ('dc01', 'dc02', 'dc03', 'dc04');
  15.  
  16. while(1) {
  17. foreach my $server (@servers) {
  18. print strftime($strftime_format, localtime) . " Connecting to $server\n";
  19. my $ldap = Net::LDAP->new($server) or die "$@";
  20.  
  21. my $bind_result = $ldap->bind($user, password => $pass);
  22. print strftime($strftime_format, localtime) . ' ' . $bind_result->{errorMessage} . "\n" if $bind_result->{resultCode} != 0;
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement