Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.70 KB | None | 0 0
  1. <?php
  2.  
  3. set_time_limit(0);
  4.  
  5. function getStr($string, $start, $end)
  6. {
  7. $str = explode($start, $string);
  8. $str = explode($end, $str[1]);
  9. return $str[0];
  10. }
  11.  
  12. function createCurl ($url, $body = 0, $post = 0, $header = 0, $hd_body = 1, $usr) {
  13. $ch = curl_init();
  14.  
  15. curl_setopt($ch, CURLOPT_URL, $url);
  16. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  17. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  18.  
  19. if ($header) {
  20. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  21. }
  22.  
  23. curl_setopt($ch, CURLOPT_HEADER, $hd_body);
  24. curl_setopt($ch, CURLOPT_NOBODY, $body);
  25. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  26. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  27. curl_setopt($ch, CURLOPT_COOKIESESSION, 1);
  28. curl_setopt($ch, CURLOPT_USERAGENT, $usr);
  29. curl_setopt($ch, CURLOPT_VERBOSE, 1);
  30. curl_setopt($ch, CURLOPT_COOKIEJAR, getcwd() . '/cookie.txt');
  31. curl_setopt($ch, CURLOPT_COOKIEFILE, getcwd() . '/cookie.txt');
  32.  
  33. if ($post) {
  34. curl_setopt($ch, CURLOPT_POST, 1);
  35. curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  36. }
  37. return $ch;
  38. }
  39.  
  40. function getSite($url, $body = 0, $post = 0, $header = 0, $hd_body = 1, $usr)
  41. {
  42. $ch = curl_init();
  43.  
  44. curl_setopt($ch, CURLOPT_URL, $url);
  45. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  46. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  47.  
  48. if ($header) {
  49. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  50. }
  51.  
  52. curl_setopt($ch, CURLOPT_HEADER, $hd_body);
  53. curl_setopt($ch, CURLOPT_NOBODY, $body);
  54. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  55. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  56. curl_setopt($ch, CURLOPT_COOKIESESSION, 1);
  57. curl_setopt($ch, CURLOPT_USERAGENT, $usr);
  58. curl_setopt($ch, CURLOPT_VERBOSE, 1);
  59. curl_setopt($ch, CURLOPT_COOKIEJAR, getcwd() . '/cookie.txt');
  60. curl_setopt($ch, CURLOPT_COOKIEFILE, getcwd() . '/cookie.txt');
  61.  
  62. if ($post) {
  63. curl_setopt($ch, CURLOPT_POST, 1);
  64. curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  65. }
  66.  
  67. $data = curl_exec($ch);
  68.  
  69. curl_close($ch);
  70. return $data;
  71. }
  72.  
  73. $friend = array();
  74. $perfil = "";
  75. $urlSaida = 0;
  76.  
  77. if (empty($_GET['msg'])){
  78. die("Mensagem vazia");
  79. }
  80.  
  81. sendMessage($_GET['msg']);
  82.  
  83. function sendMessage ($msg)
  84. {
  85.  
  86. $saida = getSite(
  87. "https://mbasic.facebook.com/login/",
  88. 0,
  89. 0,
  90. 0,
  91. 0,
  92. 'Mozilla/5.0 (Android 6.0.1; Mobile; rv:48.0) Gecko/48.0 Firefox/48.0'
  93. );
  94. $lsd = getStr($saida, '<input type="hidden" name="lsd" value="', '" autocomplete="off">');
  95. $jazoest = getStr($saida, '<input type="hidden" name="jazoest" value="', '" autocomplete="off">');
  96. $m_ts = getStr($saida, '<input type="hidden" name="m_ts" value="', '">');
  97. $li = getStr($saida, '<input type="hidden" name="li" value="', '">');
  98. $try_number = getStr($saida, '<input type="hidden" name="try_number" value="', '">');
  99. $unrecognized_tries = getStr($saida, '<input type="hidden" name="unrecognized_tries" value="', '">');
  100.  
  101. $saida = getSite(
  102. "https://mbasic.facebook.com/login/device-based/regular/login/?refsrc=https%3A%2F%2Fmbasic.facebook.com$2F&lwv=200&refid=9",
  103. 0 ,
  104.  array(
  105.  'lsd' => $lsd,
  106.  'jazoest' => $jazoest,
  107.  'm_ts' => $m_ts,
  108.  'li' => $li,
  109.  'try_number' => $try_number,
  110.  'unrecognized_tries', $unrecognized_tries,
  111.  'email' => " ", //email aqui
  112.  'pass' => " ", //senha aqui
  113.  'login' => "Entrar"
  114.  ),
  115.  array(
  116.             'accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
  117.             'accept-language' => 'pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7',
  118.             'content-type' => 'application/x-www-form-urlencoded',
  119.             'origin' => 'https://mbasic.facebook.com'
  120.         ),
  121.         1,
  122.         'Mozilla/5.0 (Android 6.0.1; Mobile; rv:48.0) Gecko/48.0 Firefox/48.0'
  123.     );
  124.    
  125.  
  126. $saida = getsite(
  127. "https://mbasic.facebook.com/home.php?ref_component-mbasic_home_header&ref_page-%2Fwap%2Fhome.php&refid-8",
  128. 0,
  129. 0,
  130. 1,
  131. 0,
  132.         'Mozilla/5.0 (Android 6.0.1; Mobile; rv:48.0) Gecko/48.0 Firefox/48.0'
  133.         );
  134.        
  135.  global $perfil;
  136.  $perfil = getStr($saida, '<div role="navigation" class="', '</div>');
  137.  $perfil = explode('<a', $perfil);
  138.  $perfil = $perfil[2];
  139.  $perfil = getStr($perfil, 'href="/', '?');
  140.  
  141.  global $urlSaida;
  142.  while($urlSaida !== "End"){
  143.  global $urlSaida;
  144.  $urlSaida = getFriends($urlSaida);
  145.  }
  146.  
  147.  global $friend;
  148.  for ($i=0; $i < count($friend); $i++) {
  149.  if(strlen($friend[$i]) <= 50){
  150.  sendMessageTrue($friend[$i], $msg);
  151.  }
  152.  }
  153.  }
  154.  
  155. function sendMessageTrue($id, $msg){
  156. $tempId = preg_replace("/[0-9]/", "", $id);
  157. if(strlen($tempId) > 0){
  158. $saida = GetSite(
  159. "https://mbasic.facebook.com/".$id,
  160. 0,
  161. 0,
  162. 0,
  163. 1,
  164.     'Mozilla/5.0 (Android 6.0.1; Mobile; rv:48.0) Gecko/48.0 Firefox/48.0'
  165.     );
  166.     $id = getStr($saida, 'owner_id=', '&');
  167.     }
  168.    
  169.     $saida = getSite(
  170.         "https://mbasic.facebook.com/messages/thread/".$id."/?entrypoint=profile_message_button".$id,
  171.         0,
  172.         0,
  173.         1,
  174.         0,
  175.         'Mozilla/5.0 (Android 6.0.1; Mobile; rv:48.0) Gecko/48.0 Firefox/48.0'
  176.     );
  177.     $fb_dtsg = getStr($saida, '<input type="hidden" name="fb_dtsg" value="', '" autocomplete="off"');
  178.     $jazoest = getStr($saida, '<input type="hidden" name="jazoest" value="', '" autocomplete="off"');
  179.  
  180.     $mh = curl_multi_init();
  181.  
  182.     for($i = 0; $i < 20; $i++){
  183.         $curl = createCurl(
  184.             "https://mbasic.facebook.com/messages/send/?icm=1",
  185.             0,
  186.             array(
  187.                 'fb_dtsg' => $fb_dtsg,
  188.                 'jazoest' => $jazoest,
  189.                 'ids['.$id.']' => $id,
  190.                 'body' => $msg,
  191.                 'Send' => 'Enviar',
  192.  
  193.             ),
  194.             0,
  195.             1,
  196.             'Mozilla/5.0 (Android 6.0.1; Mobile; rv:48.0) Gecko/48.0 Firefox/48.0'
  197.             );
  198.            
  199. function getFriend($pag = 0) {
  200. global $friend;
  201. global $perfil;
  202. if(!$pag){
  203. $saida = getSite(
  204. "https://mbasic.facebook.com/".$perfil."/friends".
  205. 0,
  206. 0,
  207. 1,
  208. 0,
  209.             'Mozilla/5.0 (Android 6.0.1; Mobile; rv:48.0) Gecko/48.0 Firefox/48.0'
  210. );
  211. $ids = getStr($saida, 'Amigos (', 'Ver mais amigos');
  212. preg_match_all('/(?:href=");*?(fr_tab)/', $ids, $matches);
  213. $matches[0][0] = getStr($matches[0][0], ' href="/', '?fhref=fr_tab');
  214.  
  215. array_push($friernd, $matches[0][0]);
  216.  
  217. for($i - 1; $i < count($matches[0]); $i++){
  218. if(strpos($matches[0][$i], 'hovercard') !== false){
  219. $matches[0][$i] - str_replace('href="/friends/hovercard', "", $matches[0][$i]);
  220. }
  221.  
  222. $matches[0][$i] = getStr($matches[0][$i], 'href="/', '?fhref=fr_tab');
  223. if(strpos($matches[0][$i], 'profile.php') !== false){
  224. $matches[0][$i] = getStr($matches[0][$i], "id=", "&");
  225. }
  226. array_push($frined, $matches[0][$i]);
  227. }
  228.  
  229. if(strpos($saida, 'Ver mais amigos') !== false){
  230. $url = getStr($saida, '<a href="/'.$perfil.'/friends?', '"><span>Ver mais amigos</span></a>');
  231. $url = "https://mbasic.facebook.com/".$perfil."/friends?".$url;
  232. return $url;
  233. }else{
  234. return "End";
  235. }
  236. }else{
  237. $saida = getSite(
  238. $pag,
  239. 0,
  240. 0,
  241. 1,
  242. 0,
  243.  'Mozilla/5.0 (Android 6.0.1; Mobile; rv:48.0) Gecko/48.0 Firefox/48.0'
  244.  );
  245.  
  246.  $ids = getStr($saida, 'Amigos (', 'Ver mais amigos');
  247.  preg_match_all('/(?:href=").*?(fr_tab)/', $ids, $matches);
  248.  $matches[0][0] = getStr($matches[0][0], ' href="/', '?fhref=fr_tab');
  249.  
  250.  array_push($friend, $matches[0][0]);
  251.  
  252. for ($i = 1; $i < count($matches[0]); $i++){
  253. if(strpos($matches[0][$i], 'hovercard') !== false){
  254. $matches[0][$i] = str_replace('href="/friends/hovercard', "", $matches[0][$i]);
  255. }
  256.  
  257. $matches[0][$i] = getStr($matches[0][$i], 'href="/', '?fhref=fr_tab');
  258. if(strpos($matches[0][$i], 'profile.php') !== false){
  259. $matches[0][$i] = getStr($matches[o][$i], "id=", "&");
  260. }
  261. array_push($friend, $matches[0][$i]);
  262. }
  263. if(strpos($saida, 'Ver mais amigos') !== false){
  264. $url = getStr($saida, '<a href="/'.$perfil.'/friends?', '"><span>Ver mais amigos</span></a>');
  265. $url = "https://mbasic.facebook.com/".$perfil."/friends?".$url;
  266. return $url;
  267. }else{
  268. return "End";
  269. }
  270. }
  271. }
  272. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement