<%
' 增强版防注入,可记录注入信息
' 将此文件包含在公共文件里
' 如:conn.asp里
'
'--------定义部份------------------
'Dim IDCCFy_Post,IDCCFy_Get,IDCCFy_In,IDCCFy_Inf,IDCCFy_Xh,IDCCFy_db,IDCCFy_dbstr
'自定义需要过滤的字串,用 "|" 分隔
'增强关键字 ---对于安全要求较高的情况使用
IDCCFy_In="'|;|--|"
Response.End
End If
Next
Next
End If
'----------------------------------
'--------GET部份-------------------
If Request.QueryString<>"" Then
For Each IDCCFy_Get In Request.QueryString
For IDCCFy_Xh=0 To Ubound(IDCCFy_Inf)
If Instr(LCase(Request.QueryString(IDCCFy_Get)),IDCCFy_Inf(IDCCFy_Xh))<>0 Then
call FsoWriteLog("sqlinLog.txt","注入IP:"& Request.ServerVariables("REMOTE_ADDR") & "----注入时间:"&now() &"-------GET注入内容:"& Request.ServerVariables("HTTP_URL")&"?"&Request.QueryString(IDCCFy_Post))
Response.Write ""
Response.End
End If
Next
Next
End If
'--------Cookie部份-------------------
If Request.Cookies<>"" Then
For Each IDCCFy_Get In Request.Cookies
For IDCCFy_Xh=0 To Ubound(IDCCFy_Inf)
If Instr(LCase(Request.Cookies(IDCCFy_Get)),IDCCFy_Inf(IDCCFy_Xh))<>0 Then
call FsoWriteLog("sqlinLog.txt","注入IP:"& Request.ServerVariables("REMOTE_ADDR") & "----注入时间:"&now() &"-------Cookie注入内容:"& Request.ServerVariables("HTTP_URL")&"?"&Request.Cookies(IDCCFy_Post))
Response.Write ""
Response.End
End If
Next
Next
End If
'写入txt记录功击者IP跟功击时间
Function FsoWriteLog(filename,Linecontent)
Dim FSO,Fs
Set FSO= Server.CreateObject("Scripting.FileSystemObject")
if not FSO.FileExists(Server.MapPath("/")&""&filename) then
Set Fs = FSO.CreateTextFile(Server.MapPath("/")&""&filename, True)
Fs.Close
end if
Set Fs = FSO.OpenTextFile(Server.MapPath("/")&""&filename,8,1)
Fs.WriteLine(Linecontent)
Fs.close
Set Fs = nothing
Set FSO = nothing
End Function
%>