快速查找PHP木马

13 年 ago jony 快速查找PHP木马已关闭评论

一句话查找PHP木马

  1. # find ./ -name "*.php" |xargs egrep "phpspy|c99sh|milw0rm|eval\(gunerpress|eval\(base64_decoolcode|spider_bc"> /tmp/php.txt
  2. # grep -r --include=*.php  '[^a-z]eval($_POST' . > /tmp/eval.txt
  3. # grep -r --include=*.php  'file_put_contents(.*$_POST\[.*\]);' . > /tmp/file_put_contents.txt
  4. # 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

查找最近一天被修改的PHP文件

  1. #   find -mtime -1 -type f -name \*.php

修改网站的权限

  1. # find -type f -name \*.php -exec chmod 444 {} \;
  2. # find ./ -type d -exec chmod 555{} \;

查文件中的一段字符:

find  -name '*.php'|xargs grep '21fb29'

查找所有php文件中带有21fb29字段的文件

查找文件/夹大的前10个目录/文件:

du -s * | sort -nr | head

转自:http://www.xtgly.com/2011/11/21/linux-shell%E5%BF%AB%E9%80%9F%E6%9F%A5%E6%89%BEphp%E6%9C%A8%E9%A9%AC.htm