我正在自动化一个脚本,该脚本在大型站点上的所有 php 文件中搜索危险命令。找到的文件将进行手动代码审查。
有人对我的剧本有什么建议吗?有什么我忘记搜索的吗?请注意,这个脚本是在 10 分钟内完成的,所以我确信可以进行很多改进以使其更容易和更好(比如多个 egrep 参数)。
find . | grep "php$" | xargs grep -s "eval(" >> /tmp/review.txt
find . | grep "php$" | xargs grep -s "fopen(" >> /tmp/review.txt
find . | grep "php$" | xargs grep -s "passthru(" >> /tmp/review.txt
find . | grep "php$" | xargs grep -s "exec(" >> /tmp/review.txt
find . | grep "php$" | xargs grep -s "proc_" >> /tmp/review.txt
find . | grep "php$" | xargs grep -s "dl(" >> /tmp/review.txt
find . | grep "php$" | xargs grep -s "require($" >> /tmp/review.txt
find . | grep "php$" | xargs grep -s "require_once($" >> /tmp/review.txt
find . | grep "php$" | xargs grep -s "include($" >> /tmp/review.txt
find . | grep "php$" | xargs grep -s "include_once($" >> /tmp/review.txt
find . | grep "php$" | xargs grep -s "include($" >> /tmp/review.txt
find . | grep "php$" | xargs grep -s "query(" >> /tmp/review.txt