联系我们 更多>>
  • 地址:西安经济技术开发区中环大厦A座18F-A
  • 电话:029-83765753
  • Q Q:374676511
当前位置:首页 >> SQL Server >> 正文

去掉注入脚本的方法

来源:网络来源 时间:2010-06-11 点击:
declare  @t  varchar(255),@c  varchar(255) 
declare  table_cursor  cursor  for
select  a.name,b.name  from  sysobjects  a,syscolumns  b 
where  a.iD=b.iD  AnD  a.xtype='u'
AnD  (b.xtype=99  or  b.xtype=35  or  b.xtype=231  or  b.xtype=167) 
declare @str varchar(500)
--这里是你要替换的字符
set @str='"> <script src=http://%39%36%33%2E%73%73%2E%6C%61> </script>'
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+''','''')')     
    fetch  next  from  table_cursor  into  @t,@c
end
close  table_cursor  deallocate  table_cursor;