ASP破解图片防盗链系统
作者:刚子 日期:2008-09-09
将代码保存为pic.asp文件,然后上传到空间之后用浏览器打开“http://……/pic.asp?http://www.baidu.com/img/baidu_sylogo1.gif” 即可看到效果。
程序代码
程序代码<%@LANGUAGE="VBSCRIPT" CODEPAGE="936" ENABLESESSIONSTATE="FALSE"%>
<%Option Explicit%>
<%
'+---------------------------------------------------------+
'| Aocool Studio Photo / Gallery Magic Show |
'| Copyright © 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
%>
<%Option Explicit%>
<%
'+---------------------------------------------------------+
'| Aocool Studio Photo / Gallery Magic Show |
'| Copyright © 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
%>
评论: 0 | 引用: 0 | 查看次数: -
发表评论
上一篇
下一篇

文章来自:
Tags: