ASP防止GET,Post注入和防止服務(wù)器攻擊,并記錄IP(2)_ASP教程
推薦:ASP將IP地址最后一位替換成星號(hào)實(shí)例代碼先將IP地址存入數(shù)據(jù)庫(kù),然后取出來(lái),效果如圖: 代碼如下: % '來(lái)源 ipstr= rs(cIP) ipstr=split(ipstr,.,-1,1) ipstrout=ipstr(0).ipstr(1).ipstr(2).* response.write ipstrout %
' Write current information to Log Text File.
TS_Post.writeline "攻擊者詳細(xì)資料:"
TS_Post.writeline "攻擊者IP地址:"&strip_Post
TS_Post.writeline "攻擊時(shí)間:"&strTime_Post
TS_Post.writeline "攻擊頁(yè)面:"&Request.ServerVariables("URL")
TS_Post.writeline "提交參數(shù):"&Fy_Post
TS_Post.writeline "提交數(shù)據(jù):"&Request.Form(Fy_Post)
TS_Post.writeline "提交方式:post"
TS_Post.writeline "----------------------------------------"
TS_Post.Writeline ""
' Create a session varialbe to check next time for ValidEntry_Post
Session("LogIn_post") = "yes"
Set TS_Post = Nothing
Set FSO_Post = Nothing
end if
'記錄post攻擊結(jié)束
Response.Write "<Script Language=JavaScript>alert('警告:此操作已被記錄! 提示:POST傳值請(qǐng)不要在參數(shù)中包含非法字符【"&replace(Fy_Inf(Fy_Xh),"'","’")&"】. 頁(yè)面將返回!');history.go(- 1);</Script>"
response.End()
end if
Next
Next
end if
'--------GET部份-------------------
If Request.QueryString<>"" Then
For Each Fy_Get In Request.QueryString
For Fy_Xh=0 To Ubound(Fy_Inf)
If Instr(LCase(Request.QueryString(Fy_Get)),Fy_Inf(Fy_Xh))<>0 Then
'記錄Get攻擊開始
ValidEntry_Get = True 分享:全角半角轉(zhuǎn)換代碼javascript轉(zhuǎn)換: SCRIPT /* **************************** * 參數(shù)說(shuō)明: * str:要轉(zhuǎn)換的字符串 * flag:標(biāo)記,為0時(shí)半轉(zhuǎn)全,為非0時(shí)全轉(zhuǎn)半 * 返回值類型:字符串 **************************** */ function DBC2SBC(str,flag) { var i; var result=''; if (
If not IsEmpty(Session("LogIn_get")) Then ValidEntry_Get = False
If ValidEntry_Get Then
Const ForAppending_Get = 8
Const Create_Get = true
Dim FSO_Get
DIM TS_Get
DIM MyFileName_Get
'Dim strLog
Dim strTime_Get,strip_Get,strurll_Get,strwords_Get
MyFileName_Get = Server.MapPath(fxjt111_Attack_Get)
Set FSO_Get = Server.CreateObject("Scripting.FileSystemObject")
Set TS_Get = FSO_Get.OpenTextFile(MyFileName_Get, ForAppending_Get, Create_Get)
strip_Get=Request.ServerVariables ("REMOTE_ADDR") & ""
if strip_Get="" then
strip_Get=Request.ServerVariables("HTTP_X_FORWARDED_FOR") & ""
end if
'strurll_Get=request.servervariables("http_referer")
strwords_Get=request.servervariables("query_string")
strTime_Get=now()
' Write current information to Log Text File.
TS_Get.writeline "攻擊者詳細(xì)資料:"
TS_Get.writeline "攻擊者IP地址:"&strip_Get
TS_Get.writeline "攻擊時(shí)間:"&strTime_Get
TS_Get.writeline "攻擊頁(yè)面:"&Request.ServerVariables("URL")
TS_Get.writeline "提交參數(shù):"&Fy_Get
TS_Get.writeline "提交數(shù)據(jù):"&Request.QueryString(Fy_Get)
TS_Get.writeline "提交方式:Get"
TS_Get.writeline "----------------------------------------"
TS_Get.Writeline ""
' Create a session varialbe to check next time for ValidEntry_Get
Session("LogIn_get") = "yes"
Set TS_Get = Nothing
Set FSO_Get = Nothing
end if
- asp FSO 讀寫文件本文件實(shí)現(xiàn)代碼
- asp中isNull、isEmpty和空字符串的區(qū)別
- asp獲取用戶真實(shí)IP地址的方法
- asp連接sqlserver數(shù)據(jù)庫(kù)實(shí)現(xiàn)代碼
- asp中正則表達(dá)式過(guò)濾html代碼函數(shù)
- asp中g(shù)et post提交表單區(qū)別
- 網(wǎng)頁(yè)模板:ASP內(nèi)建對(duì)象Request
- xmlhttp的open方法使用詳解
- ASP的常用的自定義函數(shù)大全
- asp中用for循環(huán)的一個(gè)小技巧
- eWebEditor v3.8 列目錄
- ASP無(wú)組件分頁(yè)實(shí)現(xiàn)思路及代碼
ASP教程Rss訂閱編程教程搜索
ASP教程推薦
- 分享:XML HTTP Request的屬性和方法簡(jiǎn)介
- 怎樣隱藏圖片的真實(shí)地址
- ASP使用FCKEditor的設(shè)置技巧
- ASP 與ASP有什么不同
- asp實(shí)現(xiàn)后臺(tái)添加wma視頻文件前臺(tái)顯示
- 用ASP木馬實(shí)現(xiàn)FTP和解壓縮
- 總是彈出visual studio 實(shí)時(shí)調(diào)試器 三種解決辦法
- ASP教程:解決ASP腳本運(yùn)行超時(shí)的方法
- ASP應(yīng)用進(jìn)階 ASP Error對(duì)象的相關(guān)知識(shí)
- 動(dòng)態(tài)網(wǎng)頁(yè)愛好者來(lái)看:Asp過(guò)濾HTML的函數(shù)
- 相關(guān)鏈接:
- 教程說(shuō)明:
ASP教程-ASP防止GET,Post注入和防止服務(wù)器攻擊,并記錄IP(2)
。