【Asp技巧】Asp绕过代理获取真实IP方法

  • A+
所属分类:lcx

普通获取IP方法:

服务器IP: Request.ServerVariables("LOCAL_ADDR")
浏览器IP: Request.ServerVariables("REMOTE_ADDR")

绕过代理获取真实IP,获得通过代理的连接的浏览器的真实IP:

Function GetIP() '绕过代理获取真实IP
Dim StrIPAddr
If Request.ServerVariables("HTTP_X_FORWARDED_FOR") = "" OR InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), "unknown") > 0 Then
 StrIPAddr = Request.ServerVariables("REMOTE_ADDR")
  ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",") > 0 Then
 StrIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",")-1)
  ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";") > 0 Then
 StrIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";")-1)
Else
 StrIPAddr = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
End If
GetIP = Trim(Mid(StrIPAddr, 1, 30))
End Function

Response.Write "真实IP为:" & getIP()

注意:可能对Vpn加密代理,高匿代理无效!

文章来源于lcx.cc:【Asp技巧】Asp绕过代理获取真实IP方法

相关推荐: 国内挖洞狂牛 - 吴石 - 寻找网络漏洞的人

    当时在看:         Microsoft 安全公告 MS09-044 - 严重:http://www.microsoft.com/china/technet/security/bulletin/MS09-044.mspx     发现:     …

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: