zoukankan      html  css  js  c++  java
  • Linux如何使用shell命令检测PHP木马防止脚本木马的破坏

     1、一句话查找PHP木马

      代码如下

      # find / -name "*.php" |xargs egrep "phpspy|c99sh|milw0rm|eval(gunerpress|eval(base64_decoolcode|spider_bc" >> /tmp/php.txt

      #  grep -r --include=*.php '[^a-z]eval($_POST'. >> /tmp/eval.txt

      # grep -r --include=*.php 'file_put_contents(.*$_POST[.*]);' . >> /tmp/file_put_contents.txt

      # 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

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

      一般站点里的页面文件都很少更改,当然动态临时生成的除外。而那些一般不会变的页面目录里的文件如果被修改了,可大可能是被人做了手脚。

      代码如下

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

      3、修改网站的权限

      代码如下

      # find -type f -name *.php -exec chmod 444 {} ;

      # find ./ -type d -exec chmod 555{} ;

      4、常见的一句话后门:

      代码如下

      grep -r --include=*.php '[^a-z]eval($_POST'. >> grep.txt

      grep -r --include=*.php 'file_put_contents(.*$_POST[.*])'. >> grep.txt

      把搜索结果写入文件,下载下来慢慢分析,其他特征木马、后门类似。有必要的话可对全站所有文件来一次特征查找,上传图片肯定有也捆绑的,来次大清洗

      5、禁用不常用函数

      将用不到的权限又比较大的php函数在php.ini文件里禁掉。修改方法如下:

      disable_functions = system,exec,shell_exec

      上面就是Linux使用shell命令检测PHP木马的方法介绍了,在不确定自己的网站是否被攻击的情况下,最好使用shell命令检测下。

    转 https://www.jb51.net/LINUXjishu/343023.html

  • 相关阅读:
    js上移、下移排序 效果
    如何为平板打造完美的网站页面?
    [BUUOJ]刮开有奖reverse
    [0CTF 2016]piapiapia
    [TSCTFJ 2019]bypass
    [安洵杯 2019]easy_serialize_php
    [TSCTFJ] relax
    c#访问网页
    DNN 数据访问
    c#访问数据库
  • 原文地址:https://www.cnblogs.com/handle/p/11774415.html
Copyright © 2011-2022 走看看