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

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

在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;

标签:SQL注入,病毒,数据库
0
投稿

猜你喜欢

  • 一个完美网站的101项指标.第七部分.W3C标准

    2008-03-01 09:31:00
  • Oracle9i取得建表和索引的DDL语句

    2010-07-20 12:59:00
  • ASP:一个网站空间多个域名访问

    2008-11-21 17:03:00
  • Linux下C连接MySQL出现错误解决一例

    2008-12-29 13:17:00
  • 我要如何了解用户的需求

    2007-08-26 17:19:00
  • SQL SERVER查询所有数据库名,表名,和字段名的语句

    2012-01-05 19:25:26
  • 当标题不能显示完整的时候

    2007-11-20 13:23:00
  • 自适应内容高度的收缩与展开

    2007-09-24 14:38:00
  • 实例讲解MySQL数据库中文问题的解决方法

    2008-12-31 15:15:00
  • 《细节决定交互设计的成败》

    2009-06-02 11:23:00
  • 中文字体在 CSS 中的写法

    2009-11-24 13:21:00
  • 开心网上input输入框研究

    2009-03-06 12:52:00
  • 不能安装SQL Server 2005的问题及解决方法

    2008-12-26 17:41:00
  • Asp 单页查询数据库

    2010-05-11 20:11:00
  • SQL Server 2005五个动态管理对象

    2009-02-24 17:41:00
  • SQL Server 2005 五个动态管理对象

    2008-12-18 14:50:00
  • asp之自动闭合HTML/ubb标签函数附简单注释

    2011-04-04 11:18:00
  • SQL Server跟踪数据实现索引优化向导

    2009-02-13 17:14:00
  • 你应当了解的5个CSS3新技术

    2009-02-11 13:01:00
  • 详解MySQL数据库安全配置

    2010-01-26 15:19:00
  • asp之家 网络编程 m.aspxhome.com