Guest User

Plugin RapidLeech For uploading.com

a guest
May 21st, 2012
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 12.35 KB | None | 0 0
  1. <?php
  2. if (!defined('RAPIDLEECH')) {
  3.     require_once ("index.html");
  4.     exit();
  5. }
  6.  
  7. class uploading_com extends DownloadClass {
  8.     public function Download($link) {
  9.         global $premium_acc;
  10.  
  11.         if (!$_REQUEST['step']) {
  12.             $this->page = $this->GetPage($link);
  13.             is_present($this->page, "The requested file is not found");
  14.             $this->cookie = GetCookiesArr($this->page);
  15.             if (empty($this->cookie['SID'])) html_error("Error: Cookie [SID] not found!");
  16.         }
  17.         $this->link = $link;
  18.         if (($_REQUEST["cookieuse"] == "on" && preg_match("/remembered_user=([\w.]+);?/i", $_REQUEST["cookie"]) !== false) || ($_REQUEST["premium_acc"] == "on" && !empty($premium_acc["uploading_com"]["cookie"]))) {
  19.             $this->changeMesg(lang(300) . "<br />Uploading.com Premium Download [Cookie]");
  20.             return $this->Login();
  21.         } elseif (($_REQUEST['premium_acc'] == 'on' && (($_REQUEST['premium_user'] && $_REQUEST['premium_pass']) || (!empty($premium_acc['uploading_com']['user']) && !empty($premium_acc['uploading_com']['pass']))))) {
  22.             $this->changeMesg(lang(300) . "<br />Uploading.com Premium Download");
  23.             return $this->Login();
  24.         } elseif ($_REQUEST['step'] == 'captcha') {
  25.             return $this->Login(true);
  26.         } elseif ($_REQUEST['step'] == 'passpre') {
  27.             return $this->Premium(true);
  28.         } else {
  29.             $this->changeMesg(lang(300) . "<br />Uploading.com Free Download");
  30.             return $this->Free();
  31.         }
  32.     }
  33.  
  34.     private function Free() {
  35.         if ($_REQUEST['step'] == 'passfree') {
  36.             $post['action'] = $_POST['action'];
  37.             $post['file_id'] = $_POST['file_id'];
  38.             $post['code'] = $_POST['code'];
  39.             $post['pass'] = $_POST['password'];
  40.             $Url = urldecode($_POST['link']);
  41.             $this->cookie = StrToCookies(urldecode($_POST['cookie']));
  42.             $check = $this->GetPage($Url, $this->cookie, $post, $this->link);
  43.         } else {
  44.             is_present($this->page, "The file owner set up a limitation<br />that only premium members are<br />able download this file.");
  45.             is_present($this->page, "Sorry, you have reached your daily download limit.<br />Please try again tomorrow or acquire a premium membership.");
  46.             $form = cut_str($this->page, '<div class="page inner_content pageDownloadAvm">', '<div class="fixer"></div>');
  47.             if (!preg_match('%<form action="([^"]+)" method="post" id="downloadform">%', $form, $fl)) html_error("Error [Post Link FREE not found!]");
  48.             $Url = trim($fl[1]);
  49.             if (!preg_match_all('@<input type="hidden" name="([^"]+)" value="([^"]+)" \/>@', $form, $c)) html_error('Error [Post Data 1 FREE not found!]');
  50.             $match = array_combine($c[1], $c[2]);
  51.             if (strpos($this->page, 'Please Enter Password')) {
  52.                 $data = array_merge($this->DefaultParamArr($Url, $this->cookie), $match);
  53.                 $data['step'] = 'passfree';
  54.                 $this->EnterPassword($data);
  55.                 exit();
  56.             }
  57.             $post = array();
  58.             foreach ($match as $key => $value) {
  59.                 $post[$key] = $value;
  60.             }
  61.             $check = $this->GetPage($Url, $this->cookie, $post, $this->link);
  62.         }
  63.         // Dont use the existing variable cookie name, uploading.com give error message from cookie
  64.         $cookie = GetCookiesArr($check, $this->cookie);
  65.         if (!empty($cookie['error'])) {
  66.             echo ("<center><font color='red'><b>" . urldecode($cookie['error']) . "</b></font></center>");
  67.             // use previous cookie variable as it need to be checked again...
  68.             $data = $this->DefaultParamArr($Url, $this->cookie);
  69.             $data['action'] = $_POST['action'];
  70.             $data['file_id'] = $_POST['file_id'];
  71.             $data['code'] = $_POST['code'];
  72.             $data['step'] = 'passfree';
  73.             $this->EnterPassword($data);
  74.             exit();
  75.         }
  76.         if (!preg_match('%<strong id="timer_count">(\d+)</strong>%', $check, $wait)) html_error("Error [Timer not found!]");
  77.         $this->CountDown($wait[1]);
  78.         if (!preg_match('@action: \'([^\']+)\',@', $check, $act) || !preg_match('@code: "([^"]+)",@', $check, $cd)) html_error("Error [Post Data 2 FREE not found!]");
  79.         if (preg_match('%<input type="hidden" value="([^"]+)" id="pass" \/>%', $check, $pasid)) $pass_id = trim($pasid[1]);
  80.         else $pass_id = 'undefined';
  81.         unset($post);
  82.         $post['action'] = $act[1];
  83.         $post['code'] = $cd[1];
  84.         $post['pass'] = $pass_id;
  85.         $this->page = $this->GetPage("http://uploading.com/files/get/?SID={$cookie['SID']}&JsHttpRequest=" . jstime() . "-xml", $cookie, $post, $Url);
  86.         if (!preg_match('@"js":\{"(\w+)":\{?"([^"]+)"?:?"?([^|\r|\n|"]+)?"\}@i', $this->page, $match)) html_error("Error [Post Page Response (FREE) UNKNOWN!]");
  87.         switch ($match[1]) {
  88.             case 'answer':
  89.                 if ($match[2] == 'link') {
  90.                     $dlink = str_replace('\\', '', $match[3]);
  91.                     $filename = basename(parse_url($dlink, PHP_URL_PATH));
  92.                     $this->RedirectDownload($dlink, $filename, $cookie, 0, $Url);
  93.                     exit();
  94.                 }
  95.                 break;
  96.         }
  97.         is_present($match[1], 'error', str_replace('\\', '', $match[2]));
  98.     }
  99.  
  100.     private function Get_Reply($page) {
  101.         if (!function_exists('json_decode')) html_error("Error: Please enable JSON in php.");
  102.         $json = substr($page, strpos($page,"\r\n\r\n") + 4);
  103.         $json = substr($json, strpos($json, "{"));$json = substr($json, 0, strrpos($json, "}") + 1);
  104.         $rply = json_decode($json, true);
  105.         if (!$rply || (is_array($rply) && count($rply) == 0)) html_error("Error getting json data.");
  106.         return $rply;
  107.     }
  108.  
  109.     private function Login($captcha = false) {
  110.         global $premium_acc;
  111.  
  112.         if (($_REQUEST["cookieuse"] == "on" && preg_match("/remembered_user=([\w.]+);?/i", $_REQUEST["cookie"], $c)) || ($_REQUEST["premium_acc"] == "on" && !empty($premium_acc["uploading_com"]["cookie"]))) {
  113.             $usecookie = (empty($c[1]) ? !empty($premium_acc["uploading_com"]["cookie"]) : $c[1]);
  114.         } else {
  115.             $usecookie = false;
  116.         }
  117.  
  118.         $posturl = 'http://uploading.com/';
  119.         if (!$usecookie) {
  120.             $pA = !empty($_REQUEST["premium_user"]) && !empty($_REQUEST["premium_pass"]) ? true : false;
  121.             $email = ($pA ? trim($_REQUEST["premium_user"]) : $premium_acc ["uploading_com"] ["user"]);
  122.             $password = ($pA ? trim($_REQUEST["premium_pass"]) : $premium_acc ["uploading_com"] ["pass"]);
  123.  
  124.             $post = array();
  125.             if ($captcha == true) {
  126.                 if (empty($_POST['recaptcha_response_field'])) html_error("You didn't enter the image verification code.");
  127.                 $post['recaptcha_challenge_field'] = $_POST['recaptcha_challenge_field'];
  128.                 $post['recaptcha_response_field'] = $_POST['recaptcha_response_field'];
  129.                 $this->cookie = StrToCookies(decrypt(urldecode($_POST['cookie'])));
  130.                 if (!empty($_POST['cuser']) && !empty($_POST['cpass'])) {
  131.                     $email = decrypt(urldecode($_POST['cuser']));
  132.                     $password = decrypt(urldecode($_POST['cpass']));
  133.                 }
  134.             }
  135.  
  136.             // This check is important incase there's conflict in post account data, do look in the bracket at error message...
  137.             if (empty($email) || empty($password)) html_error("Login failed, email or password is empty!");
  138.  
  139.             $post['email'] = urlencode($email);
  140.             $post['password'] = urlencode($password);
  141.             $post['remember'] = "on";
  142.             $page = $this->GetPage($posturl."general/login_form/?ajax", $this->cookie, $post, $posturl);                        
  143.             $json = $this->Get_Reply($page);
  144.  
  145.             if (!empty($json['error'])) html_error('Login Error: '.$json['error']);
  146.  
  147.             if (!empty($json['answer']['captcha']) && $json['answer']['captcha'] == 'true') {
  148.                 if (!preg_match('@\(\'recaptcha_block\', \'([^\']+)\'\);@', $this->page, $c)) html_error("Error[CAPTCHA Data not found!]");
  149.                 $data = $this->DefaultParamArr($this->link, encrypt(CookiesToStr($this->cookie)));
  150.                 $data['step'] = 'captcha';
  151.                 if ($pA) {
  152.                     $data['cuser'] = urlencode(encrypt($email));
  153.                     $data['cpass'] = urlencode(encrypt($password));
  154.                 }
  155.                 $this->Show_reCaptcha($c[1], $data);
  156.                 exit();
  157.             }
  158.  
  159.             if (!empty($json['redirect'])) {
  160.                 $this->cookie = GetCookiesArr($page, $this->cookie);
  161.             } else html_error("Error [Login Page Response UNKNOWN!]");
  162.         } else {
  163.             $this->cookie['remembered_user'] = $usecookie;
  164.         }
  165.  
  166.         $page = $this->GetPage($posturl, $this->cookie, 0, $posturl);
  167.         $this->cookie = GetCookiesArr($page, $this->cookie);
  168.  
  169.         return $this->Premium();
  170.     }
  171.  
  172.     private function Premium($password = false) {
  173.         if ($password == true) {
  174.             $post['action'] = $_POST['action'];
  175.             $post['code'] = $_POST['code'];
  176.             $post['pass'] = $_POST['password'];
  177.             $Url = urldecode($_POST['link']);
  178.             $this->cookie = decrypt(urldecode($_POST['cookie']));
  179.             $page = $this->GetPage($Url, $this->cookie, $post, $this->link);
  180.         } else {
  181.             $this->page = $this->GetPage($this->link, $this->cookie, 0, $this->link);
  182.             is_present($this->page, 'Your account premium traffic has been limited');                        
  183.             if (preg_match('@Location: (http(s)?:\/[^\r\n]+)@i', $this->page, $dl)) { //this for direct link file
  184.                 $dlink = trim($dl[1]);
  185.                 $filename = basename(parse_url($dlink, PHP_URL_PATH));
  186.                 $this->RedirectDownload($dlink, $filename, $this->cookie, 0, $this->link);
  187.                 exit(); //must use this or not???
  188.             } else {
  189.                 if (!preg_match('@code: "([^"]+)",@', $this->page, $cd)) html_error("Error [Post Data - PREMIUM not found!]");                                
  190.                 $Url = "http://uploading.com/files/get/?ajax";
  191.                 if (strpos($this->page, 'Please Enter Password')) {
  192.                     $data = $this->DefaultParamArr($Url, encrypt(CookiesToStr($this->cookie)));
  193.                     $data['action'] = 'get_link';
  194.                     $data['code'] = $cd[1];
  195.                     $data['step'] = 'passpre';
  196.                     $this->EnterPassword($data);
  197.                     exit();
  198.                 } else { // no password
  199.                     $post['action'] = 'get_link';
  200.                     $post['code'] = $cd[1];
  201.                     $post['pass'] = 'undefined';
  202.                     $page = $this->GetPage($Url, $this->cookie, $post, $this->link);                                        
  203.                 }
  204.             }
  205.         }
  206.         $json = $this->Get_Reply($page);
  207.  
  208.         if (!empty($json['error'])) html_error('Login Error: '.$json['error']);
  209.         if (empty($json['answer']['link'])) html_error('Login Error: '.$json['error']);
  210.                
  211.         $dlink = $json['answer']['link'];                
  212.         $filename = basename(parse_url($dlink, PHP_URL_PATH));
  213.         $this->RedirectDownload($dlink, $filename, $this->cookie);
  214.     }
  215.  
  216.     private function Show_reCaptcha($pid, $inputs) {
  217.         global $PHP_SELF;
  218.         if (!is_array($inputs)) {
  219.             html_error("Error parsing captcha data.");
  220.         }
  221.         // Themes: 'red', 'white', 'blackglass', 'clean'
  222.         echo "<script language='JavaScript'>var RecaptchaOptions={theme:'white', lang:'en'};</script>\n";
  223.         echo "\n<center><form name='dl' action='$PHP_SELF' method='post' ><br />\n";
  224.         foreach ($inputs as $name => $input) {
  225.             echo "<input type='hidden' name='$name' id='$name' value='$input' />\n";
  226.         }
  227.         echo "<script type='text/javascript' src='http://www.google.com/recaptcha/api/challenge?k=$pid'></script>";
  228.         echo "<noscript><iframe src='http://www.google.com/recaptcha/api/noscript?k=$pid' height='300' width='500' frameborder='0'></iframe><br />";
  229.         echo "<textarea name='recaptcha_challenge_field' rows='3' cols='40'></textarea><input type='hidden' name='recaptcha_response_field' value='manual_challenge' /></noscript><br />";
  230.         echo "<input type='submit' name='submit' onclick='javascript:return checkc();' value='Enter Captcha' />\n";
  231.         echo "<script type='text/javascript'>/*<![CDATA[*/\nfunction checkc(){\nvar capt=document.getElementById('recaptcha_response_field');\nif (capt.value == '') { window.alert('You didn\'t enter the image verification code.'); return false; }\nelse { return true; }\n}\n/*]]>*/</script>\n";
  232.         echo "</form></center>\n</body>\n</html>";
  233.         exit;
  234.     }
  235.  
  236.     private function EnterPassword($inputs) {
  237.         global $PHP_SELF;
  238.         if (!is_array($inputs)) {
  239.             html_error("Error parsing password data.");
  240.         }
  241.         echo "\n" . '<center><form action="' . $PHP_SELF . '" method="post" >' . "\n";
  242.         foreach ($inputs as $name => $input) {
  243.             echo "<input type='hidden' name='$name' id='$name' value='$input' />\n";
  244.         }
  245.         echo '<h4>Enter password here: <input type="text" name="password" id="filepass" size="13" />&nbsp;&nbsp;<input type="submit" onclick="return check()" value="Submit" /></h4>' . "\n";
  246.         echo "<script type='text/javascript'>\nfunction check() {\nvar pass=document.getElementById('filepass');\nif (pass.value == '') { window.alert('You didn\'t enter the password'); return false; }\nelse { return true; }\n}\n</script>\n";
  247.         echo "\n</form></center>\n</body>\n</html>";
  248.         exit();
  249.     }
  250.  
  251.     public function CheckBack($header) {
  252.         is_present($header, 'HTTP/1.1 302 Moved', urldecode(cut_str($header, "Set-Cookie: error=", ";")));
  253.     }
  254.  
  255. }
  256.  
  257. /*
  258.  * Written by Ruud v.Tony 10-02-2012
  259.  * Premium Dl and Login fixed by Th3-822 14-03-2012
  260.  * Premium Dl after new template fixed by IndoLeech.Com 21-05-2012
  261.  */
  262. ?>
Advertisement
Add Comment
Please, Sign In to add comment