-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmscheck.cron
55 lines (45 loc) · 2.37 KB
/
cmscheck.cron
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
#Developed by Bill Brooks
#Contributions by Colin Roche-Dutch, Dominik Poetek, Connar Pierce
#This script is designed to search for out of date Wordpress, Joomla, and Drupal installation
### Features to impliment:
### Account verification
### Error handling when no account is provided
### Log locations and versions
### Retrieve Wordpress version
#Run cmscheck script
#date +"%d/%b/%Y" >> cmscheck.log
#sh cmscheck -e >> cmscheck.log
#Current version functions
function currentw
{
#curl -s https://wordpress.org/download/ |grep 'WordPress (Version' |awk -F 'Version ' '{print$2}' |awk -F ') ' '{print$1}'
echo "Wordpress locations and version: (`curl -s https://wordpress.org/download/ |grep 'WordPress (Version' |awk -F 'Version ' '{print$2}' |awk -F ') ' '{print$1}'`)"
}
function currentj
{
echo "Joomla locations and versions: (`lynx http://www.joomla.org/download.html --accept_all_cookies -dump |grep -i 'full package' |awk '{print$3}' |grep -v Full`)"
}
function currentd
{
echo "Drupal locations and versions: (`curl -s https://www.drupal.org/download |grep 'Download Drupal' |grep -v 'core files' |awk -F 'Drupal ' '{print$2}' |awk -F '</' '{print$1}'`)"
}
function exhaustive {
#Wordpress
tput bold
currentw
tput sgr0
for i in $(grep USER /var/cpanel/users/* |awk -F= '{print$2}' |grep -v system); do find /home/$i/public_html/ -type d -name wp-includes -print -exec grep -Ri '$wp_version =' {} \; |grep version.php |awk -F 'version.php:$wp_version = ' '{print$1.$2}' |sed 's/wp-includes\/version.php:$wp_version\ =//' |sed 's/;//' |awk '{print$1,$2}';done
#Joomla
tput bold
currentj
tput sgr0
for i in $(grep USER /var/cpanel/users/* |awk -F= '{print$2}' |grep -v system); do find /home/$i/public_html -type d -name version -exec grep -Ri '$RELEASE =' {} \; | grep 'cms/version' |awk -F libraries/cms/version/version.php: '{print$1,$2}' |sed 's/public $RELEASE = //' |sed 's/;//' |awk '{print$1,$2}';done
#Drupal
tput bold
currentd
tput sgr0
for i in $(grep USER /var/cpanel/users/* |awk -F= '{print$2}' |grep -v system); do find /home/$i/public_html/ -type d -name includes -print -exec grep -Ri 'VERSION' {} \; |grep bootstrap.inc |grep "('VERSION'." |awk -F includes/bootstrap.inc:define '{print$1,$2}' |sed "s/('VERSION', //" |sed "s/);//" |awk '{print$1,$2}';done
}
#Execute
exhaustive |awk '{print strftime("[%d %b %Y %H:%M:%S]"), $0 }' > cmscheck.log