站长论坛

标题: 清除SQL被注入恶意病毒代码的语句 [打印本页]

作者: superadmin    时间: 2010-2-1 11:50
标题: 清除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;




欢迎光临 站长论坛 (http://tzlink.com/bbs/) Powered by Discuz! X3.2