日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

ASP安全检测类

發(fā)布時(shí)間:2025/7/14 编程问答 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ASP安全检测类 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

作者:孤劍

時(shí)間:2006-9-27

<%
?class security
??Private p_InvaildWords
??Private p_hError,p_Hex,p_errDetails
??Private p_msg
??Private P_ipAdd
??
??Private Sub Class_Initialize
???p_hError=&H00000000
???p_msg=""
???p_Hex=TRUE
???p_errDetails=false
???p_InvaildWords="from|select|update|delete|insert|--|;|'|#|%|xp|cmd|shell|drop|create"
??End Sub
??
??rem **********************************************************************
??rem 系統(tǒng)屬性定義區(qū)域
??public property get Version()
???version="Security 2.0.1.24"
??end property
??rem ----------------------------------------------------------------------
??
??public property let Filter(words)
???if(lcase(left(trim(words),7))="default") then
????p_InvaildWords =p_InvaildWords & right(trim(words),len(trim(words))-7)
???else
????p_InvaildWords=words
???end if
??end property
??rem ----------------------------------------------------------------------
??
??'**********************************
??'?獲得此過(guò)程中產(chǎn)生的錯(cuò)誤信息
??'----------------------------------
??Public property let HexError(hnum)?'2006-9-18 添加編碼屬性
???if(isnumeric(hnum)) then
????if(cint(hnum)=16) then?p_hex=true
???end if
??End Property
??rem ----------------------------------------------------------------------??
??Public property let ShowErrorNum(value)?'2006-09-18 添加條事實(shí)顯示詳細(xì)的錯(cuò)誤信息
???if(value) then
????p_errdetails=true
???else
????p_errdetails=false
???end if
??End Property??
??rem ----------------------------------------------------------------------?
??Public Property Get ErrNum()
???If?(p_hex) then?'Hex Code
????ErrNum=hex(p_hError)
???Else
????ErrNum=p_hError?'D Code
???End if
??End Property
??rem ----------------------------------------------------------------------??
??Public Property Get ErrDescription()
???if(len(trim(p_msg))<1) then
????ErrDescription="<li>系統(tǒng)正常!</li>"
???else
????ErrDescription=p_msg
???end if
??End Property
??'***********************************
??rem ----------------------------------------------------------------------
??rem 屬性定義結(jié)束
??rem **********************************************************************
??
??rem **********************************************************************
??rem 功能函數(shù)
??'******************************
??'名稱: ChkPost
??'參數(shù):NULL
??'返回值:True:本站/False:未知來(lái)源
??'創(chuàng)建時(shí)間:2005年5月5日
??'作用:檢查被提交的數(shù)據(jù)來(lái)源
??'******************************
??Public Function ChkPost()
???Dim Server_v1,Server_v2
???ChkPost=false
???Server_v1=CStr(Request.ServerVariables("HTTP_REFERER"))
???Server_v2=CStr(Request.ServerVariables("SERVER_NAME"))
???If Mid(Server_v1,8,Len(Server_v2))=Server_v2 Then ?
????ChkPost=True
???else
????p_hError=&H11010301
????p_msg=p_msg & "<li><font color=red>數(shù)據(jù)來(lái)源不確定,請(qǐng)從常規(guī)入口進(jìn)入!</font>"
????if?(p_errDetails) then p_msg=p_msg & "(錯(cuò)誤碼:"& hex(p_hError) &")"
????p_msg =p_msg & "</li>"
???end if
??End Function
??rem ----------------------------------------------------------------------
?
??'******************************
??'名稱: ChkInvStr
??'參數(shù):Str
??'返回值:True(有特殊字符)/False(無(wú)特殊字符)
??'創(chuàng)建時(shí)間:2006年9月16日
??'作用:檢查參數(shù)是否有非法字符
??'******************************
??Public Function ChkInvStr(Str)
???Rem 定義需要過(guò)濾得非法字符
???Dim InvaildWord,inWords,i
???Dim m_msg
???m_msg=""
???Str=CStr(Str)
???ChkInvStr=FALSE
???If Len(Replace(p_InvaildWords,Chr(0),""))<1 Then
????p_hError=&H10010001
????p_msg =m_msg & "<li>系統(tǒng)設(shè)置有誤!"
????if?(p_errDetails) then p_msg=p_msg & "(錯(cuò)誤碼:"& hex(p_hError) &")"????
????p_msg = p_msg & "</li>"
???Else
????InvaildWord=Split(p_InvaildWords,"|")
????inWords=LCase(Trim(Str))
????For i=LBound(InvaildWord) To UBound(InvaildWord)
?????If Instr(inWords,trim(InvaildWord(i)))>0 and len(InvaildWord(i))>0 Then
??????p_hError=&H11010102?'發(fā)現(xiàn)非法字符
??????m_msg = m_msg & " <font color=""red"">" & InvaildWord(i) & "</font> "
?????End If
????Next
???End If
???if (p_hError=&H11010102) then
????p_msg=p_msg &"<li>"& m_msg & " 是被系統(tǒng)禁止的."
????if?(p_errDetails) then p_msg=p_msg & "(錯(cuò)誤碼:"& hex(p_hError) &")"
????p_msg =p_msg & "</li>"
????ChkInvStr=TRUE
???end if
??End Function
??rem ----------------------------------------------------------------------
?
??'******************************
??'名稱: GetIP
??'參數(shù):NULL
??'返回值:NULL
??'創(chuàng)建時(shí)間:2005年5月3日
??'作用:得到用戶的ip地址
??'******************************
??Public Function GetIP()
???p_IpAdd=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
???If IsNull(p_IpAdd) OR p_IpAdd="" Then
????p_IpAdd=Request.ServerVariables("REMOTE_ADDR")
???else
????p_herror=&H11010201
????p_msg =p_msg & "<li>您使用了代理 "
????if?(p_errDetails) then p_msg=p_msg & "(錯(cuò)誤碼:"& hex(p_hError) &")"
????p_msg =p_msg & "</li>"
???End If
???GetIp=p_IpAdd
??End Function
??rem ----------------------------------------------------------------------
??rem **********************************************************************?
??
?end class
%>

轉(zhuǎn)載于:https://www.cnblogs.com/AloneSword/archive/2006/09/30/2237574.html

《新程序員》:云原生和全面數(shù)字化實(shí)踐50位技術(shù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀

總結(jié)

以上是生活随笔為你收集整理的ASP安全检测类的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。