Advertisement
Th3-822

[rapidleech][d] kumpulbagi_id

Apr 22nd, 2016
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.57 KB | None | 0 0
  1. <?php
  2.  
  3. if (!defined('RAPIDLEECH')) {
  4.     require_once('index.html');
  5.     exit;
  6. }
  7.  
  8. class kumpulbagi_id extends DownloadClass {
  9.     private $page, $cookie = array(), $pA, $DLRegexp = '@https?://s\d+\.(?:kumpulbagi\.(?:id|com)|kbagi\.com)/download\?[^\t\r\n\'\"<>]+@i';
  10.     public function Download($link) {
  11.         $link = parse_url($link);
  12.         $link['scheme'] = 'http';
  13.         $link['host'] = 'kbagi.com';
  14.         $link = rebuild_url($link);
  15.         if (!preg_match('@(https?://kbagi\.com)/(?:[^/]+/)+[^\r\n\t/<>\"]+?,(\d+)[^\r\n\t/<>\"]*@i', $link, $fid)) html_error('Invalid link?.');
  16.         $this->link = $GLOBALS['Referer'] = $fid[0];
  17.         $this->baseurl = $fid[1];
  18.         $this->fid = $fid[2];
  19.  
  20.         $this->pA = (empty($_REQUEST['premium_user']) || empty($_REQUEST['premium_pass']) ? false : true);
  21.         if (($_REQUEST['premium_acc'] == 'on' && ($this->pA || (!empty($GLOBALS['premium_acc']['kumpulbagi_id']['user']) && !empty($GLOBALS['premium_acc']['kumpulbagi_id']['pass']))))) {
  22.             $user = ($this->pA ? $_REQUEST['premium_user'] : $GLOBALS['premium_acc']['kumpulbagi_id']['user']);
  23.             $pass = ($this->pA ? $_REQUEST['premium_pass'] : $GLOBALS['premium_acc']['kumpulbagi_id']['pass']);
  24.             return $this->Login($user, $pass);
  25.         } else return $this->TryDL();
  26.     }
  27.  
  28.     private function TryDL() {
  29.         $this->page = $this->GetPage($this->link, $this->cookie);
  30.         $this->cookie = GetCookiesArr($this->page, $this->cookie);
  31.  
  32.         if (!preg_match($this->DLRegexp, $this->page, $DL)) {
  33.             if (substr($this->page, 9, 3) != '200') html_error('File Not Found or Private.');
  34.             $download = $this->reqAction('DownloadFile', array('fileId' => $this->fid, '__RequestVerificationToken' => $this->getCSRFToken($this->page)));
  35.             if (empty($download['DownloadUrl']) || !preg_match($this->DLRegexp, $download['DownloadUrl'], $DL)) {
  36.                 if (empty($this->cookie['.ASPXAUTH_v2']) && $download['Type'] == 'Window') html_error('Login is Required to Download This File.');
  37.                 html_error('Download-Link Not Found.');
  38.             }
  39.         }
  40.         return $this->RedirectDownload($DL[0], 'kumpulbagi_placeholder_fname');
  41.     }
  42.  
  43.     private function getCSRFToken($page, $errorPrefix = 'Error') {
  44.         if (!preg_match('@name="__RequestVerificationToken"\s+type="hidden"\s+value="([\w\-+/=]+)"@i', $page, $token)) return html_error("[$errorPrefix]: Request Token Not Found.");
  45.         return $token[1];
  46.     }
  47.  
  48.     private function Login($user, $pass) {
  49.         $page = $this->GetPage($this->baseurl . '/', $this->cookie);
  50.         $this->cookie = GetCookiesArr($page, $this->cookie);
  51.  
  52.         $login = $this->reqAction('Account/Login', array('UserName' => $user, 'Password' => $pass, '__RequestVerificationToken' => $this->getCSRFToken($page, 'Login Error')));
  53.         if (!empty($login['Content'])) is_present($login['Content'], 'ID atau kata sandi salah.', 'Login Error: Wrong Login/Password.');
  54.         if (empty($this->cookie['.ASPXAUTH_v2'])) html_error('Login Error: Cookie ".ASPXAUTH_v2" not Found.');
  55.  
  56.         return $this->TryDL();
  57.     }
  58.  
  59.     private function reqAction($path, $post = array()) {
  60.         $page = $this->GetPage("{$this->baseurl}/action/$path", $this->cookie, array_map('urlencode', $post), "{$this->baseurl}/\r\nX-Requested-With: XMLHttpRequest");
  61.         $reply = $this->json2array($page, "reqAction($path) Error");
  62.         if (empty($reply)) html_error("[reqAction($path) Error] Empty Response.");
  63.         $this->cookie = GetCookiesArr($page, $this->cookie);
  64.  
  65.         return $reply;
  66.     }
  67. }
  68.  
  69. // [20-3-2016] Written by Th3-822.
  70. // [22-4-2016] Renamed to kumpulbagi_id and fixed. - Th3-822
  71. // [12-8-2016] Switched domain to .com tld (I won't rename the plugin again) & Added support for "mirror" domains. - Th3-822
  72. // [12-10-2016] Changed Domain. - Th3-822
  73.  
  74. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement