This article mainly introduces a simple method to use PHP to crack anti-Leech images, but the small series is not tested and looks a bit unreliable. if you need a friend, you can refer to it and have your own host to design "anti-leech ", in fact, this 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: