Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

hbcheck Heartbleed nmap/openssl bash script

By: a guest on Apr 9th, 2014  |  syntax: None  |  size: 0.44 KB  |  views: 1,976  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2.  
  3. if [[ $# -eq 0 ]] ; then
  4.     echo 'Usage: ./hbcheck <ip-range> eg. 192.168.1.0/24'
  5.     exit 0
  6. fi
  7.  
  8. tmpfile="tmp$RANDOM"
  9.  
  10. nmap -sT -p 443 --open -n -r -PN $1 |  grep report | awk '{print $5}' > $tmpfile
  11.  
  12. for i in $(awk '{print}' < $tmpfile )
  13. do
  14. echo "Checking $i"
  15. echo EOF | openssl s_client -connect $i:443 -tlsextdebug 2<&1| grep 'server extension "heartbeat" (id=15)' || echo "$i is safe"
  16. done
  17.  
  18. rm $tmpfile
  19.  
  20. exit 0