-
-
Save hiphopsmurf/5390874 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script inspired by https://gist.github.com/1025598 | |
#### WARNING #### | |
#### Please be careful with this script. The use of eval $(find) is dangerous. | |
#### If a user can upload a file called wp-config.php anywhere onto your site, | |
#### they can probably execute arbitrary commands via this script. | |
#### You have been warned. GPL, no warranty. | |
# Inspired by http://stackoverflow.com/questions/7586995/read-variables-from-wp-config-php | |
eval $(find . -name "wp-config.php" -print0 | xargs -0 -r grep -e "DB_HOST" -e "DB_NAME" -e "DB_USER" -e "DB_PASSWORD" | awk -F"[()']" '/^define/{printf "%s=\"%s\"\n", $3, $5;}') | |
DOMAINS=$(mysql --silent --skip-column-names --host $DB_HOST --user $DB_USER -p$DB_PASSWORD $DB_NAME --execute "SELECT CONCAT(domain,path) FROM wp_blogs WHERE archived = '0' AND spam = '0' AND deleted = '0';") | |
for DOMAIN in $DOMAINS | |
do | |
wget --quiet --output-document=/dev/null http://$DOMAIN | |
sleep 2 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment