private function CheckLogin($user = '', $pass = '') { if (!empty($this->cookie)) { $this->apiurl['query'] = 'sub=getaccountdetails&cookie=' . rawurlencode($this->cookie); $page = $this->GetPage(rebuild_url($this->apiurl)); $t1 = 'Cookie'; $t2 = 'cookie'; } elseif (!empty($user) && !empty($pass)) { $this->apiurl['query'] = "sub=getaccountdetails&withcookie=1&login={$user}&password={$pass}"; $page = $this->GetPage(rebuild_url($this->apiurl)); $t1 = 'Error'; $t2 = 'login details'; } else { html_error('Login Failed. User/Password empty.'); } is_present($page, 'ERROR: IP blocked.', '[ERROR] Rapidshare has locked your IP. (Too many wrong login/cookie sended)'); is_present($page, 'ERROR: Login failed. Login data invalid.', "[{$t1}] Invalid {$t2}."); is_present($page, 'ERROR: Login failed. Password incorrect or account not found.', "[{$t1}] Login failed. User/Password incorrect or could not be found."); is_present($page, 'ERROR: Login failed. Account not validated.', "[{$t1}] Login failed. Account not validated."); is_present($page, 'ERROR: Login failed. Account locked.', "[{$t1}] Login failed. Account locked."); is_present($page, 'ERROR: Login failed.', "[{$t1}] Login failed. Invalid {$t2}?"); if (empty($this->cookie)) { $body = substr($page, strpos($page, "\r\n\r\n") + 4); if (!preg_match('@\\Wcookie=(\\w+)@i', $body, $cookie)) { html_error('Cookie value not found.'); } $this->cookie = $cookie[1]; } $this->StartDL(); }
protected function Start($link, $cErrs = array(), $cErrReplace = true) { if ($this->pluginVer > $this->classVer) { html_error('GenericXFS_DL class is outdated, please update it.'); } $this->cookie = empty($this->cookie) ? array('lang' => 'english') : array_merge($this->cookie, array('lang' => 'english')); $link = explode('|', str_ireplace('%7C', '|', $link), 2); if (count($link) > 1) { $this->lpass = rawurldecode($link[1]); } if (!preg_match('@https?://(?:[\\w\\-]+\\.)+[\\w\\-]+(?:\\:\\d+)?/(\\w{12})(?=(?:[/\\.]|(?:\\.html?))?)@i', str_ireplace('/embed-', '/', $link[0]), $url)) { html_error('Invalid link?.'); } $this->fid = $url[1]; $url = parse_url($url[0]); $url['scheme'] = strtolower($url['scheme']); $url['host'] = strtolower($url['host']); if ($this->wwwDomain && strpos($url['host'], 'www.') !== 0) { $url['host'] = 'www.' . $url['host']; } elseif (!$this->wwwDomain && strpos($url['host'], 'www.') === 0) { $url['host'] = substr($url['host'], 4); } $this->scheme = $url['scheme']; $this->domain = $url['host']; $this->port = !empty($url['port']) && $url['port'] > 0 && $url['port'] < 65536 ? $url['port'] : 0; $this->host = $this->domain . (!empty($this->port) ? ':' . $this->port : ''); $this->purl = $this->scheme . '://' . $this->host . '/'; $this->link = $GLOBALS['Referer'] = rebuild_url($url); unset($url, $link); $this->enableDecoders = $this->embedDL || $this->unescaper || $this->customDecoder; if (empty($_POST['step']) || empty($_POST['captcha_type'])) { $this->page = $this->GetPage($this->link, $this->cookie); if (!empty($cErrs) && is_array($cErrs)) { foreach ($cErrs as $cErr) { if (is_array($cErr)) { is_present($this->page, $cErr[0], $cErr[1]); } else { is_present($this->page, $cErr); } } if ($cErrReplace) { return $this->Login(); } } is_present($this->page, 'The file you were looking for could not be found'); is_present($this->page, 'The file was removed by administrator'); is_present($this->page, 'The file was deleted by its owner'); is_present($this->page, 'The file was deleted by administration'); is_present($this->page, 'No such file with this filename', 'Error: Invalid filename, check your link and try again.'); // With the regexp i removed the filename part of the link, this error shouldn't be showed } return $this->Login(); }
public function Download($link) { if (stripos($link, '://d-h.st/') === false) { $link = parse_url($link); $link['host'] = 'd-h.st'; $link = rebuild_url($link); } $page = $this->GetPage($link); is_present($page, 'The file you were looking for could not be found', 'File Not Found.'); if (!preg_match('@https?://fs\\d*\\.d-h\\.st/download/\\w+/\\w+/[^\\s<>\'\\"]+@i', $page, $dl)) { html_error('Download Link Not Found'); } return $this->RedirectDownload($dl[0], basename(urldecode(parse_url($dl[0], PHP_URL_PATH))), 0, 0, $link); }
public function Download($link) { $this->DLregexp = '@https?://(?:[\\w\\-]+\\.)+filesflash\\.(?:com|net)(?:\\:\\d+)?/\\w{32}/\\w{32}/[^\'\\"\\t<>\\r\\n]+@i'; $this->cookie = array(); $link = parse_url($link); $link['host'] = 'filesflash.com'; if (!empty($link['port']) && !in_array($link['port'], array(80, 443))) { $link['port'] = strtolower($link['scheme']) == 'https' ? 443 : 80; } $link = rebuild_url($link); $this->link = $GLOBALS['Referer'] = $link; if (empty($_POST['step']) || $_POST['step'] != '1') { $this->page = $this->GetPage($this->link, $this->cookie); is_present($this->page, 'That file has been deleted.'); is_present($this->page, 'That is not a valid url.', 'Error: Invalid Link?.'); } $this->FreeDL(); }
private function CheckDomain($reload = true) { if (empty($this->page)) { $content = $this->GetPage($this->link, $this->cookie); } else { $content = $this->page; } if (($hpos = strpos($content, "\r\n\r\n")) > 0) { $content = substr($content, 0, $hpos); } if (stripos($content, "\nLocation: ") !== false && preg_match('@\\nLocation: https?://(?:[^/\\r\\n]+\\.)?((?:depositfiles|dfiles)\\.[^/:\\r\\n\\t\\"\'<>]+)(?:\\:\\d+)?/@i', $content, $redir_domain)) { $link = parse_url($this->link); $domain = strtolower($link['host']); $redir_domain = strtolower($redir_domain[1]); if ($domain != $redir_domain) { global $Referer; $this->domain = $link['host'] = $redir_domain; $Referer = $this->link = rebuild_url($link); if ($reload) { $this->page = $this->GetPage($this->link, $this->cookie); } } } }
} if ($options['redir'] && $lastError && strpos($lastError, substr(lang(95), 0, strpos(lang(95), '%1$s'))) !== false) { $redirectto = trim(cut_str($lastError, substr(lang(95), 0, strpos(lang(95), '%1$s')), ']')); $_GET['referer'] = urlencode($_GET['link']); if (strpos($redirectto, '://') === false) { // If redirect doesn't have the host $ref = parse_url(urldecode($_GET['referer'])); unset($ref['user'], $ref['pass'], $ref['query'], $ref['fragment']); if (substr($redirectto, 0, 1) != '/') { $redirectto = "/{$redirectto}"; } $purl = array_merge($ref, parse_url($redirectto)); } else { $purl = parse_url($redirectto); } $_GET['link'] = urlencode(rebuild_url($purl)); $_GET['filename'] = urlencode(basename($purl['path'])); $_GET['host'] = urlencode($purl['host']); $_GET['path'] = urlencode($purl['path'] . (!empty($purl['query']) ? '?' . $purl['query'] : '')); $_GET['port'] = !empty($purl['port']) ? $purl['port'] : 80; $_GET['cookie'] = !empty($_GET['cookie']) ? urlencode(encrypt($_GET['cookie'])) : ''; if (is_array($_GET['post'])) { $_GET['post'] = urlencode(encrypt(serialize($_GET['post']))); } $lastError = $_GET['auth'] = ''; // With $_GET['auth'] empty it will still using the $auth unset($ref, $purl); } if ($lastError) { echo "<script type='text/javascript'>updateStatus({$i}, '" . addslashes($lastError) . "');</script>{$nn}"; } elseif ($file['bytesReceived'] == $file['bytesTotal'] || $file['size'] == 'Unknown') {
public function RedirectDownload($link, $FileName, $cookie = 0, $post = 0, $referer = 0, $force_name = 0, $auth = 0, $addon = array()) { $link = parse_url($link); $link['scheme'] = 'http'; $link = rebuild_url($link); return parent::RedirectDownload($link, $FileName, $cookie, $post, $referer, $force_name, $auth, $addon); }
/** Specific return URL builder for protocol v1.0. * Reads Get:: */ function wats4u_sso_v1_build_return_url($user) { global $globals; $challenge = Get::s('challenge'); $session = Get::s('session'); $return_url = Get::s('url'); $profile = $user->profile(); $ax_id = $profile->ax_id; $email = $user->forlifeEmail(); $contributing = 1; // TODO: Fetch actual data $signature = md5("1" . $challenge . $globals->wats4u->shared_key . $ax_id . "1"); $cleartext_data = "{$challenge}\n{$ax_id}\n{$email}\n{$contributing}"; $encrypted_data = wats4u_sso_v1_encrypt_data($cleartext_data, $globals->wats4u->shared_key); if ($encrypted_data === false) { return ""; } $params = array('session' => $session, 'matricule' => $ax_id, 'auth' => $signature, 'data' => $encrypted_data); return rebuild_url($return_url, http_build_query($params)); }
private function ChkRGRedirs($page, $lasturl, $rgpath = '/') { if (!is_array($lasturl)) { $lasturl = parse_url($lasturl); } if ($page === false) { return rebuild_url($lasturl); } $hpos = strpos($page, "\r\n\r\n"); $headers = empty($hpos) ? $page : substr($page, 0, $hpos); if (stripos($headers, "\nLocation: ") === false && stripos($headers, "\nSet-Cookie: ") === false && stripos($headers, '<script') !== false && !cut_str($page, '<title>', '</title>')) { if (empty($_GET['rgredir'])) { if (!($body = cut_str($page, '<body>', '</body>'))) { $body = $page; } if (stripos($body, '<script') !== strripos($body, '<script')) { html_error('Unknown error while getting redirect code.'); } $login = $_REQUEST['premium_acc'] == 'on' && (!empty($_REQUEST['premium_user']) && !empty($_REQUEST['premium_pass'])); $data = $this->DefaultParamArr($this->link, 0, rebuild_url($lasturl)); $data['rgredir'] = ''; $data['premium_acc'] = $_REQUEST['premium_acc']; // I should add 'premium_acc' to DefaultParamArr() if ($login) { $data['pA_encrypted'] = 'true'; $data['premium_user'] = urlencode(encrypt($_REQUEST['premium_user'])); // encrypt() will keep this safe. $data['premium_pass'] = urlencode(encrypt($_REQUEST['premium_pass'])); // And this too. } if (!($js = cut_str($body, '<script language="JavaScript">', '</script>')) && !($js = cut_str($body, '<script type="text/javascript">', '</script>'))) { html_error('Cannot get the redirect code.'); } $js = str_ireplace(array('window.location.href', 'document.location.href'), 'document.getElementById("rgredir").value', $js); if (strpos($js, 'document.body.onmousemove') !== false) { // New redirect code $js = preg_replace('@^[\\s\\t]*\\w+\\([^\\;]+;@i', '', $js); $js = preg_replace('@document\\.body\\.onmousemove[\\s\\t]*=[\\s\\t]*function[\\s\\t]*\\(\\)[\\s\\t]*\\{@i', '', $js); $js = preg_replace('@document\\.body\\.onmousemove[\\s\\t]*=[\\s\\t]*\'\';?\\};[\\s\\t]*window\\.setTimeout\\([\\s\\t]*((\\"[^\\"]+\\")|(\'[^\']+\'))[^\\;]+;[\\s\\t\\r\\n]*$@i', '', $js); } elseif (($funcPos = stripos($js, 'function WriteA(')) !== false) { // JS + aaaaaaaaaaaaaaaaaaaaaaaaa $links = array(); if (preg_match_all('@<a\\s*[^>]*\\shref="((?:https?://(?:www\\.)?rapidgator\\.net)?/[^\\"]+)"[^>]*\\sid="([A-Za-z][\\w\\.\\-]*)"@i', $body, $a)) { $links = array_merge($links, array_combine($a[2], $a[1])); } if (preg_match_all('@<a\\s*[^>]*\\sid="([A-Za-z][\\w\\.\\-]*)"[^>]*\\shref="((?:https?://(?:www\\.)?rapidgator\\.net)?/[^\\"]+)"@i', $body, $a)) { $links = array_merge($links, array_combine($a[1], $a[2])); } if (empty($links)) { html_error('Cannot get the redirect fields'); } unset($a); $jsLinks = ''; foreach ($links as $key => $link) { if (strpos($link, '://') === false) { $link = (!empty($lasturl['scheme']) && strtolower($lasturl['scheme']) == 'https' ? 'https' : 'http') . '://rapidgator.net' . $link; } $jsLinks .= "{$key}: '" . addslashes($link) . "', "; } unset($links, $key, $link); $jsLinks = '{' . substr($jsLinks, 0, -2) . '}'; $func = substr($js, $funcPos); if (!preg_match('@\\.getElementById\\(([\\$_A-Za-z][\\$\\w]*)\\)@i', $func, $linkVar)) { html_error('Cannot edit redirect JS'); } $linkVar = $linkVar[1]; unset($func); $js = substr($js, 0, $funcPos) . "\nvar T8RGLinks = {$jsLinks};\nif ({$linkVar} in T8RGLinks) document.getElementById('rgredir').value = T8RGLinks[{$linkVar}];"; unset($jsLinks, $funcPos, $linkVar); } echo "\n<form name='rg_redir' action='{$_SERVER['SCRIPT_NAME']}' method='POST'><br />\n"; foreach ($data as $name => $input) { echo "<input type='hidden' name='{$name}' id='{$name}' value='" . htmlspecialchars($input, ENT_QUOTES) . "' />\n"; } echo "</form>\n<span id='T8_emsg' class='htmlerror' style='text-align:center;display:none;'></span>\n<noscript><span class='htmlerror'><b>Sorry, this code needs JavaScript enabled to work.</b></span></noscript>\n<script type='text/javascript'>/* <![CDATA[ Th3-822 */\n\tvar T8 = true;\n\ttry {{$js}\n\t} catch(e) {\n\t\t\$('#T8_emsg').html('<b>Cannot decode challenge: ['+e.name+'] '+e.message+'</b>').show();\n\t\tT8 = false;\n\t}\n\tif (T8) window.setTimeout(\"\$('form[name=rg_redir]').submit();\", 300); // 300 µs to make sure that the value was decoded and added.\n/* ]]> */</script>\n\n</body>\n</html>"; exit; } else { $_GET['rgredir'] = rawurldecode($_GET['rgredir']); if (strpos($_GET['rgredir'], '://')) { $_GET['rgredir'] = parse_url($_GET['rgredir'], PHP_URL_PATH); } if (empty($_GET['rgredir']) || substr($_GET['rgredir'], 0, 1) != '/') { html_error('Invalid redirect value.'); } $redir = (!empty($lasturl['scheme']) && strtolower($lasturl['scheme']) == 'https' ? 'https' : 'http') . '://rapidgator.net' . $_GET['rgredir']; unset($_GET['rgredir']); } } elseif (preg_match('@Location: ((https?://(?:[^/\\r\\n]+\\.)?rapidgator\\.net)?' . $rgpath . '[^\\r\\n]*)@i', $headers, $redir)) { $redir = empty($redir[2]) ? (!empty($lasturl['scheme']) && strtolower($lasturl['scheme']) == 'https' ? 'https' : 'http') . '://rapidgator.net' . $redir[1] : $redir[1]; } return empty($redir) ? false : $redir; }
private function GetVideosArr() { $fmturls = array(); foreach ($this->fmtmaps as $fmtlist) { $fmtlist = array_map('urldecode', $this->FormToArr($fmtlist)); if (!in_array($fmtlist['itag'], $this->fmts)) { continue; } if (!empty($fmtlist['s']) && empty($this->encS)) { if (empty($this->sts)) { return $this->getCipher(); } else { $this->decError('No decoded steps'); } } $fmtlist['url'] = parse_url($fmtlist['url']); $fmtlist['url']['query'] = array_map('urldecode', $this->FormToArr($fmtlist['url']['query'])); if (empty($fmtlist['url']['query']['signature'])) { $fmtlist['url']['query']['signature'] = !empty($fmtlist['s']) ? $this->sigDecode($fmtlist['s']) : $fmtlist['sig']; } foreach (array_diff(array_keys($fmtlist), array('signature', 'sig', 's', 'url')) as $k) { $fmtlist['url']['query'][$k] = $fmtlist[$k]; } ksort($fmtlist['url']['query']); $fmtlist['url']['query'] = http_build_query($fmtlist['url']['query']); $fmturls[$fmtlist['itag']] = rebuild_url($fmtlist['url']); } return $fmturls; }
function curl_head($url, $referer = null) { $url = rebuild_url($url); $curl = curl_init($url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_HEADER, true); curl_setopt($curl, CURLOPT_NOBODY, true); curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); if ($referer) { curl_setopt($curl, CURLOPT_REFERER, $referer); } $ret = curl_exec($curl); curl_close($curl); return $ret; }
$return_url = link_for_file(realpath(basename($PHP_SELF)), true) . '?uploaded=' . urlencode($_REQUEST['uploaded']) . '&filename=' . urlencode(base64_encode($lname)); if (!empty($_GET['proxy'])) { $return_url .= '&useuproxy=on&uproxy=' . urlencode($_GET['proxy']); } if (!empty($_REQUEST['pauth'])) { $return_url .= '&upauth=' . urlencode($pauth); } if (!empty($_GET['save_style'])) { $return_url .= '&save_style=' . urlencode($_GET['save_style']); } if (isset($_GET['auul'])) { $return_url .= '&auul=' . urlencode($_GET['auul']); } $return_url = parse_url($return_url); unset($return_url['user'], $return_url['pass']); $return_url = rebuild_url($return_url); $videxts = array('.avi', '.mp4', '.3gp', '.mpg', '.mpeg', '.mov', '.flv', '.wmv'); $video = true; if (strtolower(strrchr($lname, '.')) == '.mp3') { if ($fsize > 20 * 1024 * 1024) { html_error('You only can upload mp3 files up to 20 MB.'); } $video = $upload_mp3_as_video; } elseif (!in_array(strtolower(strrchr($lname, '.')), $videxts)) { html_error('This file ext isn\'t allowed by VK.'); } // Check https support for login. $usecurl = $cantuse = false; if (!extension_loaded('openssl')) { if (extension_loaded('curl')) { $cV = curl_version();