突破网易相册的反盗链
作者:ilank 日期:2007-02-06
网易相册,免费,无限容量,存取速度快(我用着确实快,要安装插件),而且支持批量上传图片,用着很方便.以前链接网易相册上的图片时从没遇到反盗链的问题,今天在引用时发现有了反盗链。链接的图片都显示如下,右键属性查看图看地址
1.没加反盗链:
http://img150.photo.163.com/admcg/16264326/390837893.jpg
2.加了反盗链:
http://iyeur.com/163.asp?url=http://img150.photo.163.com/admcg/16264326/390837893.jpg
.............................................................................................................
这两个图片网易地址是相同的,都为http://img150.photo.163.com/admcg/16264326/390837893.jpg
网易相册有个特点,盗链的图片当时你可以看,发给别人就看不了,这是因为你看到的是缓存的图片。如果清除缓存和cookies再看,就看不到了。
网易相册,免费,无限容量,存取速度快(我用着确实快,要安装插件),而且支持批量上传图片。用着很方便
突破反盗链的方法是:新建一163.asp文件,内容如下:
将该文件上传到服务器空间,以后在要链接的图片地址前加上 路径/163.asp?url=图片地址 ,即可正常显示图片了,还是前面的图,加上后正常了
1.没加反盗链:
http://img150.photo.163.com/admcg/16264326/390837893.jpg
2.加了反盗链:
http://iyeur.com/163.asp?url=http://img150.photo.163.com/admcg/16264326/390837893.jpg
.............................................................................................................
这两个图片网易地址是相同的,都为http://img150.photo.163.com/admcg/16264326/390837893.jpg
网易相册有个特点,盗链的图片当时你可以看,发给别人就看不了,这是因为你看到的是缓存的图片。如果清除缓存和cookies再看,就看不到了。
网易相册,免费,无限容量,存取速度快(我用着确实快,要安装插件),而且支持批量上传图片。用着很方便
突破反盗链的方法是:新建一163.asp文件,内容如下:
程序代码
<%
Dim url, body, myCache
url = Request.QueryString("url")
Set myCache = new cache
myCache.name = "picindex"&url
If myCache.valid Then
body = myCache.value
Else
body = GetWebData(url)
myCache.add body,dateadd("d",1,now)
End If
If Err.Number = 0 Then
Response.CharSet = "UTF-8"
Response.ContentType = "application/octet-stream"
Response.BinaryWrite body
Response.Flush
Else
Wscript.Echo Err.Description
End if
'取得数据
Public Function GetWebData(ByVal strUrl)
Dim curlpath
curlpath = Mid(strUrl,1,Instr(8,strUrl,"/"))
Dim Retrieval
Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", strUrl, False,"",""
.setRequestHeader "Referer", curlpath
.Send
GetWebData =.ResponseBody
End With
Set Retrieval = Nothing
End Function
'cache类
class Cache
private obj 'cache内容
private expireTime '过期时间
private expireTimeName '过期时间application名
private cacheName 'cache内容application名
private path 'url
private sub class_initialize()
path=request.servervariables("url")
path=left(path,instrRev(path,"/"))
end sub
private sub class_terminate()
end sub
public property get blEmpty
'是否为空
if isempty(obj) then
blEmpty=true
else
blEmpty=false
end if
end property
public property get valid
'是否可用(过期)
if isempty(obj) or not isDate(expireTime) then
valid=false
elseif CDate(expireTime)<now then
valid=false
else
valid=true
end if
end property
public property let name(str)
'设置cache名
cacheName=str & path
obj=application(cacheName)
expireTimeName=str & "expires" & path
expireTime=application(expireTimeName)
end property
public property let expires(tm)
'重设置过期时间
expireTime=tm
application.lock
application(expireTimeName)=expireTime
application.unlock
end property
public sub add(var,expire)
'赋值
if isempty(var) or not isDate(expire) then
exit sub
end if
obj=var
expireTime=expire
application.lock
application(cacheName)=obj
application(expireTimeName)=expireTime
application.unlock
end sub
public property get value
'取值
if isempty(obj) or not isDate(expireTime) then
value=null
elseif CDate(expireTime)<now then
value=null
else
value=obj
end if
end property
public sub makeEmpty()
'释放application
application.lock
application(cacheName)=empty
application(expireTimeName)=empty
application.unlock
obj=empty
expireTime=empty
end sub
public function equal(var2)
'比较
if typename(obj)<>typename(var2) then
equal=false
elseif typename(obj)="Object" then
if obj is var2 then
equal=true
else
equal=false
end if
elseif typename(obj)="Variant()" then
if join(obj,"^")=join(var2,"^") then
equal=true
else
equal=false
end if
else
if obj=var2 then
equal=true
else
equal=false
end if
end if
end function
end class
%>
Dim url, body, myCache
url = Request.QueryString("url")
Set myCache = new cache
myCache.name = "picindex"&url
If myCache.valid Then
body = myCache.value
Else
body = GetWebData(url)
myCache.add body,dateadd("d",1,now)
End If
If Err.Number = 0 Then
Response.CharSet = "UTF-8"
Response.ContentType = "application/octet-stream"
Response.BinaryWrite body
Response.Flush
Else
Wscript.Echo Err.Description
End if
'取得数据
Public Function GetWebData(ByVal strUrl)
Dim curlpath
curlpath = Mid(strUrl,1,Instr(8,strUrl,"/"))
Dim Retrieval
Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", strUrl, False,"",""
.setRequestHeader "Referer", curlpath
.Send
GetWebData =.ResponseBody
End With
Set Retrieval = Nothing
End Function
'cache类
class Cache
private obj 'cache内容
private expireTime '过期时间
private expireTimeName '过期时间application名
private cacheName 'cache内容application名
private path 'url
private sub class_initialize()
path=request.servervariables("url")
path=left(path,instrRev(path,"/"))
end sub
private sub class_terminate()
end sub
public property get blEmpty
'是否为空
if isempty(obj) then
blEmpty=true
else
blEmpty=false
end if
end property
public property get valid
'是否可用(过期)
if isempty(obj) or not isDate(expireTime) then
valid=false
elseif CDate(expireTime)<now then
valid=false
else
valid=true
end if
end property
public property let name(str)
'设置cache名
cacheName=str & path
obj=application(cacheName)
expireTimeName=str & "expires" & path
expireTime=application(expireTimeName)
end property
public property let expires(tm)
'重设置过期时间
expireTime=tm
application.lock
application(expireTimeName)=expireTime
application.unlock
end property
public sub add(var,expire)
'赋值
if isempty(var) or not isDate(expire) then
exit sub
end if
obj=var
expireTime=expire
application.lock
application(cacheName)=obj
application(expireTimeName)=expireTime
application.unlock
end sub
public property get value
'取值
if isempty(obj) or not isDate(expireTime) then
value=null
elseif CDate(expireTime)<now then
value=null
else
value=obj
end if
end property
public sub makeEmpty()
'释放application
application.lock
application(cacheName)=empty
application(expireTimeName)=empty
application.unlock
obj=empty
expireTime=empty
end sub
public function equal(var2)
'比较
if typename(obj)<>typename(var2) then
equal=false
elseif typename(obj)="Object" then
if obj is var2 then
equal=true
else
equal=false
end if
elseif typename(obj)="Variant()" then
if join(obj,"^")=join(var2,"^") then
equal=true
else
equal=false
end if
else
if obj=var2 then
equal=true
else
equal=false
end if
end if
end function
end class
%>
将该文件上传到服务器空间,以后在要链接的图片地址前加上 路径/163.asp?url=图片地址 ,即可正常显示图片了,还是前面的图,加上后正常了
评论: 3 | 引用: 0 | 查看次数: 32561
- 1
依风听雨 [2007-04-15 11:58 PM]
太完美了。。。。。。。我顶。。。
谢谢 谢谢 终于 找到 好的 处理 办法了
这个 对 baidu同样 有效
还有 博主你 选的 自动 填验证码有问题 ,填 的 是 错误的
这个 对 baidu同样 有效
还有 博主你 选的 自动 填验证码有问题 ,填 的 是 错误的
- 1
发表评论