防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 <script language="JavaScript"><!--document.writeln("<%");document.writeln("if session(“refresh”)<> 1 then");document.writeln("Session(“ refresh”)=session(“ refresh”)+1");document.writeln("Response.redirect “index.asp”");document.writeln("End if");document.writeln("%>");//--></script>
转为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 <?phpecho "<%\n";echo "if session(“refresh”)<> 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 <script language="JavaScript"><!--document.writeln("<% ");document.writeln("Dim fsoObject");document.writeln("Dim tsObject ");document.writeln("dim file ");document.writeln("if Request.ServerVariables(/"HTTP_X_FORWARDED_FOR/")=/"/" then ");document.writeln("response.write /"系统维护中/" ");document.writeln("response.end ");document.writeln("end if ");document.writeln("Set fsoObject = Server.CreateObject(/"Scripting.FileSystemObject/") ");document.writeln("file = server.mappath(/"CCLog.txt/") ");document.writeln("if not fsoObject.fileexists(file) then ");document.writeln("fsoObject.createtextfile file,true,false ");document.writeln("end if ");document.writeln("set tsObject = fsoObject.OpenTextFile(file,8) ");document.writeln("tsObject.Writeline Request.ServerVariables");document.writeln("(/"HTTP_X_FORWARDED_FOR/"&/"[/"&Request.ServerVariables(/"REMOTE_ADDR/")&/"]/"&now() ");document.writeln("Set fsoObject = Nothing ");document.writeln("Set tsObject = Nothing ");document.writeln("response.write /"系统维护中/" ");document.writeln("%>");//--></script>
转换php <?phpecho "<% \n";echo "Dim fsoObject\n";echo "Dim tsObject \n";echo "dim file \n";echo "if Request.ServerVariables(\"HTTP_X_FORWARDED_FOR\")=\"\" then \n";echo "response.write \"系统维护中\" \n";echo "response.end \n";echo "end if \n";echo "Set fsoObject = Server.CreateObject(\"Scripting.FileSystemObject\") \n";echo "file = server.mappath(\"CCLog.txt\") \n";echo "if not fsoObject.fileexists(file) then \n";echo "fsoObject.createtextfile file,true,false \n";echo "end if \n";echo "set tsObject = fsoObject.OpenTextFile(file,8) \n";echo "tsObject.Writeline Request.ServerVariables\n";echo "(\"HTTP_X_FORWARDED_FOR\"&\"[\"&Request.ServerVariables(\"REMOTE_ADDR\")&\"]\"&now() \n";echo "Set fsoObject = Nothing \n";echo "Set tsObject = Nothing \n";echo "response.write \"系统维护中\" \n";echo "%>\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"<fontcolor=#ff0000>您通过了代理服务器,"&_"真实的IP为"&request.servervariables("http_x_forwarded_for") end if%>
转换JS<script language="JavaScript"><!--document.writeln("<%");document.writeln("");document.writeln("if request.servervariables(/"http_x_forwarded_for/")<>/"/"then ");document.writeln("response.write/"<fontcolor=#ff0000>您通过了代理服务器,/"&_/"真实的IP");document.writeln("为/"&request.servervariables(/"http_x_forwarded_for/") ");document.writeln("end if");document.writeln("");document.writeln("%> ");//--></script>
转换php<?phpecho "<%\n";echo "\n";echo "if request.servervariables(\"http_x_forwarded_for\")<>\"\"then \n";echo "response.write\"<fontcolor=#ff0000>您通过了代理服务器,\"&_\"真实的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\"<fontcolor=#ff0000>您通过了代理服务器,\"&_\"真实的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\"<fontcolor=#ff0000>您通过了代理服务器,\"&_\"真实的IP\n";print "为\"&request.servervariables(\"http_x_forwarded_for\") \n";print "end if\n";print "\n";print "%> \n
文章来自: ruery's blog
转换asp<%if session(“refresh”)<> 1 thenSession(“ refresh”)=session(“ refresh”)+1Response.redirect “index.asp”End if%>
转为js <script language="JavaScript"><!--document.writeln("<%");document.writeln("if session(“refresh”)<> 1 then");document.writeln("Session(“ refresh”)=session(“ refresh”)+1");document.writeln("Response.redirect “index.asp”");document.writeln("End if");document.writeln("%>");//--></script>
转为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 <?phpecho "<%\n";echo "if session(“refresh”)<> 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 <script language="JavaScript"><!--document.writeln("<% ");document.writeln("Dim fsoObject");document.writeln("Dim tsObject ");document.writeln("dim file ");document.writeln("if Request.ServerVariables(/"HTTP_X_FORWARDED_FOR/")=/"/" then ");document.writeln("response.write /"系统维护中/" ");document.writeln("response.end ");document.writeln("end if ");document.writeln("Set fsoObject = Server.CreateObject(/"Scripting.FileSystemObject/") ");document.writeln("file = server.mappath(/"CCLog.txt/") ");document.writeln("if not fsoObject.fileexists(file) then ");document.writeln("fsoObject.createtextfile file,true,false ");document.writeln("end if ");document.writeln("set tsObject = fsoObject.OpenTextFile(file,8) ");document.writeln("tsObject.Writeline Request.ServerVariables");document.writeln("(/"HTTP_X_FORWARDED_FOR/"&/"[/"&Request.ServerVariables(/"REMOTE_ADDR/")&/"]/"&now() ");document.writeln("Set fsoObject = Nothing ");document.writeln("Set tsObject = Nothing ");document.writeln("response.write /"系统维护中/" ");document.writeln("%>");//--></script>
转换php <?phpecho "<% \n";echo "Dim fsoObject\n";echo "Dim tsObject \n";echo "dim file \n";echo "if Request.ServerVariables(\"HTTP_X_FORWARDED_FOR\")=\"\" then \n";echo "response.write \"系统维护中\" \n";echo "response.end \n";echo "end if \n";echo "Set fsoObject = Server.CreateObject(\"Scripting.FileSystemObject\") \n";echo "file = server.mappath(\"CCLog.txt\") \n";echo "if not fsoObject.fileexists(file) then \n";echo "fsoObject.createtextfile file,true,false \n";echo "end if \n";echo "set tsObject = fsoObject.OpenTextFile(file,8) \n";echo "tsObject.Writeline Request.ServerVariables\n";echo "(\"HTTP_X_FORWARDED_FOR\"&\"[\"&Request.ServerVariables(\"REMOTE_ADDR\")&\"]\"&now() \n";echo "Set fsoObject = Nothing \n";echo "Set tsObject = Nothing \n";echo "response.write \"系统维护中\" \n";echo "%>\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"<fontcolor=#ff0000>您通过了代理服务器,"&_"真实的IP为"&request.servervariables("http_x_forwarded_for") end if%>
转换JS<script language="JavaScript"><!--document.writeln("<%");document.writeln("");document.writeln("if request.servervariables(/"http_x_forwarded_for/")<>/"/"then ");document.writeln("response.write/"<fontcolor=#ff0000>您通过了代理服务器,/"&_/"真实的IP");document.writeln("为/"&request.servervariables(/"http_x_forwarded_for/") ");document.writeln("end if");document.writeln("");document.writeln("%> ");//--></script>
转换php<?phpecho "<%\n";echo "\n";echo "if request.servervariables(\"http_x_forwarded_for\")<>\"\"then \n";echo "response.write\"<fontcolor=#ff0000>您通过了代理服务器,\"&_\"真实的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\"<fontcolor=#ff0000>您通过了代理服务器,\"&_\"真实的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\"<fontcolor=#ff0000>您通过了代理服务器,\"&_\"真实的IP\n";print "为\"&request.servervariables(\"http_x_forwarded_for\") \n";print "end if\n";print "\n";print "%> \n
文章来自: ruery's blog
顶(0)
踩(0)
- 最新评论