Php code to crack anti-Leech protection by forging an http header _ PHP Tutorial

Source: Internet
Author: User
Php code to crack anti-Leech protection by forging an http header. Counterfeit referer instance code is mainly used to break through anti-Leech protection, comparison films, software, etc. here we will directly provide the complete program. you can modify the specific application. I am here to counterfeit referer instance code, mainly used for breaking through anti-Leech protection, slice, software, etc.

The complete program is provided here. you can modify the specific application on your own.
The example I provided here is very simple. In fact, many applications can be shown in this example. For example, hiding a real URL ...... Hey, let's analyze it by yourself.
Create a file. php. The following parameter is the target address of the referer to be forged. Such as: file. php/http://www.xxx.xxx/xxx.mp3

The code is as follows:


$ Url = str_replace ('/file. php/', '', $ _ SERVER [" REQUEST_URI "]); // Obtain the url to be converted. I am so lazy here that I don't need to perform security detection. I need to add it myself.
$ Downfile = str_replace ("", "% 20", $ url); // replace spaces and so on, which can be replaced according to the actual situation
$ Downfile = str_replace ("http: //", "", $ downfile); // remove http ://
$ Urlarr = explode ("/", $ downfile); // break down the domain name "/"
$ Domain = $ urlarr [0]; // domain name
$ Getfile = str_replace ($ urlarr [0], '', $ downfile); // GET The GET part in the header.
$ Content = @ fsockopen ("$ domain", 80, $ errno, $ errstr, 12); // connect to the target host
If (! $ Content) {// An error is prompted if the link is not connected.
Die ("Sorry, unable to connect to $ domain. ");
}
Fputs ($ content, "GET $ getfile HTTP/1.0rn ");
Fputs ($ content, "Host: $ domainrn ");
Fputs ($ content, "Referer: $ domainrn"); // counterfeit part
Fputs ($ content, "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) rnrn ");
While (! Feof ($ content )){
$ Tp. = fgets ($ content, 128 );
If (strstr ($ tp, "200 OK") {// Here we will describe it. The first line of the header is generally the status of the request file. For details, refer to the HTTP 1.1 Status Code and its meaning. Programs in other states
Header ("Location: $ url ");
Die ();
}
}
// 302 redirection. most anti-Leech systems first judge the referer. If yes, they will then turn to the real address. The following describes how to obtain the real address.
$ Arr = explode ("n", $ tp );
$ Arr1 = explode ("Location:", $ tp); // returns the actual address after the Location
$ Arr2 = explode ("n", $ arr1 [1]);
Header ('content-Type: application/force-download'); // force download
Header ("location:". $ arr2 [0]); // redirects to the target address
Die ();
?>




This program can only use referer to determine whether the leeching anti-Leech system is used. Other special anti-Leech methods are used. This estimation is not applicable.

The code is as follows:


$ Txt = $ _ GET ['URL'];
Echo referfile ($ txt, 'http: // www.jb51.net /');

Function referfile ($ url, $ refer = ''){
$ Opt = array ('http' => array ('header' => "Referer: $ refer "));
$ Context = stream_context_create ($ opt );
Header ("Location:". $ url );
Return file_get_contents ($ url, false, $ context );
}


The code is as follows:


$ Host = "pakey.net"; // The domain name you want to access
$ Target = "/test. asp"; // address of the page to be accessed
$ Referer = "http // uuwar.com/"; // forged webpage
$ Fp = fsockopen ($ host, 80, $ errno, $ errstr, 30 );
If (! $ Fp ){
Echo "$ errstr ($ errno)
\ N ";
} Else {
$ Out ="
GET $ target HTTP/1.1
Host: $ host
Referer: $ referer
Connection: Close \ r \ n ";

Fwrite ($ fp, $ out );
While (! Feof ($ fp )){
Echo fgets ($ fp, 1024 );
}
Fclose ($ fp );
}
?>


I used the code in my novel thief and cracked the txt file anti-Leech of yunxuange.

The complete program is provided here. you can modify the specific application on your own. Here I will give...

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.