#! /bin/bash
based=/data/wwwroot
for f in `cat $1`; do
if [ -f $based/$f ]; then
if grep -q -i 'base64' $based/$f ; then
ls -l $based/$f
echo "base64"
grep -i 'base64' $based/$f
fi
if grep -q -i system\s*\( $based/$f ; then
ls -l $based/$f
echo "system\s*\("
grep -i system\s*\( $based/$f
fi
if egrep -i -q "select\s*|insert\s*|update\s*|grant\s*|create\s*" $based/$f; then
ls -l $based/$f
echo 'select\s*|insert\s*|update\s*|grant\s*|create\s*'
egrep -i "select\s*|insert\s*|update\s*|grant\s*|create\s*" $based/$f
fi
if egrep -i -q '\$_POST|\$_REQUEST|\$_GET|\$_SESSION' $based/$f; then
ls -l $based/$f
echo ''\$_POST|\$_REQUEST|\$_GET|\$_SESSION''
egrep -i '\$_POST|\$_REQUEST|\$_GET|\$_SESSION' $based/$f
fi
fi
done
使用方法:脚本假设你的网站根目录在 /data/wwwroot, 脚本名为 scan.sh你还需要做:1. cd /data/wwwroot2. find ./ -name "*.php" >/tmp/phpfile.list3. /bin/bash scan.sh /tmp/phpfile.list > scan.log查看scan.log 即可。