网络编程
位置:首页>> 网络编程>> 数据库>> 清除SQL被注入恶意病毒代码的语句

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

 来源:asp之家 发布时间:2010-03-03 09:59:00 

标签: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;

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com