#! /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/wwwroot
2. find ./ -name "*.php" >/tmp/phpfile.list
3. /bin/bash scan.sh /tmp/phpfile.list > scan.log
查看scan.log 便可。php