FACEBOOK Friend Request worm.


SUBMITTED BY: Guest

DATE: Nov. 10, 2013, 5:13 p.m.

FORMAT: Text only

SIZE: 8.3 kB

HITS: 701

  1. <?php
  2. // CODED BY Metts / metts.blog.hu / da.metts@hotmail.com
  3. // FACEBOOK Friend Request worm.
  4. // A Kódért felelősséget nem vállalok!
  5. set_time_limit(60);
  6. $time = round(microtime(), 3);
  7. function fb_login($login_email, $login_pass)
  8. {
  9. $ch = curl_init();
  10. curl_setopt($ch, CURLOPT_URL, 'http://login.facebook.com/login.php?login_attempt=1');
  11. curl_setopt($ch, CURLOPT_POSTFIELDS,'charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&locale=en_US&email='.urlencode($login_email).'&pass='.urlencode($login_pass).'&pass_placeholder=&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84');
  12. curl_setopt($ch, CURLOPT_POST, 1);
  13. curl_setopt($ch, CURLOPT_HEADER, 0);
  14. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  15. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  16. curl_setopt($ch, CURLOPT_COOKIEJAR, str_replace('\\','/',dirname(__FILE__)).'/fb_cookies.txt');
  17. curl_setopt($ch, CURLOPT_COOKIEFILE, str_replace('\\','/',dirname(__FILE__)).'/fb_cookies.txt');
  18. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  19. curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");
  20. curl_exec($ch);
  21. $err = 0;
  22. $err = curl_errno($ch);
  23. if ($err != 0){
  24. curl_close($ch);
  25. echo 'LOGIN: error='.$err."\n";
  26. return(false);
  27. }
  28. else
  29. {
  30. echo " LOGIN: SUCESS<br/>";
  31. echo " GET: http://m.facebook.com/findfriends.php ";
  32. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  33. curl_setopt($ch, CURLOPT_TIMEOUT, '3');
  34. curl_setopt($ch, CURLOPT_COOKIEFILE, 'fb_cookies.txt');
  35. curl_setopt($ch, CURLOPT_URL, 'http://m.facebook.com/findfriends.php');
  36. $content = curl_exec($ch);
  37. return $content;
  38. }
  39. }
  40. function invite_friend($login_email,$login_pass,$f_id,$token)
  41. {
  42. $ch = curl_init();
  43. curl_setopt($ch, CURLOPT_URL, 'http://login.facebook.com/login.php?login_attempt=1');
  44. curl_setopt($ch, CURLOPT_POSTFIELDS,'charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&locale=en_US&email='.urlencode($login_email).'&pass='.urlencode($login_pass).'&pass_placeholder=&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84');
  45. curl_setopt($ch, CURLOPT_POST, 1);
  46. curl_setopt($ch, CURLOPT_HEADER, 0);
  47. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  48. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  49. curl_setopt($ch, CURLOPT_COOKIEJAR, str_replace('\\','/',dirname(__FILE__)).'/fb_cookies.txt');
  50. curl_setopt($ch, CURLOPT_COOKIEFILE, str_replace('\\','/',dirname(__FILE__)).'/fb_cookies.txt');
  51. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  52. curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");
  53. curl_exec($ch);
  54. $err = 0;
  55. $err = curl_errno($ch);
  56. if ($err != 0){
  57. curl_close($ch);
  58. echo 'LOGIN: error='.$err."\n";
  59. return(false);
  60. }
  61. else
  62. {
  63. $infos = curl_getinfo($ch);
  64. $_ID = iconv('ISO-8859-1','UTF-8',urlencode($f_id));
  65. $_PL = iconv('ISO-8859-1','UTF-8',urlencode('/find-friends/index.php'));
  66. $_TOKEN = iconv('ISO-8859-1','UTF-8',urlencode($token));
  67. $_SURI = iconv('ISO-8859-1','UTF-8',urlencode('/findfriends.php?fr_id='.$_ID));
  68. $_REFID = iconv('ISO-8859-1','UTF-8',urlencode('43'));
  69. $_HF = iconv('ISO-8859-1','UTF-8',urlencode('friend_browser'));
  70. echo "LOGIN: SUCESS<br/>
  71. SEND REQUEST: <br/>
  72. ID : ".$_ID." <br/>
  73. TOKEN: ".$_TOKEN."<br/>
  74. SURI : ".$_SURI."<br/>
  75. PL : ".$_PL."<br/>
  76. REFID: ".$_REFID."<br/>
  77. HF : ".$_HF."<br/>";
  78. echo 'URL: http://m.facebook.com/a/mobile/friends/add_friend.php?id='.$_ID.'&hf='.$_HF.'&pl='.$_PL.'&suri='.$_SURI.'&gfid='.$_TOKEN.'&refid='.$_REFID.'<br/>';
  79. curl_setopt($ch, CURLOPT_URL,'http://m.facebook.com/a/mobile/friends/add_friend.php?id='.$_ID.'&hf='.$_HF.'&pl='.$_PL.'&suri='.$_SURI.'&gfid='.$_TOKEN.'&refid='.$_REFID.'');
  80. curl_setopt($ch,CURLOPT_BINARYTRANSFER, true);
  81. curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  82. 'Host: m.facebook.com',
  83. 'User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1',
  84. 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  85. 'Accept-Language: hu-hu,hu;q=0.8,en-us;q=0.5,en;q=0.3',
  86. 'Accept-Charset: utf-8;q=0.7,*;q=0.7',
  87. 'Connection: keep-alive',
  88. 'Accept-Language: hu-hu,hu;q=0.8,en-us;q=0.5,en;q=0.3',
  89. 'Referer: https://m.facebook.com/findfriends.php'
  90. ));
  91. curl_setopt($ch, CURLOPT_POST, 0);
  92. curl_setopt($ch, CURLOPT_HEADER, 0);
  93. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  94. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  95. curl_setopt($ch, CURLOPT_COOKIEFILE, 'fb_cookies.txt');
  96. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  97. curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");
  98. $err = 0;
  99. $err = curl_errno($ch);
  100. if ($err != 0){
  101. curl_close($ch);
  102. echo 'LOGIN: error='.$err."\n";
  103. }
  104. else {
  105. $c = curl_exec($ch);
  106. $string = "You sent a friend request to ";
  107. if(stristr(strip_tags($c), $string) === FALSE) {
  108. echo("<b>ERROR: Can't sent a friend request</b>");
  109. $fail--;
  110. }
  111. else
  112. echo "<b>You sent a friend request to ".$_ID."</b>";
  113. curl_close($ch);
  114. }
  115. }
  116. }
  117. echo "<h1>Facebook friend request worm - Coded by Metts</h1><br/>";
  118. $login_email = 'e1730121222@rppkn.com'; //EMAIL
  119. $login_pass = 'pw'; //PW
  120. $pattern = '{<div\s+class="pymkName"\s*>((?:(?:(?!<div[^>]*>|</div>).)++|<div[^>]*>(?1)</div>)*)</div>}si';
  121. $pattern_to_href = '#<a\s*(?:href=[\'"]([^\'"]+)[\'"])?\s*(?:title=[\'"]([^\'"]+)[\'"])?.*?>((?:(?!</a>).)*)</a>#i';
  122. $pattern_to_hidden_form = '{<div\s+class="pymkAddButton"\s*>((?:(?:(?!<div[^>]*>|</div>).)++|<div[^>]*>(?1)</div>)*)</div>}si';
  123. $pattern_to_hidden_input = "/input type=\"hidden\" name=\"gfid\" value=\".*?\"/i";
  124. $data = fb_login($login_email,$login_pass);
  125. $array = array();
  126. $matchcount = preg_match_all($pattern, $data, $matches);
  127. $matchcount2 = preg_match_all($pattern_to_hidden_form, $data, $matches_2);
  128. $fail = $matchcount;
  129. if ($matchcount > 0)
  130. {
  131. echo "<h3>Friends:</h3>";
  132. echo("$matchcount matches found.<br/>");
  133. for($i = 0; $i < $matchcount ; $i++)
  134. {
  135. echo("<br/><br/>Match #" . ($i + 1) . ":<br/>");
  136. echo($matches[1][$i]);
  137. preg_match_all("/<a.*?href\s*=\s*['\"](.*?)['\"]/", $matches[1][$i], $res[$i]);
  138. echo " URL: ".$res[$i][1][0];
  139. $id = preg_replace("/[^0-9]/", '',$res[$i][1][0]);
  140. $id = substr($id, 0, (strlen($id)-2));
  141. echo " ID : ".$id;
  142. if(strlen($id) == 0) {
  143. // http://m.facebook.com/xxx.yyyy?
  144. print "<b>ERROR: He heavent not id!</b>";
  145. $fail--;
  146. }
  147. else {
  148. preg_match_all($pattern_to_hidden_input,$matches_2[1][$i],$out);
  149. $gfid =str_replace("input type=\"hidden\" name=\"gfid\" value=\"", "", $out[0][0]);
  150. $gfid =trim($gfid,'"');
  151. $token[$i] = $gfid;
  152. echo " TOKEN: ". $token[$i]."<br/><br/>";
  153. //invite_friend($login_email,$login_pass,$id,$token[$i]);
  154. }
  155. }
  156. }
  157. else {
  158. echo('No matches');
  159. echo($data);
  160. }
  161. $time2 = round(microtime(), 3);
  162. $generation = $time2 - $time;
  163. print "<br/>
  164. STAT: (".$matchcount."/".$fail.")<br/>
  165. TIME : ".$generation."";
  166. echo "<h1>WORM END</h1>";
  167. // 22:10 kor inditottama botot.
  168. // 10/8 at jelöl be a bot
  169. // 1 perc alatt végez
  170. // (8 * 3600) * 24 nap végére: 691200
  171. ?>

comments powered by Disqus