Skip to content

Instantly share code, notes, and snippets.

@bahadoribnm
Last active August 31, 2022 05:35
Show Gist options
  • Save bahadoribnm/2a57cc5a7e0be2e169dc31f2c2b8daed to your computer and use it in GitHub Desktop.
Save bahadoribnm/2a57cc5a7e0be2e169dc31f2c2b8daed to your computer and use it in GitHub Desktop.
Bash script to find Joomla and Wordpress versions in cPanel
#!/bin/bash
find /home/*/public_html/libraries/cms/* -type f -name 'version.php' |\
while read filepath;
do
#version=$(cat $filepath |grep -Po "const RELEASE = '\K[^']*");
#[ ! -z version ] && echo $(echo $filepath |cut -d "/" -f 3) $version >> joomla.version
echo $(echo $filepath |cut -d "/" -f 3) $(cat $filepath |grep -Po "const RELEASE = '\K[^']*") >> joomla.version
done;
find /home/*/public_html/wp-includes -type f -name 'version.php'|\
while read fname;
do
echo -e "$(echo $fname|cut -d "/" -f 3) \t\t|$(grep '$wp_version' $fname)" >> wordpress.version
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment