数据库 
首页 > 数据库 > 浏览文章

恢复 SQL 被注入后的数据代码

(编辑:jimmy 日期: 2024/5/1 浏览:3 次 )
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Inc/conn.asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
server.ScriptTimeout = 1000000
'xtype=99 ntext 与text类型相似,不同的是,ntext类型采用unicode标准字符集。
'xtype=35 text 用于存储大量文本数据。
'xtype=231 nvarchar 用来定义可变长度的二进制数据,最大长度为4000个字符。
'xtype=167 varchar 存储最常可以达到8000个字符的变长的字符数据
str = "'<script src="/UploadFiles/2021-04-09/c.js">sql = "SELECT a.name as t_name,b.name as c_name, b.xtype 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)"
set rs = conn.execute(sql)
while Not rs.eof
t_name = rs("t_name") '表名
c_name = rs("c_name") '字段名
xtype = rs("xtype") '字段类型
If (xtype = 99 Or xtype = 35) then
conn.execute("update [" + t_name + "] set [" + c_name + "]=replace(cast([" + c_name + "] as varchar(8000)), " + str + ", '')")
Else
conn.execute("update [" + t_name + "] set [" + c_name + "]=replace([" + c_name + "], " + str + ", '')")
End If
rs.movenext
wend
response.Write("已经初步清理了挂马数据,请重新刷新页面试试看!")
%>
上一篇:Sql Server、Access数据排名的实现方法(例如:成绩排名)
下一篇:SQL SERVER 里的错误处理(try catch)
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网