fb-anya 0.0.1-security → 9.7.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fb-anya might be problematic. Click here for more details.

Files changed (80) hide show
  1. package/.cache/replit/__replit_disk_meta.json +1 -0
  2. package/.cache/replit/modules.stamp +0 -0
  3. package/.cache/replit/nix/env.json +1 -0
  4. package/.gitattributes +2 -0
  5. package/.travis.yml +6 -0
  6. package/CHANGELOG.md +2 -0
  7. package/DOCS.md +1738 -0
  8. package/LICENSE-MIT +21 -0
  9. package/StateCrypt.js +28 -0
  10. package/broadcast.js +1 -0
  11. package/index.js +686 -0
  12. package/languages/languages.json +122 -0
  13. package/lib/getInfoNew.js +34 -0
  14. package/lib/getToken.js +44 -0
  15. package/logger.js +15 -0
  16. package/package.json +73 -4
  17. package/src/ReportV1.js +55 -0
  18. package/src/addExternalModule.js +16 -0
  19. package/src/addUserToGroup.js +78 -0
  20. package/src/changeAdminStatus.js +79 -0
  21. package/src/changeArchivedStatus.js +41 -0
  22. package/src/changeAvt.js +86 -0
  23. package/src/changeBio.js +65 -0
  24. package/src/changeBlockedStatus.js +36 -0
  25. package/src/changeGroupImage.js +106 -0
  26. package/src/changeNickname.js +45 -0
  27. package/src/changeThreadColor.js +62 -0
  28. package/src/changeThreadEmoji.js +42 -0
  29. package/src/createNewGroup.js +70 -0
  30. package/src/createPoll.js +60 -0
  31. package/src/deleteMessage.js +45 -0
  32. package/src/deleteThread.js +43 -0
  33. package/src/forwardAttachment.js +48 -0
  34. package/src/getAccessToken.js +33 -0
  35. package/src/getCurrentUserID.js +7 -0
  36. package/src/getEmojiUrl.js +27 -0
  37. package/src/getFriendsList.js +73 -0
  38. package/src/getMessage.js +79 -0
  39. package/src/getThreadHistory.js +537 -0
  40. package/src/getThreadHistoryDeprecated.js +71 -0
  41. package/src/getThreadInfo.js +206 -0
  42. package/src/getThreadInfoDeprecated.js +56 -0
  43. package/src/getThreadList.js +213 -0
  44. package/src/getThreadListDeprecated.js +46 -0
  45. package/src/getThreadPictures.js +59 -0
  46. package/src/getUserID.js +62 -0
  47. package/src/getUserInfo.js +66 -0
  48. package/src/getUserInfoMain.js +65 -0
  49. package/src/getUserInfoV2.js +35 -0
  50. package/src/getUserInfoV3.js +63 -0
  51. package/src/getUserInfoV4.js +55 -0
  52. package/src/getUserInfoV5.js +61 -0
  53. package/src/handleFriendRequest.js +46 -0
  54. package/src/handleMessageRequest.js +49 -0
  55. package/src/httpGet.js +49 -0
  56. package/src/httpPost.js +48 -0
  57. package/src/httpPostFormData.js +41 -0
  58. package/src/listenMqtt.js +629 -0
  59. package/src/logout.js +68 -0
  60. package/src/markAsDelivered.js +48 -0
  61. package/src/markAsRead.js +70 -0
  62. package/src/markAsReadAll.js +43 -0
  63. package/src/markAsSeen.js +51 -0
  64. package/src/muteThread.js +47 -0
  65. package/src/removeUserFromGroup.js +49 -0
  66. package/src/resolvePhotoUrl.js +37 -0
  67. package/src/searchForThread.js +43 -0
  68. package/src/sendMessage.js +381 -0
  69. package/src/sendTypingIndicator.js +80 -0
  70. package/src/setMessageReaction.js +109 -0
  71. package/src/setPostReaction.js +102 -0
  72. package/src/setTitle.js +74 -0
  73. package/src/threadColors.js +39 -0
  74. package/src/unfriend.js +43 -0
  75. package/src/unsendMessage.js +40 -0
  76. package/test/example-config.json +18 -0
  77. package/test/test-page.js +140 -0
  78. package/test/test.js +385 -0
  79. package/utils.js +1246 -0
  80. package/README.md +0 -5
@@ -0,0 +1,122 @@
1
+ {
2
+ "vi": {
3
+ "index": {
4
+ "uptime": "Đã Hoàn Thành Kết Nối Đến Server Uptime Cho Url: ",
5
+ "erroUptime": "Server Uptime Gặp sự Cố, Không Thể Bật Uptime Cho Bạn!",
6
+ "errorLogin": "Appstate - Cookie Của Bạn Đã Bị Lỗi, Hãy Thay Cái Mới, Hoặc Vô Trình Duyệt Ẩn Danh Rồi Đăng Nhập Và Thử Lại !",
7
+ "checkpoint": "Phát Hiện CheckPoint - Không Đăng Nhập Được, Hãy Thử Logout Rồi Login Và Lấy Lại Appstate - Cookie !",
8
+ "loginSu": "Đăng Nhập Thành Công Tại UID: ",
9
+ "region": "Vùng Của Tài Khoản Là: ",
10
+ "login": "Đang Đăng Nhập...",
11
+ "loginError": "Sai Mật Khẩu Hoặc Tài Khoản !",
12
+ "errorFa": "Bạn Đang Sử Dụng 2 Bảo Mật !",
13
+ "okweb": "Xác Nhận Từ Trình Duyệt, Tiến Hành Các Quá Trình Đăng Nhập...",
14
+ "errorEnv": "Tạo Tệp ENV Thất Bại !",
15
+ "env": "Tạo Thành Công Tệp ENV !",
16
+ "errorPassRandom": "Đã Có Lỗi Khi Đang Try Tạo Mật Khẩu Ngẫu Nhiên",
17
+ "appstateDec": "Chưa Sẵn Sàng Để Giải Mã Appstate !",
18
+ "appstate": "Giải Mã Appstate Thành Công !",
19
+ "appstateError": "Appstate Đã Bị Lỗi ! Vui Lòng Thay Mới",
20
+ "oklogin": "Hoàn Thành Quá Trình Đăng Nhập !",
21
+ "newVersion": "Phiên Bản Mới Đã Được Publish: ",
22
+ "autoUpdate": "Tiến Hành Tự Động Cập Nhật Lên Phiên Bản Mới Nhất !",
23
+ "okUpdate": "Nâng Cấp Phiên Bản Thành Công!",
24
+ "restart": "Đang Khởi Động Lại...",
25
+ "errorUpdate": "Đã Xảy Ra Lỗi",
26
+ "checkVersion": "Bạn Hiện Đang Sử Dụng Phiên Bản: ",
27
+ "chucAdmin": "Chúc Các Admin Một Ngày Tốt Lành",
28
+ "errorUid": "Không Thể Lấy UID Hãy Thử Lại !",
29
+ "encAppstate": "Mã Hoá AppState Thành Công !"
30
+ }
31
+ },
32
+ "en": {
33
+ "index": {
34
+ "uptime": "Completed Connection To Server Uptime For Url: ",
35
+ "erroUptime": "Uptime Server Has Problems, Can't Turn On Uptime For You!",
36
+ "errorLogin": "Appstate - Your Cookie Is Wrong, Please Replace It, Or Go To Incognito Browser Then Login And Try Again!",
37
+ "checkpoint": "Detected CheckPoint - Can't Login, Try Logout Then Login And Get Appstate - Cookie !",
38
+ "loginSu": "Successfully Login At UID: ",
39
+ "region": "Account's Region Is:",
40
+ "login": "Logging in...",
41
+ "loginError": "Wrong Password Or Account !",
42
+ "errorFa": "You're Using 2 Security !",
43
+ "okweb": "Confirm From Browser, Proceed to Login Process...",
44
+ "errorEnv": "Create ENV File Failed!",
45
+ "env": "Successfully Created ENV File!",
46
+ "errorPassRandom": "An error occurred while trying to generate a Random Password",
47
+ "appstateDec": "Not Ready To Decode Appstate !",
48
+ "appstate": "Decrypting Appstate Successfully!",
49
+ "appstateError": "Appstate Error ! Please Replace",
50
+ "oklogin": "Complete Login Process!",
51
+ "newVersion": "New Version Published: ",
52
+ "autoUpdate": "Proceed to Automatically Update to the Latest Version!",
53
+ "okUpdate": "Version Upgrade Successful!",
54
+ "restart": "Rebooting...",
55
+ "errorUpdate": "An error has occurred",
56
+ "checkVersion": "You Are Currently Using Version: ",
57
+ "chucAdmin": "Have a nice day Admin",
58
+ "errorUid": "Unable to Get UID Try Again !",
59
+ "encAppstate": "AppState Encryption Successful !"
60
+ }
61
+ },
62
+ "th": {
63
+ "index": {
64
+ "uptime": "เสร็จสิ้นการเชื่อมต่อกับ Server Uptime สำหรับ URL: ",
65
+ "erroUptime": "เซิร์ฟเวอร์เวลาทำงานมีปัญหา ไม่สามารถเปิดเวลาทำงานให้คุณ!",
66
+ "errorLogin": "Appstate - คุกกี้ของคุณไม่ถูกต้อง โปรดแทนที่ด้วยอันใหม่ หรือไปที่เบราว์เซอร์ที่ไม่ระบุตัวตน จากนั้นลงชื่อเข้าใช้แล้วลองอีกครั้ง!",
67
+ "checkpoint": "ตรวจพบจุดตรวจสอบ - ไม่สามารถเข้าสู่ระบบ ลองออกจากระบบ จากนั้นเข้าสู่ระบบและรับ Appstate - Cookie !",
68
+ "loginSu": "เข้าสู่ระบบสำเร็จที่ UID: ",
69
+ "region": "ภูมิภาคของบัญชีคือ:",
70
+ "login": "กำลังเข้าสู่ระบบ...",
71
+ "loginError": "รหัสผ่านหรือบัญชีไม่ถูกต้อง!",
72
+ "errorFa": "คุณกำลังใช้ 2 Security !",
73
+ "okweb": "ยืนยันจากเบราว์เซอร์ ดำเนินการเข้าสู่ระบบ...",
74
+ "errorEnv": "สร้างไฟล์ ENV ล้มเหลว!",
75
+ "env": "สร้างไฟล์ ENV สำเร็จ!",
76
+ "errorPassRandom": "เกิดข้อผิดพลาดขณะพยายามสร้างรหัสผ่านแบบสุ่ม",
77
+ "appstateDec": "ไม่พร้อมที่จะถอดรหัส Appstate !",
78
+ "appstate": "ถอดรหัส Appstate สำเร็จ!",
79
+ "appstateError": "ข้อผิดพลาดของ Appstate โปรดแทนที่",
80
+ "oklogin": "เสร็จสิ้นขั้นตอนการเข้าสู่ระบบ!",
81
+ "newVersion": "เผยแพร่เวอร์ชันใหม่: ",
82
+ "autoUpdate": "ดำเนินการอัปเดตอัตโนมัติเป็นเวอร์ชันล่าสุด!",
83
+ "okUpdate": "อัปเกรดเวอร์ชันสำเร็จ!",
84
+ "restart": "กำลังรีบูต...",
85
+ "errorUpdate": "เกิดข้อผิดพลาด",
86
+ "checkVersion": "คุณกำลังใช้เวอร์ชัน: ",
87
+ "chucAdmin": "ขอให้มีวันที่ดีผู้ดูแลระบบ",
88
+ "errorUid": "ไม่สามารถรับ UID ลองอีกครั้ง !",
89
+ "encAppstate": "การเข้ารหัส AppState สำเร็จ !"
90
+ }
91
+ },
92
+ "jp": {
93
+ "index": {
94
+ "uptime": "URL のサーバー稼働時間への接続が完了しました: ",
95
+ "erroUptime": "稼働時間サーバーに問題があり、稼働時間をオンにできません!",
96
+ "errorLogin": "Appstate - あなたの Cookie が間違っています。新しい Cookie に置き換えるか、シークレット ブラウザに移動してからサインインしてから、もう一度お試しください!",
97
+ "checkpoint": "検出された CheckPoint - ログインできません。ログアウトしてからログインして Appstate を取得してください - Cookie !",
98
+ "loginSu": "UID でログインに成功しました: ",
99
+ "region": "アカウントの地域:",
100
+ "login": "ログインしています...",
101
+ "loginError": "パスワードまたはアカウントが間違っています!",
102
+ "errorFa": "2 つのセキュリティを使用しています!",
103
+ "okweb": "ブラウザから確認し、ログインプロセスに進みます...",
104
+ "errorEnv": "ENV ファイルの作成に失敗しました!",
105
+ "env": "ENV ファイルの作成に成功しました!",
106
+ "errorPassRandom": "ランダム パスワードの生成中にエラーが発生しました",
107
+ "appstateDec": "Appstate をデコードする準備ができていません!",
108
+ "appstate": "Appstate の復号に成功しました!",
109
+ "appstateError": "Appstate エラーです! 置き換えてください",
110
+ "oklogin": "ログインプロセスを完了してください!",
111
+ "newVersion": "公開された新しいバージョン: ",
112
+ "autoUpdate": "最新バージョンへの自動更新に進みます!",
113
+ "okUpdate": "バージョンアップ成功!",
114
+ "restart": "再起動しています...",
115
+ "errorUpdate": "エラーが発生しました",
116
+ "checkVersion": "現在使用しているバージョン: ",
117
+ "chucAdmin": "良い一日を管理者に",
118
+ "errorUid": "UID を取得できません。再試行してください!",
119
+ "encAppstate": "AppState の暗号化に成功しました!"
120
+ }
121
+ }
122
+ }
@@ -0,0 +1,34 @@
1
+ var utils = require('./../utils');
2
+ var logger = require('./../logger')
3
+ var OTP = require('totp-generator');
4
+
5
+ module.exports.getInfo = async function(id, jar, ctx, defaultFuncs) {
6
+ var AccessToken = await require("./getToken").getAccessToken(jar, ctx, defaultFuncs);
7
+ var { body:Data } = await utils.get(`https://graph.facebook.com/${id}?fields=name,first_name,email,about,birthday,gender,website,hometown,link,location, quotes,relationship_status,significant_other,username,subscribers.limite(0)&access_token=${AccessToken}`, jar, null, ctx.globalOptions);
8
+ var Format = {
9
+ id: JSON.parse(Data).id || "No data",
10
+ name: JSON.parse(Data).name || "No data",
11
+ first_name: JSON.parse(Data).first_name || "No data",
12
+ username: JSON.parse(Data).username || "No data",
13
+ link: JSON.parse(Data).link || "No data",
14
+ verified: JSON.parse(Data).verified || "No data",
15
+ about: JSON.parse(Data).about || "No data",
16
+ avatar: `https://graph.facebook.com/${id}/picture?height=1500&width=1500&access_token=1449557605494892|aaf0a865c8bafc314ced5b7f18f3caa6` || "No data",
17
+ birthday: JSON.parse(Data).birthday || "No data",
18
+ follow: JSON.parse(Data).subscribers.summary.total_count || "No data",
19
+ gender: JSON.parse(Data).gender || "No data",
20
+ hometown: JSON.parse(Data).hometown || "No data",
21
+ email: JSON.parse(Data).email || "No data",
22
+ interested_in: JSON.parse(Data).interested_in || "No data",
23
+ location: JSON.parse(Data).location || "No data",
24
+ locale: JSON.parse(Data).locale || "No data",
25
+ relationship_status: JSON.parse(Data).relationship_status || "No data",
26
+ love: JSON.parse(Data).significant_other || "No data",
27
+ website: JSON.parse(Data).website || "No data",
28
+ quotes: JSON.parse(Data).quotes || "No data",
29
+ timezone: JSON.parse(Data).timezone || "No data",
30
+ updated_time: JSON.parse(Data).updated_time || "No data"
31
+ };
32
+ return Format;
33
+ }
34
+ //HORIZON
@@ -0,0 +1,44 @@
1
+ var utils = require('../utils');
2
+ var log = require('../logger');
3
+ var OTP = require('totp-generator');
4
+ //var FastConfig = require("./../../FastConfig");
5
+ //var { AuthString } = FastConfig
6
+
7
+ module.exports.getAccessToken = async function (jar, ctx, defaultFuncs) {
8
+ if (global.data.AccessToken) {
9
+ return global.data.AccessToken;
10
+ }
11
+ else {
12
+ var netURLS = "https://business.facebook.com/security/twofactor/reauth/enter/";
13
+ return defaultFuncs.get('https://business.facebook.com/business_locations', jar, null, ctx.globalOptions).then(async function(data) {
14
+ try {
15
+ if (/"],\["(.*?)","/.exec(/LMBootstrapper(.*?){"__m":"LMBootstrapper"}/.exec(data.body)[1])[1]) {
16
+ global.data.AccessToken = /"],\["(.*?)","/.exec(/LMBootstrapper(.*?){"__m":"LMBootstrapper"}/.exec(data.body)[1])[1];
17
+ return global.data.AccessToken;
18
+ }
19
+ }
20
+ catch (_) {
21
+ var OPTCODE = AuthString.includes(" ") ? AuthString.replace(RegExp(" ", 'g'), "") : AuthString;
22
+ var Form = {
23
+ approvals_code: OTP(String(OPTCODE)),
24
+ save_device: true,
25
+ lsd: utils.getFrom(data.body, "[\"LSD\",[],{\"token\":\"", "\"}")
26
+ }
27
+ return defaultFuncs.post(netURLS, jar, Form, ctx.globalOptions, {
28
+ referer: "https://business.facebook.com/security/twofactor/reauth/?twofac_next=https%3A%2F%2Fbusiness.facebook.com%2Fbusiness_locations&type=avoid_bypass&app_id=0&save_device=1",
29
+ }).then(async function(data) {
30
+ if (String(data.body).includes(false)) throw { Error: "Invaild OTP | FastConfig.json: AuthString" }
31
+ return defaultFuncs.get('https://business.facebook.com/business_locations', jar, null, ctx.globalOptions,{
32
+ referer: "https://business.facebook.com/security/twofactor/reauth/?twofac_next=https%3A%2F%2Fbusiness.facebook.com%2Fbusiness_locations&type=avoid_bypass&app_id=0&save_device=1",
33
+ })
34
+ .then(async function(data) {
35
+ var Access_Token = /"],\["(.*?)","/.exec(/LMBootstrapper(.*?){"__m":"LMBootstrapper"}/.exec(data.body)[1])[1];
36
+ global.data.AccessToken = Access_Token;
37
+ return Access_Token;
38
+ });
39
+ });
40
+ }
41
+ })
42
+ }
43
+ }
44
+ //HORIZON
package/logger.js ADDED
@@ -0,0 +1,15 @@
1
+ const chalk = require('chalk');
2
+ module.exports = (str, end) => {
3
+ console.log(chalk.hex(global.fca.ObjFcaConfig.mainColor || "#00FFFF").bold(`${global.fca.ObjFcaConfig.mainName || '[ FCA - ANYA ]'} > `) + str);
4
+ };
5
+ module.exports.onLogger = (str,end,ctscolor) => {
6
+ var checkbutdak = ctscolor.replace("#",'');
7
+ if (ctscolor.indexOf('#') != 1) {
8
+
9
+ console.log(chalk.hex(global.fca.ObjFcaConfig.mainColor || "#00FFFF").bold(`${global.fca.ObjFcaConfig.mainName || '[ FCA - ANYA ]'} > `) + str);
10
+ }
11
+ else if (!isNaN(checkbutdak)) {
12
+ console.log(chalk.hex(ctscolor).bold(`${global.fca.ObjFcaConfig.mainName || '[ FCA - ANYA ]'} > `) + str);
13
+ }
14
+ else console.log(chalk.hex(global.fca.ObjFcaConfig.mainColor || "#00FFFF").bold(`${global.fca.ObjFcaConfig.mainName || '[ FCA - ANYA ]'} > `) + str);
15
+ }
package/package.json CHANGED
@@ -1,6 +1,75 @@
1
1
  {
2
2
  "name": "fb-anya",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
6
- }
3
+ "version": "9.7.0",
4
+ "description": "labyou",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "mocha",
8
+ "lint": "./node_modules/.bin/eslint **.js",
9
+ "prettier": "prettier utils.js src/* --write"
10
+ },
11
+ "author": "Avery, David, Maude, Benjamin, KanzuWakazaki",
12
+ "license": "MIT",
13
+ "bugs": {
14
+ "url": "https://github.com/ChoruTiktokers182/fb-anya/issues"
15
+ },
16
+ "homepage": "https://github.com/ChoruTiktokers182/fb-anya#readme",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/ChoruTiktokers182/fca-anjelo.git"
20
+ },
21
+ "dependencies": {
22
+ "aes-js": "^3.1.2",
23
+ "axios": "^1.2.1",
24
+ "bluebird": "^2.11.0",
25
+ "cheerio": "^1.0.0-rc.10",
26
+ "dotenv": "^16.0.3",
27
+ "fs-extra": "^11.1.0",
28
+ "https-proxy-agent": "^4.0.0",
29
+ "mqtt": "^4.2.8",
30
+ "npmlog": "^1.2.0",
31
+ "request": "^2.53.0",
32
+ "semver": "",
33
+ "websocket-stream": "^5.5.0"
34
+ },
35
+ "engines": {
36
+ "node": ">=14.x <16.x"
37
+ },
38
+ "devDependencies": {
39
+ "eslint": "latest",
40
+ "mocha": "latest",
41
+ "prettier": "latest"
42
+ },
43
+ "eslintConfig": {
44
+ "env": {
45
+ "es6": true,
46
+ "node": true
47
+ },
48
+ "extends": "eslint:recommended",
49
+ "parserOptions": {
50
+ "sourceType": "module"
51
+ },
52
+ "rules": {
53
+ "linebreak-style": [
54
+ "error",
55
+ "unix"
56
+ ],
57
+ "semi": [
58
+ "error",
59
+ "always"
60
+ ],
61
+ "no-unused-vars": [
62
+ 1,
63
+ {
64
+ "argsIgnorePattern": "^_"
65
+ }
66
+ ]
67
+ }
68
+ },
69
+ "keywords": [
70
+ "Fb anya",
71
+ "fb-Anya",
72
+ "anya",
73
+ "Anya"
74
+ ]
75
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return function ReportV1(args,callback) {
8
+ if (!args.Link && !args.RealName && !args.Content && !args.Gmail) throw new Error("Link,RealName,Content,Gmail are required");
9
+ if (!args.Link) throw new Error("Điền args.Link vào, api.Premium.ReportV1(Link,RealName,Content,Gmail,Time,callback)");
10
+ if (!args.RealName) throw new Error("Điền RealName vào, api.Premium.ReportV1(Link,RealName,Content,Time,Gmail,callback)");
11
+ if (!args.Gmail) throw new Error("Điền Gmail vào, api.Premium.ReportV1(Link,RealName,Content,Gmail,Time,callback)");
12
+ var resolveFunc = function () { };
13
+ var rejectFunc = function () { };
14
+ var returnPromise = new Promise(function (resolve, reject) {
15
+ resolveFunc = resolve;
16
+ rejectFunc = reject;
17
+ });
18
+
19
+ if (!callback) {
20
+ callback = function (err, data) {
21
+ if (err) return rejectFunc(err);
22
+ resolveFunc(data);
23
+ };
24
+ }
25
+ let RealForm;
26
+ utils.get('https://www.facebook.com/help/contact/209046679279097?locale2=en_US', ctx.jar, null, ctx.globalOptions)
27
+ .then(function(data) {
28
+ RealForm = {
29
+ crt_url: args.Link,
30
+ crt_name: args.RealName,
31
+ cf_age: "9 years",
32
+ Field255260417881843: args.Content ? utils.getType(args.Content)=="String"? args.Content : "This timeline is impersonating me and my friends. It harass people on Facebook. I think this is a time line of baby, parents are not allowed. Please let Facebook account deactivated for Facebook is increasingly safer. Thank you!" : "This timeline is impersonating me and my friends. It harass people on Facebook. I think this is a time line of baby, parents are not allowed. Please let Facebook account deactivated for Facebook is increasingly safer. Thank you!",
33
+ Field166040066844792: args.Gmail,
34
+ source: '',
35
+ support_form_id: 209046679279097,
36
+ support_form_hidden_fields: JSON.stringify({}),
37
+ support_form_fact_false_fields: [],
38
+ lsd: utils.getFrom(data.body, "[\"LSD\",[],{\"token\":\"", "\"}")
39
+ };
40
+ }).then(function() {
41
+ defaultFuncs.postFormData('https://www.facebook.com/ajax/help/contact/submit/page', ctx.jar, RealForm, {})
42
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
43
+ .then(async function(dt) {
44
+ if (dt.__ar == 1) {
45
+ callback(null, "Thành Công");
46
+ }
47
+ else {
48
+ callback(null, "Thất Bại");
49
+ }
50
+ });
51
+ })
52
+ return returnPromise;
53
+ }
54
+ };
55
+ //HORIZON
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ const utils = require("../utils");
4
+
5
+ module.exports = function (defaultFuncs, api, ctx) {
6
+ return function addExternalModule(moduleObj) {
7
+ if (utils.getType(moduleObj) == "Object") {
8
+ for (let apiName in moduleObj) {
9
+ if (utils.getType(moduleObj[apiName]) == "Function") api[apiName] = moduleObj[apiName](defaultFuncs, api, ctx);
10
+ else throw new Error(`Item "${apiName}" in moduleObj must be a function, not ${utils.getType(moduleObj[apiName])}!`);
11
+
12
+ }
13
+ }
14
+ else throw new Error(`moduleObj must be an object, not ${utils.getType(moduleObj)}!`);
15
+ };
16
+ };
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return function addUserToGroup(userID, threadID, callback) {
8
+ var resolveFunc = function () { };
9
+ var rejectFunc = function () { };
10
+ var returnPromise = new Promise(function (resolve, reject) {
11
+ resolveFunc = resolve;
12
+ rejectFunc = reject;
13
+ });
14
+
15
+ if (!callback && (utils.getType(threadID) === "Function" || utils.getType(threadID) === "AsyncFunction")) throw { error: "please pass a threadID as a second argument." };
16
+
17
+ if (!callback) {
18
+ callback = function (err) {
19
+ if (err) return rejectFunc(err);
20
+ resolveFunc();
21
+ };
22
+ }
23
+
24
+ if (utils.getType(threadID) !== "Number" && utils.getType(threadID) !== "String") throw { error: "ThreadID should be of type Number or String and not " + utils.getType(threadID) + "." };
25
+
26
+ if (utils.getType(userID) !== "Array") userID = [userID];
27
+
28
+ var messageAndOTID = utils.generateOfflineThreadingID();
29
+ var form = {
30
+ client: "mercury",
31
+ action_type: "ma-type:log-message",
32
+ author: "fbid:" + ctx.userID,
33
+ thread_id: "",
34
+ timestamp: Date.now(),
35
+ timestamp_absolute: "Today",
36
+ timestamp_relative: utils.generateTimestampRelative(),
37
+ timestamp_time_passed: "0",
38
+ is_unread: false,
39
+ is_cleared: false,
40
+ is_forward: false,
41
+ is_filtered_content: false,
42
+ is_filtered_content_bh: false,
43
+ is_filtered_content_account: false,
44
+ is_spoof_warning: false,
45
+ source: "source:chat:web",
46
+ "source_tags[0]": "source:chat",
47
+ log_message_type: "log:subscribe",
48
+ status: "0",
49
+ offline_threading_id: messageAndOTID,
50
+ message_id: messageAndOTID,
51
+ threading_id: utils.generateThreadingID(ctx.clientID),
52
+ manual_retry_cnt: "0",
53
+ thread_fbid: threadID
54
+ };
55
+
56
+ for (var i = 0; i < userID.length; i++) {
57
+ if (utils.getType(userID[i]) !== "Number" && utils.getType(userID[i]) !== "String") throw { error: "Elements of userID should be of type Number or String and not " + utils.getType(userID[i]) + "." };
58
+ form["log_message_data[added_participants][" + i + "]"] = "fbid:" + userID[i];
59
+ }
60
+
61
+ defaultFuncs
62
+ .post("https://www.facebook.com/messaging/send/", ctx.jar, form)
63
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
64
+ .then(function (resData) {
65
+ if (!resData) throw { error: "Add to group failed." };
66
+ if (resData.error) throw resData;
67
+
68
+
69
+ return callback();
70
+ })
71
+ .catch(function (err) {
72
+ log.error("addUserToGroup", err);
73
+ return callback(err);
74
+ });
75
+
76
+ return returnPromise;
77
+ };
78
+ };
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ const utils = require("../utils");
4
+ const log = require("npmlog");
5
+
6
+ module.exports = function(defaultFuncs, api, ctx) {
7
+ return function changeAdminStatus(threadID, adminIDs, adminStatus, callback) {
8
+ if (utils.getType(threadID) !== "String") {
9
+ throw {error: "changeAdminStatus: threadID must be a string"};
10
+ }
11
+
12
+ if (utils.getType(adminIDs) === "String") {
13
+ adminIDs = [adminIDs];
14
+ }
15
+
16
+ if (utils.getType(adminIDs) !== "Array") {
17
+ throw {error: "changeAdminStatus: adminIDs must be an array or string"};
18
+ }
19
+
20
+ if (utils.getType(adminStatus) !== "Boolean") {
21
+ throw {error: "changeAdminStatus: adminStatus must be a string"};
22
+ }
23
+
24
+ var resolveFunc = function(){};
25
+ var rejectFunc = function(){};
26
+ var returnPromise = new Promise(function (resolve, reject) {
27
+ resolveFunc = resolve;
28
+ rejectFunc = reject;
29
+ });
30
+
31
+ if (!callback) {
32
+ callback = function (err) {
33
+ if (err) {
34
+ return rejectFunc(err);
35
+ }
36
+ resolveFunc();
37
+ };
38
+ }
39
+
40
+ if (utils.getType(callback) !== "Function" && utils.getType(callback) !== "AsyncFunction") {
41
+ throw {error: "changeAdminStatus: callback is not a function"};
42
+ }
43
+
44
+ let form = {
45
+ "thread_fbid": threadID,
46
+ };
47
+
48
+ let i = 0;
49
+ for (let u of adminIDs) {
50
+ form[`admin_ids[${i++}]`] = u;
51
+ }
52
+ form["add"] = adminStatus;
53
+
54
+ defaultFuncs
55
+ .post("https://www.facebook.com/messaging/save_admins/?dpr=1", ctx.jar, form)
56
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
57
+ .then(function(resData) {
58
+ if (resData.error) {
59
+ switch (resData.error) {
60
+ case 1976004:
61
+ throw { error: "Cannot alter admin status: you are not an admin.", rawResponse: resData };
62
+ case 1357031:
63
+ throw { error: "Cannot alter admin status: this thread is not a group chat.", rawResponse: resData };
64
+ default:
65
+ throw { error: "Cannot alter admin status: unknown error.", rawResponse: resData };
66
+ }
67
+ }
68
+
69
+ callback();
70
+ })
71
+ .catch(function(err) {
72
+ log.error("changeAdminStatus", err);
73
+ return callback(err);
74
+ });
75
+
76
+ return returnPromise;
77
+ };
78
+ };
79
+
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return function changeArchivedStatus(threadOrThreads, archive, callback) {
8
+ var resolveFunc = function () { };
9
+ var rejectFunc = function () { };
10
+ var returnPromise = new Promise(function (resolve, reject) {
11
+ resolveFunc = resolve;
12
+ rejectFunc = reject;
13
+ });
14
+
15
+ if (!callback) {
16
+ callback = function (err) {
17
+ if (err) return rejectFunc(err);
18
+ resolveFunc();
19
+ };
20
+ }
21
+
22
+ var form = {};
23
+
24
+ if (utils.getType(threadOrThreads) === "Array") for (var i = 0; i < threadOrThreads.length; i++) form["ids[" + threadOrThreads[i] + "]"] = archive;
25
+ else form["ids[" + threadOrThreads + "]"] = archive;
26
+
27
+ defaultFuncs
28
+ .post("https://www.facebook.com/ajax/mercury/change_archived_status.php", ctx.jar, form)
29
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
30
+ .then(function (resData) {
31
+ if (resData.error) throw resData;
32
+ return callback();
33
+ })
34
+ .catch(function (err) {
35
+ log.error("changeArchivedStatus", err);
36
+ return callback(err);
37
+ });
38
+
39
+ return returnPromise;
40
+ };
41
+ };
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+ /**
6
+ * It posts an image to a Facebook profile
7
+ * @param Api - The API object
8
+ * @param BotID - The ID of the bot you want to post the image to.
9
+ * @param form - The form data that you want to send.
10
+ * @returns The JSON.parse(Data.split("for (;;);")[1]); is returning the following:
11
+ * {"__ar":1,"payload":null,"jsmods":{"require":[["ImageUploader","uploadPhoto",[{"__m":"__elem_0"},{"__m":"__elem_1"},{"__m":"__elem_2"},{"__m":"__
12
+ */
13
+ async function postImage(Api,BotID,form) {
14
+ var Data = await Api.httpPostFormData(`https://www.facebook.com/profile/picture/upload/?profile_id=${BotID}&photo_source=57&av=${BotID}`, form);
15
+ return JSON.parse(Data.split("for (;;);")[1]);
16
+ }
17
+
18
+ module.exports = function(defaultFuncs, api, ctx) {
19
+ /* Changing the profile picture of the bot. */
20
+ return function changeAvt(link, caption, callback) {
21
+ var resolveFunc = function() {};
22
+ var rejectFunc = function() {};
23
+ var returnPromise = new Promise(function(resolve, reject) {
24
+ resolveFunc = resolve;
25
+ rejectFunc = reject;
26
+ });
27
+
28
+ if (!callback) {
29
+ callback = function(err, data) {
30
+ if (err) return rejectFunc(err);
31
+ resolveFunc(data);
32
+ };
33
+ }
34
+ try {
35
+ var Fetch = require('axios')
36
+ Fetch.get(link, { responseType: "stream" }).then(data => {
37
+ postImage(api, ctx.userID, { file: data.data }).then(data => {
38
+ if (data.error) throw new Error({ error: data.error, des: data.error.errorDescription });
39
+ var form = {
40
+ av: ctx.userID,
41
+ fb_api_req_friendly_name: "ProfileCometProfilePictureSetMutation",
42
+ fb_api_caller_class: "RelayModern",
43
+ doc_id: "5066134240065849",
44
+ variables: JSON.stringify({
45
+ input: {
46
+ caption: (caption || ""),
47
+ existing_photo_id: data.payload.fbid,
48
+ expiration_time: null,
49
+ profile_id: ctx.userID,
50
+ profile_pic_method: "EXISTING",
51
+ profile_pic_source: "TIMELINE",
52
+ scaled_crop_rect: {
53
+ height: 1,
54
+ width: 1,
55
+ x: 0,
56
+ y: 0
57
+ },
58
+ skip_cropping: true,
59
+ actor_id: ctx.userID,
60
+ client_mutation_id: Math.round(Math.random() * 19).toString()
61
+ },
62
+ isPage: false,
63
+ isProfile: true,
64
+ scale: 3,
65
+ })
66
+ };
67
+ defaultFuncs
68
+ .post("https://www.facebook.com/api/graphql/", ctx.jar, form)
69
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
70
+ .then(function(resData) {
71
+ if (resData.error) throw resData;
72
+ else return callback(null,true)
73
+ })
74
+ .catch(function(err) {
75
+ return callback(err);
76
+ });
77
+ })
78
+ })
79
+ }
80
+ catch (e) {
81
+ throw e;
82
+ }
83
+ return returnPromise;
84
+ };
85
+ };
86
+ //HORIZON