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

前端之家收集整理的这篇文章主要介绍了解析:清除SQL被注入恶意病毒代码的语句前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

SQL查询分析器执行以下代码就可以了。
<div class="codetitle"><a style="CURSOR: pointer" data="44004" class="copybut" id="copybut44004" onclick="doCopy('code44004')"> 代码如下:

<div class="codebody" id="code44004">
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"&gt;</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

猜你在找的MsSQL相关文章