萬盛學電腦網

 萬盛學電腦網 >> 數據庫 >> mssql數據庫 >> 清除SQL被注入惡意病毒代碼的語句

清除SQL被注入惡意病毒代碼的語句

在SQL查詢分析器執行以下代碼就可以了。

復制代碼 代碼如下:


declare @t varchar(255),@c varchar(255)
declare table_cursor cursor for select a.name,b.name
from sysobjects a,syscolumns b ,systypes c
where a.id=b.id and a.xtype='u' and c.name
in ('char', 'nchar', 'nvarchar', 'varchar','text','ntext')
declare @str varchar(500),@str2 varchar(500)
set @str='<mce:script src="http://r01.3322.org/c.js" mce_src="http://r01.3322.org/c.js"></mce:script>'/*要替換的內容*/
set @str2=''
open table_cursor
fetch next from table_cursor
into @t,@c while(@@fetch_status=0)
begin exec('update [' + @t + '] set [' + @c + ']=replace(cast([' + @c + '] as varchar(8000)),'''+@str+''','''+ @str2 +''')')
fetch next from table_cursor 14.into @t,@c end close table_cursor deallocate table_cursor

copyright © 萬盛學電腦網 all rights reserved