A simple method for cracking anti-Leech images using PHP _ PHP Tutorial

Source: Internet
Author: User
Use PHP to crack anti-Leech images. Anti-Leech protection is generally designed for hosts, including image anti-Leech protection and download anti-Leech protection, for example: 1. use. the code for setting anti-Leech replication in htaccess is as follows: RewriteEngineon has its own host and generally designs "anti-Leech", which includes Image anti-Leech protection and download anti-Leech protection, for example:
1. use. htaccess to set anti-Leech

The 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

The 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:

The code is as follows:

// GetImg. php? Url = target Image connection
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:

Refer "anti-Leech", which actually includes Image anti-Leech and download anti-Leech, for example: 1. use. htaccess to set anti-Leech code as follows: RewriteEngine on...

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.