教程集 www.jiaochengji.com
教程集 >  脚本编程  >  php  >  正文 php破解apache,nginx,iis防盗链图片

php破解apache,nginx,iis防盗链图片

发布时间:2016-12-03   编辑:jiaochengji.com
教程集为您提供php破解apache,nginx,iis防盗链图片等资源,欢迎您收藏本站,我们将为您提供最新的php破解apache,nginx,iis防盗链图片资源
现在多数网站都有防盗链一些简单设置了最常用的就是apache,nginx,iis设置了,那么这种设置是不是不可破的呢,答案是否写了,下面我们一起来看破解方法。

有自己的主机一般都会设计"防盗链", 其实包括图片防盗链,和下载防盗链等,如:

使用.htaccess设置防盗链

<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy7469')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy7469>

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?xuexb.com/.*$ [NC]
RewriteRule .(gif|jpg)$ http://www.jiaochengji.com /image.gif [R,L]


nginx设置防盗链

<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy2332')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy2332>

location ~* .(gif|jpg|png|swf|flv)$ {
 valid_referers none blocked jquerycn.cn;
 if ($invalid_referer) {
  rewrite ^/ http://jquerycn.cn /234_s.gif;
  #return 404;
 }
}

但怎么破解防盗链呢? 一般的防盗链是判断来路是否为自己的域名, 我们可以使用 php 内置的 file_get_contents 方法来请求这个图片(当然别的后端语言也有类似的方法), 如:
//getImg.php?url=目标图片连接

<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy2340')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy2340><?php
header('Content-type: image/jpeg');
echo file_get_contents(isset($_GET["url"])?$_GET["url"]:'http://xxxx域名 /images/v1/loading-16-16.gif');
?>

php代码片段看例子:

1, 直接加载防盗链图片: 

破解防盗链图片
 
2, 通过php读取图片:

破解防盗链图片

您可能感兴趣的文章:
PHP防盗链图片怎么破解?实例代码
php破解apache,nginx,iis防盗链图片
PHP禁止图片盗链
PHP网站大流量与高并发的解决方法
php中curl破解图片防盗链
PHP禁止图片文件的被盗链函数
php采集防图片盗链方法
php实现图片批量下载到本地实例(可采防盗链)
php伪造referer 使用referer防止图片盗链
dedecms 下载远程图片和资源失败解析方法

[关闭]
~ ~