IWBH_01

php_gd_proxy1.php

Nov 24th, 2018
433
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 14.43 KB | None | 0 0
  1. <?php
  2. function cget($lvn){
  3. if(isset($_GET[$lvn]))
  4.     return $_GET[$lvn];
  5. else
  6.     return "";
  7. }
  8.  
  9. $gd="";$ref1=!1;
  10. if(isset($_SERVER["HTTP_REFERER"])&&strpos($ref1=$_SERVER["HTTP_REFERER"],"/gd.d")==6)$gd="gd.";
  11. header("Access-Control-Allow-Origin: http://".$gd."dreamoftranscendence.x10host.com");
  12.  
  13. $mime1=cget("m2");
  14. if(!strlen($mime1))
  15.     $mime1="text/html;charset=utf-8";
  16.  
  17. if(($_cej1=($_ce1=cget("ce"))=="js")||($rjs_=isset($_GET["rjs"])))$mime1="text/javascript;charset=utf-8";
  18.  
  19. header("Content-Type: ".$mime1);
  20.  
  21. function s_page($ti0,$b0dy){
  22.     return "<!Doctype html><html><head><meta content='text/html; charset=utf-8' http-equiv='Content-Type'/><title>".$ti0."</title></head><body>".$b0dy."</body></html>";
  23. }
  24.  
  25.  
  26. $rd1_='{"is":"f.php","exists":!0}';
  27. if($_ce1=="html"){
  28. if((!($orig=cget("or")))&&$ref1) $orig=substr($ref1,4,strpos($ref1,"/",9)-4); else $orig="://dreamoftranscendence.x10host.com";
  29. exit(s_page("check existence iframe",'<script type="text/javascript">var pos=function(or_,i){try{self.top.postMessage('.$rd1_.',or_);}catch(e){if(!i)pos("http://main.xfiddle.com",!0);}};if(self!=self.top)pos("http'.$orig.'");</script>'));
  30. }else if($_cej1)exit('if(typeof self.got_it_01=="function")self.got_it_01('.$rd1_.');');
  31.  
  32.  
  33.  
  34. if(strlen(cget("r2"))>0){
  35.     header("Cache-Control: max-age=172800");
  36.     header("Location: http".cget("r2"));
  37. exit;
  38. }
  39.  
  40.  
  41. $shwo=cget("shwo");
  42.  
  43. $agent= "Mozilla/5.0 (Windows NT 8.1; WOW64; Trident/7.0; rv:11.0) like Gecko";
  44.  
  45. function sset_curl($dat,$url1){
  46.     global $agent;
  47.     curl_setopt($dat,CURLOPT_SSL_VERIFYPEER,false);
  48.     curl_setopt($dat,CURLOPT_RETURNTRANSFER,true);
  49.     curl_setopt($dat,CURLOPT_USERAGENT,$agent);
  50.     curl_setopt($dat,CURLOPT_VERBOSE,true);
  51.     curl_setopt($dat,CURLOPT_HTTPGET,true);
  52.     curl_setopt($dat,CURLOPT_ENCODING,"gzip");
  53.     if(strlen($url1)>2)
  54.     curl_setopt($dat,CURLOPT_URL, $url1);
  55. }
  56.  
  57. function gurl($es,$bf,$af){
  58.     $es="\x02".$es;
  59.     $sp1=strpos($es,$bf);
  60.     $fe_s=substr($es,$sp1+strlen($bf));
  61.     $sp2=strpos($fe_s,$af);
  62.     if($sp1 && $sp2)
  63.         return substr($fe_s,0,$sp2);
  64.     else
  65.         return "";
  66. }
  67.    
  68. function gurli($es,$bf,$af){
  69.     $es="\x02".$es;
  70.     $sp1=stripos($es,$bf);
  71.     $fe_s=substr($es,$sp1+strlen($bf));
  72.     $sp2=stripos($fe_s,$af);
  73.     if($sp1 && $sp2)
  74.         return substr($fe_s,0,$sp2);
  75.     else
  76.         return "";
  77. }
  78.  
  79.  
  80. $acc01="en-US";
  81. function load_curl($url,$extra_h,$bdy){
  82.  global $agent, $acc01;
  83.  $h0st=gurl($url,"://","/");
  84.  $harr=["Accept"=>"text/html, application/xhtml xml, image/jxr, */*",
  85.  "Accept-Encoding"=>"gzip, deflate",
  86.  "Accept-Language"=>$acc01,
  87.  "Host"=>$h0st,
  88.  "User-Agent"=>$agent];
  89.  $if0=gettype($extra_h)=="array";
  90.  if($if0)
  91.     $harr=array_merge($harr, $extra_h);
  92.  $g1=curl_init();
  93.  sset_curl($g1,$url);
  94.  if($bLn=strlen($bdy)){
  95.     if(!isset($harr["Content-Length"])) $harr["Content-Length"]=$bLn;
  96.     curl_setopt($g1,CURLOPT_HTTPGET,false);
  97.     curl_setopt($g1,CURLOPT_POST,!0);
  98.     curl_setopt($g1,CURLOPT_POSTFIELDS,$bdy);
  99.  }
  100.  $i0=0;
  101.  $harr2=[];
  102.  foreach($harr as $n1 => $v1){
  103.      $harr2[$i0]=$n1.": ".$v1;
  104.      $i0++;
  105.  }
  106.  curl_setopt($g1, CURLOPT_COOKIESESSION, true);
  107.  curl_setopt($g1, CURLOPT_BINARYTRANSFER,true);
  108.  curl_setopt($g1, CURLOPT_HEADER, true);
  109.  curl_setopt($g1, CURLOPT_HTTPHEADER, $harr2);
  110.  curl_setopt($g1, CURLOPT_FRESH_CONNECT, true);
  111.  $fdat01=curl_exec($g1);
  112.  $hl1=curl_getinfo($g1, CURLINFO_HEADER_SIZE);
  113.  curl_close($g1);
  114.  $hed1=substr($fdat01, 0, $hl1);
  115.  $b0dy=substr($fdat01, $hl1);
  116.  if((strlen($b0dy)-gurli($hed1,"content-length: ","\r\n"))==2) $b0dy=substr($b0dy,2);
  117.  /*if($blen=strlen($b0dy) && gurli($hed1, "\r\nContent-Encoding: ", "\r\n")=="gzip")
  118.  $b0dy=gzinflate($b0dy, $blen*/
  119.  $r00=[$hed1, $b0dy, $url];
  120.  if($if0)
  121.  $r00[3]=$extra_h;
  122.  return $r00;
  123. }
  124.  
  125. function s_cuk($v,$dn,$pt,$nd){
  126.     header("Set-Cookie: ".$v."; Expires=".date("D, j-M-Y H:i:s", time()+round(86400*$nd))." GMT; Path=/".$pt."; Domain=".$dn.";");
  127. }
  128.  
  129. function strinclude($str){
  130.  $fi=fopen($p_="temp_".rand (1,1000).".txt","w");
  131.  fwrite($fi,$str);
  132.  fclose($fi);
  133.  include $p_;
  134.  unlink($p_);
  135. }
  136.  
  137.  
  138. $gdfg_c=0;
  139. function gdfg($gfi,$i){
  140. global $gdfg_c,$shwo;
  141. $pp1="https://docs.google.com/uc?";
  142. $rfu=load_curl($pp1."id=".$gfi."&export=download", "","");
  143.  
  144. if(substr($shwo,3)*1==$gdfg_c&&substr($shwo,0,3)=="gfg")
  145. exit("got: ".$rfu[2]."\x0D\x0A".$rfu[0].$rfu[1]);
  146.  
  147. if(strpos($rfu[1],"<title>Go"."og"."le Drive - Virus scan warning</title>")||gurl($rfu[0], "\x20", "\x20")=="500"){
  148.         $ku=gurli($rfu[0],"set-cookie: ", ";");
  149.         if(strlen($ku))
  150.         $ku=["Cookie"=>$ku];
  151.         $rfu=load_curl($pp1.gurl($rfu[1], 'href="/uc?', '"'), $ku,"");
  152. }
  153.  
  154. $rfu=load_curl(gurli($rfu[0],"\r\nlocation: ", "\r\n"), "","");
  155.  
  156. if(substr($shwo,4)*1==$gdfg_c&&substr($shwo,0,4)=="grfg")
  157. exit("got: ".$rfu[2]."\x0D\x0A".$rfu[0].$rfu[1]);
  158.  
  159. $tbp=strpos($rfu[1],"~*tbar*~");
  160. if($tbp)
  161. $rfu[1]=str_replace("~*tbar*~", file_get_contents("../t_bar.html"), $rfu[1]);
  162.  
  163. $gdfg_c++;
  164.  
  165. if($i)
  166.     strinclude($rfu[1]);
  167. else
  168.     return $rfu;
  169. }
  170.  
  171. $ggb_p_00="0Bxb5iFgmM3V6SS1QQlZBS0w0bGc";
  172.  
  173. $r_p1=[$_SERVER["SERVER_NAME"],$_SERVER["REQUEST_URI"]];
  174. if(substr($r_p1[1],0,6)!="/f.php")
  175. $fp_includenorun=!0;
  176.  
  177. if(isset($fp_includenorun)){ gdfg($ggb_p_00,1); goto ending; }
  178.  
  179. $main_c=function(){
  180.     global $agent, $g004, $ggb_p_00, $g0, $cukie, $ggb_true, $shwo,$r_p1;
  181.  
  182. gdfg("0Bxb5iFgmM3V6dDJsQUdGN3V2OUU",1); //stor
  183.  
  184. $SS_r_cache=f_parse();
  185.  
  186. if($shwo=="cache"){
  187. var_dump($SS_r_cache);
  188. exit;
  189. }
  190.  
  191.  
  192. $nm=cget("f");
  193. $fes=strpos($r_p1[1],".php/");
  194. if(!strlen($nm) && $fes){
  195. $nm="/".substr($r_p1[1],$fes+5);
  196. if($qui=strpos($nm,"?"))
  197. $nm=substr($nm,0,$qui);
  198. $nm=urldecode($nm);
  199. }
  200.  
  201. $url_par_ex="<br>Available URL Params:\n<br> f: the file name of a file stored on Google drive (Letter Case needs to match) a / and the file name will also work\n<br> m2: specify an alternate content-type header\n<br> fid: folder id of Google drive folder that file is stored in (you can use sub-directory paths but the root directory must be specified).\n<br> cg: (complete get) use this if you want the file output directly instead of redirecting to the Google drive download link\n<br> shwo: in case of error, show fetched content at various stages\n<br>r2: redirect (302) to specified url\n<br>rjs: return file path in javascript format.";
  202.  
  203. if(!strlen($nm))
  204.     exit(s_page("f.php", "Please put the \"f\" param in the url.".$url_par_ex));
  205.    
  206. if($nm[0]!="/")
  207. $nm="/".$nm;
  208.  
  209. $nm=str_replace ("//","/",$nm);
  210.  
  211. $tree_1=explode("/",$nm);
  212. $lev_0=0;
  213. if($tree_1==["",""])
  214. $nm2="index.html";
  215. else
  216. $tree_1=array_slice($tree_1,1);
  217.  
  218. $nm2=$tree_1[$lev_0];
  219.  
  220. $tl_1=count($tree_1);
  221.  
  222. if($tree_1[$tl_1-1]=="") $tree_1[$tl_1-1]="index.html";
  223.  
  224. $c_var01="nm_".base64_encode($nm);
  225. if(isset($SS_r_cache[$c_var01])){
  226.     $g004=[$SS_r_cache[$c_var01], $tree_1[$tl_1-1]];
  227.     goto endy;
  228. }
  229.  
  230. $s_pos01=strpos(strrev($nm), "/");
  231.     $nm5=substr($nm,0,strlen($nm)-$s_pos01);
  232.     if($nm5[0]!="/")
  233.     $nm5="/".$nm5;
  234.  
  235. $mn_gd_fr=cget("fid");
  236. if(isset($SS_r_cache["fid".$nm5]) && !strlen($mn_gd_fr) && !isset($_GET["f"])){
  237.     $mn_gd_fr=$SS_r_cache["fid".$nm5];
  238.     $nm2=$tree_1[$tl_1-1];
  239. }
  240.  
  241. if(!strlen($mn_gd_fr))
  242.     $mn_gd_fr="0Bxb5iFgmM3V6VkUtdVU1eWV4ZWs"; //mn gd fr (main googledrive folder)
  243.  
  244. $cukie=[];
  245.  
  246. gdfg($ggb_p_00,1);
  247.  
  248. if(isset($SS_r_cache["KEY"])){
  249.     $unglobd=$SS_r_cache["KEY"];
  250.     goto fload;
  251. }
  252.  
  253. $res_1=load_curl("https://drive.google.com/open?id=".$mn_gd_fr, "", "");
  254.  
  255. if($shwo=="1")
  256.     exit($res_1[0]."\n".$res_1[1]);
  257.  
  258.    
  259. $res_1=re_302($res_1);
  260.  
  261. couki($res_1);
  262. $hds1=$res_1[0];
  263. $fdat1=$res_1[1];
  264.  
  265. if(stripos($hds1, "\r\nLocation: "))
  266.     exit(s_page("Error: ", "Error, 302 manys."));
  267. if($shwo=="2")
  268.     exit("R_times = ".$res_1["re_dir"]."<br>\n".$hds1."\n".$fdat1);
  269. if(stripos($fdat1, "<html>") < 20)
  270. $d_name=gurli($fdat1, "<title>", "</title>");
  271.  
  272. if(!strpos($fdat1, "__initData"))
  273.     exit(s_page("Error", "Error, no key ring."));
  274.  
  275. $dataGlob01=gurl($fdat1, "__initData", "\x0A;");
  276.  
  277. if($shwo=="DataGlob")
  278.     exit("//<script type='text/javascript'>\x0Aself.__initData".$dataGlob01."\x0Aif(typeof self.got_it_01=='function')\x0Aself.got_it_01(__initData); //</script>");
  279.  
  280. $unglob01=explode('https://client-channel.'.$g0.'.com/client-channel/client', $dataGlob01);
  281. $unglob02=strrev(clunch(strrev($unglob01[0]),"[","]")).clunch($unglob01[1],"]","[");
  282. $unglob02=str_replace('""','',$unglob02);
  283. if($shwo=="Globby")
  284.     exit($unglob02);
  285. $unglob02=explode('"',$unglob02);
  286. $ug2_l=count($unglob02);
  287. $unglb_r=0;
  288. while(!isset($unglobd) && $unglb_r < $ug2_l){
  289.     $_dis=$unglob02[$unglb_r];
  290.     if(strlen($_dis) > 15)
  291.     if($_dis[0]=="A")
  292.     $unglobd=$_dis;
  293.     $unglb_r++;
  294. }
  295.  
  296. if(!isset($unglobd))
  297.     exit(s_page("Error", "No key to fit the lock."));
  298.  
  299. $SS_r_cache["KEY"]=$unglobd;
  300.  
  301. fload:
  302.  
  303. if($shwo=="unGlobd")
  304.     exit($unglobd);
  305. $pth01="https://clients6.google.com/drive/v2beta/files?openDrive=true&reason=102&syncType=0&errorRecovery=false&q=trashed%20%3D%20false%20and%20'".$mn_gd_fr."'%20in%20parents&fields=kind%2CnextPageToken%2Citems(kind%2Ctitle%2CmimeType%2CcreatedDate%2CmodifiedDate%2CmodifiedByMeDate%2ClastViewedByMeDate%2CfileSize%2ClastModifyingUser(kind%2C%20displayName%2C%20picture%2C%20permissionId%2C%20emailAddress)%2ChasThumbnail%2CthumbnailVersion%2CiconLink%2Cid%2Cshared%2CsharedWithMeDate%2CuserPermission(role)%2CexplicitlyTrashed%2CquotaBytesUsed%2Cshareable%2Ccopyable%2CfileExtension%2CsharingUser(kind%2CdisplayName%2Cpicture%2CpermissionId%2CemailAddress)%2Cspaces%2Ceditable%2Cversion%2CteamDriveId%2ChasAugmentedPermissions%2CtrashingUser(kind%2CdisplayName%2Cpicture%2CpermissionId%2CemailAddress)%2CtrashedDate%2Cparents(id)%2Clabels(starred%2Chidden%2Ctrashed%2Crestricted%2Cviewed)%2Cowners(permissionId%2CdisplayName%2Cpicture%2Ckind)%2Ccapabilities(canCopy%2CcanDownload%2CcanEdit%2CcanAddChildren%2CcanDelete%2CcanRemoveChildren%2CcanShare%2CcanTrash%2CcanRename%2CcanReadTeamDrive%2CcanMoveTeamDriveItem))%2CincompleteSearch&appDataFilter=NO_APP_DATA&spaces=DRIVE&maxResults=150&orderBy=folder%2Ctitle%20asc&key=".$unglobd;
  306.  
  307.  
  308. $eh1=["Origin"=>"https://drive.google.com", "Referer"=>"https://drive.google.com/drive/folders/".$mn_gd_fr, "Accept"=>"*/*"];  //"x-goog-authuser"=>"0"
  309.  
  310.  
  311. $ic01=if_cuk($pth01);
  312. if(strlen($ic01))
  313. $eh1["Cookie"]=$ic01;
  314.  
  315. $res_2=load_curl($pth01, $eh1,'');
  316. $res_2=re_302($res_2);
  317. couki($res_2);
  318.  
  319. if(stripos($res_2[0], "\r\nLocation: "))
  320.     exit(s_page("Error: ", "Error, 302 manys."));
  321.  
  322. $fldr_dat=json_decode($res_2[1],!0);
  323.  
  324. //bad code:
  325. while(isset($fldr_dat["nextPageToken"])){
  326. $pth01.="&pageToken=".$fldr_dat["nextPageToken"];
  327. $ic01=if_cuk($pth01);
  328. if(strlen($ic01))
  329. $eh1["Cookie"]=$ic01;
  330. $res_3=load_curl($pth01, $eh1);
  331. $res_3=re_302($res_3);
  332. $fldr_dat2=json_decode($res_3[1],!0);
  333. $fldr_dat["items"]=array_merge($fldr_dat["items"],$fldr_dat2["items"]);
  334. if(isset($fldr_dat2["nextPageToken"])) $fldr_dat["nextPageToken"]=$fldr_dat2["nextPageToken"]; else unset($fldr_dat["nextPageToken"]);
  335. //$res_2[1]=substr($res_2[1], 0, -1).",".substr($res_3[1], 1);
  336. }
  337. //end bad code
  338.  
  339. if($shwo=="JSON_".$lev_0)
  340.     exit("/*".$res_2[0]."*//*\nself.got_url=\"".$res_2[2]."\"\nself.GDFs_1=".json_encode($fldr_dat).";\n//e: ");
  341.  
  342. if(!isset($d_name) && $mn_gd_fr == "0Bxb5iFgmM3V6VkUtdVU1eWV4ZWs")
  343. $d_name="b0x{}^W@\x24";
  344.  
  345. /*$nm3=str_replace('"', "\\u0022", $nm2);
  346. if(!strpos($res_2[1], $nm3)) */
  347.  
  348. foreach($fldr_dat["items"] as $v){
  349. if($v["title"]==$nm2) $_file1_=$v;
  350. }
  351.  
  352. if(!isset($_file1_)){
  353. //bad code 2:
  354. if($nm2=="index.html"||$nm2=="index.htm"||$nm2=="index.php"){
  355. $ti_="Index Of ".htmlentities($nm);
  356. $NDX_="<style>td,th{padding-left:10px;}</style><br>".$ti_."<br><table><tbody><tr><th></th><th>Name</th><th>Size (bytes)</th><th>Created On Date</th><th>Last Modified Date</th><th>Owner</th></tr>\r\n<tr><td></td><td><a href='../'>Parent Directory</a></td><td>0</td><td>. . .</td><td>. . .</td><td>. . .</td></tr>\r\n<tr><td></td><td><a href='/./f.php/'>Top Directory</a></td><td>0</td><td>. . .</td><td>. . .</td><td>. . .</td></tr>\r\n";
  357. foreach($fldr_dat["items"] as $v){
  358. $s_="";
  359. if($v["mimeType"]=="application/vnd.google-apps.folder"){ $SS_r_cache["fid".$nm5.$v["title"]]=$v["id"];
  360. $s_="/";
  361. }else $SS_r_cache["nm_".base64_encode($v["title"])]=$v["id"];
  362. if(!isset($v["fileSize"])) $v["fileSize"]=0;
  363. $NDX_.="<tr><td><img src='".$v["iconLink"]."'></td><td><a href='".$v["title"].$s_."'>".$v["title"]."</a></td><td>".$v["fileSize"]."</td><td>".$v["createdDate"]."</td><td>".$v["modifiedDate"]."</td><td>".$v["owners"][0]["displayName"]."</td>\r\n";
  364. }
  365. c_store($SS_r_cache);
  366. exit(s_page($ti_,$NDX_."</tbody></table>"));
  367. }else
  368. //end bad code 2 */
  369.  exit(s_page("Error", "Error: \"$nm2\" not found in folder: \"".$mn_gd_fr."\" AKA \"".$d_name."\"".$url_par_ex));
  370. }
  371. //get file/folder id from drive
  372. $fid1=$_file1_["id"];
  373.  
  374. if($_file1_["mimeType"]=="application/vnd.google-apps.folder"){
  375.     $lev_0++;
  376.     if($lev_0 > 12)
  377.         exit(s_page("Error", "Error, too many sub dirs. Try using the \"fid\" parameter with the id of the folder the file you are looking for is in, and change the \"f\" parameter to only the file name."));
  378.     if($lev_0 < $tl_1)
  379.      $nm2=$tree_1[$lev_0];
  380.     else
  381.     $nm2="index.html";
  382.     $d_name=$nm2;
  383.     $mn_gd_fr=$fid1;
  384.     unset($_file1_);
  385.     goto fload;
  386. }
  387.  
  388. $gc01=if_cuk("https://drive.google.com/");
  389. if(strlen($gc01))
  390. header("X-got-cookie: ".$gc01);
  391.  
  392. if($tl_1 >1 && !isset($SS_r_cache["fid".$nm5]) && !isset($_GET["fid"])){
  393.     $SS_r_cache["fid".$nm5]=$mn_gd_fr;
  394. }
  395.  
  396. if(strlen($fid1) < 25)
  397.  exit(s_page("Error", "Error, Unknown. &#9785;  :("));
  398.  
  399. if(!isset($SS_r_cache[$c_var01]))
  400.  $SS_r_cache[$c_var01]=$fid1;
  401.  
  402. c_store($SS_r_cache);
  403. $g004=[$fid1, $nm2,$unglobd];
  404.  endy:
  405.     if(gurl($r_p1[1],".php/","?")=="Stor.php_act" && !strlen(cget("fid")))
  406.         exit();
  407. };
  408. $main_c();
  409. unset($main_c);
  410.  
  411.  
  412. $grr2="https://docs.google.com/uc?id=".$g004[0]."&export=download";
  413.  
  414.  
  415. if($rjs_){
  416.   if(cget("sdsc")*1){
  417.   $res_='"odt":'.(load_curl("https://clients6.google.com/drive/v2beta/files/".$g004[0]."?fields=createdDate%2Cdescription%2Ckind&supportsTeamDrives=true&key=AIzaSyC1qbk75NzWBvSaDh6KnsjjA9pIrP4lYIE",["Origin"=>"https://drive.google.com", "Referer"=>"https://drive.google.com/file/d/".$g004[0]."/view"],"")[1]);
  418.   }else $res_="";
  419.     echo "self.fid_01={\"path\":\"".$grr2."\", \"name\":\"".$g004[1]."\"".$res_."};\r\nif(typeof self.got_it_01=='function')\r\nself.got_it_01(fid_01);";
  420. }elseif(!isset($_GET["dwnld"])){
  421. $pa=strpos("_".$g004[1],'.php_act');
  422. $ii=($pa&&strpos("_".$g004[1], '.')==$pa)&&(!isset($_GET["fid"]));
  423. if($ii&&(!$ggb_true))
  424. gdfg($ggb_p_00,1);
  425.  
  426. $gro=gdfg($g004[0], $ii);
  427.  
  428. if(!$ii)
  429. echo $gro[1];
  430. }
  431. else
  432.     header("Location: ".$grr2);
  433.  
  434. ending:
  435. 0;
  436. ?>
Add Comment
Please, Sign In to add comment