summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--php-malware-finder/docroot-check.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/php-malware-finder/docroot-check.sh b/php-malware-finder/docroot-check.sh
new file mode 100644
index 0000000..a5cce6e
--- /dev/null
+++ b/php-malware-finder/docroot-check.sh
@@ -0,0 +1,21 @@
1#!/usr/bin/env bash
2
3apache_confdir="/etc/apache2/sites-available"
4
5# grab the different document roots
6for docroot in $(grep -o 'DocumentRoot.*' $apache_confdir/* | \
7 awk '{if ($2 ~ "/data/www/*") print $2}') ; do
8
9 pmf_output_dir=$(echo $docroot |egrep -o '[^/]*/[^/]*$')
10 mkdir -p /tmp/$pmf_output_dir
11
12 SAVEIFS=$IFS
13 IFS=$(echo -en "\n\b")
14 find $docroot -type f -iname "*php" -exec yara /etc/phpmalwarefinder/malwares.yara {} > \
15 /tmp/$pmf_output_dir/cron.out 2>&1 \;
16
17 if [ -s /tmp/$pmf_output_dir/cron.out ]; then
18 cat /tmp/$pmf_output_dir/cron.out | \
19 mail -s "PMF REPORT:$(uname -n) DocumentRoot $docroot" jre@nbs-system.com
20 fi;
21done