< span="">Anti-theft chain< span="">
Forged Referer instance code, mainly used for some breakthrough anti-theft chain, than tablets, software and so on.
Here directly to the complete program, the specific application can be modified by themselves.
The example I gave here is very simple, and in fact, there are many applications that can be developed from this example. such as hiding the real URL address ... Hey, I'm going to do the exact analysis.
Create a new file file.php here. The next parameter is the target address of the referfer that needs to be forged. such as: File.php/http://www.xxx.xxx/xxx.mp3
Code:
-
- $url = Str_replace ('/file.php/',',$_server[" Request_uri "]); //Get the URL that needs to be converted. Here I am lazy, do not do safety testing, need to add their own to
- $downfile = Str_replace ("","%20",$url); //Replace spaces, etc., can be replaced according to the actual situation
- $downfile = Str_replace ("http://","",$downfile);//Remove HTTP///
- $urlarr = Explode ("/",$downfile); //Break out Domain name with "/"
- $domain = $urlarr [0]; //Domain name
- $getfile = Str_replace ($urlarr[0],",$downfile); //Get part of the header
- $content = @ Fsockopen ("$domain", $errno , $errstr,); //Connect to target host
- if (! $content ) {//Link not on prompt error
- die ("Sorry, unable to connect on $domain. ");
- }
- fputs ($content, "GET $getfile http/1.0rn");
- fputs ($content, "Host: $domainrn");
- fputs ($content, "Referer: $domainrn"); //Forged parts
- fputs ($content, "user-agent:mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) rnrn ");
- while (! feof ($content)) {
- $TP .= fgets ($content, +);
- if (strstr($tp,"OK"){ //here to illustrate. The first line of the header is typically the state of the requested file. Please refer to the HTTP 1.1 status code and its meaning hi.baidu.com/110911/blog/item/21f20d2475af812ed50742c5.html here is the normal file request status, just a direct turn on it. Continuation program for other states
- Header ("Location: $url");
- die ();
- }
- }
- //302 steering, most of the anti-theft chain system is the first to judge the Referfer, the words then turn to the real address. Here's how to get the real address.
- $arr = Explode ("n",$tp);
- $arr 1 = Explode ("Location:",$tp); //Break out the real-time address behind the location
- $arr 2 = Explode ("n",$arr 1[1]);
- Header (' content-type:application/force-download '); //Mandatory Download
- Header ("Location:". ) $arr 2 [0]); //Turn to Destination address
- die ();
- ?>
The above code only for the use of Referer to determine whether hotlinking anti-theft chain system, the use of other special methods of anti-theft chain, it does not apply.
< span="">< span="">
-
- $txt = $_get [' url '];
- Echo referfile ($txt,' http://www.jbxue.com/');
- 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);
- }
- $host = "Pakey.net" ; //The domain you want to visit
- $target = "/test.asp" ; //The page address you want to visit
- $referer = "http//uuwar.com/" ;//Forge the antecedents page
- $fp = Fsockopen ($host, $errno , $errstr,);
- if (! $fp ){
- Echo "$errstr ($errno)
\ n ";
- }Else{
- $out = "
- GET $target http/1.1
- Host: $host
- Referer: $referer
- Connection:close\r\n\r\n ";
- Fwrite ($fp, $out);
- while (! feof ($fp)) {
- Echo fgets($fp, 1024x768);
- }
- Fclose ($fp);
- }
- ?>
http://www.bkjia.com/PHPjc/743818.html www.bkjia.com true http://www.bkjia.com/PHPjc/743818.html techarticle anti-theft chain forged Referer instance code, mainly used for some breakthrough anti-theft chain, than tablets, software and so on. Here directly to the complete program, the specific application can be modified by themselves. ...