Skip to content

Instantly share code, notes, and snippets.

@r4ulcl
Created June 24, 2019 14:43
Show Gist options
  • Save r4ulcl/b61f8fc4b17d527112b310183e9562e4 to your computer and use it in GitHub Desktop.
Save r4ulcl/b61f8fc4b17d527112b310183e9562e4 to your computer and use it in GitHub Desktop.
Find WordPress Version and Default files.
if [ "$#" -ne 1 ]; then
echo "Illegal number of parameters"
exit 1
fi
URL=$1
DefFolder="/wp-admin/ /wp-includes/ /wp-content/ /wp-update/ /feed/ /comments/feed/"
DefFile="/robots.txt /sitemap.xml /wp-includes/version.php /wp-login.php?action=register /wp-includes/cache.php /wp-config.php /wp-login.php /xmlrpc.php /wp-cron.php /version.php"
DefFileV="/readme.html /license.txt /feed/ /comments/feed/ /wp-includes/version.php /wp-links-opml.php /feed/rdf/ /feed/atom/"
echo "WP script"
echo -e "\nFOLDERS"
for FOLDER in $DefFolder; do
echo -n "$URL$FOLDER: "
curl -s -o /dev/null -w "%{http_code}" $URL$FOLDER
echo
done
echo -e "\nFILES"
for FILE in $DefFile; do
echo -n "$URL$FILE: "
curl -s -o /dev/null -w "%{http_code}" $URL$FILE
echo
done
echo -e "\nFILES VERSION WP"
for FILEV in $DefFileV; do
echo -n "$URL$FILEV: "
CODE=$(curl -s -o /dev/null -w "%{http_code}" $URL$FILEV)
echo -n $CODE
if [ $CODE = "200" ]; then
VERSION=$(curl $URL$FILEV -s | grep -E "WordPress/[0-9.]*|wordpress.org/\?v=[0-9.]*| version=\"[0-9.]*\">WordPress" -o)
if test -z $VERSION ; then
echo -n " No version"
else
echo -n " Version: "
echo -n $VERSION
fi
fi
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment