Guest User

Untitled

a guest
Aug 12th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. read -sp "Password: " passw < /dev/tty
  4.  
  5. host=$1
  6. user=$2
  7. base=$3
  8. query=$4
  9.  
  10. function adsearch {
  11. query=$1
  12. ldapsearch -x -LLL -D "$user" -b "$base" -w "$passw" -h "$host"($query)" samaccountname
  13. }
  14.  
  15. function getusername {
  16. perl -nle '/sAMAccountName: (.*)/ && print $1'
  17. }
  18.  
  19. adsearch "$passw" "$query"
Add Comment
Please, Sign In to add comment