fca-horidai-remastered 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
package/CountTime.json ADDED
@@ -0,0 +1 @@
1
+ 3528441.946147631
@@ -0,0 +1,49 @@
1
+ class APILoadBalancer {
2
+ constructor(Api1,Api2 ,preferredRatio = 0.85, forceType2) {
3
+ this.Api1 = Api1;
4
+ this.Api2 = Api2;
5
+ this.preferredRatio = preferredRatio;
6
+ this.totalRequests = 0;
7
+ this.api2Requests = 0;
8
+ }
9
+
10
+ async makeRequest(requestData) {
11
+ try {
12
+ this.totalRequests++;
13
+ const currentRatio = this.api2Requests / this.totalRequests;
14
+
15
+ if (currentRatio < this.preferredRatio) {
16
+ this.api2Requests++;
17
+ return await this.Api2(...requestData)
18
+ } else {
19
+ return await this.Api1(...requestData);
20
+ }
21
+ } catch (error) {
22
+ return await this.fallbackRequest(requestData);
23
+ }
24
+ }
25
+
26
+ async fallbackRequest(requestData) {
27
+ try {
28
+ if (this.api2Requests / this.totalRequests >= this.preferredRatio) {
29
+ this.api2Requests++;
30
+ return await this.Api2(...requestData);
31
+ } else {
32
+ return await this.Api1(...requestData);
33
+ }
34
+ } catch (error) {
35
+ throw new Error('Balancer Error, contact fb.com/Lazic.Kanzu');
36
+ }
37
+ }
38
+
39
+ getStats() {
40
+ return {
41
+ totalRequests: this.totalRequests,
42
+ api2Requests: this.api2Requests,
43
+ api1Requests: this.totalRequests - this.api2Requests,
44
+ currentRatio: (this.api2Requests / this.totalRequests) * 100
45
+ };
46
+ }
47
+ }
48
+
49
+ module.exports = APILoadBalancer;
@@ -79,7 +79,7 @@ class MemoryManager extends EventEmitter {
79
79
  //global.Fca.Require.logger.Info(logMessage);
80
80
  break;
81
81
  case 'warn':
82
- //global.Fca.Require.logger.Normal(logMessage);
82
+ //global.Fca.Require.logger.Normal(logMessage);
83
83
  break;
84
84
  case 'error':
85
85
  //global.Fca.Require.logger.Error(logMessage);
@@ -6,9 +6,9 @@
6
6
  "ErrAppState": "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
7
  "CheckPointLevelI": "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
8
  "UID": "Đăng Nhập Tại ID: %1",
9
- "Area": "Vùng Của Tài Khoản Là: %1",
9
+ "Area": "Chào Mừng Bạn Đến Với Server: %1",
10
10
  "NoAreaData": "Không Thể Lấy Vùng Của Tài Khoản!",
11
- "NoAreaDataBypass": "Không thể lấy vùng của tài khoản nhưng fca đã bypass😔",
11
+ "NoAreaDataBypass": "Không thể lấy vùng của tài khoản nhưng đã bỏ qua bước đó 🐑",
12
12
  "OnLogin": "Đang Đăng Nhập ...",
13
13
  "InvaildAccount": "Sai Mật Khẩu Hoặc Tài Khoản !",
14
14
  "TwoAuth": "Bạn Đang Bật 2 Bảo Mật !",
@@ -82,7 +82,10 @@
82
82
  "Ws_2Fa": "Đây là mã xác thực 2 yếu tố(2FA) của bạn cho Horizon_Extension, hãy sử dụng Google Authenticator để lấy mã phòng trường hợp quên mật khẩu hoặc yêu cầu xác minh !\n\n=> Đây: %1",
83
83
  "Ws_2Fa_Check": "Hãy nhập mã 2Fa của bạn từ ứng dụng xác thực: ",
84
84
 
85
+ "2FaBypassCheckpoint": "Tài khoản bạn đang cố gắng đăng nhập qua 2FA đã bị dính 1 dạng checkpoint nào đấy, hiện tại chưa có bản fix cho checkpoint ở 2FA, hãy liên hệ đến https://www.facebook.com/Lazic.Kanzu (Nguyễn Thái Hảo) để biết chi tiết cách sửa lỗi !\n\n MÃ LỖI: %1",
86
+
85
87
  "Bypass_956": "Đang thử nghiệm coi bạn có dính checkpoint 956 hay không!",
88
+ "Bypass_AutoNoti": "Đã vượt qua cảnh báo hành vi thành công!",
86
89
 
87
90
  "WishMessage": [
88
91
  "Chúc Bạn Một Ngày Tốt Lành Nhé !",
@@ -117,9 +120,9 @@
117
120
  "ErrAppState": "Appstate - Your Cookie Is Wrong, Please Replace It, Or Go To Incognito Browser Then Sign In And Try Again !",
118
121
  "CheckPointLevelI": "CheckPoint Detected - Can't Login, Try Logout Then Login And Retrieve Appstate - Cookie !",
119
122
  "UID": "Login as ID: %1",
120
- "Area": "Area Of Account Is: %1",
123
+ "Area": "Welcome To Server: %1",
121
124
  "NoAreaData": "Can't Get Area Of Account !",
122
- "NoAreaDataBypass": "Can't get the area of the account but fca bypass 😔",
125
+ "NoAreaDataBypass": "Can't get account area but fca ignores it 🐑",
123
126
  "OnLogin": "Currently logged ...",
124
127
  "InvaildAccount": "Wrong Password Or Account !",
125
128
  "TwoAuth": "You Currently On 2 Factor Security !",
@@ -185,6 +188,8 @@
185
188
  "EVMChange": "Changing replit.nix to support node v14!",
186
189
  "EVMChangeSuccess": "Successfully changed replit.nix, go ahead and restart!",
187
190
 
191
+ "2FaBypassCheckpoint": "The account you are trying to log in to with 2FA has encountered a checkpoint error. There is currently no fix for 2FA checkpoints. Please contact https://www.facebook.com/Lazic.Kanzu (Nguyễn Thái Hảo) for detailed troubleshooting instructions.\n\n ERROR CODE: %1",
192
+
188
193
  "Ws_TypeUserName": "Please enter a username for your websocket extension account: ",
189
194
  "Ws_TypePassWord": "Please enter a password for your websocket extension account: ",
190
195
  "Ws_Success": "Successfully set data for websocket extension!",
@@ -192,6 +197,7 @@
192
197
  "Ws_2Fa_Check": "Please enter your 2FA code from the authentication app: ",
193
198
 
194
199
  "Bypass_956": "Testing to see if you get checkpoint 956 or not!",
200
+ "Bypass_AutoNoti": "Successfully passed the behavior warning!",
195
201
 
196
202
  "WishMessage": [
197
203
  "Have a Nice Day !",
package/Main.js CHANGED
@@ -244,6 +244,89 @@ function setOptions(globalOptions, options) {
244
244
  });
245
245
  }
246
246
 
247
+ function BypassAutomationNotification(resp, jar, globalOptions, appstate,ID) {
248
+ global.Fca.BypassAutomationNotification = BypassAutomationNotification
249
+ try {
250
+ let UID;
251
+ if (ID) UID = ID
252
+ else {
253
+ UID = (appstate.find(i => i.key == 'c_user') || appstate.find(i => i.key == 'i_user'))
254
+ UID = UID.value;
255
+ }
256
+ if (resp !== undefined) {
257
+ if (resp.request.uri && resp.request.uri.href.includes("https://www.facebook.com/checkpoint/")) {
258
+ if (resp.request.uri.href.includes('601051028565049')) {
259
+ const fb_dtsg = utils.getFrom(resp.body, '["DTSGInitData",[],{"token":"', '","');
260
+ const jazoest = utils.getFrom(resp.body, 'jazoest=', '",');
261
+ const lsd = utils.getFrom(resp.body, "[\"LSD\",[],{\"token\":\"", "\"}");
262
+
263
+ const FormBypass = {
264
+ av: UID,
265
+ fb_dtsg, jazoest, lsd,
266
+ fb_api_caller_class: "RelayModern",
267
+ fb_api_req_friendly_name: "FBScrapingWarningMutation",
268
+ variables: JSON.stringify({}),
269
+ server_timestamps: true,
270
+ doc_id: 6339492849481770
271
+ }
272
+ return utils.post("https://www.facebook.com/api/graphql/", jar, FormBypass, globalOptions)
273
+ .then(utils.saveCookies(jar)).then(function(res) {
274
+ global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.Bypass_AutoNoti);
275
+ return process.exit(1);
276
+ });
277
+ }
278
+ else {
279
+ return resp;
280
+ }
281
+ }
282
+ else {
283
+ return resp
284
+ }
285
+ }
286
+ else {
287
+ return utils.get('https://www.facebook.com/', jar, null, globalOptions).then(function(res) {
288
+ if (res.request.uri && res.request.uri.href.includes("https://www.facebook.com/checkpoint/")) {
289
+ if (res.request.uri.href.includes('601051028565049')) return { Status: true, Body: res.body }
290
+ else return { Status: false, Body: res.body }
291
+ }
292
+ else return { Status: false, Body: res.body }
293
+ }).then(function(res) {
294
+ if (res.Status === true) {
295
+ const fb_dtsg = utils.getFrom(res.Body, '["DTSGInitData",[],{"token":"', '","');
296
+ const jazoest = utils.getFrom(res.Body, 'jazoest=', '",');
297
+ const lsd = utils.getFrom(res.Body, "[\"LSD\",[],{\"token\":\"", "\"}");
298
+
299
+ const FormBypass = {
300
+ av: UID,
301
+ fb_dtsg, jazoest, lsd,
302
+ fb_api_caller_class: "RelayModern",
303
+ fb_api_req_friendly_name: "FBScrapingWarningMutation",
304
+ variables: JSON.stringify({}),
305
+ server_timestamps: true,
306
+ doc_id: 6339492849481770
307
+ }
308
+ return utils.post("https://www.facebook.com/api/graphql/", jar, FormBypass, globalOptions).then(utils.saveCookies(jar))
309
+ .then(res => {
310
+ global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.Bypass_AutoNoti);
311
+ return res
312
+ })
313
+ }
314
+ else return res;
315
+
316
+ })
317
+ .then(function(res) {
318
+ return utils.get('https://www.facebook.com/', jar, null, globalOptions, { noRef: true }).then(utils.saveCookies(jar))
319
+ })
320
+ .then(function(res) {
321
+ return process.exit(1)
322
+ })
323
+ }
324
+ }
325
+ catch (e) {
326
+ console.log(e)
327
+ }
328
+ }
329
+
247
330
  //-[ Function BuildAPI ]-!/
248
331
 
249
332
  /**
@@ -298,16 +381,16 @@ function buildAPI(globalOptions, html, jar, bypass_region) {
298
381
 
299
382
  // tổng hợp danh sách region never die của Kanzu =))
300
383
  /**
301
- * PRN = Paris (France)
302
- * VLL (Virginia Low Latency)
303
- * ATN (Ashburn)
304
- * SIN = Singapore
305
- * HKG = Hong Kong
306
- * TPE = Taipei (Taiwan)
307
- * ICN = Seoul (South Korea)
384
+ * PRN = Pacific Northwest Region (Khu vực Tây Bắc Thái Bình Dương)
385
+ * VLL = Valley Region
386
+ * ASH = Ashburn Region
387
+ * DFW = Dallas/Fort Worth Region
388
+ * LLA = Los Angeles Region
389
+ * FRA = Frankfurt
390
+ * SIN = Singapore
308
391
  * NRT = Tokyo (Japan)
309
- * BOM = Mumbai (India)
310
- * TPE = Taipei (Taiwan)
392
+ * HKG = Hong Kong
393
+ * SYD = Sydney
311
394
  */
312
395
 
313
396
  let Slot = Object.keys(CHECK_MQTT);
@@ -337,12 +420,74 @@ function buildAPI(globalOptions, html, jar, bypass_region) {
337
420
  }
338
421
  });
339
422
 
423
+ const regions = [
424
+ {
425
+ code: "PRN",
426
+ name: "Pacific Northwest Region",
427
+ location: "Khu vực Tây Bắc Thái Bình Dương"
428
+ },
429
+ {
430
+ code: "VLL",
431
+ name: "Valley Region",
432
+ location: "Valley"
433
+ },
434
+ {
435
+ code: "ASH",
436
+ name: "Ashburn Region",
437
+ location: "Ashburn"
438
+ },
439
+ {
440
+ code: "DFW",
441
+ name: "Dallas/Fort Worth Region",
442
+ location: "Dallas/Fort Worth"
443
+ },
444
+ {
445
+ code: "LLA",
446
+ name: "Los Angeles Region",
447
+ location: "Los Angeles"
448
+ },
449
+ {
450
+ code: "FRA",
451
+ name: "Frankfurt",
452
+ location: "Frankfurt"
453
+ },
454
+ {
455
+ code: "SIN",
456
+ name: "Singapore",
457
+ location: "Singapore"
458
+ },
459
+ {
460
+ code: "NRT",
461
+ name: "Tokyo",
462
+ location: "Japan"
463
+ },
464
+ {
465
+ code: "HKG",
466
+ name: "Hong Kong",
467
+ location: "Hong Kong"
468
+ },
469
+ {
470
+ code: "SYD",
471
+ name: "Sydney",
472
+ location: "Sydney"
473
+ },
474
+ {
475
+ code: "PNB",
476
+ name: "Pacific Northwest - Beta",
477
+ location: "Pacific Northwest "
478
+ }
479
+ ];
480
+
340
481
  if (!region) {
341
- region = ['prn',"TPE","atn","hkg","sin"][Math.random()*5|0];
482
+ region = ['prn',"pnb","vll","hkg","sin"][Math.random()*5|0];
483
+
342
484
  }
343
485
  if (!mqttEndpoint) {
344
486
  mqttEndpoint = "wss://edge-chat.facebook.com/chat?region=" + region;
345
487
  }
488
+
489
+ const Location = regions.find(r => r.code === region.toUpperCase());
490
+ logger.Normal(getText(Language.Area,(Location == undefined ? region.toUpperCase() : Location.name)));
346
491
 
347
492
  var ctx = {
348
493
  userID: userID,
@@ -386,7 +531,6 @@ function buildAPI(globalOptions, html, jar, bypass_region) {
386
531
  api.postFormData = function(url, body) {
387
532
  return defaultFuncs.postFormData(url, ctx.jar, body);
388
533
  };
389
-
390
534
  fs.readdirSync(__dirname + "/src").filter((/** @type {string} */File) => File.endsWith(".js") && !File.includes('Dev_')).map((/** @type {string} */File) => {
391
535
  if (File == 'getThreadInfo.js' && global.Fca.Require.FastConfig.AntiGetInfo.AntiGetThreadInfo != true || File == 'getUserInfo.js' && global.Fca.Require.FastConfig.AntiGetInfo.AntiGetUserInfo != true) api[File.split('.').slice(0, -1).join('.')] = require('./src/' + (File.includes('getThreadInfo') ? 'getThreadMain.js' : 'getUserInfoMain.js'))(defaultFuncs, api, ctx)
392
536
  else api[File.split('.').slice(0, -1).join('.')] = require('./src/' + File)(defaultFuncs, api, ctx)
@@ -971,7 +1115,7 @@ try {
971
1115
 
972
1116
  else {
973
1117
  mainPromise = utils
974
- .get("https://www.facebook.com/", null, null, globalOptions, { noRef: true })
1118
+ .get("https://www.facebook.com/Lazic.Kanzu", null, null, globalOptions, { noRef: true }) // for fixing
975
1119
  .then(utils.saveCookies(jar))
976
1120
  .then(makeLogin(jar, email, password, globalOptions, callback, prCallback))
977
1121
  .then(function() {
@@ -983,103 +1127,103 @@ try {
983
1127
  }
984
1128
 
985
1129
  function CheckAndFixErr(res, fastSwitch) {
1130
+ if (fastSwitch) return res;
1131
+ let reg_antierr = /7431627028261359627/gs; // =))))))
1132
+ if (reg_antierr.test(res.body)) {
1133
+ const Data = JSON.stringify(res.body);
1134
+ const Dt_Check = Data.split('2Fhome.php&amp;gfid=')[1];
1135
+ if (Dt_Check == undefined) return res
1136
+ const fid = Dt_Check.split("\\\\")[0];//fix sau
1137
+ if (Dt_Check == undefined || Dt_Check == "") return res
1138
+ const final_fid = fid.split(`\\`)[0];
1139
+ if (final_fid == undefined || final_fid == '') return res;
1140
+ const redirectlink = redirect[1] + "a/preferences.php?basic_site_devices=m_basic&uri=" + encodeURIComponent("https://m.facebook.com/home.php") + "&gfid=" + final_fid;
1141
+ bypass_region_err = true;
1142
+ return utils.get(redirectlink, jar, null, globalOptions).then(utils.saveCookies(jar));
1143
+ }
1144
+ else return res
1145
+ }
1146
+
1147
+ function Redirect(res,fastSwitch) {
1148
+ if (fastSwitch) return res;
1149
+ var reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/;
1150
+ redirect = reg.exec(res.body);
1151
+ if (redirect && redirect[1]) return utils.get(redirect[1], jar, null, globalOptions)
1152
+ return res;
1153
+ }
1154
+
1155
+ let redirect = [1, "https://m.facebook.com/"];
1156
+ let bypass_region_err = false;
1157
+ var ctx,api;
1158
+ mainPromise = mainPromise
1159
+ .then(res => Redirect(res))
1160
+ .then(res => CheckAndFixErr(res))
1161
+ //fix via login with defaut UA return WWW.facebook.com not m.facebook.com
1162
+ .then(function(res) {
1163
+ if (global.OnAutoLoginProcess) return res;
1164
+ else {
1165
+ let Regex_Via = /MPageLoadClientMetrics/gs; //default for normal account, can easily get region, without this u can't get region in some case but u can run normal
1166
+ if (!Regex_Via.test(res.body)) {
1167
+ //www.facebook.com
1168
+ globalOptions.userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.2849.68";
1169
+ return utils.get('https://www.facebook.com/', jar, null, globalOptions, { noRef: true })
1170
+ }
1171
+ else return res
1172
+ }
1173
+ })
1174
+ .then(res => BypassAutomationNotification(res, jar, globalOptions, appState))
1175
+ .then(res => Redirect(res, global.OnAutoLoginProcess))
1176
+ .then(res => CheckAndFixErr(res, global.OnAutoLoginProcess))
1177
+ // .then(res => {
1178
+ // return utils.get('https://www.facebook.com/', jar, null, globalOptions, {}).then(utils.saveCookies(jar));
1179
+ // })
1180
+ // .then(function(res) {
1181
+ // let reg_old_web = /Switch Default Site/gs;
1182
+ // if (reg_old_web.test(res.body)) {
1183
+ // let Data_Resp = JSON.stringify(res.body);
1184
+ // const link = Data_Resp.split('settings/site')[1].split("\"")[0].replace('\\', '')
1185
+ // const redirect_link2 = redirect[1] + "settings/site" + utils.cleanHTML(link)
1186
+ // console.log(redirect_link2)
1187
+ // return utils.get("https://www.facebook.com/", jar, null, globalOptions).then(utils.saveCookies(jar)); // try ag
1188
+ // }
1189
+ // else return res;
1190
+ // })
1191
+ // .then(function(res) {
1192
+ // var reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/;
1193
+ // redirect = reg.exec(res.body);
1194
+ // if (redirect && redirect[1]) return utils.get(redirect[1], jar, null, globalOptions).then(utils.saveCookies(jar));
1195
+ // return res;
1196
+ // })
1197
+ .then(function(res){
1198
+ var html = res.body,Obj = buildAPI(globalOptions, html, jar,bypass_region_err);
1199
+ ctx = Obj.ctx;
1200
+ api = Obj.api;
1201
+ return res;
1202
+ });
1203
+ if (globalOptions.pageID) {
1204
+ mainPromise = mainPromise
1205
+ .then(function() {
1206
+ return utils.get('https://www.facebook.com/' + ctx.globalOptions.pageID + '/messages/?section=messages&subsection=inbox', ctx.jar, null, globalOptions);
1207
+ })
1208
+ .then(function(resData) {
1209
+ var url = utils.getFrom(resData.body, 'window.location.replace("https:\\/\\/www.facebook.com\\', '");').split('\\').join('');
1210
+ url = url.substring(0, url.length - 1);
1211
+ return utils.get('https://www.facebook.com' + url, ctx.jar, null, globalOptions);
1212
+ });
1213
+ }
1214
+ mainPromise
1215
+ .then(async() => {
1216
+ logger.Normal(getText(Language.LocalVersion,global.Fca.Version));
1217
+ logger.Normal(getText(Language.CountTime,global.Fca.Data.CountTime()))
1218
+ logger.Normal(Language.WishMessage[Math.floor(Math.random()*Language.WishMessage.length)]);
1219
+ require('./Extra/ExtraUptimeRobot')();
1220
+ callback(null, api);
1221
+ }).catch(function(/** @type {{ error: any; }} */e) {
1222
+ log.error("login", e.error || e);
1223
+ callback(e);
1224
+ });
1225
+ }
986
1226
 
987
- if (fastSwitch) return res;
988
- let reg_antierr = /7431627028261359627/gs; // =))))))
989
- if (reg_antierr.test(res.body)) {
990
- const Data = JSON.stringify(res.body);
991
- const Dt_Check = Data.split('2Fhome.php&amp;gfid=')[1];
992
- if (Dt_Check == undefined) return res
993
- const fid = Dt_Check.split("\\\\")[0];//fix sau
994
- if (Dt_Check == undefined || Dt_Check == "") return res
995
- const final_fid = fid.split(`\\`)[0];
996
- if (final_fid == undefined || final_fid == '') return res;
997
- const redirectlink = redirect[1] + "a/preferences.php?basic_site_devices=m_basic&uri=" + encodeURIComponent("https://m.facebook.com/home.php") + "&gfid=" + final_fid;
998
- bypass_region_err = true;
999
- return utils.get(redirectlink, jar, null, globalOptions).then(utils.saveCookies(jar));
1000
- }
1001
- else return res
1002
- }
1003
-
1004
- function Redirect(res,fastSwitch) {
1005
- if (fastSwitch) return res;
1006
- var reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/;
1007
- redirect = reg.exec(res.body);
1008
- if (redirect && redirect[1]) return utils.get(redirect[1], jar, null, globalOptions)
1009
- return res;
1010
- }
1011
-
1012
- let redirect = [1, "https://m.facebook.com/"];
1013
- let bypass_region_err = false;
1014
- var ctx,api;
1015
- mainPromise = mainPromise
1016
- .then(res => Redirect(res))
1017
- .then(res => CheckAndFixErr(res))
1018
- //fix via login with defaut UA return WWW.facebook.com not m.facebook.com
1019
-
1020
- .then(function(res) {
1021
- if (global.OnAutoLoginProcess) return res;
1022
- else {
1023
- let Regex_Via = /MPageLoadClientMetrics/gs; //default for normal account, can easily get region, without this u can't get region in some case but u can run normal
1024
- if (!Regex_Via.test(res.body)) {
1025
- //www.facebook.com
1026
- globalOptions.userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.2849.68";
1027
- return utils.get('https://www.facebook.com/', jar, null, globalOptions, { noRef: true })
1028
- }
1029
- else return res
1030
- }
1031
- })
1032
- .then(res => Redirect(res, global.OnAutoLoginProcess))
1033
- .then(res => CheckAndFixErr(res, global.OnAutoLoginProcess))
1034
- // .then(res => {
1035
- // return utils.get('https://www.facebook.com/', jar, null, globalOptions, {}).then(utils.saveCookies(jar));
1036
- // })
1037
- // .then(function(res) {
1038
- // let reg_old_web = /Switch Default Site/gs;
1039
- // if (reg_old_web.test(res.body)) {
1040
- // let Data_Resp = JSON.stringify(res.body);
1041
- // const link = Data_Resp.split('settings/site')[1].split("\"")[0].replace('\\', '')
1042
- // const redirect_link2 = redirect[1] + "settings/site" + utils.cleanHTML(link)
1043
- // console.log(redirect_link2)
1044
- // return utils.get("https://www.facebook.com/", jar, null, globalOptions).then(utils.saveCookies(jar)); // try ag
1045
- // }
1046
- // else return res;
1047
- // })
1048
- // .then(function(res) {
1049
- // var reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/;
1050
- // redirect = reg.exec(res.body);
1051
- // if (redirect && redirect[1]) return utils.get(redirect[1], jar, null, globalOptions).then(utils.saveCookies(jar));
1052
- // return res;
1053
- // })
1054
- .then(function(res){
1055
- var html = res.body,Obj = buildAPI(globalOptions, html, jar,bypass_region_err);
1056
- ctx = Obj.ctx;
1057
- api = Obj.api;
1058
- return res;
1059
- });
1060
- if (globalOptions.pageID) {
1061
- mainPromise = mainPromise
1062
- .then(function() {
1063
- return utils.get('https://www.facebook.com/' + ctx.globalOptions.pageID + '/messages/?section=messages&subsection=inbox', ctx.jar, null, globalOptions);
1064
- })
1065
- .then(function(resData) {
1066
- var url = utils.getFrom(resData.body, 'window.location.replace("https:\\/\\/www.facebook.com\\', '");').split('\\').join('');
1067
- url = url.substring(0, url.length - 1);
1068
- return utils.get('https://www.facebook.com' + url, ctx.jar, null, globalOptions);
1069
- });
1070
- }
1071
- mainPromise
1072
- .then(async() => {
1073
- logger.Normal(getText(Language.LocalVersion,global.Fca.Version));
1074
- logger.Normal(getText(Language.CountTime,global.Fca.Data.CountTime()))
1075
- logger.Normal(Language.WishMessage[Math.floor(Math.random()*Language.WishMessage.length)]);
1076
- require('./Extra/ExtraUptimeRobot')();
1077
- callback(null, api);
1078
- }).catch(function(/** @type {{ error: any; }} */e) {
1079
- log.error("login", e.error || e);
1080
- callback(e);
1081
- });
1082
- }
1083
1227
 
1084
1228
  /**
1085
1229
  * It asks the user for their account and password, and then saves it to the database.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fca-horidai-remastered",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "Facebook-chat-api protect and deploy by Kanzu and HZI Team",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -20,15 +20,16 @@
20
20
  "aes-js": "latest",
21
21
  "ansi-to-html": "latest",
22
22
  "assert": "latest",
23
- "better-sqlite3": "7.6.2",
24
23
  "bluebird": "latest",
25
24
  "chalk": "4.1.2",
26
- "cheerio": "latest",
25
+ "cheerio": "1.0.0-rc.12",
27
26
  "crypto-js": "latest",
28
27
  "deasync": "^0.1.28",
29
28
  "duplexify": "^4.1.2",
29
+ "better-sqlite3": "7.6.2",
30
30
  "encode32": "latest",
31
31
  "express": "latest",
32
+ "figlet": "latest",
32
33
  "file-url": "^3.0.0",
33
34
  "got": "^11.8.6",
34
35
  "https-proxy-agent": "latest",
@@ -44,12 +45,11 @@
44
45
  "readline": "latest",
45
46
  "request": "latest",
46
47
  "speakeasy": "latest",
47
- "totp-generator": "latest",
48
+ "sqlite3": "^5.0.2",
49
+ "totp-generator": "^0.0.14",
48
50
  "tough-cookie": "^4.1.2",
49
51
  "uuid": "latest",
50
- "ws": "^8.13.0",
51
- "sqlite3": "^5.0.2",
52
- "figlet": "latest"
52
+ "ws": "^8.13.0"
53
53
  },
54
54
  "engines": {
55
55
  "node": ">=14.x"
package/src/listenMqtt.js CHANGED
@@ -135,7 +135,7 @@ function listenMqtt(defaultFuncs, api, ctx, globalCallback) {
135
135
  headers: {
136
136
  Cookie: cookies,
137
137
  Origin: 'https://www.facebook.com',
138
- 'User-Agent': ctx.globalOptions.userAgent || 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36',
138
+ 'User-Agent': ctx.globalOptions.userAgent,
139
139
  Referer: 'https://www.facebook.com/',
140
140
  Host: new URL(host).hostname,
141
141
  },
@@ -210,7 +210,7 @@ function listenMqtt(defaultFuncs, api, ctx, globalCallback) {
210
210
  warningThreshold: 0.7,
211
211
  releaseThreshold: 0.8,
212
212
  maxThreshold: 0.9,
213
- interval: 60 * 1000,
213
+ interval: 300 * 1000,
214
214
  logLevel: 'warn',
215
215
  logFile: path.join(process.cwd(), 'main/database_fca' ,'memory.log'),
216
216
  smartReleaseEnabled: true,
@@ -558,22 +558,27 @@ function parseDelta(defaultFuncs, api, ctx, globalCallback, {
558
558
  messageID: delta.deltaMessageReply.repliedToMessage.messageMetadata.messageId,
559
559
  senderID: delta.deltaMessageReply.repliedToMessage.messageMetadata.actorFbId.toString(),
560
560
  attachments: delta.deltaMessageReply.repliedToMessage.attachments
561
- .map((att) => {
562
- const mercury = JSON.parse(att.mercuryJSON);
561
+ .map((att) => {
562
+ let mercury;
563
+ try {
564
+ mercury = JSON.parse(att.mercuryJSON);
563
565
  Object.assign(att, mercury);
564
- return att;
565
- })
566
- .map((att) => {
567
- let x;
568
- try {
569
- x = utils._formatAttachment(att);
570
- } catch (ex) {
571
- x = att;
572
- x.error = ex;
573
- x.type = 'unknown';
574
- }
575
- return x;
576
- }),
566
+ } catch (ex) {
567
+ mercury = {};
568
+ }
569
+ return att;
570
+ })
571
+ .map((att) => {
572
+ let x;
573
+ try {
574
+ x = utils._formatAttachment(att);
575
+ } catch (ex) {
576
+ x = att;
577
+ x.error = ex;
578
+ x.type = 'unknown';
579
+ }
580
+ return x;
581
+ }),
577
582
  args: (delta.deltaMessageReply.repliedToMessage.body || '').trim().split(/\s+/),
578
583
  body: delta.deltaMessageReply.repliedToMessage.body || '',
579
584
  isGroup: !!delta.deltaMessageReply.repliedToMessage.messageMetadata.threadKey.threadFbId,
@@ -843,13 +848,23 @@ function markDelivery(ctx, api, threadID, messageID) {
843
848
 
844
849
  module.exports = function(defaultFuncs, api, ctx) {
845
850
  var globalCallback = identity;
851
+ var okeoke;
846
852
  getSeqID = function getSeqID() {
847
853
  ctx.t_mqttCalled = false;
848
854
  defaultFuncs
849
855
  .post("https://www.facebook.com/api/graphqlbatch/", ctx.jar, form)
856
+ .then(res => {
857
+ okeoke = res;
858
+ return res;
859
+ })
850
860
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
851
861
  .then((resData) => {
852
862
  if (utils.getType(resData) != "Array") {
863
+ if (okeoke.request.uri && okeoke.request.uri.href.includes("https://www.facebook.com/checkpoint/")) {
864
+ if (okeoke.request.uri.href.includes('601051028565049')) {
865
+ return global.Fca.BypassAutomationNotification(undefined, ctx.jar, ctx.globalOptions, undefined ,process.env.UID)
866
+ }
867
+ }
853
868
  if (global.Fca.Require.FastConfig.AutoLogin) {
854
869
  return global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.AutoLogin, function() {
855
870
  return global.Fca.Action('AutoLogin');
@@ -875,6 +890,11 @@ module.exports = function(defaultFuncs, api, ctx) {
875
890
  })
876
891
  .catch((err) => {
877
892
  log.error("getSeqId", err);
893
+ if (okeoke.request.uri && okeoke.request.uri.href.includes("https://www.facebook.com/checkpoint/")) {
894
+ if (okeoke.request.uri.href.includes('601051028565049')) {
895
+ return global.Fca.BypassAutomationNotification(undefined, ctx.jar, ctx.globalOptions, undefined ,process.env.UID)
896
+ }
897
+ }
878
898
  if (utils.getType(err) == "Object" && err.error === global.Fca.Require.Language.Index.ErrAppState) ctx.loggedIn = false;
879
899
  return globalCallback(err);
880
900
  });
@@ -1,17 +1,20 @@
1
1
  "use strict";
2
2
 
3
+ const Balancer = require('../Extra/Balancer.js');
3
4
  var utils = require("../utils");
4
5
  var log = require("npmlog");
5
6
 
6
7
  module.exports = function (defaultFuncs, api, ctx) {
7
- return function unsendMessage(messageID, callback) {
8
+ //const BalancerInstance = new Balancer(api.unsendMessage, unsendMessage, 0.85);
9
+
10
+ function unsendMessage(messageID, threadID, callback) {
8
11
  var resolveFunc = function () { };
9
12
  var rejectFunc = function () { };
10
13
  var returnPromise = new Promise(function (resolve, reject) {
11
14
  resolveFunc = resolve;
12
15
  rejectFunc = reject;
13
16
  });
14
-
17
+
15
18
  if (!callback) {
16
19
  callback = function (err, friendList) {
17
20
  if (err) return rejectFunc(err);
@@ -19,22 +22,27 @@ module.exports = function (defaultFuncs, api, ctx) {
19
22
  };
20
23
  }
21
24
 
22
- var form = {
23
- message_id: messageID
24
- };
25
-
26
- defaultFuncs
27
- .post("https://www.facebook.com/messaging/unsend_message/", ctx.jar, form)
28
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
29
- .then(function (resData) {
30
- if (resData.error) throw resData;
31
- return callback();
32
- })
33
- .catch(function (err) {
34
- log.error("unsendMessage", err);
35
- return callback(err);
36
- });
25
+ if (threadID) return api.unsendMqttMessage(threadID, messageID, callback);
26
+ else {
27
+ var form = {
28
+ message_id: messageID
29
+ };
30
+
31
+ defaultFuncs
32
+ .post("https://www.facebook.com/messaging/unsend_message/", ctx.jar, form)
33
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
34
+ .then(function (resData) {
35
+ if (resData.error) throw resData;
36
+ return callback();
37
+ })
38
+ .catch(function (err) {
39
+ log.error("unsendMessage", err);
40
+ return callback(err);
41
+ });
42
+
43
+ return returnPromise;
44
+ }
45
+ }
37
46
 
38
- return returnPromise;
39
- };
40
- };
47
+ return unsendMessage;
48
+ };
@@ -0,0 +1,66 @@
1
+ /* eslint-disable linebreak-style */
2
+ "use strict";
3
+
4
+ var utils = require("../utils");
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return function(threadID, messageID ,callback) {
8
+ var resolveFunc = function () { };
9
+ var rejectFunc = function () { };
10
+
11
+ var returnPromise = new Promise(function (resolve, reject) {
12
+ resolveFunc = resolve;
13
+ rejectFunc = reject;
14
+ });
15
+
16
+ if (!callback && utils.getType(messageID) === "AsyncFunction" || !callback && utils.getType(messageID) === "Function") messageID = callback;
17
+
18
+ if (!callback) {
19
+ callback = function (err, data) {
20
+ if (err) return rejectFunc(err);
21
+ resolveFunc(data);
22
+ };
23
+ }
24
+
25
+ const Payload = {
26
+ message_id:messageID,
27
+ thread_key:threadID,
28
+ sync_group: 1
29
+ };
30
+
31
+ if (messageID != undefined || messageID != null) Payload.reply_metadata = {
32
+ reply_source_id: messageID,
33
+ reply_source_type: 1,
34
+ reply_type: 0
35
+ };
36
+
37
+ const Form = JSON.stringify({
38
+ app_id: "2220391788200892",
39
+ payload: JSON.stringify({
40
+ tasks: [{
41
+ label: 33,
42
+ payload: JSON.stringify(Payload),
43
+ queue_name: "unsend_message",
44
+ task_id: Math.random() * 1001 << 0,
45
+ failure_count: null,
46
+ }],
47
+ epoch_id: utils.generateOfflineThreadingID(),
48
+ version_id: '9094446350588544',
49
+
50
+ }),
51
+ request_id: ++ctx.req_ID,
52
+ type: 3
53
+ });
54
+
55
+ ctx.mqttClient.publish('/ls_req', Form,{
56
+ qos: 1,
57
+ retain: false,
58
+ });
59
+ ctx.callback_Task[ctx.req_ID] = new Object({
60
+ callback,
61
+ type: "unsendMqttMessage",
62
+ });
63
+
64
+ return returnPromise;
65
+ };
66
+ };
package/utils.js CHANGED
@@ -2692,7 +2692,12 @@ function parseAndCheckLogin(ctx, defaultFuncs, retryCount) {
2692
2692
  const Check = () => new Promise((re) => {
2693
2693
  defaultFuncs.get('https://facebook.com', ctx.jar).then(function(res) {
2694
2694
  if (res.headers.location && res.headers.location.includes('https://www.facebook.com/checkpoint/')) {
2695
- if (res.headers.includes('828281030927956')) return global.Fca.Action('Bypass', ctx, "956", defaultFuncs)
2695
+ if (res.headers.location.includes('828281030927956')) return global.Fca.Action('Bypass', ctx, "956", defaultFuncs)
2696
+ else if (res.request.uri && res.request.uri.href.includes("https://www.facebook.com/checkpoint/")) {
2697
+ if (res.request.uri.href.includes('601051028565049')) {
2698
+ return global.Fca.BypassAutomationNotification(undefined, ctx.jar, ctx.globalOptions, undefined ,process.env.UID)
2699
+ }
2700
+ }
2696
2701
  else return global.Fca.Require.logger.Error(global.Fca.Require.Language.Index.ErrAppState);
2697
2702
  }
2698
2703
  else return global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.AutoLogin, function() {
@@ -2703,6 +2708,11 @@ function parseAndCheckLogin(ctx, defaultFuncs, retryCount) {
2703
2708
  await Check();
2704
2709
  });
2705
2710
  }
2711
+ if (res.request.uri && res.request.uri.href.includes("https://www.facebook.com/checkpoint/")) {
2712
+ if (res.request.uri.href.includes('601051028565049')) {
2713
+ return global.Fca.BypassAutomationNotification(undefined, ctx.jar, ctx.globalOptions, undefined ,process.env.UID)
2714
+ }
2715
+ }
2706
2716
  if (global.Fca.Require.FastConfig.AutoLogin) {
2707
2717
  return global.Fca.Require.logger.Warning(global.Fca.Require.Language.Index.AutoLogin, function() {
2708
2718
  return global.Fca.Action('AutoLogin');