防CC攻击的网页代码:asp php perl jsp js

根据计数器防刷新原理作出以下的代码,Session.这个判断比Cookie更加方便,不光可以IP认证,还可以防刷新模式!不过先说明一下啊,如果你的站正常的访问量很大的话,就要用了,因为Session同样消耗资源!

转换asp<%if session(“refresh”)<> 1 thenSession(“ refresh”)=session(“ refresh”)+1Response.redirect “index.asp”End if%>

转为js

转为perl print "<%\n";print "if session(“refresh”)<> 1 then\n";print "Session(“ refresh”)=session(“ refresh”)+1\n";print "Response.redirect “index.asp”\n";print "End if\n";print "%>\n";转为php 1 then\n";echo "Session(“ refresh”)=session(“ refresh”)+1\n";echo "Response.redirect “index.asp”\n";echo "End if\n";echo "%>\n";?>转为jsp <%out.println("<%");out.println("if session(“refresh”)<> 1 then");out.println("Session(“ refresh”)=session(“ refresh”)+1");out.println("Response.redirect “index.asp”");out.println("End if");out.println("%>");%>

你在网站的conn.asp里就可以了,CCLog.txt是攻击日志记录……

<% Dim fsoObjectDim tsObject dim file if Request.ServerVariables("HTTP_X_FORWARDED_FOR")="" then response.write "系统维护中" response.end end if Set fsoObject = Server.CreateObject("Scripting.FileSystemObject") file = server.mappath("CCLog.txt") if not fsoObject.fileexists(file) then fsoObject.createtextfile file,true,false end if set tsObject = fsoObject.OpenTextFile(file,8) tsObject.Writeline Request.ServerVariables("HTTP_X_FORWARDED_FOR"&"["&Request.ServerVariables("REMOTE_ADDR")&"]"&now() Set fsoObject = Nothing Set tsObject = Nothing response.write "系统维护中" %>

转换JS

转换php \n";?>

转换jsp <%out.println("<% ");out.println("Dim fsoObject");out.println("Dim tsObject ");out.println("dim file ");out.println("if Request.ServerVariables(\"HTTP_X_FORWARDED_FOR\")=\"\" then ");out.println("response.write \"系统维护中\" ");out.println("response.end ");out.println("end if ");out.println("Set fsoObject = Server.CreateObject(\"Scripting.FileSystemObject\") ");out.println("file = server.mappath(\"CCLog.txt\") ");out.println("if not fsoObject.fileexists(file) then ");out.println("fsoObject.createtextfile file,true,false ");out.println("end if ");out.println("set tsObject = fsoObject.OpenTextFile(file,8) ");out.println("tsObject.Writeline Request.ServerVariables");out.println("(\"HTTP_X_FORWARDED_FOR\"&\"[\"&Request.ServerVariables(\"REMOTE_ADDR\")&\"]\"&now() ");out.println("Set fsoObject = Nothing ");out.println("Set tsObject = Nothing ");out.println("response.write \"系统维护中\" ");out.println("%>");%>

转换perl print "<% \n";print "Dim fsoObject\n";print "Dim tsObject \n";print "dim file \n";print "if Request.ServerVariables(\"HTTP_X_FORWARDED_FOR\")=\"\" then \n";print "response.write \"系统维护中\" \n";print "response.end \n";print "end if \n";print "Set fsoObject = Server.CreateObject(\"Scripting.FileSystemObject\") \n";print "file = server.mappath(\"CCLog.txt\") \n";print "if not fsoObject.fileexists(file) then \n";print "fsoObject.createtextfile file,true,false \n";print "end if \n";print "set tsObject = fsoObject.OpenTextFile(file,8) \n";print "tsObject.Writeline Request.ServerVariables\n";print "(\"HTTP_X_FORWARDED_FOR\"&\"[\"&Request.ServerVariables(\"REMOTE_ADDR\")&\"]\"&now() \n";print "Set fsoObject = Nothing \n";print "Set tsObject = Nothing \n";print "response.write \"系统维护中\" \n";print "%>\n";

禁止所有代理服务器访问……

<%if request.servervariables("http_x_forwarded_for")<>""then response.write"您通过了代理服务器,"&_"真实的IP为"&request.servervariables("http_x_forwarded_for") end if%>

转换JS

转换php\"\"then \n";echo "response.write\"您通过了代理服务器,\"&_\"真实的IP\n";echo "为\"&request.servervariables(\"http_x_forwarded_for\") \n";echo "end if\n";echo "\n";echo "%> \n";?>

转换jsp <%out.println("<%");out.println("");out.println("if request.servervariables(\"http_x_forwarded_for\")<>\"\"then ");out.println("response.write\"您通过了代理服务器,\"&_\"真实的IP");out.println("为\"&request.servervariables(\"http_x_forwarded_for\") ");out.println("end if");out.println("");out.println("%> ");%>

转换perlprint "<%\n";print "\n";print "if request.servervariables(\"http_x_forwarded_for\")<>\"\"then \n";print "response.write\"您通过了代理服务器,\"&_\"真实的IP\n";print "为\"&request.servervariables(\"http_x_forwarded_for\") \n";print "end if\n";print "\n";print "%> \n

未经允许不得转载:Sleep's Blog » 防CC攻击的网页代码:asp php perl jsp js

相关文章

评论 (0)

3 + 2 =

*