makag

Автоматическая валидация анкет на хостинге через логин парол

May 2nd, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.44 KB | None | 0 0
  1.  
  2. //*****************Автоматическая валидация анкет на хостинге через логин пароль один раз в сутки
  3. if ($cur_hour == 5 and $cur_min == 55) {
  4. $ridding = fopen('service/passdata.txt', 'r'); $unsr = fgets($ridding, 123456); fclose($ridding); $passdata = unserialize($unsr); ksort($passdata);
  5. foreach ($tokens as $key => $token) {
  6. if ($token[token] <> 5) {
  7. $setonline = vkapi('account.setOnline?access_token='.$token[token].'&v=5.59'); $online_json = json_decode($setonline, true); $errcode = $online_json['error']['error_code'];
  8. if ($errcode == 17) { $nacc = $key; $phone = $passdata[$nacc]['phone']; $login = $passdata[$nacc]['mail']; $password = $passdata[$nacc]['pass']; $security_check_code = getscode("$phone");
  9. if (isset($phone) and isset($login) and isset($password)) {
  10.  
  11. $headers = array( 'accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'content-type' => 'application/x-www-form-urlencoded', 'user-agent' => 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36' );
  12.  
  13. // получаем главную страницу
  14. $get_main_page = post('https://vk.com', array( 'headers' => array( 'accept: '.$headers['accept'], 'content-type: '.$headers['content-type'], 'user-agent: '.$headers['user-agent'] )));
  15.  
  16. // парсим с главной страницы параметры ip_h и lg_h
  17. preg_match('/name=\"ip_h\" value=\"(.*?)\"/s', $get_main_page['content'], $ip_h); preg_match('/name=\"lg_h\" value=\"(.*?)\"/s', $get_main_page['content'], $lg_h);
  18.  
  19. // посылаем запрос на авторизацию
  20. $post_auth = post('https://login.vk.com/?act=login', array( '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),
  21. 'headers' => array( 'accept: '.$headers['accept'], 'content-type: '.$headers['content-type'], 'user-agent: '.$headers['user-agent'] ), 'cookies' => $get_main_page['cookies']));
  22.  
  23. // получаем ссылку для редиректа после авторизации
  24. preg_match('/Location\: (.*)/u', $post_auth['headers'], $post_auth_location);
  25.  
  26. if(!preg_match('/\_\_q\_hash=/s', $post_auth_location[1])) { echo 'Не удалось авторизоваться <br /> <br />'.$post_auth['headers']; exit; }
  27.  
  28. // переходим по полученной для редиректа ссылке
  29. $get_auth_location = post(trim($post_auth_location[1]), array(
  30. 'headers' => array( 'accept: '.$headers['accept'], 'content-type: '.$headers['content-type'], 'user-agent: '.$headers['user-agent'] ), 'cookies' => $post_auth['cookies']));
  31.  
  32. // получаем ссылку на свою страницу
  33. preg_match('/"uid"\:"([0-9]+)"/s', $get_auth_location['content'], $my_page_id); $my_page_id = $my_page_id[1]; $get_my_page = getUserPage($my_page_id, $get_auth_location['cookies']);
  34.  
  35. // если запрошена проверка безопасности
  36. if(preg_match('/act=security\_check/u', $get_my_page['headers'])) { preg_match('/Location\: (.*)/s', $get_my_page['headers'], $security_check_location);
  37.  
  38. if(isset($security_check_location[1])) { $security_check_location = explode("\n", $security_check_location[1]); }
  39.  
  40. // переходим на страницу проверки безопасности
  41. $get_security_check_page = post('https://vk.com'.trim($security_check_location[0]), array(
  42. 'headers' => array( 'accept: '.$headers['accept'], 'content-type: '.$headers['content-type'], 'user-agent: '.$headers['user-agent'] ), 'cookies' => $get_auth_location['cookies'] ));
  43.  
  44. // получаем hash для запроса на проверку мобильного телефона
  45. preg_match('/hash: \'(.*?)\'/s', $get_security_check_page['content'], $get_security_check_page_hash);
  46.  
  47. // вводим запрошенные цифры мобильного телефона
  48. $post_security_check_code = post('https://vk.com/login.php', array(
  49. 'params' => 'act=security_check&code='.$security_check_code.'&al_page=2&hash='.$get_security_check_page_hash[1],
  50. 'headers' => array( 'accept: '.$headers['accept'], 'content-type: '.$headers['content-type'], 'user-agent: '.$headers['user-agent'] ), 'cookies' => $get_auth_location['cookies'] ));
  51.  
  52. echo 'Запрошена проверка безопасности';
  53.  
  54. // отображаем свою страницу после проверки безопасности
  55. $get_my_page = getUserPage($my_page_id, $get_auth_location['cookies']);
  56. echo iconv('windows-1251', 'utf-8', $get_my_page['content']); }
  57. else {
  58. // также отображаем свою страницу, если нет проверки безопасности
  59. echo iconv('windows-1251', 'utf-8', $get_my_page['content']); }
  60.  
  61. } } } } }
  62.  
  63.  
  64. //выделение кода безопасности из номера
  65. function getscode($phone) { $sim = substr($phone, 0, 1);
  66. if($sim == '+') { $phone = substr($phone, 1); }
  67. $prifixKz = substr($phone, 0, 2);
  68. $prifixRus = substr($phone, 0, 1);
  69. $prifixUkr = substr($phone, 0, 2);
  70. $prifixChina = substr($phone, 0, 2);
  71. if($prifixKz == '77') { $chunked_code = substr($phone, 2, 7); }
  72. else if($prifixRus == '7') { $chunked_code = substr($phone, 1, 8); }
  73. else if($prifixUkr == '38') { $chunked_code = substr($phone, 3, 7); }
  74. else if($prifixChina == '86') { $chunked_code = substr($phone, 2, 9); }
  75. else { $phone = array('tel' => $phone, 'country' => 'Unknown'); }
  76. return $chunked_code; }
  77.  
  78.  
  79. //********функции для валидации страницы
  80. function getUserPage($id = null, $cookies = null) {
  81. global $headers;
  82.  
  83. $get = post('https://vk.com/id'.$id, array(
  84. 'headers' => array(
  85. 'accept: '.$headers['accept'],
  86. 'content-type: '.$headers['content-type'],
  87. 'user-agent: '.$headers['user-agent']
  88. ),
  89. 'cookies' => $cookies
  90. ));
  91.  
  92. return $get;
  93. }
  94.  
  95.  
  96.  
  97. function post($url = null, $params = null, $proxy = null, $proxy_userpwd = null) {
  98. $ch = curl_init();
  99.  
  100. curl_setopt($ch, CURLOPT_URL, $url);
  101. curl_setopt($ch, CURLOPT_HEADER, 1);
  102. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  103. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
  104.  
  105. if(isset($params['params'])) { curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $params['params']); }
  106. if(isset($params['headers'])) { curl_setopt($ch, CURLOPT_HTTPHEADER, $params['headers']); }
  107. if(isset($params['cookies'])) { curl_setopt($ch, CURLOPT_COOKIE, $params['cookies']); }
  108. if($proxy) { curl_setopt($ch, CURLOPT_PROXY, $proxy);
  109. if($proxy_userpwd) { curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy_userpwd); } }
  110.  
  111. $result = curl_exec($ch); $result_explode = explode("\r\n\r\n", $result);
  112.  
  113. $headers = ((isset($result_explode[0])) ? $result_explode[0]."\r\n" : '').''.((isset($result_explode[1])) ? $result_explode[1] : '');
  114. $content = $result_explode[count($result_explode) - 1];
  115.  
  116. preg_match_all('|Set-Cookie: (.*);|U', $headers, $parse_cookies);
  117.  
  118. $cookies = implode(';', $parse_cookies[1]);
  119.  
  120. curl_close($ch);
  121. return array('headers' => $headers, 'cookies' => $cookies, 'content' => $content);
  122. }
  123.  
  124.  
  125.  
  126. //**
  127. $time_start = microtime(true);
  128. $time_end = microtime(true);
  129. $time_full = $time_end - $time_start;
  130. $cur_date = date('H:i-d:m');
  131. $fp = fopen ("microtime.txt", 'a+'); fwrite($fp, "$time_full at $cur_min - $cur_date \r\n"); fclose($fp);
  132.  
  133.  
  134. //***
  135.  
  136. if (is_array($proxyraw) and is_array($new_proxy_raw)) { $sumresult = array_replace($proxyraw, $new_proxy_raw); ssnwrite($sumresult, "service/proxyraw.txt"); }
  137. if (!is_array($proxyraw) and is_array($new_proxy_raw)) { ssnwrite($new_proxy_raw, "service/proxyraw.txt"); }
  138.  
  139. // обновление данных мускль телеграм бота
  140.  
  141. if (strlen($tgpeer) < 3) {
  142. $getupdates = tgapi($tgtoken, getUpdates); $jdecode = json_decode($getupdates, 1);
  143. $tginterlocutor = $jdecode['result']['0']['message']['from']['id']; $uname = $jdecode['result']['0']['message']['from']['username'];
  144. if ($tgpeer == 0) { $link = mysqli_connect($host, $sql_user, $sql_pass, $sql_user);
  145. $query = "UPDATE telegram SET tgnum = $tgnum, tgtoken = '$tgtoken', tgname = '$tgname', tginterlocutor = '$tginterlocutor', uname = '$uname' WHERE tgnum = $tgnum";
  146. $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); }
  147. mysqli_close($link);
  148.  
  149. }
Advertisement
Add Comment
Please, Sign In to add comment