社区应用 最新帖子 精华区 社区服务 会员列表 统计排行
  • 6825阅读
  • 2回复

[分享]小学生,主机中木马后,几行代码自救

楼层直达
z3960 
级别: 茶馆馆主
发帖
770593
飞翔币
207694
威望
215657
飞扬币
2511651
信誉值
8

[font=-apple-system, BlinkMacSystemFont, &quot]使用explorer ftp没发现木马文件,asp文件管理器能看得到news.php[font=-apple-system, BlinkMacSystemFont, &quot][font=-apple-system, BlinkMacSystemFont, &quot][font=-apple-system, BlinkMacSystemFont, &quot]点进去就转跳到美国**媒体,点删除就报错
主机管理台直接清空主机,同样报错
[font=-apple-system, BlinkMacSystemFont, &quot][font=-apple-system, BlinkMacSystemFont, &quot]因为不太会asp,所以改php。[font=-apple-system, BlinkMacSystemFont, &quot]网上搜索到简单模板,然后看PHP Filesystem 参考手册[font=-apple-system, BlinkMacSystemFont, &quot][font=-apple-system, BlinkMacSystemFont, &quot]发现木马news.php的[font=-apple-system, BlinkMacSystemFont, &quot]所有者fileowner()不是特殊的,问题就简单多了只是单纯的权限问题。修改php增加修改文件权限[font=-apple-system, BlinkMacSystemFont, &quot][font=-apple-system, BlinkMacSystemFont, &quot]先chmod 再删除[font=-apple-system, BlinkMacSystemFont, &quot]就把木马删除掉了

[PHP] 纯文本查看 复制代码

?[tr=none]
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
<html>    <head>        <title>文件管理</title>        <meta charset='utf-8' />    </head>    <body>        <?php            //定义要查看的目录            $dir=dirname(__FILE__);                         //先判断$_GET['a']是否已经传值 防止NOTICE错误            if(isset($_GET['a'])){                //选择判断要执行的操作                switch($_GET['a']){                    case 'creat':                        //新建文件                        $filename=$_POST["filename"];                        $filename=rtrim($dir,"/")."/".$filename;                        //写入文件 写入一个空字符串                        file_put_contents($filename,"");                        break;                    case 'del':                        //删除文件                        unlink($_GET['filename']);                        break;                    case 'ch':                        //文件                        chmod($_GET['filename'],0777);                        break;                    case 'update':                        //修改文件                        file_put_contents($_POST['filename'],$_POST['content']);                        echo "修改成功";                        header("refresh:1;url=index.php");                        break;                }            }                     ?>        <center>            <h1>文件管理</h1>            <form action='index.php?a=creat' method='post'>                文件:<input type='text' name='filename' />                <input type='submit' value='新建' />            </form>            <table border='1' width='900' cellpadding='5' cellspacing='0'>                <tr>                    <th>文件名</th>                    <th>类型</th>                    <th>大小</th>                    <th>创建时间</th>                    <th>所有者</th>                    <th>权限</th>                    <th>操作</th>                </tr>                <?php                    //遍历目录                    $dd=opendir($dir);                    while(false !== ($f=readdir($dd))){                        //过滤点                        if($f == "." || $f == ".."){                            continue;                        }                        //拼路径                        $file=rtrim($dir,"/")."/".$f;                        //防止中文乱码                        $f2=iconv("gb2312","utf-8",$f);                        echo "<tr>";                            echo "<td>{$f2}</td>";                            echo "<td>".filetype($file)."</td>";                            echo "<td>".filesize($file)."</td>";                            echo "<td>".date("Y-m-d H:i:s", filectime($file))."</td>";                            echo "<td>".fileowner($file)."</td>";                            echo "<td>".substr(sprintf("%o",fileperms($file)),-4)."</td>";                            echo "<td align='center'>                                    <a href='index.php?a=edit&filename={$file}'>修改</a>|                                    <a href='index.php?a=del&filename={$file}'>删除</a>|                                    <a href='index.php?a=ch&filename={$file}'>chmod</a>                                  </td>";                        echo "</tr>";                                         }                ?>            </table>            <?php                if(isset($_GET['a']) && $_GET['a']=='edit'){                    echo "<hr/>";                    echo "<form action='index.php?a=update' method='post'>";                        echo "文件名:<input type='text' name='filename' readonly value='{$_GET['filename']}'  />";                        echo "<br/><br/>";                        echo "<textarea name='content' rows='5' cols='30'>".file_get_contents($_GET['filename'])."</textarea>";                        echo "<br/><br/>";                        echo "<input type='submit' value='保存修改' />";                    echo "</form>";                }                         ?>        </center>    </body></html>[font=-apple-system, BlinkMacSystemFont, &quot]木马解决了,又继续愉快的小学生活
关键词: 木马
我不喜欢说话却每天说最多的话,我不喜欢笑却总笑个不停,身边的每个人都说我的生活好快乐,于是我也就认为自己真的快乐。可是为什么我会在一大群朋友中突然地就沉默,为什么在人群中看到个相似的背影就难过,看见秋天树木疯狂地掉叶子我就忘记了说话,看见天色渐晚路上暖黄色的灯火就忘记了自己原来的方向。
级别: 超级版主
发帖
836105
飞翔币
228724
威望
224673
飞扬币
2459971
信誉值
0

只看该作者 1 发表于: 2022-07-23
来看一下
级别: 超级版主
发帖
836105
飞翔币
228724
威望
224673
飞扬币
2459971
信誉值
0

只看该作者 2 发表于: 2022-07-23
不错,了解了