Skip to content

Instantly share code, notes, and snippets.

@MasonSpeed
Last active November 10, 2024 22:38
Show Gist options
  • Select an option

  • Save MasonSpeed/bac1661a87d2fe9e780906c670b7a789 to your computer and use it in GitHub Desktop.

Select an option

Save MasonSpeed/bac1661a87d2fe9e780906c670b7a789 to your computer and use it in GitHub Desktop.
#!/bin/bash
FILE=wp-config.php
for d in */; do
# Just... yeah
if [ "$d" != "ottersbusinesshub.co.uk/" ]; then
if [ "$d" != "lilymaehomecare.com/" ]; then
echo ""
echo "Entering $d..."
sudo chown -R www-data:www-data $d
cd $d
if test -f "$FILE"; then
echo ""
echo "Removing common hack files"
rm -rf wp-content/mcloud-reports
rm -rf wp-content/mcloud-view-cache
rm -rf wp-content/themes/sketch
rm -rf wp-content/themes/twenty*
rm -rf wp-admin.php
rm -rf admin.php
rm -rf .wp-config.php.swp
rm -rf wp-config.php.swp
rm -rf _wp-config.php
rm -rf wp-admin/.htaccess
rm -rf wp-admin/*.txt
rm -rf 3index.php
rm -rf old-index.php
rm -rf wikindex.php
rm -rf plugin-install.php
rm -rf wp-booking.php
rm -rf rindex.php
rm -rf jindex.php
rm -rf accesson.php
rm -rf on.php
rm -rf wp-content/mu-plugins-old
rm -rf wp-content/plugins/wp-core-*
rm -rf index.php
rm -rf style.php
rm -rf styel.php
rm -rf static
rm -rf info.php
rm -rf stylec.php
rm -rf robots.txt
rm -rf vgp8uc.php
rm -rf hbhbrdryld.php
rm -rf system_log.php
rm -rf container.php
rm -rf .maintenance
rm -rf about.php
rm -rf fiq0jz
rm -rf index.php.1
rm -rf export.php
rm -rf shesource*
rm -rf pkuqyoeidjn.php
rm -rf popular.php
sudo find . -type f -name "hbhbrdryld.php" -exec rm -rf {} \;
echo ""
echo "Removing .htaccess files"
sudo find . -type f -name ".htaccess" -exec rm -rf {} \;
echo ""
echo "Creating real .htaccess file"
if ! wp core is-installed --network --skip-plugins --skip-themes --allow-root; then
echo '<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</IfModule>' >.htaccess
fi
if wp core is-installed --network --skip-plugins --skip-themes --allow-root; then
echo 'RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]' >.htaccess
fi
wget https://raw.githubusercontent.com/WordPress/WordPress/master/index.php
echo 'User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php' >robots.txt
echo ""
echo "Reinstalling Wordpress"
rm -rf wp-admin
rm -rf wp-includes
wp core download --force --skip-plugins --skip-themes --skip-content --allow-root
echo ""
echo "Reinstalling Plugins"
wp plugin install $(wp plugin list --skip-plugins --skip-themes --field=name --allow-root) --skip-plugins --skip-themes --force --allow-root
wp plugin update --all --allow-root --allow-root
wp plugin install aryo-activity-log --activate --skip-plugins --skip-themes --force --allow-root
echo ""
echo "Regenerating salt keys"
wp config shuffle-salts --allow-root
echo "-------------------"
fi
cd ../
fi
fi
done
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment