Advertisement
Th3-822

[rapidleech][d][free] mediafire_com.php

Oct 6th, 2012
1,739
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.65 KB | None | 0 0
  1. <?php
  2.  
  3. if (!defined('RAPIDLEECH')) {
  4.     require_once('index.html');
  5.     exit;
  6. }
  7.  
  8. class mediafire_com extends DownloadClass {
  9.     private $page = '', $cookie = array(), $fid, $link;
  10.     public function Download($link) {
  11.         if (!empty($_POST['mfpassword'])) {
  12.             $this->cookie = StrToCookies(urldecode($_POST['cookie']));
  13.             $this->page = $this->GetPage($link, $this->cookie, array('downloadp' => urlencode($_POST['mfpassword'])), $link);
  14.             $this->cookie = GetCookiesArr($this->page, $this->cookie);
  15.         }
  16.  
  17.         if (!preg_match('@https?://(?:[\w\-]+\.)*mediafire\.com/(?:(download|file)/|(download\.php|file/|view/)?\??)([\w\-\.]+)(?(1)(/[^/\s]+))?@i', $link, $this->fid)) html_error('Invalid Link?');
  18.  
  19.         $this->link = $GLOBALS['Referer'] = 'http://www.mediafire.com/file/' . $this->fid[3] . (!empty($this->fid[4]) ? $this->fid[4] : '');
  20.  
  21.         if (empty($_POST['step']) || $_POST['step'] != '1') {
  22.             $this->page = $this->GetPage($this->link, $this->cookie, 0, 'http://www.mediafire.com/?' . $this->fid[3]);
  23.             $this->cookie = GetCookiesArr($this->page, $this->cookie);
  24.             if (preg_match('@\nLocation: .*(/file/([^/\r\n]+)/?[^\r\n]*)@i', $this->page, $redir)) {
  25.                 $this->link = $GLOBALS['Referer'] = 'http://www.mediafire.com'.$redir[1];
  26.                 $this->page = $this->GetPage($this->link, $this->cookie);
  27.                 $this->cookie = GetCookiesArr($this->page, $this->cookie);
  28.             }
  29.             if (preg_match('@/error\.php\?errno=\d+@i', $this->page, $redir)) {
  30.                 $this->page = $this->GetPage('http://www.mediafire.com'.$redir[0]);
  31.                 if (preg_match('@error_msg_title(?: notranslate)?">\s*([^\r\n<>]+)\s*<@i', $this->page, $err)) html_error($err[1]);
  32.                 html_error('Link is not available');
  33.             }
  34.         }
  35.  
  36.         $this->MF_Captcha();
  37.         if (strpos($this->page, 'name="downloadp" id="downloadp"')) {
  38.             $DefaultParam = $this->DefaultParamArr(preg_replace('@/file/([^/]+)/?.*@i', '/?$1', $link), $this->cookie);
  39.             echo "<form action='".htmlspecialchars($GLOBALS['PHP_SELF'], ENT_QUOTES)."' method='POST'>\n";
  40.             foreach ($DefaultParam as $key => $value) echo "<input type='hidden' name='$key' value='" . htmlspecialchars($value, ENT_QUOTES) . "' />\n";
  41.             echo "Enter your password here:<br />\n<input type='text' name='mfpassword' value='' placeholder='Enter file password here' autofocus='autofocus' required='required' />\n<input type='submit' />\n</form>";
  42.             return html_error('File requires password');
  43.         }
  44.         if (!preg_match('@https?://(?:[\w\-]+\.)+[\w\-]+(?:\:\d+)?/[\w\-\.]{5,}/' . preg_quote($this->fid[3]) . '/[^\?\'\"\t<>\r\n\\\]+@i', $this->page, $dl)) return html_error("Error: Download link [FREE] not found!");
  45.         $this->RedirectDownload($dl[0], 'Mediafire.com');
  46.     }
  47.  
  48.     private function MF_Captcha() {
  49.         if (!empty($this->page) && stripos($this->page, ">Authorize Download</a>") === false) return;
  50.         if (!empty($_POST['step']) && $_POST['step'] == '1') {
  51.             $_POST['step'] = false;
  52.             if (empty($_POST['recaptcha2_response_field']) && empty($_POST['recaptcha_response_field']) && empty($_POST['adcopy_response']) && empty($_POST['mf_captcha_response'])) html_error('You didn\'t enter the image verification code.');
  53.             if (empty($_POST['mf_captcha_response'])) {
  54.                 if (empty($_POST['adcopy_response'])) {
  55.                     if (empty($_POST['recaptcha2_public_key'])) $post = array('recaptcha_challenge_field' => urlencode($_POST['recaptcha_challenge_field']), 'recaptcha_response_field' => urlencode($_POST['recaptcha_response_field']));
  56.                     else $post = $this->verifyReCaptchav2();
  57.                 } else $post = $this->verifySolveMedia();
  58.                 $this->cookie = StrToCookies(urldecode($_POST['cookie']));
  59.             } else {
  60.                 $post = array('mf_captcha_response' => $_POST['mf_captcha_response']);
  61.             }
  62.  
  63.             $purl = 'http://www.mediafire.com/?' . $this->fid[3];
  64.  
  65.             $this->page = $this->GetPage($purl, $this->cookie, $post);
  66.             $this->cookie = GetCookiesArr($this->page, $this->cookie);
  67.             is_present($this->page, 'Your entry was incorrect, please try again!');
  68.  
  69.             $this->page = $this->GetPage($this->link, $this->cookie, 0, $purl);
  70.             $this->cookie = GetCookiesArr($this->page, $this->cookie);
  71.             is_present($this->page, 'Your entry was incorrect, please try again!.');
  72.  
  73.             $this->MF_Captcha();
  74.         } else {
  75.             $data = $this->DefaultParamArr($this->link, $this->cookie);
  76.             $data['step'] = 1;
  77.  
  78.             if (($pos = stripos($this->page, 'data-sitekey=')) !== false && preg_match('@data-sitekey=\s*[\"\']([\w\.\-]+)[\"\']@i', $this->page, $cKey, 0, $pos)) {
  79.                 // reCAPTCHA v2
  80.                 return $this->reCAPTCHAv2($cKey[1], $data);
  81.             } else if (($pos = stripos($this->page, '://api.solvemedia.com/')) !== false && preg_match('@https?://api\.solvemedia\.com/papi/challenge\.(?:no)?script\?k=([\w\.\-]+)@i', $this->page, $cKey, 0, $pos)) {
  82.                 // SolveMedia
  83.                 return $this->SolveMedia($cKey[1], $data);
  84.             } else if (preg_match('@https?://(?:[^/]+\.)?(?:(?:google\.com/recaptcha/api)|(?:recaptcha\.net))/(?:(?:challenge)|(?:noscript))\?k=([\w\.\-]+)@i', $this->page, $cKey)) {
  85.                 // Old reCAPTCHA
  86.                 return $this->reCAPTCHA($cKey[1], $data);
  87.             } else if (($pseudoCaptcha = cut_str($this->page, 'name="mf_captcha_response" value="', '"'))) {
  88.                 // Best... CAPTCHA... Ever... :D
  89.                 if (!empty($_POST['mf_captcha_response'])) html_error('Captcha Loop?');
  90.                 $_POST['step'] = '1';
  91.                 $_POST['mf_captcha_response'] = html_entity_decode($pseudoCaptcha);
  92.                 return $this->MF_Captcha();
  93.             }
  94.  
  95.             html_error('Error: CAPTCHA not found.');
  96.         }
  97.     }
  98.  
  99.     // Special Function Called by verifyReCaptchav2 When Captcha Is Incorrect, To Allow Retry. - Required
  100.     protected function retryReCaptchav2() {
  101.         $data = $this->DefaultParamArr($this->link, $this->cookie);
  102.         $data['step'] = '1';
  103.  
  104.         return $this->reCAPTCHAv2($_POST['recaptcha2_public_key'], $data);
  105.     }
  106. }
  107.  
  108. /*
  109.  * credit to farizemo [at] rapidleech forum
  110.  * by vdhdevil
  111.  * remove additional function for temporary fix until get finished - Ruud v.Tony 06-01-2011
  112.  * fix for shared premium link by Ruud v.Tony 23-01-2012
  113.  * regex fix for download link not found by Th3-822 24-02-2012
  114.  * added support for captcha by Th3-822 14-04-2012
  115.  * freedl regexp fixed again by Th3-822 10-05-2012
  116.  * incomplete fix for getting dllink by Th3-822 14-05-2012
  117.  * added solvemedia captcha support && fixed dead link msgs by Th3-822 06-10-2012
  118.  * quick fix for new format/redirect for share links && fixed capcha submit url by Th3-822 24-05-2013
  119.  * fixed password post url by Th3-822 27-07-2013
  120.  * fixed redirects by Th3-822 24-09-2013
  121.  * fixed captcha forms by Th3-822 11-04-2014
  122.  * added recaptcha v2 captcha support && fixed dead link msgs by Th3-822 07-04-2015
  123.  * added checkbox "captcha" support (non tested) by Th3-822 18-06-2015
  124.  * fixed link regexp, redirect by Th3-822 18-10-2016
  125.  * fixed download regexp by Th3-822 09-05-2018
  126.  */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement