#!/bin/bash
#wirte by zhenglong 20150818
#centos
# php trojan checking
email=1525356778@qq.com
rm -rf /tmp/file.txt
echo contain suspicious files: >> /tmp/file.txt
find / -name *.php -type f -print0 | xargs -0 egrep (phpspy|c99sh|milw0rm|eval\(gzuncompress\(base64_decoolcode|eval\(base64_decoolcode|spider_bc|gzinflate) | awk -f: '{print $1}' | sort | uniq >> /tmp/file.txt
echo -e \ncontain file_put_contents: >>/tmp/file.txt
grep -r --include=*.php 'file_put_contents(.*$_post\[.*\]);' / >>/tmp/file.txt
echo -e \ncontain eval: >> /tmp/file.txt
grep -r --include=*.php '[^a-z]eval($_post' / >>/tmp/file.txt
echo -e \n php file change in one day: >> /tmp/file.txt
find / -mtime -1 -type f -name *.php >>/tmp/file.txt
cat /tmp/file.txt |mail -s php trojan ${email}