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...