meta-horizon 0.0.1-security → 1.2.4

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

Potentially problematic release.


This version of meta-horizon might be problematic. Click here for more details.

Files changed (122) hide show
  1. package/.cache/replit/__replit_disk_meta.json +1 -0
  2. package/.cache/replit/nix/env.json +1 -0
  3. package/.config/configstore/update-notifier-npm.json +4 -0
  4. package/.config/configstore/update-notifier-npm.json.1735545094 +4 -0
  5. package/.gitattributes +2 -0
  6. package/.replit +80 -0
  7. package/Extra/Database/index.js +469 -0
  8. package/Extra/ExtraAddons.js +82 -0
  9. package/Extra/ExtraFindUID.js +62 -0
  10. package/Extra/ExtraGetThread.js +340 -0
  11. package/Extra/ExtraScreenShot.js +430 -0
  12. package/Extra/ExtraUptimeRobot.js +38 -0
  13. package/Extra/Html/Classic/script.js +119 -0
  14. package/Extra/Html/Classic/style.css +8 -0
  15. package/Extra/Security/AES_256_GCM/index.js +0 -0
  16. package/Extra/Security/Base/Step_1.js +6 -0
  17. package/Extra/Security/Base/Step_2.js +22 -0
  18. package/Extra/Security/Base/Step_3.js +22 -0
  19. package/Extra/Security/Base/index.js +173 -0
  20. package/Extra/Security/Index.js +5 -0
  21. package/Extra/Security/Indexbackup.js +173 -0
  22. package/Extra/Security/Step_1.js +6 -0
  23. package/Extra/Security/Step_2.js +22 -0
  24. package/Extra/Security/Step_3.js +22 -0
  25. package/Extra/Src/Change_Environment.js +24 -0
  26. package/Extra/Src/Check_Update.js +67 -0
  27. package/Extra/Src/History.js +115 -0
  28. package/Extra/Src/Instant_Update.js +65 -0
  29. package/Extra/Src/Last-Run.js +65 -0
  30. package/Extra/Src/Premium.js +81 -0
  31. package/Extra/Src/Release_Memory.js +41 -0
  32. package/Extra/Src/Websocket.js +213 -0
  33. package/Extra/Src/image/checkmate.jpg +0 -0
  34. package/Extra/Src/uuid.js +137 -0
  35. package/Func/AcceptAgreement.js +31 -0
  36. package/Func/ClearCache.js +64 -0
  37. package/Func/ReportV1.js +54 -0
  38. package/LICENSE +21 -0
  39. package/Language/index.json +218 -0
  40. package/Main.js +1211 -0
  41. package/README.md +143 -3
  42. package/broadcast.js +41 -0
  43. package/index.js +386 -0
  44. package/logger.js +66 -0
  45. package/package.json +91 -3
  46. package/replit.nix +8 -0
  47. package/src/Dev_Horizon_Data.js +125 -0
  48. package/src/Premium.js +25 -0
  49. package/src/Screenshot.js +83 -0
  50. package/src/addExternalModule.js +16 -0
  51. package/src/addUserToGroup.js +79 -0
  52. package/src/changeAdminStatus.js +79 -0
  53. package/src/changeArchivedStatus.js +41 -0
  54. package/src/changeAvt.js +85 -0
  55. package/src/changeBio.js +65 -0
  56. package/src/changeBlockedStatus.js +36 -0
  57. package/src/changeGroupImage.js +106 -0
  58. package/src/changeNickname.js +45 -0
  59. package/src/changeThreadColor.js +62 -0
  60. package/src/changeThreadEmoji.js +42 -0
  61. package/src/createNewGroup.js +70 -0
  62. package/src/createPoll.js +60 -0
  63. package/src/deleteMessage.js +45 -0
  64. package/src/deleteThread.js +43 -0
  65. package/src/forwardAttachment.js +48 -0
  66. package/src/getAccessToken.js +28 -0
  67. package/src/getCurrentUserID.js +7 -0
  68. package/src/getEmojiUrl.js +27 -0
  69. package/src/getFriendsList.js +73 -0
  70. package/src/getMessage.js +80 -0
  71. package/src/getThreadHistory.js +537 -0
  72. package/src/getThreadInfo.js +425 -0
  73. package/src/getThreadList.js +213 -0
  74. package/src/getThreadMain.js +220 -0
  75. package/src/getThreadPictures.js +59 -0
  76. package/src/getUID.js +59 -0
  77. package/src/getUserID.js +62 -0
  78. package/src/getUserInfo.js +113 -0
  79. package/src/getUserInfoMain.js +65 -0
  80. package/src/getUserInfoV2.js +32 -0
  81. package/src/getUserInfoV3.js +63 -0
  82. package/src/getUserInfoV4.js +55 -0
  83. package/src/getUserInfoV5.js +61 -0
  84. package/src/handleFriendRequest.js +46 -0
  85. package/src/handleMessageRequest.js +49 -0
  86. package/src/httpGet.js +49 -0
  87. package/src/httpPost.js +48 -0
  88. package/src/httpPostFormData.js +41 -0
  89. package/src/listenMqtt.js +787 -0
  90. package/src/logout.js +68 -0
  91. package/src/markAsDelivered.js +48 -0
  92. package/src/markAsRead.js +70 -0
  93. package/src/markAsReadAll.js +43 -0
  94. package/src/markAsSeen.js +51 -0
  95. package/src/muteThread.js +47 -0
  96. package/src/removeUserFromGroup.js +49 -0
  97. package/src/resolvePhotoUrl.js +37 -0
  98. package/src/searchForThread.js +43 -0
  99. package/src/sendMessage.js +379 -0
  100. package/src/sendTypingIndicator.js +80 -0
  101. package/src/setMessageReaction.js +109 -0
  102. package/src/setPostReaction.js +102 -0
  103. package/src/setTitle.js +74 -0
  104. package/src/threadColors.js +39 -0
  105. package/src/unfriend.js +43 -0
  106. package/src/unsendMessage.js +40 -0
  107. package/test/Database_Test.js +4 -0
  108. package/test/Db2.js +530 -0
  109. package/test/Horizon_Database/A_README.md +1 -0
  110. package/test/Horizon_Database/Database.db +0 -0
  111. package/test/data/shareAttach.js +146 -0
  112. package/test/data/something.mov +0 -0
  113. package/test/data/test.png +0 -0
  114. package/test/data/test.txt +7 -0
  115. package/test/env/.env +0 -0
  116. package/test/example-config.json +18 -0
  117. package/test/example-db.db +0 -0
  118. package/test/memoryleak.js +18 -0
  119. package/test/test-page.js +140 -0
  120. package/test/test.js +385 -0
  121. package/test/testv2.js +18 -0
  122. package/utils.js +1683 -0
@@ -0,0 +1,65 @@
1
+ module.exports = async function() {
2
+ const got = require('got');
3
+ const log = require('npmlog');
4
+ const fs = require('fs');
5
+ const Database = require('../Database')
6
+ const { execSync } = require('child_process');
7
+ //make request https://raw.githubusercontent.com/KanzuXHorizon/Fca-Horizon-Remastered/main/package.json
8
+ const { body } = await got('https://raw.githubusercontent.com/JustKemForFun/Global_MetaHorizon/main/InstantAction.json');
9
+ const json = JSON.parse(body);
10
+ const LocalVersion = require('../../package.json').version;
11
+ if (Number(LocalVersion.replace(/\./g,"")) < Number(json.Version.replace(/\./g,"")) ) {
12
+ log.warn("[ FCA-UPDATE ] ➣","Found a command that requires downloading an important Version to avoid errors, update onions: " + LocalVersion + " -> " + json.Version);
13
+ log.warn("[ FCA-UPDATE ] ➣","Problem Description: " + json.Problem);
14
+ await new Promise(resolve => setTimeout(resolve, 3000));
15
+ try {
16
+ execSync(`npm install meta-horizon@${json.Version}`, { stdio: 'inherit' });
17
+ log.info("[ FCA-UPDATE ] ➣","Update Complete, Restarting...");
18
+ await new Promise(resolve => setTimeout(resolve, 3000));
19
+ Database(true).set("Instant_Update", Date.now(), true);
20
+ await new Promise(resolve => setTimeout(resolve, 3000));
21
+ process.exit(1);
22
+ }
23
+ catch (err) {
24
+ try {
25
+ log.warn("[ FCA-UPDATE ] ➣","Update Failed, Trying Another Method 1...");
26
+ await new Promise(resolve => setTimeout(resolve, 3000));
27
+ execSync(`npm install meta-horizon@${json.Version} --force`, { stdio: 'inherit' });
28
+ log.info("[ FCA-UPDATE ] ➣","Update Complete, Restarting...");
29
+ await new Promise(resolve => setTimeout(resolve, 3000));
30
+ Database(true).set("Instant_Update", Date.now());
31
+ await new Promise(resolve => setTimeout(resolve, 3000));
32
+ process.exit(1);
33
+ }
34
+ catch (err) {
35
+ try {
36
+ log.warn("[ FCA-UPDATE ] ➣","Update Failed, Trying to clean package cache...");
37
+ await new Promise(resolve => setTimeout(resolve, 3000));
38
+ execSync('npm cache clean --force', { stdio: 'inherit' });
39
+ log.info("[ FCA-UPDATE ] ➣","Cache Cleaned, Trying Another Method 2...");
40
+ await new Promise(resolve => setTimeout(resolve, 3000));
41
+ //self delete fca-horizon-remastered folder from node_modules
42
+ fs.rmdirSync((process.cwd() + "/node_modules/meta-horizon" || __dirname + '../../../meta-horizon'), { recursive: true });
43
+ await new Promise(resolve => setTimeout(resolve, 3000));
44
+ execSync(`npm install meta-horizon@${json.Version}`, { stdio: 'inherit' });
45
+ log.info("[ FCA-UPDATE ] ➣","Update Complete, Restarting...");
46
+ await new Promise(resolve => setTimeout(resolve, 3000));
47
+ Database(true).set("Instant_Update", Date.now());
48
+ await new Promise(resolve => setTimeout(resolve, 3000));
49
+ process.exit(1);
50
+ }
51
+ catch (e) {
52
+ console.log(e);
53
+ log.error("[ FCA-UPDATE ] ➣","Update Failed, Please Update Manually");
54
+ await new Promise(resolve => setTimeout(resolve, 3000));
55
+ log.warn("[ FCA-UPDATE ] ➣","Please contact to owner about update failed and screentshot error log at fb.com/kemsadboiz");
56
+ await new Promise(resolve => setTimeout(resolve, 3000));
57
+ process.exit(1);
58
+ }
59
+ }
60
+ }
61
+ }
62
+ else {
63
+ return Database(true).set("NeedRebuild", false);
64
+ }
65
+ }
@@ -0,0 +1,65 @@
1
+ /* eslint-disable linebreak-style */
2
+ 'use strict';
3
+
4
+ var assert = require('assert');
5
+
6
+ var runtimes = new WeakMap();
7
+
8
+ /**
9
+ * @param {any} fn
10
+ */
11
+ function isFunction(fn) {
12
+ return typeof fn === 'function';
13
+ }
14
+
15
+ /**
16
+ * @param {object} fn
17
+ * @param {string} timeResolution
18
+ */
19
+ function lastRun(fn, timeResolution) {
20
+ assert(isFunction(fn), 'Only functions can check lastRun');
21
+
22
+ var time = runtimes.get(fn);
23
+
24
+ if (time == null) {
25
+ return;
26
+ }
27
+
28
+ var resolution = parseInt(timeResolution, 10) || 1;
29
+ return time - (time % resolution);
30
+ }
31
+
32
+ /**
33
+ * @param {object} fn
34
+ * @param {number} timestamp
35
+ */
36
+ function capture(fn, timestamp) {
37
+ assert(isFunction(fn), 'Only functions can be captured');
38
+
39
+ timestamp = timestamp || Date.now();
40
+
41
+ runtimes.set(fn, timestamp);
42
+ }
43
+
44
+ /**
45
+ * @param {object} name
46
+ */
47
+ function has(name) {
48
+ return runtimes.has(name);
49
+ }
50
+
51
+ /**
52
+ * @param {object} fn
53
+ */
54
+ function release(fn) {
55
+ assert(isFunction(fn), 'Only functions can be captured');
56
+
57
+ runtimes.delete(fn);
58
+ }
59
+
60
+ module.exports = {
61
+ lastRun,
62
+ capture,
63
+ release,
64
+ has
65
+ };
@@ -0,0 +1,81 @@
1
+ module.exports = async function(SessionID) {
2
+ try {
3
+ var userName,Text;
4
+ var os = require('os');
5
+ var Database = require("../Database");
6
+ var { getAll,readyCreate,deleteAll } = require('../ExtraGetThread');
7
+ if (process.env.REPL_OWNER != undefined) userName = process.env.REPL_OWNER;
8
+ else if (os.hostname() != null || os.hostname() != undefined) userName = os.hostname();
9
+ else userName = os.userInfo().username;
10
+ if (Database(true).has('UserName')) {
11
+ if (Database(true).get('UserName') != userName) {
12
+ Database(true).set('Premium', false);
13
+ Database(true).set('PremiumKey', '');
14
+ Database(true).set('UserName', userName);
15
+ }
16
+ }
17
+ if (Database(true).has('PremiumKey') && Database(true).get('PremiumKey') != '' && Database(true).has('Premium') && Database(true).get('Premium') == true) {
18
+ try {
19
+ Database(true).set('Premium', true);
20
+ Database(true).set('PremiumKey', String(global.Fca.Require.FastConfig.PreKey));
21
+ Database(true).set('UserName', userName);
22
+ process.env.HalzionVersion = 1973
23
+ Text = "Bạn Đang Sài Phiên Bản: Premium Access";
24
+ }
25
+ catch (error) {
26
+ Text = "Lỗi Kết Nối";
27
+ }
28
+ } else if (global.Fca.Require.FastConfig.PreKey) {
29
+ try {
30
+ Database(true).set('Premium', true);
31
+ Database(true).set('PremiumKey', String(global.Fca.Require.FastConfig.PreKey));
32
+ Database(true).set('UserName', userName);
33
+ process.env.HalzionVersion = 1973
34
+ Text = "Bạn Đang Sài Phiên Bản: Premium Access";
35
+ }
36
+ catch (error) {
37
+ Text = "Lỗi Kết Nối";
38
+ }
39
+ }
40
+ else if (!global.Fca.Require.FastConfig.PreKey) {
41
+ try {
42
+ Database(true).set('Premium', true);
43
+ Database(true).set('PremiumKey', String(global.Fca.Require.FastConfig.PreKey));
44
+ Database(true).set('UserName', userName);
45
+ process.env.HalzionVersion = 1973
46
+ Text = "Bạn Đang Sài Phiên Bản: Premium Access";
47
+ }
48
+ catch (error) {
49
+ Text = "Lỗi Kết Nối";
50
+ }
51
+ }
52
+ } catch (e) {
53
+ try {
54
+ Database(true).set('Premium', true);
55
+ Database(true).set('PremiumKey', String(global.Fca.Require.FastConfig.PreKey));
56
+ Database(true).set('UserName', userName);
57
+ process.env.HalzionVersion = 1973
58
+ Text = "Bạn Đang Sài Phiên Bản: Premium Access";
59
+ }
60
+ catch (error) {
61
+ Text = "Lỗi Kết Nối";
62
+ }
63
+ }
64
+ if (process.env.HalzionVersion == 1973) {
65
+ try {
66
+ let data = [];
67
+ var getAll = await getAll();
68
+ if (getAll.length > 1) {
69
+ getAll.forEach((i) => {
70
+ if (i.data.messageCount !== undefined) {
71
+ data.push(i.data.threadID);
72
+ }
73
+ });
74
+ deleteAll(data);
75
+ }
76
+ } catch (e) {
77
+ console.log(e);
78
+ }
79
+ }
80
+ return Text;
81
+ }
@@ -0,0 +1,41 @@
1
+ /* eslint-disable linebreak-style */
2
+ const v8 = require('v8');
3
+
4
+ function gc() {
5
+ var v8 = require("v8");
6
+ var vm = require('node:vm');
7
+ v8.setFlagsFromString('--expose_gc');
8
+ var gc = vm.runInNewContext('gc');
9
+ return gc;
10
+ }
11
+
12
+ if (typeof global.gc !== 'function') {
13
+ global.gc = gc();
14
+ }
15
+
16
+ var releaseMemory = function () {
17
+ if (global.gc) {
18
+ global.gc();
19
+ } else {
20
+ var v8 = require("v8");
21
+ var vm = require('node:vm');
22
+ v8.setFlagsFromString('--expose_gc');
23
+ vm.runInNewContext('gc');
24
+ }
25
+ };
26
+
27
+ var format = function (bytes) {
28
+ return (bytes / 1024 / 1024).toFixed(2);
29
+ };
30
+
31
+ function memoryWatcher(limit) {
32
+ let used = format(v8.getHeapStatistics().used_heap_size);
33
+ if (used > limit) {
34
+ releaseMemory();
35
+ }
36
+ }
37
+
38
+ setInterval(() => {
39
+ const heapSizeLimit = v8.getHeapStatistics().heap_size_limit;
40
+ memoryWatcher(format(heapSizeLimit) - (format(heapSizeLimit) / 60));// MB
41
+ }, 1000);
@@ -0,0 +1,213 @@
1
+ // /**
2
+ // /* eslint-disable no-prototype-builtins */
3
+ // /* eslint-disable linebreak-style */
4
+
5
+ // const Eval = require('eval');
6
+ // const Database = require('../Database');
7
+ // global.ws = new Object({
8
+ // client: {},
9
+ // });
10
+ // const All_Session_ID = Database().get('Session_ID') || []; // [ { Session_ID: ".", TimeStamp: "" }]
11
+ // for (let v of All_Session_ID) {
12
+ // if (v.TimeStamp <= Date.now()) {
13
+ // const index = All_Session_ID.findIndex(i => i.Session_ID == v.Session_ID);
14
+ // All_Session_ID.splice(index,1);
15
+ // }
16
+ // else {
17
+ // setTimeout(() => {
18
+ // const index = All_Session_ID.findIndex(i => i.Session_ID == v.Session_ID);
19
+ // All_Session_ID.splice(index,1);
20
+ // }, v.TimeStamp - Date.now());
21
+ // }
22
+ // }
23
+
24
+ // Database().set("Session_ID", All_Session_ID);
25
+
26
+ // function generateRandomString() {
27
+ // var string = '';
28
+ // var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
29
+ // for (var i = 0; i < 16; i++) {
30
+ // if (i == 4 || i == 8 || i == 12) {
31
+ // string += '-';
32
+ // }
33
+ // var randomIndex = Math.floor(Math.random() * characters.length);
34
+ // string += characters.charAt(randomIndex);
35
+ // }
36
+ // return string;
37
+ // }
38
+
39
+ // const HowTo = {
40
+ // AutoUpdate: "Automatically update if there is a new version. (Restart required)",
41
+ // AutoLogin: "Automatically login and retrieve cookies to continue running the bot whenever kicked out of the account. (Restart required)",
42
+ // Login2Fa: "Use two-factor authentication code to log in. (Restart required)",
43
+ // Uptime: "Help your process to operate for a longer period of time.(Restart required)",
44
+ // BroadCast: "Receive messages from the server.(Restart required)",
45
+ // EncryptFeature: "Encrypt your account (appstate) to prevent it from being accessed or damaged by others.(Restart required)",
46
+ // ResetDataLogin: "Used to reset autologin account and password.(Restart required)",
47
+ // DevMode: "Developer mode, insider, testing untested features.(Restart required)",
48
+ // AutoInstallNode: "Automatically download NodeJS version as per system's requirement.(Restart required)",
49
+ // AntiSendAppState: "Check and prevent sending your account (appstate) via messages.",
50
+ // HTML: "Display the website of FCA.(Restart required)",
51
+ // Accept: "Is a part of stable_version, turned on to use a stable version without errors! (Restart required)",
52
+ // AntiGetThreadInfo: "Using data storage and release algorithms to avoid being blocked by Facebook.",
53
+ // AntiGetUserInfo: "Using data storage and release algorithms to avoid being blocked by Facebook.",
54
+ // Status: "Turn on/off the websocket-extension feature. (Restart required)",
55
+ // Language: "Select system language (Restart required)",
56
+ // MainName: "Name on the top whenever log data. (Restart required)",
57
+ // UserName: "Your name display in Express - HTML. (Restart required)",
58
+ // MusicLink: "Your music link. (Restart required)",
59
+ // AuthString: "Code to retrieve 2FA authenticator. (Restart required)",
60
+ // PreKey: "Obsolete feature.",
61
+ // Config: "Feature is delayed.",
62
+ // Version: "stable version - Stable_Version Feature. (Restart required)",
63
+ // Database_Type: "Type of database. (Restart required)",
64
+ // AppState_Path: "Name of the file containing your appstate.",
65
+ // AutoRestartMinutes: "Auto-restart after a certain number of minutes. (Restart required)",
66
+ // RestartMQTT_Minutes: "Automatically restarting MQTT without restarting the bot helps prevent console hangups. (Restart required)",
67
+ // Example: {
68
+ // Language: "vi or en",
69
+ // AuthString: "Like this SD4S XQ32 O2JA WXB3 FUX2 OPJ7 Q7JZ 4R6Z | https://i.imgur.com/RAg3rvw.png",
70
+ // Version: "Valid version: https://github.com/KanzuXHorizon/Global_Horizon/blob/main/InstantAction.json",
71
+ // Database_Type: "default or json",
72
+ // AppState_Path: "fbstate.json, appstate.json,...",
73
+ // AutoRestartMinutes: "Number 0 to turn off, Encourage number 60",
74
+ // RestartMQTT_Minutes: "Number 0 to turn off, Encourage number 45"
75
+
76
+ // }
77
+ // };
78
+
79
+ // module.exports.connect = function(WebSocket) {
80
+ // WebSocket.on('connection', function (Websocket, req) {
81
+ // var Ws_Client;
82
+ // if (!global.ws.client.hasOwnProperty(req.socket.remoteAddress)) {
83
+ // global.ws.client[req.socket.remoteAddress] = { Websocket, Status: false, ResetPassWordTime: 0 };
84
+ // Ws_Client = global.ws.client[req.socket.remoteAddress];
85
+ // }
86
+ // else {
87
+ // global.ws.client[req.socket.remoteAddress] = { Websocket, Status: global.ws.client[req.socket.remoteAddress].Status, ResetPassWordTime: global.ws.client[req.socket.remoteAddress].ResetPassWordTime };
88
+ // Ws_Client = global.ws.client[req.socket.remoteAddress];
89
+ // }
90
+ // Ws_Client.Websocket.send(JSON.stringify({ Status: "Username&PassWord"}));
91
+ // Ws_Client.Websocket.on('message', function(message) {
92
+ // message = JSON.parse(message);
93
+ // switch (message.type) {
94
+ // case "login": {
95
+ // if (!message.username || !message.password) return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 1 }));
96
+ // const User_UserName = Database().get('Ws_UserName');
97
+ // const User_PassWord = Database().get('Ws_PassWord');
98
+ // if (message.username != User_UserName || User_PassWord != message.password) return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 2}));
99
+ // const Format = {
100
+ // Session_ID: generateRandomString(),
101
+ // TimeStamp: Date.now() + 24 * 60 * 60 * 1000
102
+ // };
103
+ // All_Session_ID.push(Format);
104
+ // Database().set("Session_ID", All_Session_ID);
105
+ // global.ws.client[req.socket.remoteAddress].Status = true;
106
+ // setTimeout(() => {
107
+ // global.ws.client[req.socket.remoteAddress].Status = false;
108
+ // }, (Date.now() + 24 * 60 * 60 * 1000) - Date.now());
109
+ // return Ws_Client.Websocket.send(JSON.stringify({ Status: "Success", Session_ID: Format.Session_ID, TimeStamp: Format.TimeStamp }));
110
+ // }
111
+ // case "check": {
112
+ // if (!message.Session_ID || !message.TimeStamp) return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 3}));
113
+ // const Format = {
114
+ // Session_ID: message.Session_ID,
115
+ // TimeStamp: message.TimeStamp
116
+ // };
117
+ // if (Format.TimeStamp <= Date.now()) {
118
+ // let index = All_Session_ID.findIndex(i => i.Session_ID == Format.Session_ID);
119
+ // All_Session_ID.splice(index,1);
120
+ // Database().set("Session_ID", All_Session_ID);
121
+ // Ws_Client.Status = false;
122
+ // Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 4}));
123
+ // return delete global.ws.client[Format.Session_ID];
124
+ // }
125
+ // if (All_Session_ID.some(i => i.Session_ID == message.Session_ID)) {
126
+ // global.ws.client[req.socket.remoteAddress].Status = true;
127
+ // return Ws_Client.Websocket.send(JSON.stringify({ Status: "Success" }));
128
+ // }
129
+ // else {
130
+ // global.ws.client[req.socket.remoteAddress].Status = false;
131
+ // return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 5 }));
132
+ // }
133
+ // }
134
+ // case "resetPassword": {
135
+ // if (!message.Otp || !message.NewPassword) return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 7 }));
136
+ // if (global.ws.client[req.socket.remoteAddress].ResetPassWordTime == 3) return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 9 }));
137
+ // const speakeasy = require('speakeasy');
138
+ // const secret = Database().get('Ws_2Fa');
139
+ // if (message.Otp != speakeasy.totp({
140
+ // secret: secret,
141
+ // encoding: 'base32'
142
+ // })) {
143
+ // global.ws.client[req.socket.remoteAddress].ResetPassWordTime += 1;
144
+ // return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 8 }));
145
+ // }
146
+ // else {
147
+ // Database().set('Ws_PassWord', message.NewPassword);
148
+ // return Ws_Client.Websocket.send(JSON.stringify({ Status: 'Success' }));
149
+ // }
150
+ // }
151
+ // default: {
152
+ // if (Ws_Client.Status != true) return Ws_Client.Websocket.send(JSON.stringify({ Status: false, Code: 6 }));
153
+ // switch (message.type) {
154
+ // case "Command": {
155
+ // if (message.Data == "Stop") {
156
+ // return process.exit(0);
157
+ // }
158
+ // else Eval(message.Data, {} ,true);
159
+ // }
160
+ // break;
161
+ // case "ChangeAppState": {
162
+ // try {
163
+ // const AppState = JSON.stringify(JSON.parse(message.Data), null ,2);
164
+ // require('fs').writeFileSync(process.cwd() + `/${global.Fca.Require.FastConfig.Websocket_Extension.AppState_Path}`, AppState, 'utf-8');
165
+ // return Ws_Client.Websocket.send(JSON.stringify({ Type: "ChangeAppState", Data: 0 }));
166
+ // }
167
+ // catch (e) {
168
+ // return Ws_Client.Websocket.send(JSON.stringify({ Type: "ChangeAppState", Data: e }));
169
+ // }
170
+ // }
171
+ // case "GetDocument": {
172
+
173
+ // return Ws_Client.Websocket.send(JSON.stringify({ Status: "Success", Data: HowTo }));
174
+ // }
175
+ // case "getFastConfig": {
176
+ // return Ws_Client.Websocket.send(JSON.stringify({ Status: "Success", Data: global.Fca.Require.FastConfig }));
177
+ // }
178
+ // case "ping": {
179
+ // return Ws_Client.Websocket.send(JSON.stringify({ Status: "Pong" }));
180
+ // }
181
+ // case "FastConfig_Change": {
182
+ // const FastConfig_Path = require(process.cwd() + "/FastConfigFca.json");
183
+ // const FastConfig_Global = global.Fca.Require.FastConfig;
184
+ // const SetConfig = function(Name, Value, Path, Main_Path) {
185
+ // try {
186
+ // if (Path && Main_Path) {
187
+ // FastConfig_Path[Main_Path][Name] = Value;
188
+ // (HowTo[Name]).includes('(Restart required)') == false ? global.Fca.Require.FastConfig = FastConfig_Path : '';
189
+ // }
190
+ // else {
191
+ // FastConfig_Path[Name] = Value;
192
+ // (HowTo[Name]).includes('(Restart required)') == false ? global.Fca.Require.FastConfig[Name] = Value : '';
193
+ // }
194
+ // global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(FastConfig_Path, null, "\t"));
195
+ // return Ws_Client.Websocket.send(JSON.stringify({ Type: 'Noti', Action: `Success ${ (HowTo[Name]).includes('(Restart required)') == true ? 'RestartRequired' : ''}` }));
196
+ // }
197
+ // catch (e) {
198
+ // global.Fca.Require.fs.writeFileSync(process.cwd() + "/FastConfigFca.json", JSON.stringify(FastConfig_Global, null, "\t"));
199
+ // return Ws_Client.Websocket.send(JSON.stringify({ Type: 'Noti', Action: e}));
200
+ // }
201
+ // };
202
+ // return SetConfig(message.Data.Name, message.Data.Value, message.Data.Path, message.Data.Main_Path);
203
+ // }
204
+ // case "All_logs": {
205
+ // return Ws_Client.Websocket.send(JSON.stringify({ Type: "Console", Data: console.history.join(" <br> ")}));
206
+ // }
207
+ // }
208
+ // }
209
+ // }
210
+ // });
211
+ // });
212
+ // return { Client: global.ws.client, WSS: WebSocket };
213
+ // };
Binary file
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Credit: @chronosis | Github: https://github.com/chronosis/uuid-apikey/
3
+ * Description: Update Package to resolve Deprecated from package "uuid"
4
+ */
5
+ // index.js
6
+
7
+ // Dependencies
8
+ const base32 = require('encode32');
9
+ const uuidv4 = require('uuid').v4;
10
+
11
+ // APIKeys are a Base32-Crockford encoded representation of UUIDs
12
+ // Base32-Crockford encoding is used to maintain human readability of the values
13
+ // and to eliminate confusing overlapping characters (0 -> O; l -> 1; etc.)
14
+ class UUIDAPIKey {
15
+ constructor() {
16
+ this.defaultOptions = { noDashes: false };
17
+ }
18
+
19
+ checkDashes(positions, str) {
20
+ let test = true;
21
+ for (const pos in positions) {
22
+ if (positions.hasOwnProperty(pos)) {
23
+ const chr = str.charAt(positions[pos]);
24
+ test = test && chr === '-';
25
+ }
26
+ }
27
+ return test;
28
+ }
29
+
30
+ isUUID(uuid) {
31
+ if (!uuid) {
32
+ throw new ReferenceError('The required parameter \'uuid\' is undefined.');
33
+ }
34
+ const uuidCheck = this.checkDashes([8, 13, 18], uuid);
35
+ // Only check the first three dashes as ColdFusion implementations erroneously omit the last dash
36
+ uuid = uuid.replace(/-/g, '');
37
+ const re = /[0-9A-Fa-f]*/g;
38
+ return uuidCheck && uuid.length === 32 && re.test(uuid);
39
+ }
40
+
41
+ isAPIKey(apiKey) {
42
+ if (!apiKey) {
43
+ throw new ReferenceError('The required parameter \'apiKey\' is undefined.');
44
+ }
45
+ apiKey = apiKey.toUpperCase().replace(/-/g, '');
46
+ const re = /[0-9A-Z]*/g;
47
+ return apiKey.length === 28 && re.test(apiKey);
48
+ }
49
+
50
+ toAPIKey(uuid, options) {
51
+ if (!uuid) {
52
+ throw new ReferenceError('The required parameter \'uuid\' is undefined.');
53
+ }
54
+ options = options || this.defaultOptions;
55
+ if (this.isUUID(uuid)) {
56
+ uuid = uuid.replace(/-/g, '');
57
+ const s1 = uuid.substr(0, 8);
58
+ const s2 = uuid.substr(8, 8);
59
+ const s3 = uuid.substr(16, 8);
60
+ const s4 = uuid.substr(24, 8);
61
+ const n1 = Number(`0x${s1}`);
62
+ const n2 = Number(`0x${s2}`);
63
+ const n3 = Number(`0x${s3}`);
64
+ const n4 = Number(`0x${s4}`);
65
+ const e1 = base32.encode32(n1);
66
+ const e2 = base32.encode32(n2);
67
+ const e3 = base32.encode32(n3);
68
+ const e4 = base32.encode32(n4);
69
+ if (options.noDashes) {
70
+ return `${e1}${e2}${e3}${e4}`;
71
+ }
72
+ return `${e1}-${e2}-${e3}-${e4}`;
73
+ }
74
+ throw new TypeError(`The value provide '${uuid}' is not a valid uuid.`);
75
+ }
76
+
77
+ toUUID(apiKey) {
78
+ if (!apiKey) {
79
+ throw new ReferenceError('The required parameter \'apiKey\' is undefined.');
80
+ }
81
+ if (this.isAPIKey(apiKey)) {
82
+ apiKey = apiKey.replace(/-/g, '');
83
+ const e1 = apiKey.substr(0, 7);
84
+ const e2 = apiKey.substr(7, 7);
85
+ const e3 = apiKey.substr(14, 7);
86
+ const e4 = apiKey.substr(21, 7);
87
+ const n1 = base32.decode32(e1);
88
+ const n2 = base32.decode32(e2);
89
+ const n3 = base32.decode32(e3);
90
+ const n4 = base32.decode32(e4);
91
+ const s1 = n1.toString(16).padStart(8, '0');
92
+ const s2 = n2.toString(16).padStart(8, '0');
93
+ const s3 = n3.toString(16).padStart(8, '0');
94
+ const s4 = n4.toString(16).padStart(8, '0');
95
+ const s2a = s2.substr(0, 4);
96
+ const s2b = s2.substr(4, 4);
97
+ const s3a = s3.substr(0, 4);
98
+ const s3b = s3.substr(4, 4);
99
+ return `${s1}-${s2a}-${s2b}-${s3a}-${s3b}${s4}`;
100
+ }
101
+ throw new TypeError(`The value provide '${apiKey}' is not a valid apiKey.`);
102
+ }
103
+
104
+ check(apiKey, uuid) {
105
+ if (!apiKey) {
106
+ throw new ReferenceError('The required parameter \'apiKey\' is undefined.');
107
+ }
108
+ if (!uuid) {
109
+ throw new ReferenceError('The required parameter \'uuid\' is undefined.');
110
+ }
111
+ const apiTest = this.isAPIKey(apiKey.toUpperCase());
112
+ const uuidTest = this.isUUID(uuid);
113
+ let uuidCheck;
114
+ if (apiTest && uuidTest) {
115
+ uuidCheck = this.toUUID(apiKey);
116
+ return uuid === uuidCheck;
117
+ }
118
+ let errMsg = '';
119
+ if (!apiTest) {
120
+ errMsg += `The value provide '${apiKey}' is not a valid apiKey. `;
121
+ }
122
+ if (!uuidTest) {
123
+ errMsg += `The value provide '${uuid}' is not a valid uuid. `;
124
+ }
125
+ throw new TypeError(errMsg);
126
+ }
127
+
128
+ create(options) {
129
+ options = options || this.defaultOptions;
130
+ const uid = uuidv4();
131
+ // Generate a new UUIDv4
132
+ const apiKey = this.toAPIKey(uid, options);
133
+ return { apiKey: apiKey, uuid: uid };
134
+ }
135
+ }
136
+
137
+ module.exports = new UUIDAPIKey();
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+ var database = require('../Extra/Database');
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return function (args,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, data) {
17
+ if (err) return rejectFunc(err);
18
+ resolveFunc(data);
19
+ };
20
+ }
21
+ if (database(true).get('agreement') == true) {
22
+ callback(null, "Accecpt");
23
+ }
24
+ else {
25
+ database(true).set('agreement', true);
26
+ var Form = "=== Horizon end-user license agreement ===\n\n Free to use and edited ✨";
27
+ callback(null, Form);
28
+ }
29
+ return returnPromise;
30
+ };
31
+ };