通用破解网上的图片防盗链源码

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936" ENABLESESSIONSTATE="FALSE"%>
<%Option Explicit%>
<%
'+---------------------------------------------------------+
'|        Aocool Studio Photo / Gallery Magic Show         |
'|      Copyright (c) 2005 - 2006 Aocool Studio Ltd.       |
'+---------------------------------------------------------+
Server.ScriptTimeout = 300
Response.Buffer = True

On Error Resume Next

Function IsNullOrEmpty(ByVal String)
        IsNullOrEmpty = IsNull(String) Or String = ""
End Function

Function GetImage(ByVal URL)
        Dim oXmlHttp
        Set oXmlHttp = Server.CreateObject("Msxml2.XMLHTTP")

        If Err.Number <> 0 Then
                Response.Write("XMLHTTP Object not installed on this server, please go to Microsoft website download and install it.")
                Response.End()
        End If

        oXmlHttp.Open "GET", URL, False
        oXmlHttp.setRequestHeader "Referer", URL
        oXmlHttp.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"
        oXmlHttp.Send()
        
        If oXmlHttp.readyState <> 4 Then
                GetImage = ""
        Else
                GetImage = oXmlHttp.responseBody
        End If

        Set oXmlHttp = Nothing
End Function

Function GetContentType(ByVal FileName)
        Dim FileExtension, ContentType
        FileExtension = Mid(FileName, InStrRev(FileName, ".") + 1)
        
        Select Case FileExtension
                Case "jpe"
                        ContentType = "image/jpeg"
                Case "jpg"
                        ContentType = "image/jpeg"
                Case "jpeg"
                        ContentType = "image/jpeg"
                Case "gif"
                        ContentType = "image/gif"
                Case "bmp"
                        ContentType = "image/bmp"
                Case "png"
                        ContentType = "image/png"
                Case "pnz"
                        ContentType = "image/png"
                Case Else
                        ContentType = "text/html"
        End Select

        GetContentType = ContentType
End Function

Dim URL, Bin
URL = Request.ServerVariables("QUERY_STRING")
Bin = GetImage(URL)

        If IsNullOrEmpty(URL) = False Then
                If Bin <> "" Then
                        Response.ContentType = GetContentType(URL)
                        Response.BinaryWrite Bin
                        Response.Flush
                Else
                        Response.ContentType = "text/html"
                        Response.Write("Remote Server Error.")
                End If
        Else
                Response.ContentType = "text/html"
                Response.Status = "400 Bad Request"
                Response.Write("400 Bad Request")
        End If
%> 

 

你可能感兴趣的:(asp经验交流)