Advertisement
Guest User

Untitled

a guest
Jan 10th, 2010
471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.61 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. numtries=10000
  4. hosts=(host1.localhost.local host2.localhost.local host3.localhost.local)
  5.  
  6. checkcert()
  7. {
  8.     output=$(gnutls-cli $1 &)
  9.     check=$(echo "$output" | grep "hostname")
  10.  
  11.     if [[ "$check" != *NOT* ]]; then
  12.         # match
  13.         echo -en "\e[32m"
  14.         echo "$check"
  15.         echo -en "\e[0m"
  16.     else
  17.         # no match
  18.         echo -en "\e[31m"
  19.         echo "$output"
  20.         echo -en "\e[0m"
  21.         exit 1
  22.     fi
  23. }
  24.  
  25. randhost()
  26. {
  27.     let "i = $RANDOM % ${#hosts[@]}"
  28.  
  29.     echo ${hosts[$i]}
  30. }
  31.  
  32.  
  33. for i in $(seq 1 $numtries)
  34. do
  35.     checkcert $(randhost)
  36. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement