link = str_ireplace('http://', 'https://', $link); $this->cookie = array('ziplocale' => 'en'); if (!preg_match('@https?://(?:[\w\-]+\.)*zippyshare\.com/\w/(\w+)@i', $this->link, $this->fid)) html_error('File ID not found at link. Invalid link?'); $this->fid = $this->fid[1]; if (!empty($_POST['step'])) switch ($_POST['step']) { case '1': return $this->CheckCaptcha(); case '2': return $this->GetDecodedLink(); } $this->page = $this->GetPage($this->link, $this->cookie); is_present($this->page, '>File does not exist on this server<', 'File does not exist.'); is_present($this->page, '>File has expired and does not exist anymore on this server', 'File does not exist.'); $this->cookie = GetCookiesArr($this->page, $this->cookie); //if (($pos = stripos($this->page, 'getElementById(\'dlbutton\').href')) !== false || ($pos = stripos($this->page, 'getElementById("dlbutton").href')) !== false) return $this->GetJSEncodedLink(); if ($this->findJS()) return $this->GetJSEncodedLink(); else return $this->GetCaptcha(); } private function GetDecodedLink() { if (empty($_POST['dllink']) || ($dlink = parse_url($_POST['dllink'])) == false || empty($dlink['path'])) html_error('Empty decoded link field.'); $this->cookie = urldecode($_POST['cookie']); $dlink = 'http://' . parse_url($this->link, PHP_URL_HOST) . $dlink['path'] . (!empty($dlink['query']) ? '?' . $dlink['query'] : ''); $fname = urldecode(basename(parse_url($dlink, PHP_URL_PATH))); $this->RedirectDownload($dlink, $fname, $this->cookie); } private function findJS() { if (!preg_match_all('@@i', $this->page, $scripts)) html_error('No inline JS found at page.'); foreach ($scripts[1] as $script) { if (preg_match('@\.getElementById\(\s*(?:(\'|\")(?i)(?:dlbutton|fimage)(?-i)\1|([\$_A-Za-z][\$\w]*))\)\.href\s*=\s*[\'\"](?i)(?:https?://(?:[\w\-]+\.)*zippyshare\.com)?/d/(?-i)'.$this->fid.'@', $script, $match)) { if (!empty($match[2])) $this->vname = $match[2]; $this->script = $script; return true; } if (preg_match('@((?:[\$_A-Za-z][\$\w]*\.)*[\$_A-Za-z][\$\w]*)\s*\(\s*(?:(\'|\")(?:dlbutton|fimage)(?-i)\2|([\$_A-Za-z][\$\w]*))\s*,\s*[\'\"](?:https?://(?:[\w\-]+\.)*zippyshare\.com)?/d/(?-i)'.$this->fid.'@i', $script, $match)) { $this->fname = $match[1]; if (!empty($match[3])) $this->vname = $match[3]; $this->script = $script; return true; } } return false; } private function GetJSEncodedLink() { $this->script = rtrim(str_replace(array(').href', "'dlbutton'", '"dlbutton"', ' '), array(').value', "'T8_dllink'", '"T8_dllink"', "\t\t"), $this->script)); if (!empty($this->fname)) $this->script = str_replace($this->fname, 'zsWriteLink', $this->script); if (empty($this->script)) html_error('Error while getting js code.'); $T8 = ''; if (preg_match_all('@getElementById[\s\t]*\([\s\t]*[\"\']([a-z][\w\.\-]*)[\"\'][\s\t]*\)@i', $this->script, $ids) && count($ids[0]) > 1) foreach (array_unique($ids[1]) as $id) { if ($id == 'T8_dllink') continue; if (!preg_match("@<([a-z][a-z\d]*)\s*(?:\w+\s*=\s*[\"\'][^\"\'<>]*[\"\']\s*)*(?:\s*id\s*=[\"\']{$id}[\"\']\s*)(?:\w+\s*=\s*[\"\'][^\"\'<>]*[\"\']\s*)*(?:(\s*>[^<>]*\1)|(/)?[\s]*>)@i", $this->page, $tag)) break; // If it doesn't found the tag the decode will fail, im not sure if break or continue... $T8 .= (!empty($tag[2]) ? $tag[0].'>' : (empty($tag[3]) ? $tag[0].''.$tag[1].'>' : $tag[0])); } $this->script = preg_replace('@^\s*(?:function\s+[\$_A-Za-z][\$\w]*|(?:var\s+)?[\$_A-Za-z][\$\w]*\s*=\s*function)\s*\([^)]*\)\s*\{\s*[\$_A-Za-z][\$\w]*\.\w+\s*\(\s*[\'\"]\w+[\'\"]\s*\)\.value\s*=\s*[\'\"][^\'\"]?[\'\"]*\s*;\s*\};?@', '', $this->script, 1); if (preg_match('@^\s*function\s+([\$_A-Za-z][\$\w]*)\s*\(@i', $this->script, $funcName) || preg_match('@^\s*(?:var\s+)?([\$_A-Za-z][\$\w]*)\s*=\s*function\s*\(@i', $this->script, $funcName)) $this->script .= "\n\t\t{$funcName[1]}();"; $data = $this->DefaultParamArr($this->link, $this->cookie); $data['step'] = '2'; $data['dllink'] = ''; echo "\n
\n\n\n\n\n\n