Advertisement
Th3-822

[rapidleech][u] fshare.vn_member.php

Feb 21st, 2014
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 10.82 KB | None | 0 0
  1. <?php
  2. ######## Account Info ########
  3. $upload_acc['fshare_vn']['user'] = ''; //Set your login
  4. $upload_acc['fshare_vn']['pass'] = ''; //Set your password
  5. ########################
  6.  
  7. $_GET['proxy'] = isset($_GET['proxy']) ? $_GET['proxy'] : '';
  8. $not_done = true;
  9.  
  10. if ($upload_acc['fshare_vn']['user'] && $upload_acc['fshare_vn']['pass']) {
  11.     $default_acc = true;
  12.     $_REQUEST['up_login'] = $upload_acc['fshare_vn']['user'];
  13.     $_REQUEST['up_pass'] = $upload_acc['fshare_vn']['pass'];
  14.     $_REQUEST['action'] = 'FORM';
  15.     echo "<b><center>Using Default Login.</center></b>\n";
  16. } else $default_acc = false;
  17.  
  18. if (empty($_REQUEST['action']) || $_REQUEST['action'] != 'FORM') {
  19.     echo "<table border='0' style='width:270px;' cellspacing='0' align='center'>
  20.     <form method='POST'>
  21.     <input type='hidden' name='action' value='FORM' />
  22.     <tr><td style='white-space:nowrap;'>&nbsp;Email*</td><td>&nbsp;<input type='text' name='up_login' value='' style='width:160px;' /></td></tr>
  23.     <tr><td style='white-space:nowrap;'>&nbsp;Password*</td><td>&nbsp;<input type='password' name='up_pass' value='' style='width:160px;' /></td></tr>\n";
  24.     echo "<tr><td colspan='2' align='center'><br /><input type='submit' value='Upload' /></td></tr>\n";
  25.     echo "<tr><td colspan='2' align='center'><small>*You can set it as default in <b>".basename(__FILE__)."</b></small></td></tr>\n";
  26.     echo "</table>\n</form>\n";
  27. } else {
  28.     $login = $not_done = false;
  29.     $domain = 'www.fshare.vn';
  30.     $referer = "http://$domain/";
  31.  
  32.     // Login
  33.     echo "<table style='width:600px;margin:auto;'>\n<tr><td align='center'>\n<div id='login' width='100%' align='center'>Login to $domain</div>\n";
  34.  
  35.     $cookie = array();
  36.     if (!empty($_REQUEST['up_login']) && !empty($_REQUEST['up_pass'])) {
  37.         if (!empty($_REQUEST['A_encrypted'])) {
  38.             $_REQUEST['up_login'] = decrypt(urldecode($_REQUEST['up_login']));
  39.             $_REQUEST['up_pass'] = decrypt(urldecode($_REQUEST['up_pass']));
  40.             unset($_REQUEST['A_encrypted']);
  41.         }
  42.         CookieLogin($_REQUEST['up_login'], $_REQUEST['up_pass']);
  43.         $login = true;
  44.     } else html_error('Login failed: User/Password empty.');
  45.  
  46.     // Retrive upload ID
  47.     echo "<script type='text/javascript'>document.getElementById('login').style.display='none';</script>\n<div id='info' width='100%' align='center'>Retrieving upload ID</div>\n";
  48.  
  49.     $page = geturl('up.fshare.vn', 80, '/index.php?keepThis=false&', $referer, $cookie, 0, 0, $_GET['proxy'], $pauth);is_page($page);
  50.     $cookie = GetCookiesArr($page, $cookie);
  51.  
  52.     if (!preg_match('@upload_url\s*:\s*"((https?://(?:\w+\.)*fshare\.vn)?(/)?[^\s\'\"<>]+)",@i', $page, $up)) html_error('Error: Upload url not found.');
  53.     if (!preg_match('@\{"SESSID"\s*:\s*"(\w+)"@i', $page, $sid)) html_error('Error: Upload session not found.');
  54.  
  55.     $post = array();
  56.     $post['Filename'] = $lname;
  57.     $post['folder_id'] = '-1';
  58.     $post['direct_link'] = $post['secure'] = 'null';
  59.     $post['desc'] = 'Uploaded with Rapidleech.';
  60.     $post['SESSID'] = $sid[1];
  61.     $post['Upload'] = 'Submit Query';
  62.  
  63.     $up_url = (empty($up[2]) ? 'http://up.fshare.vn'.(empty($up[3]) ? '/' : '').$up[1] : $up[1]);
  64.  
  65.     // Uploading
  66.     echo "<script type='text/javascript'>document.getElementById('info').style.display='none';</script>\n";
  67.  
  68.     $url = parse_url($up_url);
  69.     $upfiles = upfile($url['host'], defport($url), $url['path'].(!empty($url['query']) ? '?'.$url['query'] : ''), 0, 0, $post, $lfile, $lname, 'fileupload', '', 0, 0, 'Shockwave Flash', $url['scheme']);
  70.  
  71.     // Upload Finished
  72.     echo "<script type='text/javascript'>document.getElementById('progressblock').style.display='none';</script>\n";
  73.  
  74.     is_page($upfiles);
  75.  
  76.     if (!preg_match('@https?://(?:www\.)?fshare\.vn/file/\w+/?@i', $upfiles, $lnk)) html_error('Download link not found.', 0);
  77.     $download_link = $lnk[0];
  78. }
  79.  
  80. // Edited For upload.php usage.
  81. function EnterCaptcha($captchaImg, $inputs, $captchaSize = '5') {
  82.     echo "\n<form name='captcha' method='POST'>\n";
  83.     foreach ($inputs as $name => $input) echo "\t<input type='hidden' name='$name' id='$name' value='$input' />\n";
  84.     echo "\t<h4>" . lang(301) . " <img alt='CAPTCHA Image' src='$captchaImg' /> " . lang(302) . ": <input type='text' name='captcha' size='$captchaSize' />&nbsp;&nbsp;\n\t\t<input type='submit' onclick='return check();' value='Enter Captcha' />\n\t</h4>\n\t<script type='text/javascript'>/* <![CDATA[ */\n\t\tfunction check() {\n\t\t\tvar captcha=document.dl.captcha.value;\n\t\t\tif (captcha == '') {\n\t\t\t\twindow.alert('You didn\'t enter the image verification code');\n\t\t\t\treturn false;\n\t\t\t} else return true;\n\t\t}\n\t/* ]]> */</script>\n</form>\n</body>\n</html>";
  85. }
  86.  
  87. function DL_reCaptcha($pid, $data) {
  88.     global $pauth;
  89.     $page = geturl('www.google.com', 80, "/recaptcha/api/challenge?k=$pid", 0, 0, 0, 0, $_GET['proxy'], $pauth);is_page($page);
  90.     if (!preg_match('/challenge \: \'([^\']+)/i', $page, $ch)) html_error('Error getting CAPTCHA data.');
  91.     $challenge = $ch[1];
  92.  
  93.     $data['challenge'] = $challenge;
  94.  
  95.     //Download captcha img.
  96.     $page = geturl('www.google.com', 80, "/recaptcha/api/image?c=$challenge", 0, 0, 0, 0, $_GET['proxy'], $pauth);is_page($page);
  97.     $capt_img = substr($page, strpos($page, "\r\n\r\n") + 4);
  98.     $imgfile = DOWNLOAD_DIR . 'fsharevn_captcha.jpg';
  99.  
  100.     if (file_exists($imgfile)) unlink($imgfile);
  101.     if (!write_file($imgfile, $capt_img)) html_error('Error getting CAPTCHA image.');
  102.  
  103.     EnterCaptcha($imgfile.'?'.time(), $data, 20);
  104.     exit;
  105. }
  106.  
  107. function Login($user, $pass) {
  108.     global $cookie, $domain, $referer, $pauth, $default_acc;
  109.     if (!empty($_POST['step']) && $_POST['step'] == '1') {
  110.         $captcha = true;
  111.         $_POST['step'] = false;
  112.     } else $captcha = false;
  113.  
  114.     $post = array();
  115.     $post['login_useremail'] = urlencode($user);
  116.     $post['login_password'] = urlencode($pass);
  117.     $post['url_refe'] = 'http%3A%2F%2Fwww.fshare.vn%2F';
  118.     $post['auto_login'] = 1;
  119.     if ($captcha) {
  120.         if (empty($_POST['captcha'])) html_error('You didn\'t enter the image verification code.');
  121.         $cookie = StrToCookies(decrypt(urldecode($_POST['cookie'])));
  122.         $post['recaptcha_challenge_field'] = urlencode($_POST['challenge']);
  123.         $post['recaptcha_response_field'] = urlencode($_POST['captcha']);
  124.     }
  125.  
  126.     $page = geturl($domain, 0, '/login.php', $referer.'login.php', $cookie, $post, 0, 0, 0, 0, 'https');is_page($page);
  127.     $cookie = GetCookiesArr($page, $cookie);
  128.     if (preg_match('@\nLocation: ((https?://(\w+\.)*fshare.vn)?/active\.php\?code=[^\r\n]+)@i', $page, $redir)) {
  129.         $redir = parse_url((empty($redir[2]) ? 'https://www.fshare.vn'.$redir[1] : $redir[1]));
  130.         $page = geturl($redir['host'], defport($redir), $redir['path'], $referer.'login.php', $cookie, 0, 0, 0, 0, 0, $redir['scheme']);is_page($page);
  131.         $cookie = GetCookiesArr($page, $cookie);
  132.     }
  133.  
  134.     if ($captcha) is_present($page, 'Mã xác nhận không chính xác', 'Login Failed: Wrong CAPTCHA entered.');
  135.     elseif (stripos($page, 'Mã xác nhận không chính xác') !== false) {
  136.         if (!preg_match('@https?://(?:[^/]+\.)?(?:(?:google\.com/recaptcha/api)|(?:recaptcha\.net))/(?:(?:challenge)|(?:noscript))\?k=([\w|\-]+)@i', $page, $pid)) html_error('Login Error: Captcha not found.');
  137.         $data = array();
  138.         $data['step'] = '1';
  139.         $data['cookie'] = urlencode(encrypt(CookiesToStr($cookie)));
  140.         $data['action'] = 'FORM';
  141.         if (!$default_acc) {
  142.             $data['A_encrypted'] = 'true';
  143.             $data['up_login'] = urlencode(encrypt($user)); // encrypt() will keep this safe.
  144.             $data['up_pass'] = urlencode(encrypt($pass)); // And this too.
  145.         }
  146.         DL_reCaptcha($pid[1], $data);
  147.         exit;
  148.     }
  149.  
  150.     is_present($page, 'Mật khẩu phải có ít nhất 6 ký tự.', 'Login Failed: Password too short (< 6).');
  151.     is_present($page, 'Bạn cần nhập chính xác email và mật khẩu.', 'Login Failed: Email/Password incorrect.');
  152.     if (empty($cookie['fshare_userpass'])) html_error('Login Error: Cannot find "fshare_userpass" cookie.');
  153.  
  154.     SaveCookies($user, $pass); // Update cookies file
  155.     return true;
  156. }
  157.  
  158. function IWillNameItLater($cookie, $decrypt=true) {
  159.     if (!is_array($cookie)) {
  160.         if (!empty($cookie)) return $decrypt ? decrypt(urldecode($cookie)) : urlencode(encrypt($cookie));
  161.         return '';
  162.     }
  163.     if (count($cookie) < 1) return $cookie;
  164.     $keys = array_keys($cookie);
  165.     $values = array_values($cookie);
  166.     $keys = $decrypt ? array_map('decrypt', array_map('urldecode', $keys)) : array_map('urlencode', array_map('encrypt', $keys));
  167.     $values = $decrypt ? array_map('decrypt', array_map('urldecode', $values)) : array_map('urlencode', array_map('encrypt', $values));
  168.     return array_combine($keys, $values);
  169. }
  170.  
  171. function CookieLogin($user, $pass) {
  172.     global $cookie, $domain, $referer, $secretkey, $pauth;
  173.     if (empty($user) || empty($pass)) html_error('Login Failed: User or Password is empty.');
  174.     $user = strtolower($user);
  175.  
  176.     $filename = 'fsharevn_ul.php';
  177.     if (!defined('DOWNLOAD_DIR')) {
  178.         global $options;
  179.         if (substr($options['download_dir'], -1) != '/') $options['download_dir'] .= '/';
  180.         define('DOWNLOAD_DIR', (substr($options['download_dir'], 0, 6) == 'ftp://' ? '' : $options['download_dir']));
  181.     }
  182.     $filename = DOWNLOAD_DIR.basename($filename);
  183.     if (!file_exists($filename)) return Login($user, $pass);
  184.  
  185.     $file = file($filename);
  186.     $savedcookies = unserialize($file[1]);
  187.     unset($file);
  188.  
  189.     $hash = hash('crc32b', $user.':'.$pass);
  190.     if (array_key_exists($hash, $savedcookies)) {
  191.         $_secretkey = $secretkey;
  192.         $secretkey = hash('crc32b', $pass).sha1($user.':'.$pass).hash('crc32b', $user); // A 56 char key should be safer. :D
  193.         $cookie = (decrypt(urldecode($savedcookies[$hash]['enc'])) == 'OK') ? IWillNameItLater($savedcookies[$hash]['cookie']) : '';
  194.         $secretkey = $_secretkey;
  195.         if ((is_array($cookie) && count($cookie) < 1) || empty($cookie)) return Login($user, $pass);
  196.  
  197.         $page = geturl($domain, 80, '/', $referer, $cookie, 0, 0, $_GET['proxy'], $pauth);is_page($page);
  198.         if (stripos($page, '>Thoát</a>') === false) return Login($user, $pass);
  199.         $cookie = GetCookiesArr($page, $cookie); // Update cookies
  200.         SaveCookies($user, $pass); // Update cookies file
  201.         return true;
  202.     }
  203.     return Login($user, $pass);
  204. }
  205.  
  206. function SaveCookies($user, $pass) {
  207.     global $cookie, $secretkey;
  208.     $maxdays = 31; // Max days to keep cookies saved
  209.  
  210.     $filename = 'fsharevn_ul.php';
  211.     $filename = DOWNLOAD_DIR.basename($filename);
  212.     if (file_exists($filename)) {
  213.         $file = file($filename);
  214.         $savedcookies = unserialize($file[1]);
  215.         unset($file);
  216.  
  217.         // Remove old cookies
  218.         foreach ($savedcookies as $k => $v) if (time() - $v['time'] >= ($maxdays * 24 * 60 * 60)) unset($savedcookies[$k]);
  219.     } else $savedcookies = array();
  220.     $hash = hash('crc32b', $user.':'.$pass);
  221.     $_secretkey = $secretkey;
  222.     $secretkey = hash('crc32b', $pass).sha1($user.':'.$pass).hash('crc32b', $user); // A 56 char key should be safer. :D
  223.     $savedcookies[$hash] = array('time' => time(), 'enc' => urlencode(encrypt('OK')), 'cookie' => IWillNameItLater($cookie, false));
  224.     $secretkey = $_secretkey;
  225.  
  226.     write_file($filename, "<?php exit(); ?>\r\n" . serialize($savedcookies));
  227. }
  228.  
  229. //[21-2-2014]  Written by Th3-822.
  230.  
  231. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement