快速查看php程序有沒有***

#! /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 即可。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章