nayan-remake-fca 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of nayan-remake-fca might be problematic. Click here for more details.
- package/.cache/replit/__replit_disk_meta.json +1 -0
- package/.cache/replit/nix/env.json +1 -0
- package/.config/configstore/update-notifier-npm.json +4 -0
- package/.config/configstore/update-notifier-npm.json.1735545094 +4 -0
- package/.github/workflows/npm-publish.yml +33 -0
- package/.github/workflows/npm-publish2.yml +33 -0
- package/.github/workflows/publish.yml +20 -0
- package/.replit +80 -0
- package/.upm/store.json +1 -0
- package/CHANGELOG.md +2 -0
- package/DOCS.md +1947 -0
- package/Extra/Database/N +1 -0
- package/Extra/Database/index.js +469 -0
- package/Extra/ExtraAddons.js +82 -0
- package/Extra/ExtraFindUID.js +62 -0
- package/Extra/ExtraGetThread.js +340 -0
- package/Extra/ExtraScreenShot.js +430 -0
- package/Extra/ExtraUptimeRobot.js +38 -0
- package/Extra/Html/Classic/script.js +119 -0
- package/Extra/Html/Classic/style.css +1 -0
- package/Extra/N +1 -0
- package/Extra/Security/Index.js +173 -0
- package/Extra/Security/N +1 -0
- package/Extra/Security/Step_1.js +6 -0
- package/Extra/Security/Step_2.js +22 -0
- package/Extra/Security/Step_3.js +22 -0
- package/Extra/Src/Change_Environment.js +24 -0
- package/Extra/Src/Check_Update.js +67 -0
- package/Extra/Src/History.js +115 -0
- package/Extra/Src/Instant_Update.js +65 -0
- package/Extra/Src/Last-Run.js +65 -0
- package/Extra/Src/Premium.js +81 -0
- package/Extra/Src/Release_Memory.js +41 -0
- package/Extra/Src/Websocket.js +213 -0
- package/Extra/Src/uuid.js +137 -0
- package/Func/AcceptAgreement.js +31 -0
- package/Func/ClearCache.js +64 -0
- package/Func/N +1 -0
- package/Func/ReportV1.js +54 -0
- package/LICENSE +21 -0
- package/LICENSE-MIT +21 -0
- package/Language/index.js +1 -0
- package/Language/index.json +217 -0
- package/Main.js +1169 -0
- package/README.md +201 -0
- package/SECURITY.md +18 -0
- package/broadcast.js +40 -0
- package/index.js +383 -0
- package/logger.js +66 -0
- package/package.json +95 -0
- package/replit.nix +8 -0
- package/src/Dev_Horizon_Data.js +125 -0
- package/src/Premium.js +25 -0
- package/src/Screenshot.js +83 -0
- package/src/addExternalModule.js +16 -0
- package/src/addUserToGroup.js +79 -0
- package/src/changeAdminStatus.js +79 -0
- package/src/changeArchivedStatus.js +41 -0
- package/src/changeAvatar.js +127 -0
- package/src/changeAvt.js +85 -0
- package/src/changeBio.js +65 -0
- package/src/changeBlockedStatus.js +36 -0
- package/src/changeGroupImage.js +106 -0
- package/src/changeNickname.js +45 -0
- package/src/changeThreadColor.js +62 -0
- package/src/changeThreadEmoji.js +42 -0
- package/src/createNewGroup.js +70 -0
- package/src/createPoll.js +60 -0
- package/src/deleteMessage.js +45 -0
- package/src/deleteThread.js +43 -0
- package/src/forwardAttachment.js +48 -0
- package/src/getAccessToken.js +28 -0
- package/src/getCurrentUserID.js +7 -0
- package/src/getEmojiUrl.js +27 -0
- package/src/getFriendsList.js +73 -0
- package/src/getMessage.js +80 -0
- package/src/getThreadHistory.js +537 -0
- package/src/getThreadInfo.js +425 -0
- package/src/getThreadList.js +213 -0
- package/src/getThreadMain.js +220 -0
- package/src/getThreadPictures.js +59 -0
- package/src/getUID.js +59 -0
- package/src/getUserID.js +62 -0
- package/src/getUserInfo.js +113 -0
- package/src/getUserInfoMain.js +65 -0
- package/src/getUserInfoV2.js +32 -0
- package/src/getUserInfoV3.js +63 -0
- package/src/getUserInfoV4.js +55 -0
- package/src/getUserInfoV5.js +61 -0
- package/src/handleFriendRequest.js +46 -0
- package/src/handleMessageRequest.js +49 -0
- package/src/httpGet.js +49 -0
- package/src/httpPost.js +48 -0
- package/src/httpPostFormData.js +41 -0
- package/src/listenMqtt.js +787 -0
- package/src/logout.js +68 -0
- package/src/markAsDelivered.js +48 -0
- package/src/markAsRead.js +70 -0
- package/src/markAsReadAll.js +43 -0
- package/src/markAsSeen.js +51 -0
- package/src/muteThread.js +47 -0
- package/src/n +1 -0
- package/src/removeUserFromGroup.js +49 -0
- package/src/resolvePhotoUrl.js +37 -0
- package/src/searchForThread.js +43 -0
- package/src/sendMessage.js +379 -0
- package/src/sendTypingIndicator.js +80 -0
- package/src/setMessageReaction.js +109 -0
- package/src/setPostReaction.js +102 -0
- package/src/setTitle.js +74 -0
- package/src/threadColors.js +39 -0
- package/src/unfriend.js +43 -0
- package/src/unsendMessage.js +40 -0
- package/src/uploadAttachment.js +96 -0
- package/test/.env/.env +1 -0
- package/test/Database_Test.js +4 -0
- package/test/Db2.js +530 -0
- package/test/Horizon_Database/A_README.md +1 -0
- package/test/Horizon_Database/Database.db +0 -0
- package/test/Horizon_Database/N +1 -0
- package/test/Nayan_Database/A_README.md +1 -0
- package/test/Nayan_Database/Database.db +0 -0
- package/test/Nayan_Database/N +1 -0
- package/test/data/N +1 -0
- package/test/data/shareAttach.js +146 -0
- package/test/data/something.mov +0 -0
- package/test/data/test.png +0 -0
- package/test/data/test.txt +7 -0
- package/test/env.env +0 -0
- package/test/example-config.json +18 -0
- package/test/example-db.db +0 -0
- package/test/memoryleak.js +18 -0
- package/test/n +1 -0
- package/test/test-page.js +140 -0
- package/test/test.js +385 -0
- package/test/testv2.js +18 -0
- package/utils.js +1684 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Console History v1.5.1
|
|
3
|
+
* console-history.js
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the MIT License.
|
|
6
|
+
* https://git.io/console
|
|
7
|
+
*/
|
|
8
|
+
'use strict'
|
|
9
|
+
|
|
10
|
+
/* Allow only one instance of console-history.js */
|
|
11
|
+
if (typeof console.history !== 'undefined') {
|
|
12
|
+
throw new Error('Only one instance of console-history.js can run at a time.')
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/* Store the original log functions. */
|
|
16
|
+
console._log = console.log
|
|
17
|
+
console._info = console.info
|
|
18
|
+
console._warn = console.warn
|
|
19
|
+
console._error = console.error
|
|
20
|
+
console._debug = console.debug
|
|
21
|
+
|
|
22
|
+
/* Declare our console history variable. */
|
|
23
|
+
console.history = []
|
|
24
|
+
|
|
25
|
+
/* Redirect all calls to the collector. */
|
|
26
|
+
console.log = function(dt) {
|
|
27
|
+
return console._intercept('log', dt, arguments)
|
|
28
|
+
}
|
|
29
|
+
console.info = function(dt) {
|
|
30
|
+
return console._intercept('info', dt, arguments)
|
|
31
|
+
}
|
|
32
|
+
console.warn = function(dt) {
|
|
33
|
+
return console._intercept('warn', dt, arguments)
|
|
34
|
+
}
|
|
35
|
+
console.error = function(dt) {
|
|
36
|
+
return console._intercept('error', dt, arguments)
|
|
37
|
+
}
|
|
38
|
+
console.debug = function(dt) {
|
|
39
|
+
return console._intercept('debug', dt, arguments)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Give the developer the ability to intercept the message before letting
|
|
43
|
+
console-history access it. */
|
|
44
|
+
console._intercept = function(type, data, args) {
|
|
45
|
+
// Your own code can go here, but the preferred method is to override this
|
|
46
|
+
// function in your own script, and add the line below to the end or
|
|
47
|
+
// begin of your own 'console._intercept' function.
|
|
48
|
+
// REMEMBER: Use only underscore console commands inside _intercept!
|
|
49
|
+
console._collect(type, data,args)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Define the main log catcher. */
|
|
53
|
+
console._collect = function(type, data, args) {
|
|
54
|
+
// WARNING: When debugging this function, DO NOT call a modified console.log
|
|
55
|
+
// function, all hell will break loose.
|
|
56
|
+
// Instead use the original console._log functions.
|
|
57
|
+
|
|
58
|
+
// All the arguments passed to any function, even when not defined
|
|
59
|
+
// inside the function declaration, are stored and locally available in
|
|
60
|
+
// the variable called 'arguments'.
|
|
61
|
+
//
|
|
62
|
+
// The arguments of the original console.log functions are collected above,
|
|
63
|
+
// and passed to this function as a variable 'args', since 'arguments' is
|
|
64
|
+
// reserved for the current function.
|
|
65
|
+
|
|
66
|
+
// Collect the timestamp of the console log.
|
|
67
|
+
const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' };
|
|
68
|
+
|
|
69
|
+
var time = new Date().toLocaleDateString('vi-VN', options)
|
|
70
|
+
|
|
71
|
+
// Make sure the 'type' parameter is set. If no type is set, we fall
|
|
72
|
+
// back to the default log type.
|
|
73
|
+
if (!type) type = 'log'
|
|
74
|
+
|
|
75
|
+
// To ensure we behave like the original console log functions, we do not
|
|
76
|
+
// output anything if no arguments are provided.
|
|
77
|
+
if (!args || args.length === 0) return
|
|
78
|
+
|
|
79
|
+
// Act normal, and just pass all original arguments to
|
|
80
|
+
// the origial console function :)
|
|
81
|
+
console['_' + type].apply(console, args)
|
|
82
|
+
|
|
83
|
+
// Get stack trace information. By throwing an error, we get access to
|
|
84
|
+
// a stack trace. We then go up in the trace tree and filter out
|
|
85
|
+
// irrelevant information.
|
|
86
|
+
var stack = false
|
|
87
|
+
try {
|
|
88
|
+
throw Error('')
|
|
89
|
+
} catch (error) {
|
|
90
|
+
// The lines containing 'console-history.js' are not relevant to us.
|
|
91
|
+
var stackParts = error.stack.split('\n')
|
|
92
|
+
stack = []
|
|
93
|
+
for (var i = 0; i < stackParts.length; i++) {
|
|
94
|
+
if (stackParts[i].indexOf('console-history.js') > -1 ||
|
|
95
|
+
stackParts[i].indexOf('console-history.min.js') > -1 ||
|
|
96
|
+
stackParts[i] === 'Error') {
|
|
97
|
+
continue
|
|
98
|
+
}
|
|
99
|
+
stack.push(stackParts[i].trim())
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
data = data.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,'')
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
data = data;
|
|
107
|
+
}
|
|
108
|
+
// Add the log to our history.
|
|
109
|
+
console.history.push({
|
|
110
|
+
type: type,
|
|
111
|
+
timestamp: time,
|
|
112
|
+
message: data,
|
|
113
|
+
stack: stack
|
|
114
|
+
})
|
|
115
|
+
}
|
|
@@ -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/NAYAN-BOT69/Global_Nayan/main/InstantAction.json
|
|
8
|
+
const { body } = await got('https://raw.githubusercontent.com/NAYAN-BOT69/Global_Nayan/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("[ NAYAN-UPDATE ] •","Found a command that requires downloading an important Version to avoid errors, update onions: " + LocalVersion + " -> " + json.Version);
|
|
13
|
+
log.warn("[ NAYAN-UPDATE ] •","Problem Description: " + json.Problem);
|
|
14
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
15
|
+
try {
|
|
16
|
+
execSync(`npm install nayan-remake-fca@${json.Version}`, { stdio: 'inherit' });
|
|
17
|
+
log.info("[ NAYAN-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("[ NAYAN-UPDATE ] •","Update Failed, Trying Another Method 1...");
|
|
26
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
27
|
+
execSync(`npm install nayan-remake-fca@${json.Version} --force`, { stdio: 'inherit' });
|
|
28
|
+
log.info("[ NAYAN-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("[ NAYAN-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("[ NAYAN-UPDATE ] •","Cache Cleaned, Trying Another Method 2...");
|
|
40
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
41
|
+
//self delete nayan-remake-fca folder from node_modules
|
|
42
|
+
fs.rmdirSync((process.cwd() + "/node_modules/nayan-remake-fca" || __dirname + '../../../nayan-remake-fca'), { recursive: true });
|
|
43
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
44
|
+
execSync(`npm install nayan-remake-fca@${json.Version}`, { stdio: 'inherit' });
|
|
45
|
+
log.info("[ NAYAN-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("[ NAYAN-UPDATE ] •","Update Failed, Please Update Manually");
|
|
54
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
55
|
+
log.warn("[ NAYAN-UPDATE ] •","Please contact to owner about update failed and screentshot error log at fb.com/www.xnxx.com169");
|
|
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 = "You Are Wrong Version: 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 = "You Are Wrong Version: 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 = "You Are Wrong Version: 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 = "You Are Wrong Version: 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
|
+
/* eslint-disable no-prototype-builtins */
|
|
2
|
+
/* eslint-disable linebreak-style */
|
|
3
|
+
|
|
4
|
+
const Eval = require('eval');
|
|
5
|
+
const Utils = require('../../utils');
|
|
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/NAYAN-BOT69/Global_Nayan/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() + "/FastConfigNayan.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() + "/FastConfigNayan.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() + "/FastConfigNayan.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
|
+
};
|