I have been consulted to help with a hacked database which has had lots of link injection in thousands of rows.

我被告知要帮助一个被黑客攻击的数据库,这个数据库有成千上万行的链接注入。

The basic format of the link injection appears to always be as follows:

链接注入的基本格式似乎总是如下所示:

<a href="http://SOME-RANDOM-LINK-HERE.com/" style="text-decoration:none;color:#676c6c">SOME RANDOM TEXT HERE</a>

Essentially I need to delete ALL A tags that contain a style attribute of text-decoration:none;color:#676c6c

本质上,我需要删除所有包含文本修饰样式属性的标记:none;color:#676c6c

I am looking for the fastest solution. Whether it be regular expressions or something else, any guidance is greatly appreciated. Thank you!

我在寻找最快的解决方案。无论是正则表达式还是其他什么,任何指导都是非常值得赞赏的。谢谢你!

1 个解决方案

#1


2

You can look for injected links using this regex.

您可以使用这个regex查找注入的链接。

Regex: <a .*? style="text-decoration:none;color:#676c6c".*?>.*?<\/a>

Regex:< . * ?风格= "文字修饰:没有,颜色:# 676 c6c”。* ? >。* ? < \ / >

This will look for <a></a> with style="text-decoration:none;color:#676c6c". This won't touch other links.

这将寻找 style="text-decoration:none;color:#676c6c"。这不会影响到其他链接。

Regex101 Demo

Regex101演示

You should also check this answer on how to do replace in MySql.

您还应该检查这个关于如何在MySql中进行替换的答案。

更多相关文章

  1. mysql 事物没提交导致事物一直运行解决方案
  2. 无法连接远程MySQL数据库的解决方案
  3. [征集] MySQL交叉表解决方案及散分
  4. java链接数据库--Mysql
  5. Yahoo,Msn,Skype,QQ,阿里旺旺在线聊天链接接口调用
  6. PHP MYSQL 出现中文乱码的解决方案
  7. Amoeba for MySQL---分布式数据库Proxy解决方案
  8. MySQL开启远程链接(2014.12.12)
  9. MySQL数据库导入或者同步大量数据时数据丢失解决方案

随机推荐

  1. asp .net 面试题及答案分享
  2. angularjs是怎么为ng-click事件传递参数
  3. WPF核心的技术--数据绑定
  4. 比如说我们要从用户表customer和用户订单
  5. MVC 5限制所有HTTP请求必须是POST方式
  6. lambda表达式进行对象结合操作的实例详解
  7. 最新开源DBLayer的详细介绍
  8. IIS中出现了时间格式转换错误该如何解决?
  9. C#中匿名委托以及Lambda表达式的实例详解
  10. WPF实现简单的进度条怎么做?