metacord 0.0.1-security → 1.2.0-Beta

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

Potentially problematic release.


This version of metacord might be problematic. Click here for more details.

Files changed (63) hide show
  1. package/LICENSE +21 -0
  2. package/MetaCord_Config.json +11 -0
  3. package/MetaCord_Database/Database.sqlite +0 -0
  4. package/MetaCord_Database/Do not delete this folder or any of the files in it +0 -0
  5. package/README.md +207 -5
  6. package/index.js +678 -0
  7. package/logger.js +16 -0
  8. package/package.json +38 -3
  9. package/src/addExternalModule.js +16 -0
  10. package/src/addUserToGroup.js +78 -0
  11. package/src/changeAdminStatus.js +78 -0
  12. package/src/changeArchivedStatus.js +41 -0
  13. package/src/changeBio.js +65 -0
  14. package/src/changeBlockedStatus.js +36 -0
  15. package/src/changeGroupImage.js +106 -0
  16. package/src/changeNickname.js +45 -0
  17. package/src/changeThreadColor.js +62 -0
  18. package/src/changeThreadEmoji.js +42 -0
  19. package/src/createNewGroup.js +70 -0
  20. package/src/createPoll.js +60 -0
  21. package/src/deleteMessage.js +45 -0
  22. package/src/deleteThread.js +43 -0
  23. package/src/forwardAttachment.js +48 -0
  24. package/src/getCurrentUserID.js +7 -0
  25. package/src/getEmojiUrl.js +27 -0
  26. package/src/getFriendsList.js +73 -0
  27. package/src/getOnlineTime.js +31 -0
  28. package/src/getThreadHistory.js +193 -0
  29. package/src/getThreadInfo.js +197 -0
  30. package/src/getThreadList.js +213 -0
  31. package/src/getThreadPictures.js +59 -0
  32. package/src/getUID.js +57 -0
  33. package/src/getUserID.js +62 -0
  34. package/src/getUserInfo.js +66 -0
  35. package/src/handleFriendRequest.js +49 -0
  36. package/src/handleMessageRequest.js +49 -0
  37. package/src/httpGet.js +49 -0
  38. package/src/httpPost.js +48 -0
  39. package/src/httpPostFormData.js +41 -0
  40. package/src/listenMqtt.js +634 -0
  41. package/src/logout.js +68 -0
  42. package/src/markAsDelivered.js +48 -0
  43. package/src/markAsRead.js +70 -0
  44. package/src/markAsReadAll.js +43 -0
  45. package/src/markAsSeen.js +51 -0
  46. package/src/muteThread.js +47 -0
  47. package/src/removeUserFromGroup.js +49 -0
  48. package/src/resolvePhotoUrl.js +37 -0
  49. package/src/searchForThread.js +43 -0
  50. package/src/sendMessage.js +334 -0
  51. package/src/sendTypingIndicator.js +80 -0
  52. package/src/setMessageReaction.js +109 -0
  53. package/src/setPostReaction.js +102 -0
  54. package/src/setTitle.js +74 -0
  55. package/src/threadColors.js +39 -0
  56. package/src/unfriend.js +43 -0
  57. package/src/unsendMessage.js +40 -0
  58. package/utils/Database.js +42 -0
  59. package/utils/Extension.js +143 -0
  60. package/utils/Html/MetaCord.png +0 -0
  61. package/utils/Html/index.html +200 -0
  62. package/utils/StateCrypt.js +53 -0
  63. package/utils.js +1249 -0
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ module.exports = function(_defaultFuncs, _api, _ctx) {
4
+ // Currently the only colors that can be passed to api.changeThreadColor(); may change if Facebook adds more
5
+ return {
6
+ ////MessengerBlue: null,
7
+ ////Viking: "#44bec7",
8
+ ////GoldenPoppy: "#ffc300",
9
+ ////RadicalRed: "#fa3c4c",
10
+ ////Shocking: "#d696bb",
11
+ ////PictonBlue: "#6699cc",
12
+ ////FreeSpeechGreen: "#13cf13",
13
+ ////Pumpkin: "#ff7e29",
14
+ ////LightCoral: "#e68585",
15
+ ////MediumSlateBlue: "#7646ff",
16
+ ////DeepSkyBlue: "#20cef5",
17
+ ////Fern: "#67b868",
18
+ ////Cameo: "#d4a88c",
19
+ ////BrilliantRose: "#ff5ca1",
20
+ ////BilobaFlower: "#a695c7"
21
+ DefaultBlue: "196241301102133",
22
+ HotPink: "169463077092846",
23
+ AquaBlue: "2442142322678320",
24
+ BrightPurple: "234137870477637",
25
+ CoralPink: "980963458735625",
26
+ Orange: "175615189761153",
27
+ Green: "2136751179887052",
28
+ LavenderPurple: "2058653964378557",
29
+ Red: "2129984390566328",
30
+ Yellow: "174636906462322",
31
+ TealBlue: "1928399724138152",
32
+ Aqua: "417639218648241",
33
+ Mango: "930060997172551",
34
+ Berry: "164535220883264",
35
+ Citrus: "370940413392601",
36
+ Candy: "205488546921017",
37
+ StarWars: "809305022860427"
38
+ };
39
+ };
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return function unfriend(userID, 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, friendList) {
17
+ if (err) return rejectFunc(err);
18
+ resolveFunc(friendList);
19
+ };
20
+ }
21
+
22
+ var form = {
23
+ uid: userID,
24
+ unref: "bd_friends_tab",
25
+ floc: "friends_tab",
26
+ "nctr[_mod]": "pagelet_timeline_app_collection_" + ctx.userID + ":2356318349:2"
27
+ };
28
+
29
+ defaultFuncs
30
+ .post("https://www.facebook.com/ajax/profile/removefriendconfirm.php", ctx.jar, form)
31
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
32
+ .then(function (resData) {
33
+ if (resData.error) throw resData;
34
+ return callback();
35
+ })
36
+ .catch(function (err) {
37
+ log.error("unfriend", err);
38
+ return callback(err);
39
+ });
40
+
41
+ return returnPromise;
42
+ };
43
+ };
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return function unsendMessage(messageID, 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, friendList) {
17
+ if (err) return rejectFunc(err);
18
+ resolveFunc(friendList);
19
+ };
20
+ }
21
+
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
+ });
37
+
38
+ return returnPromise;
39
+ };
40
+ };
@@ -0,0 +1,42 @@
1
+ const Database = require('better-sqlite3');
2
+ const fs = require('fs');
3
+
4
+ if (!fs.existsSync(process.cwd() + '/MetaCord_Database')) {
5
+ fs.mkdirSync(process.cwd() + '/MetaCord_Database');
6
+ fs.writeFileSync(process.cwd() + '/MetaCord_Database/Do not delete this folder or any of the files in it', '', 'utf8');
7
+ }
8
+ var db = new Database(process.cwd() + "/MetaCord_Database/Database.sqlite");
9
+
10
+
11
+ db.exec("CREATE TABLE IF NOT EXISTS MetaCord (key TEXT, value TEXT)");
12
+
13
+ function setKeyValue(key, value) {
14
+ const insertStatement = db.prepare("INSERT INTO MetaCord (key, value) VALUES (?, ?)");
15
+ insertStatement.run(key, value);
16
+ }
17
+
18
+ function getKeyValue(key) {
19
+ const selectStatement = db.prepare("SELECT value FROM MetaCord WHERE key = ?");
20
+ const data = selectStatement.get(key);
21
+ return data ? data.value : null;
22
+ }
23
+
24
+ function CreateJson(name, value) {
25
+ if (!fs.existsSync(process.cwd() + '/MetaCord_Database/' + name)) {
26
+ fs.writeFileSync(process.cwd() + '/MetaCord_Database/' + name, JSON.stringify(value, null, 2));
27
+ }
28
+ }
29
+
30
+ function GetJson(name) {
31
+ if (fs.existsSync(process.cwd() + '/MetaCord_Database/' + name)) {
32
+ return JSON.parse(fs.readFileSync(process.cwd() + '/MetaCord_Database/' + name, 'utf-8'));
33
+ }
34
+ }
35
+
36
+
37
+ module.exports = {
38
+ setKeyValue,
39
+ getKeyValue,
40
+ CreateJson,
41
+ GetJson
42
+ };
@@ -0,0 +1,143 @@
1
+ const express = require('express');
2
+ const app = express();
3
+ const logger = require('../logger');
4
+ const path = require('path');
5
+ const axios = require('axios');
6
+ const chalk = require('chalk');
7
+ const fs = require('fs');
8
+
9
+ function Uptime(url) {
10
+ switch (process.platform) {
11
+ case 'win32':
12
+ case 'darwin':
13
+ logger("Your Operating System does not currently support Auto Uptime !");
14
+ break;
15
+ case 'linux':
16
+ if (process.env.REPL_SLUG) {
17
+ logger(`Activating uptime for ${chalk.underline(`'${url}'`)}`);
18
+ return setInterval(function () {
19
+ axios.get(url).then(() => { }).catch(() => { });
20
+ }, 10 * 1000);
21
+ } else {
22
+ logger("Your Operating System does not currently support Auto Uptime !");
23
+ }
24
+ break;
25
+ default:
26
+ logger("Your Operating System does not currently support Auto Uptime !");
27
+ }
28
+ }
29
+
30
+ function CreateSiteHtml(port) {
31
+ app.use(express.static(path.join(__dirname, "/Html")));
32
+
33
+ app.get('/', function (req, res) {
34
+ res.sendFile(path.join(__dirname, '/Html/index.html'));
35
+ });
36
+
37
+ app.get('/', (req, res) => res.sendStatus(200));
38
+
39
+ const listen_port = port || 3000;
40
+
41
+ app.listen(listen_port, () => {
42
+ logger(`Bot is running on port: ${listen_port}`);
43
+ });
44
+
45
+ app.on('error', (error) => {
46
+ logger(`An error occurred while starting the server: ${error}`);
47
+ });
48
+ }
49
+
50
+ async function getUIDSlow(url) {
51
+ var FormData = require("form-data");
52
+ var Form = new FormData();
53
+ var Url = new URL(url);
54
+ Form.append('username', Url.pathname.replace(/\//g, ""));
55
+ try {
56
+ var response = await axios.post('https://api.findids.net/api/get-uid-from-username', Form, {
57
+ headers: {
58
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.79 Safari/537.36'
59
+ }
60
+ });
61
+ var data = response.data;
62
+ if (data.status !== 200) {
63
+ throw new Error('Error!');
64
+ }
65
+ if (typeof data.error === 'string') {
66
+ throw new Error("errr");
67
+ } else {
68
+ return data.data.id || "Not Found";
69
+ }
70
+ } catch (e) {
71
+ throw e;
72
+ }
73
+ }
74
+
75
+ async function getUIDFast(url) {
76
+ var FormData = require("form-data");
77
+ var Form = new FormData();
78
+ var Url = new URL(url);
79
+ Form.append('link', Url.href);
80
+ try {
81
+ var response = await axios.post('https://id.traodoisub.com/api.php', Form);
82
+ var data = response.data;
83
+ if (data.error) {
84
+ throw new Error(data.error);
85
+ } else {
86
+ return data.id || "Not Found";
87
+ }
88
+ } catch (e) {
89
+ throw e;
90
+ }
91
+ }
92
+
93
+ async function getUID(url, callback) {
94
+ try {
95
+ var getUID = await getUIDFast(url);
96
+ if (!isNaN(getUID)) {
97
+ callback(null, getUID);
98
+ } else {
99
+ let getUIDSlowResult = await getUIDSlow(url);
100
+ if (!isNaN(getUIDSlowResult)) {
101
+ callback(null, getUIDSlowResult);
102
+ } else {
103
+ callback("UID not found", null);
104
+ }
105
+ }
106
+ } catch (error) {
107
+ callback(error.message, null);
108
+ }
109
+ }
110
+
111
+ function StartCountOnlineTime() {
112
+ if (!fs.existsSync("./Online.js")) {
113
+ fs.writeFileSync("./Online.js", JSON.stringify(0, null, 2));
114
+ }
115
+ setInterval(function () {
116
+ const data = Number(fs.readFileSync('./Online.js', 'utf8'));
117
+ const time = data + 1;
118
+ fs.writeFileSync("./Online.js", JSON.stringify(time, null, 2));
119
+ }, 1000);
120
+ }
121
+
122
+ function GetCountOnlineTime() {
123
+ const s = Number(fs.readFileSync('./Online.js', 'utf8'));
124
+ const n = Math.floor(s / 86400);
125
+ const t = Math.floor(s % 86400 / 3600);
126
+ const r = Math.floor(s / 60 % 60);
127
+ const a = Math.floor(s % 60);
128
+
129
+ const formattedTime = [n, t, r, a]
130
+ .map(e => (e < 10 ? "0" + e : e))
131
+ .filter((e, o) => "00" !== e || o > 0)
132
+ .join(": ");
133
+
134
+ return formattedTime;
135
+ }
136
+
137
+ module.exports = {
138
+ CreateSiteHtml,
139
+ Uptime,
140
+ getUID,
141
+ StartCountOnlineTime,
142
+ GetCountOnlineTime
143
+ };
Binary file
@@ -0,0 +1,200 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <script src="https://use.fontawesome.com/d1341f9b7a.js"></script>
6
+ <title>MetaCord</title>
7
+ <style>
8
+ @import url('https://fonts.googleapis.com/css2?family=Roboto+Condensed:ital,wght@1,500&display=swap');
9
+ * {
10
+ margin: 0;
11
+ padding: 0;
12
+ }
13
+ body {
14
+ background-color: #190096;
15
+ }
16
+ .bg {
17
+ width: 100%;
18
+ height: 100vh;
19
+ background-image: linear-gradient(
20
+ 45deg,
21
+ #243aff 0%,
22
+ #4687f0 46%,
23
+ #5800d4 100%
24
+ );
25
+ display: flex;
26
+ flex-direction: column;
27
+ align-items: center;
28
+ justify-content: center;
29
+ }
30
+ .glass {
31
+ position: absolute;
32
+ top: 0;
33
+ left: 0;
34
+ width: 100%;
35
+ height: 100%;
36
+ overflow: hidden;
37
+ }
38
+ .glass li {
39
+ position: absolute;
40
+ display: block;
41
+ list-style: none;
42
+ width: 20px;
43
+ height: 20px;
44
+ background: rgba(255, 255, 255, 0.1);
45
+ border: 1px solid rgba(255, 255, 255, 0.18);
46
+ animation: spin 5s linear infinite;
47
+ bottom: -150px;
48
+ }
49
+ .glass li:nth-child(1) {
50
+ left: 35%;
51
+ width: 150px;
52
+ height: 150px;
53
+ animation-delay: 0s;
54
+ }
55
+ .glass li:nth-child(2) {
56
+ left: 10%;
57
+ width: 20px;
58
+ height: 20px;
59
+ animation-delay: 2s;
60
+ animation-duration: 12s;
61
+ }
62
+ .glass li:nth-child(3) {
63
+ left: 70%;
64
+ width: 20px;
65
+ height: 20px;
66
+ animation-delay: 4s;
67
+ }
68
+ .glass li:nth-child(4) {
69
+ left: 40%;
70
+ width: 60px;
71
+ height: 60px;
72
+ animation-delay: 0s;
73
+ animation-duration: 18s;
74
+ }
75
+ .glass li:nth-child(5) {
76
+ left: 65%;
77
+ width: 20px;
78
+ height: 20px;
79
+ animation-delay: 0s;
80
+ }
81
+ .glass li:nth-child(6) {
82
+ left: 75%;
83
+ width: 110px;
84
+ height: 110px;
85
+ animation-delay: 3s;
86
+ }
87
+ .glass li:nth-child(7) {
88
+ left: 35%;
89
+ width: 150px;
90
+ height: 150px;
91
+ animation-delay: 7s;
92
+ }
93
+ .glass li:nth-child(8) {
94
+ left: 50%;
95
+ width: 25px;
96
+ height: 25px;
97
+ animation-delay: 15s;
98
+ animation-duration: 45s;
99
+ }
100
+ .glass li:nth-child(9) {
101
+ left: 20%;
102
+ width: 15px;
103
+ height: 15px;
104
+ animation-delay: 2s;
105
+ animation-duration: 35s;
106
+ }
107
+ .glass li:nth-child(10) {
108
+ left: 85%;
109
+ width: 150px;
110
+ height: 150px;
111
+ animation-delay: 0s;
112
+ animation-duration: 11s;
113
+ }
114
+ .glass li:nth-child(11) {
115
+ left: 10%;
116
+ width: 110px;
117
+ height: 110px;
118
+ animation-delay: 0s;
119
+ animation-duration: 11s;
120
+ }
121
+ .glass li:nth-child(12) {
122
+ left: 45%;
123
+ width: 160px;
124
+ height: 160px;
125
+ animation-delay: 2s;
126
+ animation-duration: 5s;
127
+ }
128
+ @keyframes spin {
129
+ 0% {
130
+ transform: translateY(0) rotate(0deg);
131
+ opacity: 1;
132
+ border-radius: 80%;
133
+ }
134
+ 100% {
135
+ transform: translateY(-1000px) rotate(720deg);
136
+ opacity: 0;
137
+ border-radius: 100%;
138
+ }
139
+ }
140
+ .image-container {
141
+ width: 150px;
142
+ height: 150px;
143
+ border-radius: 50%;
144
+ overflow: hidden;
145
+ animation: float 2s ease infinite;
146
+ }
147
+ .image-container img {
148
+ width: 100%;
149
+ height: 100%;
150
+ object-fit: cover;
151
+ }
152
+ @keyframes float {
153
+ 0%, 100% {
154
+ transform: translateY(0);
155
+ }
156
+ 50% {
157
+ transform: translateY(-10px);
158
+ }
159
+ }
160
+ .text {
161
+ color: #fff;
162
+ font-size: 20px;
163
+ font-family: 'Roboto Condensed', sans-serif;
164
+ margin-top: 20px;
165
+ position: relative;
166
+ animation: floatText 2s ease infinite;
167
+ }
168
+ @keyframes floatText {
169
+ 0%, 100% {
170
+ transform: translateY(0);
171
+ }
172
+ 50% {
173
+ transform: translateY(-10px);
174
+ }
175
+ }
176
+ </style>
177
+ </head>
178
+ <body>
179
+ <div class="bg">
180
+ <ul class="glass">
181
+ <li></li>
182
+ <li></li>
183
+ <li></li>
184
+ <li></li>
185
+ <li></li>
186
+ <li></li>
187
+ <li></li>
188
+ <li></li>
189
+ <li></li>
190
+ <li></li>
191
+ <li></li>
192
+ <li></li>
193
+ </ul>
194
+ <div class="image-container">
195
+ <img src="MetaCord.png" alt="MetaCord" />
196
+ </div>
197
+ <p class="text">Thanks for using MetaCord</p>
198
+ </div>
199
+ </body>
200
+ </html>
@@ -0,0 +1,53 @@
1
+ const crypto = require('crypto');
2
+ const aes = require("aes-js");
3
+
4
+ function encryptState(data, key1, key2, key3) {
5
+ //Step 1
6
+ let hashEngine1 = crypto.createHash("sha256");
7
+ let hashKey1 = hashEngine1.update(key1).digest();
8
+ let bytes1 = aes.utils.utf8.toBytes(data);
9
+ let aesCtr1 = new aes.ModeOfOperation.ctr(hashKey1);
10
+ let encryptedData1 = aesCtr1.encrypt(bytes1);
11
+
12
+ //Step 2
13
+ let hashEngine2 = crypto.createHash("sha256");
14
+ let hashKey2 = hashEngine2.update(key2).digest();
15
+ let aesCtr2 = new aes.ModeOfOperation.ctr(hashKey2);
16
+ let encryptedData2 = aesCtr2.encrypt(encryptedData1);
17
+
18
+ //Step 3
19
+ let hashEngine3 = crypto.createHash("sha256");
20
+ let hashKey3 = hashEngine3.update(key3).digest();
21
+ let aesCtr3 = new aes.ModeOfOperation.ctr(hashKey3);
22
+ let encryptedData3 = aesCtr3.encrypt(encryptedData2);
23
+
24
+ return aes.utils.hex.fromBytes(encryptedData3).padStart(32, '0');
25
+ }
26
+
27
+ function decryptState(data, key1, key2, key3) {
28
+ //Step 1
29
+ let hashEngine3 = crypto.createHash("sha256");
30
+ let hashKey3 = hashEngine3.update(key3).digest();
31
+ let encryptedBytes3 = aes.utils.hex.toBytes(data);
32
+ let aesCtr3 = new aes.ModeOfOperation.ctr(hashKey3);
33
+ let decryptedData3 = aesCtr3.decrypt(encryptedBytes3);
34
+
35
+ //Step 2
36
+ let hashEngine2 = crypto.createHash("sha256");
37
+ let hashKey2 = hashEngine2.update(key2).digest();
38
+ let aesCtr2 = new aes.ModeOfOperation.ctr(hashKey2);
39
+ let decryptedData2 = aesCtr2.decrypt(decryptedData3);
40
+
41
+ //Step 3
42
+ let hashEngine1 = crypto.createHash("sha256");
43
+ let hashKey1 = hashEngine1.update(key1).digest();
44
+ let aesCtr1 = new aes.ModeOfOperation.ctr(hashKey1);
45
+ let decryptedData1 = aesCtr1.decrypt(decryptedData2);
46
+
47
+ return aes.utils.utf8.fromBytes(decryptedData1);
48
+ }
49
+
50
+ module.exports = {
51
+ encryptState: encryptState,
52
+ decryptState: decryptState
53
+ }