A simple method to crack anti-leech images using PHP

Source: Internet
Author: User

You can design anti-leech protection for your host, including image anti-leech protection and download anti-leech protection, for example:
1. Use. htaccess to set anti-leech
Copy codeThe Code is as follows: RewriteEngine on
RewriteCond % {HTTP_REFERER }! ^ $
RewriteCond % {HTTP_REFERER }! ^ Http: // (www \.)? Jb51.net/.*$ [NC]
RewriteRule \. (gif | jpg) $ http://www.jb51.net/image.gif [R, L]
2. Set anti-leech protection for nginx
Copy codeThe Code is as follows: location ~ * \. (Gif | jpg | png | swf | flv) $ {
Valid_referers none blocked jb51.net;
If ($ invalid_referer ){
Rewrite ^/http://jb51.net/234_s.gif;
# Return 404;
}
}
But how to crack anti-leech? Generally, anti-leech is used to determine whether the origin is your own domain name. We can use the file_get_contents Method built in php to request this image (of course, other backend languages also have similar methods), such:
Copy codeThe Code is as follows: // getImg. php? Url = Target Image connection
<? Php
Header ('content-type: image/jpeg ');
Echo file_get_contents (isset ($ _ GET ["url"])? $ _ GET ["url"]: 'http: // static.jb51.net/images/v1/loading-16-16.gif ');
?>
Example:

1. Directly attach anti-leech images: (unauthorized images on the site are displayed blank)

2. Read images through php:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.