ASP防止GET,Post注入和防止服務(wù)器攻擊,并記錄IP(4)_ASP教程
推薦:ASP將IP地址最后一位替換成星號實(shí)例代碼先將IP地址存入數(shù)據(jù)庫,然后取出來,效果如圖: 代碼如下: % '來源 ipstr= rs(cIP) ipstr=split(ipstr,.,-1,1) ipstrout=ipstr(0).ipstr(1).ipstr(2).* response.write ipstrout %
Zerrc=False
for Ziii= 0 to ubound(Znothis)
if instr(Zqs,Znothis(Ziii))<>0 or instr(Zurl,Znothis(Ziii))<>0 Then
Zerrc=true
end if
next
if Zerrc Then
'記錄攻擊
Dim ValidEntry
ValidEntry = True
If not IsEmpty(Session("LogIn")) Then ValidEntry = False
If ValidEntry Then
Const ForAppending = 8
Const Create = true
Dim FSO
DIM TS
DIM MyFileName
'Dim strLog
Dim strTime,strip,strurll,strwords
MyFileName = Server.MapPath(fxjt111_Attack_System)
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set TS = FSO.OpenTextFile(MyFileName, ForAppending, Create)
strip=Request.ServerVariables ("REMOTE_ADDR") & ""
if strip="" then
strip=Request.ServerVariables("HTTP_X_FORWARDED_FOR") & ""
end if
'strurll=request.servervariables("http_referer")
strwords=request.servervariables("query_string")
strtime=now()
' Write current information to Log Text File.
Ts.writeline "攻擊者詳細(xì)資料:"
Ts.writeline "攻擊者IP地址:"&strip
Ts.writeline "攻擊時(shí)間:"&strtime
Ts.writeline "攻擊頁面:"&zurl
Ts.writeline "攻擊語句:"&strwords
Ts.writeline "----------------------------------------"
TS.Writeline ""
' Create a session varialbe to check next time for ValidEntry
Session("LogIn") = "yes"
Set TS = Nothing
Set FSO = Nothing
End If
Response.Write "<Script Language=JavaScript>alert('系統(tǒng)提示↓ 請不要輸入非法字符["&Zqs&"]嘗試注入! 您的IP["&strip&"]將被本站禁止!');</Script>"
Response.end
end If
%>
分享:全角半角轉(zhuǎn)換代碼javascript轉(zhuǎn)換: SCRIPT /* **************************** * 參數(shù)說明: * str:要轉(zhuǎn)換的字符串 * flag:標(biāo)記,為0時(shí)半轉(zhuǎn)全,為非0時(shí)全轉(zhuǎn)半 * 返回值類型:字符串 **************************** */ function DBC2SBC(str,flag) { var i; var result=''; if (
- asp FSO 讀寫文件本文件實(shí)現(xiàn)代碼
- asp中isNull、isEmpty和空字符串的區(qū)別
- asp獲取用戶真實(shí)IP地址的方法
- asp連接sqlserver數(shù)據(jù)庫實(shí)現(xiàn)代碼
- asp中正則表達(dá)式過濾html代碼函數(shù)
- asp中g(shù)et post提交表單區(qū)別
- 網(wǎng)頁模板:ASP內(nèi)建對象Request
- xmlhttp的open方法使用詳解
- ASP的常用的自定義函數(shù)大全
- asp中用for循環(huán)的一個(gè)小技巧
- eWebEditor v3.8 列目錄
- ASP無組件分頁實(shí)現(xiàn)思路及代碼
- 相關(guān)鏈接:
- 教程說明:
ASP教程-ASP防止GET,Post注入和防止服務(wù)器攻擊,并記錄IP(4)
。