恢復(fù) SQL 被注入后的數(shù)據(jù)代碼
更新時間:2009年02月27日 21:26:46 作者:
當(dāng)數(shù)據(jù)庫別批量注入掛馬后,需要批量替換掉,可以參考下面的代碼。
<%@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 用于存儲大量文本數(shù)據(jù)。
'xtype=231 nvarchar 用來定義可變長度的二進制數(shù)據(jù),最大長度為4000個字符。
'xtype=167 varchar 存儲最??梢赃_到8000個字符的變長的字符數(shù)據(jù)
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("已經(jīng)初步清理了掛馬數(shù)據(jù),請重新刷新頁面試試看!")
%>
<!--#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 用于存儲大量文本數(shù)據(jù)。
'xtype=231 nvarchar 用來定義可變長度的二進制數(shù)據(jù),最大長度為4000個字符。
'xtype=167 varchar 存儲最??梢赃_到8000個字符的變長的字符數(shù)據(jù)
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("已經(jīng)初步清理了掛馬數(shù)據(jù),請重新刷新頁面試試看!")
%>
相關(guān)文章
復(fù)制數(shù)據(jù)庫表中兩個字段數(shù)據(jù)的SQL語句
今天為表新添加一個字段,但又想與表中的另一個字段值相同,由于數(shù)據(jù)過多想通過sql語句實現(xiàn),經(jīng)測試下面的這句話確實很好用2013-07-07SQL行轉(zhuǎn)列、列轉(zhuǎn)行的簡單實現(xiàn)
這篇文章主要給大家介紹了關(guān)于SQL行轉(zhuǎn)列、列轉(zhuǎn)行的簡單實現(xiàn)方法,文中通過示例代碼介紹的非常詳細,對大家學(xué)習(xí)或者使用SQL具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧2019-05-05SQL數(shù)據(jù)庫的所有命令(函數(shù)、運算符)匯總大全
結(jié)構(gòu)化查詢語言(Structured?Query?Language)簡稱SQL,結(jié)構(gòu)化查詢語言是一種數(shù)據(jù)庫查詢和程序設(shè)計語言,用于存取數(shù)據(jù)以及查詢、更新和管理關(guān)系數(shù)據(jù)庫系統(tǒng)。sql語句就是對數(shù)據(jù)庫進行操作的一種語言。2023-01-01Doris?數(shù)據(jù)模型ROLLUP及前綴索引官方教程
本文檔主要從邏輯層面,描述 Doris 的數(shù)據(jù)模型 ROLLUP 以及前綴索引的概念,以幫助用戶更好的使用 Doris 應(yīng)對不同的業(yè)務(wù)場景,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-05-05IndexedDB瀏覽器內(nèi)建數(shù)據(jù)庫并行更新問題詳解
這篇文章主要為大家介紹了IndexedDB瀏覽器內(nèi)建數(shù)據(jù)庫并行更新問題詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2022-12-12