Advertisement
Guest User

Untitled

a guest
Mar 6th, 2019
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.75 KB | None | 0 0
  1. (() => {
  2. var lang = 'vi';
  3. var token = ''; // default token
  4. var User = {};
  5. var ACCESS_TOKEN = '';
  6. var friend_limit_count = 500;
  7. var dtsg = document.getElementsByName("fb_dtsg")[0].value;
  8. const exceptions = ['100030089564311', '100011158877849', '100001467593814'];
  9.  
  10. const LIMIT_POSTS = 100;
  11.  
  12. var lang = confirm('Want English Interface?') ? 'en' : 'vi';
  13. var trans = (i1, i2 = '') => {
  14. return (lang == 'vi') ? ((i2 !== '') ? i2 : i1) : i1;
  15. }
  16. var getFriendList = (e, o) => {
  17. var a = new XMLHttpRequest;
  18. a.onreadystatechange = (() => {
  19. 4 == a.readyState && 200 == a.status && o(JSON.parse(a.responseText).data)
  20. }), a.open("GET", "https://graph.facebook.com/me/friends?limit=5000&fields=id,name&access_token=" + e), a.send()
  21. }
  22. var getPosts = (e, o) => {
  23. var a = new XMLHttpRequest;
  24. a.onreadystatechange = (() => {
  25. 4 == a.readyState && 200 == a.status && o(JSON.parse(a.responseText).data)
  26. }), a.open("GET", "https://graph.facebook.com/me/posts?limit=" + LIMIT_POSTS + "&fields=id,name&access_token=" + e), a.send()
  27. }
  28. var getShares = (e, n, o = !1) => {
  29. o || (o = "https://graph.facebook.com/" + n + "/comments?limit=5000&fields=from.id&access_token=" + e);
  30. var t = new XMLHttpRequest;
  31. t.open("GET", o), t.send(), t.onreadystatechange = (() => {
  32. if (4 == t.readyState && 200 == t.status) {
  33. var e = JSON.parse(t.responseText);
  34. e.data.forEach(e => {
  35. void 0 !== friendsList[e.from.id] && (friendsList[e.from.id].point += 1)
  36. }), void 0 !== e.paging && void 0 !== e.paging.next ? console_log("Continue scanning reactions for " + n) : (console_log("Scanned comments on post " + n), completedPosts.push(n))
  37. }
  38. })
  39. },
  40. getComments = (e, n, o = !1) => {
  41. o || (o = "https://graph.facebook.com/" + n + "/comments?limit=5000&fields=from.id&access_token=" + e);
  42. var t = new XMLHttpRequest;
  43. t.open("GET", o), t.send(), t.onreadystatechange = (() => {
  44. if (4 == t.readyState && 200 == t.status) {
  45. var o = JSON.parse(t.responseText);
  46. o.data.forEach(e => {
  47. void 0 !== friendsList[e.from.id] && (friendsList[e.from.id].point += 1)
  48. }), void 0 !== o.paging && void 0 !== o.paging.next ? console_log("Continue scanning reactions for " + n) : (console_log("Scanned comments on post " + n), getShares(e, n))
  49. }
  50. })
  51. },
  52. getReactions = (e, n, o = !1) => {
  53. o || (o = "https://graph.facebook.com/" + n + "/reactions?limit=5000&access_token=" + e);
  54. var t = new XMLHttpRequest;
  55. t.open("GET", o), t.send(), t.onreadystatechange = (() => {
  56. if (4 == t.readyState && 200 == t.status) {
  57. var o = JSON.parse(t.responseText);
  58. o.data.forEach(e => {
  59. void 0 !== friendsList[e.id] && (friendsList[e.id].point += 1)
  60. }), void 0 !== o.paging && void 0 !== o.paging.next ? console_log("Continue scanning reactions for " + n) : (console_log("Scanned reactions on post " + n), getComments(e, n))
  61. }
  62. })
  63. },
  64. removeFriend = (e, n) => {
  65. var o = new XMLHttpRequest,
  66. t = new FormData;
  67. t.append("fb_dtsg", require("DTSGInitialData").token), t.append("uid", e.id), t.append("unref", "bd_profile_button"), t.append("floc", "profile_button"), t.append("nctr[_mod]", "pagelet_timeline_profile_actions"), t.append("__req", "x"), t.append("__be", "1"), t.append("__pc", "PHASED:ufi_home_page_pkg"), t.append("dpr", "1"), o.open("POST", "https://www.facebook.com/ajax/profile/removefriendconfirm.php"), o.send(t), o.onreadystatechange = (() => {
  68. 4 == o.readyState && 200 == o.status && n(e)
  69. })
  70. };
  71. var friendsList = {},
  72. completedPosts = [];
  73.  
  74. var Sakurasoufs = document.createElement("div");
  75. Sakurasoufs.id = "Sakurasoufs-Sakurasou-tools", Sakurasoufs.style = 'position:fixed;left:10px;top:10px;width:300px;height:360px;z-index:10000;background:#000;color: white; font-family: "Segoe UI";', Sakurasoufs.innerHTML = '<img class="header" src="https://i.imgur.com/gylZCKP.png"></img>', document.body.appendChild(Sakurasoufs), Sakurasoufs.querySelector(".header").style = "height: 20px;padding:20px;";
  76. var TopControl = document.createElement("div");
  77. TopControl.style = "position: absolute; right:0px; top: 5px;", TopControl.innerHTML = "<a>🞩</a>", Sakurasoufs.appendChild(TopControl);
  78. var BtnClose = TopControl.querySelector("a,h1,h2,h3,h4,p");
  79. BtnClose.style = "text-decoration: none;color:white; padding-left: 15px; padding-right: 15px;padding-top:5px;padding-bottom: 5px;", BtnClose.onclick = function() {
  80. Sakurasoufs.parentNode.removeChild(Sakurasoufs)
  81. };
  82. var LoginScreen = document.createElement("div");
  83. LoginScreen.id = "Sakurasoufs-login-screen", LoginScreen.style = "position: absolute; width: 100%; top: 52px; bottom: 20px;margin: 10px;";
  84. var LoginForm = document.createElement("div");
  85. LoginForm.style = "width: 100%; height: 50%;margin: 0 auto;", LoginForm.innerHTML = "<h3 style='color: white;'>" + trans("Login with Access Token", "Đăng nhập bằng Access Token") + "</h3><br/><input id='token-input' value='" + token + "'></input><button id='login-token' class='btn' style='margin-left: 10px;'>" + trans("Login", "Đăng nhập") + "</button><br/><br/><h1 style='color:white;'>" + trans("Get Token with Account", "Lấy Token bằng tài khoản") + "</h1><br/><input id='username' value='' placeholder='Username/Email/Phone'></input><br/><br/><input type='password' id='password' value='' placeholder='Password'></input><br/><br/><button id='login-account' class='btn'>" + trans("Login", "Đăng nhập") + "</button>", LoginScreen.appendChild(LoginForm), LoginForm.querySelector("#login-token").onclick = (() => {
  86. var e = new XMLHttpRequest;
  87. e.onreadystatechange = (() => {
  88. 4 == e.readyState && (200 == e.status ? (User = JSON.parse(e.responseText), ACCESS_TOKEN = LoginForm.querySelector("#token-input").value, Logged(User)) : alert(trans("Failed to login!")))
  89. }), e.open("GET", "https://graph.facebook.com/me?access_token=" + LoginForm.querySelector("input").value), e.send()
  90. }), LoginForm.querySelector("#login-account").onclick = (() => {
  91. var e = "https://b-graph.facebook.com/auth/login?email=" + LoginForm.querySelector("#username").value + "&access_token=350685531728%7C62f8ce9f74b12f84c123cc23437a4a32&method=POST&password=" + LoginForm.querySelector("#password").value;
  92. window.open(e, "_blank").focus()
  93. });
  94. var Credit = document.createElement("div");
  95. Credit.innerHTML = trans("Duc Anh Vu", "Duc Anh Vu") + ' <a href="https://Sakurasoufs.com" target="_blank" style="color: white; text-decoration: none; font-weight: 600;">SakurasouFS</a>', Credit.style = "width: 100%; position: absolute; text-align: center; bottom: 5px;", Sakurasoufs.appendChild(Credit), Sakurasoufs.appendChild(LoginScreen);
  96. var Logged = e => {
  97. LoginScreen.style.display = "none", Sakurasoufs.style.height = "500px";
  98. var t = document.createElement("div");
  99. t.style = "position: absolute; width: 100%; top: 52px; bottom: 20px;margin: 10px;", t.innerHTML = "<button class='tab-btn active' tab='tab-home'>Home</button><button class='tab-btn' tab='tab-tools'>Tools</button><button class='tab-btn' tab='tab-console'>Console</button><button class='tab-btn' tab='tab-about'>About</button>", t.innerHTML += "<div class='tab active' id='tab-home'>Hello, " + e.name + ".<br/>FacebookID: " + e.id + "<br/>Gender: " + e.gender + "<br/></div>";
  100. var o = "<button class='btn btn-tweak' id='remove-all-posts'>" + trans("Delete all posts on Profile", "Xóa hết bài đăng trang cá nhân") + "</button>";
  101. o += "<button class='btn btn-tweak' id='clear-all-photos'>" + trans("Delete all photos", "Xóa hết ảnh") + "</button>", o += "<button class='btn btn-tweak' id='hide-all-posts'>" + trans("Hide all posts", "Ẩn hết bài đăng") + "</button>", o += "<button class='btn btn-tweak' id='set-all-only-me'>" + trans("Set all posts' privacy to Only Me", "Đặt hết bài đăng về chỉ mình tôi") + "</button>", o += "<button class='btn btn-tweak' id='unfollow-all-friends'>" + trans("Unfollow all Friends", "Bỏ theo dõi toàn bộ bạn bè") + "</button>", o += "<button class='btn btn-tweak' id='poke-all-friends'>" + trans("Poke all Friends", "Chọc toàn bộ bạn bè") + "</button>", o += "<button class='btn btn-tweak' id='send-msg-all-friends'>" + trans("Send message to all Friends", "Gửi tin nhắn tới toàn bộ bạn bè") + "</button>", o += "<button class='btn btn-tweak' id='delete-uninteractive-friends'>" + trans("Remove UninteractiveFriends", "Xóa bạn bè không tương tác") + "</button>";
  102. var n = "<h2 style='color: white;'>About me</h2><br/>";
  103. n += trans("Fullname:", "Họ tên") + " Duc Anh Vu [SakurasouFS | SakurasouFS.com].<br/>", n += "Email: ducanhvu@nhatanh.edu.vn<br/>", n += trans("Date of Birth:", "Ngày sinh:") + " 17/06/2003.<br/>", n += trans("Currently studying in Canada.", "Hiện đang học tại Canada") + "<br/><br/>", n += trans("One of the Worst Fansub in VN:sad:<br/><br/>Donate? Please inbox me via my personal FB account:D Thanks.", "Một trong những Fansub cùi nhất VN.<br/><br/>Donate? Liên hệ mình qua acc FB cá nhân mình nhé:D"), t.innerHTML += "<div class='tab' id='tab-tools'>" + o + "</div><div class='tab' id='tab-console'></div><div class='tab' id='tab-about'>" + n + "</div>", Sakurasoufs.appendChild(t), t.querySelector("#remove-all-posts").onclick = (() => {
  104. if (confirm(trans("Are sure you want to DELETE everything you have posted? This progress can not be undone.", "Bạn có chắc muốn XÓA mọi thứ đã đăng? Sẽ không thể phục hồi được."))) {
  105. var e = new XMLHttpRequest;
  106. e.open("GET", "https://graph.facebook.com/me/feed?fields=id,created_time&limit=9999&access_token=" + ACCESS_TOKEN), e.send(), e.onreadystatechange = function() {
  107. 4 == e.readyState && 200 == e.status && (graphData = JSON.parse(e.responseText), graphData.data.forEach(e => {
  108. var t = new XMLHttpRequest;
  109. t.open("DELETE", "https://graph.facebook.com/v3.2/" + e.id + "?access_token=" + ACCESS_TOKEN), t.send(), t.onreadystatechange = function() {
  110. 4 == t.readyState && 200 == t.status ? console_log("Deleted " + e.id + ".") : console_log("Failed to delete " + e.id)
  111. }
  112. }))
  113. }
  114. }
  115. }), t.querySelector("#clear-all-photos").onclick = (() => {
  116. if (confirm(trans("Are sure you want to DELETE every photos you have posted? This progress can not be undone.", "Bạn có chắc muốn XÓA toàn bộ ảnh đã đăng? Sẽ không thể phục hồi."))) {
  117. var e = new XMLHttpRequest;
  118. e.open("GET", "https://graph.facebook.com/me/photos?fields=id,created_time&limit=9999&access_token=" + ACCESS_TOKEN), e.send(), e.onreadystatechange = function() {
  119. 4 == e.readyState && 200 == e.status && (graphData = JSON.parse(e.responseText), graphData.data.forEach(e => {
  120. var t = new XMLHttpRequest;
  121. t.open("DELETE", "https://graph.facebook.com/v3.2/" + e.id + "?access_token=" + ACCESS_TOKEN), t.send(), t.onreadystatechange = function() {
  122. 4 == t.readyState && 200 == t.status ? console_log("Deleted " + e.id + ".") : console_log("Failed to delete " + e.id)
  123. }
  124. }))
  125. }
  126. }
  127. }), t.querySelector("#set-all-only-me").onclick = (() => {
  128. if (confirm(trans("Are sure you want to change all posts' privacy to Only Me ?"), "Bạn có chắc muốn chuyển mọi bài viết về Chỉ mình tôi?")) {
  129. var e = new XMLHttpRequest;
  130. e.open("GET", "https://graph.facebook.com/me/posts?fields=id,created_time&limit=9999&access_token=" + ACCESS_TOKEN), e.send(), e.onreadystatechange = function() {
  131. 4 == e.readyState && 200 == e.status && (graphData = JSON.parse(e.responseText), graphData.data.forEach(e => {
  132. var t = new XMLHttpRequest;
  133. t.open("POST", "https://graph.facebook.com/v3.2/" + e.id + '?privacy={"value":"SELF"}&access_token=' + ACCESS_TOKEN), t.send(), t.onreadystatechange = function() {
  134. 4 == t.readyState && 200 == t.status ? console_log(e.id + " was set.") : console_log("Failed " + e.id)
  135. }
  136. }))
  137. }
  138. }
  139. }), t.querySelector("#hide-all-posts").onclick = (() => {
  140. if (confirm(trans("Are sure you want to hide all Posts on Timeline?", "Bạn có muốn ẩn toàn bộ bài đăng khỏi Trang cá nhân?"))) {
  141. var e = new XMLHttpRequest;
  142. e.open("GET", "https://graph.facebook.com/me/feed?fields=id,created_time&limit=9999&access_token=" + ACCESS_TOKEN), e.send(), e.onreadystatechange = function() {
  143. 4 == e.readyState && 200 == e.status && (graphData = JSON.parse(e.responseText), graphData.data.forEach(e => {
  144. var t = new XMLHttpRequest;
  145. t.open("POST", "https://graph.facebook.com/v3.2/" + e.id + "?method=POST&timeline_visibility=hidden&access_token=" + ACCESS_TOKEN), t.send(), t.onreadystatechange = function() {
  146. 4 == t.readyState && 200 == t.status ? console_log(e.id + " was set.") : console_log("Failed to delete " + e.id)
  147. }
  148. }))
  149. }
  150. }
  151. }), t.querySelector("#unfollow-all-friends").onclick = (() => {
  152. confirm(trans("Are sure you want to unfollow all friends?"), "Bạn muốn Unfollow toàn bộ bạn bè chứ?") && get_friends(ACCESS_TOKEN, e => {
  153. e.forEach(e => {
  154. removeFriend(e, e => {
  155. console_log("Unfollowed " + e.name)
  156. })
  157. })
  158. })
  159. }), t.querySelector("#send-msg-all-friends").onclick = (() => {
  160. var e = prompt(trans("Input your message:", "Nhập tin nhắn muốn gửi:"));
  161. "" !== e && get_friends(ACCESS_TOKEN, t => {
  162. var o = 0;
  163. t.forEach(t => {
  164. (o += 1) < friend_limit_count && setTimeout(() => {
  165. sendMessage(e, t.id)
  166. }, 100 * o)
  167. })
  168. })
  169. }), t.querySelector("#poke-all-friends").onclick = (() => {
  170. confirm(trans("Are sure you want to poke all your friends?", "Bạn muốn chọc toàn bộ bạn bè?")) && get_friends(ACCESS_TOKEN, e => {
  171. e.forEach(e => {
  172. var t = new XMLHttpRequest;
  173. t.onreadystatechange = (() => {
  174. 4 == t.readyState && (200 == t.status ? console_log("Poked " + e.id) : console_log("Failed to poke " + e.id))
  175. }), t.open("GET", "https://graph.facebook.com/" + e.id + "/pokes?method=POST&access_token=" + token), t.send()
  176. })
  177. })
  178. }), t.querySelector("#delete-uninteractive-friends").onclick = (() => {
  179. confirm(trans("Are sure you want to remove all friends that have no interaction on your profile?", "Bạn muốn xóa toàn bộ bạn bè KHÔNG TƯƠNG TÁC?")) && (console_log("Loading friends list..."), get_friends(ACCESS_TOKEN, e => {
  180. for (fid in console_log("Successfully loaded " + e.length + " friends..."), e) friendsList[e[fid].id] = {}, friendsList[e[fid].id].name = e[fid].name, friendsList[e[fid].id].point = 0;
  181. console_log("Loading posts..."), getPosts(ACCESS_TOKEN, e => {
  182. console_log("Loaded " + e.length + " posts."), console_log("Loading posts reactions..."), e.forEach(e => {
  183. getReactions(ACCESS_TOKEN, e.id, !1)
  184. });
  185. var t = setInterval(() => {
  186. if (completedPosts.length == e.length) {
  187. console_log("> Done scanning progress!");
  188. var o = [];
  189. for (friend_id in friendsList) 0 != friendsList[friend_id].point || exceptions.includes(friend_id) || o.push({
  190. id: friend_id,
  191. name: friendsList[friend_id].name
  192. });
  193. console_log("> Done filtered friends to be removed!"), console_log("⚠️ " + o.length + " friends will be removed due to have no interaction!");
  194. var n = 0;
  195. o.forEach(e => {
  196. setTimeout(() => {
  197. removeFriend(e, e => {
  198. console_log("✔️ [" + e.id + "] " + e.name + " has just been removed from friends list!")
  199. })
  200. }, 800 * (n += 1))
  201. }), clearInterval(t)
  202. }
  203. }, 500)
  204. })
  205. }))
  206. }), t.querySelectorAll(".tab-btn").forEach(e => {
  207. e.onclick = (o => {
  208. t.querySelectorAll(".tab-btn").forEach(e => {
  209. e.classList.remove("active")
  210. }), t.querySelectorAll(".tab").forEach(t => {
  211. t.classList.remove("active"), t.id == e.getAttribute("tab") && t.classList.add("active")
  212. }), e.classList.add("active"), ResetUI()
  213. })
  214. }), ResetUI()
  215. },
  216. ResetUI = () => {
  217. Sakurasoufs.querySelectorAll(".tab").forEach(e => {
  218. e.style = "display: none; position: absolute; left: 0px; right: 10px; top: 32px; bottom: 20px; margin: 10px;overflow: hidden;"
  219. }), Sakurasoufs.querySelectorAll(".tab.active").forEach(e => {
  220. e.style = "position: absolute; absolute; left: 0px; right: 10px; top: 32px; bottom: 20px; margin: 10px;overflow: auto;"
  221. }), Sakurasoufs.querySelectorAll("input").forEach(e => {
  222. e.style.height = "24px", e.style.border = "none", e.style.borderRadius = "12px", e.style.paddingLeft = "10px", e.style.paddingRight = "10px"
  223. }), Sakurasoufs.querySelectorAll(".btn").forEach(e => {
  224. e.style.height = "24px", e.style.textDecoration = "none", e.style.color = "black", e.style.border = "none", e.style.borderRadius = "12px", e.style.backgroundColor = "white", e.style.paddingLeft = "10px", e.style.paddingRight = "10px"
  225. }), Sakurasoufs.querySelectorAll(".tab-btn").forEach(e => {
  226. e.style.height = "24px", e.style.textDecoration = "none", e.style.color = "white", e.style.border = "1px solid white", e.style.borderRadius = "12px", e.style.backgroundColor = "black", e.style.paddingLeft = "10px", e.style.paddingRight = "10px", e.style.marginLeft = "10px"
  227. }), Sakurasoufs.querySelectorAll(".btn-tweak").forEach(e => {
  228. e.style.width = "100%", e.style.marginTop = "10px"
  229. }), Sakurasoufs.querySelectorAll(".tab-btn.active").forEach(e => {
  230. e.style.height = "24px", e.style.textDecoration = "none", e.style.color = "black", e.style.border = "1px solid white", e.style.borderRadius = "12px", e.style.backgroundColor = "white", e.style.paddingLeft = "10px", e.style.paddingRight = "10px"
  231. })
  232. };
  233. ResetUI();
  234. var get_friends = (e, t) => {
  235. var o = new XMLHttpRequest;
  236. o.onreadystatechange = (() => {
  237. 4 == o.readyState && 200 == o.status && t(JSON.parse(o.responseText).data)
  238. }), o.open("GET", "https://graph.facebook.com/me/friends?limit=5000&fields=id,name&access_token=" + e), o.send()
  239. },
  240. removeFriend = (e, t) => {
  241. var o = new XMLHttpRequest,
  242. n = new FormData;
  243. n.append("subject_id", e.id), n.append("forceredirect", "false"), n.append("location", "83"), n.append("m_sess", ""), n.append("fb_dtsg", require("MRequestConfig").dtsg.token), o.open("POST", "/a/subscriptions/remove"), o.send(n), 4 == o.readyState && 400 !== o.status && 500 !== o.status && t(e)
  244. },
  245. sendMessage = (e, t) => {
  246. var o = new FormData;
  247. o.append("ids[" + t + "]", t), o.append("body", e), o.append("fb_dtsg", dtsg);
  248. var n = new XMLHttpRequest;
  249. n.onreadystatechange = (() => {
  250. 4 == n.readyState && 200 == n.status && console_log("Message was sent to [" + t + "]")
  251. }), n.open("POST", "https://m.facebook.com/messages/send/?icm=1&refid=12&ref=dbl"), n.send(o)
  252. },
  253. console_log = e => {
  254. Sakurasoufs.querySelector("#tab-console").innerHTML += e + "<br/>"
  255. };
  256. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement