修复被注入的sql server
declare @delStr nvarchar(500)
set @delStr='<script src=http://3b3.org/c.js></script>'----这边修改被注入的js set nocount on declare @tableName nvarchar(100),@columnName nvarchar(100),@tbID int,@iRow int,@iResult int
declare @sql nvarchar(500) set @iResult=0
declare cur cursor for
select name,id from sysobjects where xtype='U' open cur
fetch next from cur into @tableName,@tbID while @@fetch_status=0
begin
declare cur1 cursor for
--xtype in (231,167,239,175) 为char,varchar,nchar,nvarchar类型
select name from syscolumns where xtype in (231,167,239,175) and id=@tbID
open cur1
fetch next from cur1 into @columnName
while @@fetch_status=0
begin
begin try
set @sql='update [' + @tableName + '] set ['+ @columnName +']= replace(['+@columnName+'],'''+@delStr+''','''') where ['+@columnName+'] like ''%'+@delStr+'%'''
exec sp_executesql @sql
set @iRow=@@rowcount
set @iResult=@iResult+@iRow
if @iRow>0
begin
print '表:[' + @tableName + '],列:'+@columnName+'被更新'+convert(varchar(10),@iRow)+'条记录;'
end
end try
begin catch
end catch
fetch next from cur1 into @columnName
end close cur1
deallocate cur1 fetch next from cur into @tableName,@tbID
end
print '数据库共有'+convert(varchar(10),@iResult)+'条记录被更新!!!' close cur
deallocate cur
set nocount off
修复被注入的sql server的更多相关文章
- 大哥带的MSsql注入(SQL Server)--预习
①判断数据库类型and exists (select * from sysobjects)--返回正常为mssql(也名sql server)and exists (select count(*) f ...
- SQL server 注入 和 SQL server 扩展(10.29 第二十九天)
Step1:检测注入点 Step2: select * from sysobjects (sysobjects 系统对象表,保存当前数据库的对象) select * from users wher ...
- 实战记录之SQL server报错手工注入
前言 最近测试了一个站点,这个站点挺有意思,发现没有关闭错误提示,初步猜测是SQL server数据库,后来验证确实是.在这里记录一下实战过程,并详细讲解一下用到的知识点. SQL server报错注 ...
- SQL Server 损坏修复
目录: 一. 常见错误解读 二. DBCC CHECKDB 三 .不同部位损坏的应对 四. Database Mirroring和AlwaysOn的页面自动修复功能 一 常见错误解读 SQL Serv ...
- SQL Server 损坏修复 之一 常见错误解读
SQL Server 对数据库损坏的错误类型做了细化,在此对几个典型的错误作一下介绍. 错误信息是:“在文件 '%ls'中.偏移量为 %#016I64x 的位置执行 %S_MSG 期间,操作系统已经向 ...
- MS Sql Server 数据库或表修复(DBCC CHECKDB)
MS Sql Server 提供了很多数据库修复的命令,当数据库质疑或是有的无法完成读取时可以尝试这些修复命令. 1. DBCC CHECKDB 重启服务器后,在没有进行任何操作的情况下,在SQL ...
- SQL Server 性能优化实战系列(一)
数据库服务器主要用于存储.查询.检索企业内部的信息,因此需要搭配专用的数据库系统,对服务器的兼容性.可靠性和稳定性等方面都有很高的要求. 下面是进行笼统的技术点说明,为的是让大家有一个整 ...
- SQL Server 2012 R2升级到SQL Server 2016无法正常启动数据库服务解决方案
原定周末把公司的TFS升级到2018,由于TFS 2018需要SQL Server至少是2016以上版本,所以还需要将原来的SQL Server 2012 R2一并升级.今天早上负责的同事告诉我升级失 ...
- SQL SERVER 2000安装遇到的问题小汇总(转载)
[1]安装程序配置服务器失败需要修改下注册表1 打开注册表 在"开始"--"运行"键入 "regedit" 2 删除注册表如下键值: HK ...
随机推荐
- LeetCode_Jump Game II
Given an array of non-negative integers, you are initially positioned at the first index of the arra ...
- 新发现一个函数:GradientFill
位于Msimg32.dll之中 https://msdn.microsoft.com/en-us/library/windows/desktop/dd144957(v=vs.85).aspx
- cf478C Table Decorations
C. Table Decorations time limit per test 1 second memory limit per test 256 megabytes input standard ...
- linux添加静态路由表,重启继续生效(转载)
在日常的使用中,或者在服务器中,有两个网卡配置两个地址,访问不同的网络段,这种情况是非常常见的现象,但是,我们需要额外的添加路由表来决定发送的数据包经过正确的网关和interface才能正确的进行通信 ...
- hdu 5610 Baby Ming and Weight lifting
Problem Description Baby Ming is fond of weight lifting. He has a barbell pole(the weight of which c ...
- IOS 网络判断
Reachability *connectionNetWork= [Reachability reachabilityForInternetConnection] ; int status = [co ...
- 物理机与虚拟机IP互ping通,而互ping主机名不通
问题描述:虚拟机信息:VMware-workstation 10安装RHEL5.8操作系统.hostname:rhel201.com IP:192.168.1.201 物理机系统:windows 7主 ...
- 教训:TOJ[4081] God Le wants to know the directory
以前的字符串题本来就弱..2年不写就更弱了.嗯.留作教训 God Le is the most talented ACMer in the TJU-ACM team. When he wants to ...
- Windows下配置sphinx+reStructuredText详解
最近有朋友想在windows下做个人笔记,没有找到顺手的工具,问我有什么好的工具推荐.正好前两天在网上看到一款做文档的利器sphinx+reStructText,当时在ubuntu下搭了下环境试了试, ...
- hibernate总结一
在hibernate中查询使用List,Map和类对象定制返回类型 在使用hibernate进行查询时,使用得最多的还是通过构建hql进行查询了.在查询的过程当中,除使用经常的查询对象方法之外,还 ...