Skip to content

Instantly share code, notes, and snippets.

@s5csimmons
Created March 26, 2015 19:59
Show Gist options
  • Save s5csimmons/f7cd19a27c8803af1574 to your computer and use it in GitHub Desktop.
Save s5csimmons/f7cd19a27c8803af1574 to your computer and use it in GitHub Desktop.
#!/bin/bash
for website in $(awk --posix '/ServerName/ { if ( $2 !~ /([0-9]{1,3}\.){3}[0-9]+/ && $2 != ENVIRON["HOSTNAME"] && $2 !~ /^_wildcard_/ ) print $2 }' /etc/httpd/conf/httpd.conf)
do
((totalSites++))
curl -s http://labs.sucuri.net/?is-my-wordpress-ddosing=$website | grep -q "Good: Your Website"
[ "$?" -ne "0" ] && badSites+=($website) || ((goodSites++))
sleep 1
done
echo "Out of $totalSites total websites on this server, $goodSites of them are clean."
[ "${badSites[0]}" ] && echo "The following sites came back as having been a part of a DDoS attack though:"; printf '%s\n' ${badSites[*]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment