Advertisement
Guest User

hbcheck Heartbleed nmap/openssl bash script

a guest
Apr 9th, 2014
10,837
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement