Mysql搜索并与regex删除。
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中进行替换的答案。
更多相关文章
- mysql 事物没提交导致事物一直运行解决方案
- 无法连接远程MySQL数据库的解决方案
- [征集] MySQL交叉表解决方案及散分
- java链接数据库--Mysql
- Yahoo,Msn,Skype,QQ,阿里旺旺在线聊天链接接口调用
- PHP MYSQL 出现中文乱码的解决方案
- Amoeba for MySQL---分布式数据库Proxy解决方案
- MySQL开启远程链接(2014.12.12)
- MySQL数据库导入或者同步大量数据时数据丢失解决方案