防盗链

1.Apache开启Rewrite模块

2..htacess文件,把所有图片都转了

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} .*\.(jpg|jpeg|gif|png) [NC]
RewriteRule .* http://www.zixue.it/static/image/common/zixuelogo.png

3.把来自非localhost的转了

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} .*\.(jpg|jpeg|gif|png) [NC]
RewriteCond %{HTTP_REFERER} !localhost [NC]
RewriteRule .* http://www.zixue.it/static/image/common/zixuelogo.png

如果只是在0618目录下

Rewrite Base /0618

4.伪造Refer就可以拿到防盗链的图片

http://www.zixue.it/static/image/common/zixuelogo.png(自学网logo)

<?php
require('./http.class.php');
$http = new Http('http://localhost/http/turn_5.jpg');
$http->setHeader('Referer: http://localhost');
$res = $http->get();

file_put_contents('./ab.jpg',substr(strstr($res,"\r\n\r\n"),4));
?>

 

posted on 2015-12-20 19:39  阿卡贝拉  阅读(88)  评论(0)    收藏  举报